How can I build my own program generator?
Very often, customers prefer to have their own program generator visualisation instead of the ready-made program generator visualisation. A process screen can be used for this purpose and the visualisation can be recreated for the program generator. This means that several program generators can be placed on a process screen.
In the JCmpVisu library, all program generators can be accessed via the global variables list.
State
Querying of the program generator status:
// Query for the status of generator 1CASE JCmpVisu.global.astProgramGenerator[1].ePscMode OF
// Generator no defined ModeJCmpPgVisu.JUMOPSA.JUMOPSC.ePscOperationModeType._psc_no_mode:
// Generator initialized and ready to startJCmpPgVisu.JUMOPSA.JUMOPSC.ePscOperationModeType._psc_stop:
// Generator loading program and necessary dataJCmpPgVisu.JUMOPSA.JUMOPSC.ePscOperationModeType._psc_start:
// Generator running fast forward (waiting for start trigger)JCmpPgVisu.JUMOPSA.JUMOPSC.ePscOperationModeType._psc_start_timer_active:
// Generator automatic mode programm is runningJCmpPgVisu.JUMOPSA.JUMOPSC.ePscOperationModeType._psc_auto_mode_run_program:
// Generator automatic mode start at actual valueJCmpPgVisu.JUMOPSA.JUMOPSC.ePscOperationModeType._psc_auto_mode_start_at_X:
// Generator automatic mode programm is stopped JCmpPgVisu.JUMOPSA.JUMOPSC.ePscOperationModeType._psc_auto_mode_stopped:
// Generator automatic mode program is waitingJCmpPgVisu.JUMOPSA.JUMOPSC.ePscOperationModeType._psc_auto_mode_wait:
// Generator is in manual modeJCmpPgVisu.JUMOPSA.JUMOPSC.ePscOperationModeType._psc_manual_mode:
// Generator programm is finishedJCmpPgVisu.JUMOPSA.JUMOPSC.ePscOperationModeType._psc_program_finished:
END_CASE
Operation
Operation of the program generator:
// Operation of generator 1
// program startJCmpVisu.global.astProgramGenerator[1].stPscCommandosCond.stPscCommand.xPscStart;
// program stopJCmpVisu.global.astProgramGenerator[1].stPscCommandosCond.stPscCommand.xPscStop;
// program cancelJCmpVisu.global.astProgramGenerator[1].stPscCommandosCond.stPscCommand.xPscCancel;
// next sectionJCmpVisu.global.astProgramGenerator[1].stPscCommandosCond.stPscCommand.xPscNextSection;
// previous sectionJCmpVisu.global.astProgramGenerator[1].stPscCommandosCond.stPscCommand.xPscPreviousSection;
// manual modeJCmpVisu.global.astProgramGenerator[1].stPscCommandosCond.stPscCommand.xPscManual;
// program continue (if in wait-mode)JCmpVisu.global.astProgramGenerator[1].stPscCommandosCond.stPscCommand.xPscContinue;
If you use the Pre-defined buttons from the library JCmpVisuBasic, you can use the following structure variables as transfer parameters:
// Controll generator 1 by buttons
// program startJCmpVisu.global.astProgramGenerator[1].stPscCommandosCond.stButtonStart
//program stopJCmpVisu.global.astProgramGenerator[1].stPscCommandosCond.stButtonPause
//program cancelJCmpVisu.global.astProgramGenerator[1].stPscCommandosCond.stButtonStop
// next sectionJCmpVisu.global.astProgramGenerator[1].stPscCommandosCond.stButtonSkipNext
// previous sectionJCmpVisu.global.astProgramGenerator[1].stPscCommandosCond.stButtonSkipPrevious
// manual modeJCmpVisu.global.astProgramGenerator[1].stPscCommandosCond.stButtonHand
Setpoints
Setpoints can be read from the program generators as follows:
// Read out setpoints of generator 1.
// Read out the setpoint (x = 0-29) from generator 1. Real-ValueJCmpVisu.global.astProgramGenerator[1].stPscSetpoints.arSetpointValues[x];
// Read out the setpoint (x = 0-29) from generator 1. String-Value with decimal placesJCmpVisu.global.astProgramGenerator[1].stPscSetpoints.asSetpointValues[x];
// Read out the setpoint name (x = 0-29) from generator 1.JCmpVisu.global.astProgramGenerator[1].stPscSetpoints.awsSetpointNames[x];
// Read out the setpoint unit (x = 0-29) from generator 1.JCmpVisu.global.astProgramGenerator[1].stPscSetpoints.awsSetpointUnits[x];
// Read out the setpoint (x = 0-29) from generator 1. Real-ValueJCmpVisu.global.astProgramGenerator[1].stPscSetpoints.arNextSetpointValues[x];
// Read out the setpoint (x = 0-29) from generator 1. String-Value with decimal placesJCmpVisu.global.astProgramGenerator[1].stPscSetpoints.asNextSetpointValues[x];
// Read out the contact (.0 - .31) from generator 1.JCmpVisu.global.astProgramGenerator[1].stPscSetpoints.udiControlContacts.0;
// Read out the contact name (x = 0-29) from generator 1.JCmpVisu.global.astProgramGenerator[1].stPscSetpoints.awsContactNames[x];
Actual values
The transfer of actual values to the program generator is described in detail here.
Program information
// Program information of generator 1
// Name of generator 1JCmpVisu.global.astProgramGenerator[1].wsActualPscName;
// Actual program nameJCmpVisu.global.astProgramGenerator[1].wsActualProgramName;
// Actual section numberJCmpVisu.global.astProgramGenerator[1].iActualSectionNo;
// Complete runtime, contains "hidden" runtimes caused by jump commands, e.g. next/prev. sectionJCmpVisu.global.astProgramGenerator[1].stPscStatusData.udiCompletePrgRunTime;
// Real program runtimeJCmpVisu.global.astProgramGenerator[1].stPscStatusData.udiPrgRunTimeReal;
// Maximum runtime for complete ProgramJCmpVisu.global.astProgramGenerator[1].stPscStatusData.udiProgMaxRunTime;
// Maximum runtime at start sectionJCmpVisu.global.astProgramGenerator[1].stPscStatusData.udiProgMaxRunTimeAtSection;
// Actual Program runtimeJCmpVisu.global.astProgramGenerator[1].stPscStatusData.udiProgRunTime;
// Remainig Program runtimeJCmpVisu.global.astProgramGenerator[1].stPscStatusData.udiProgRunTimeRmg;
// Remainig Time for program StartJCmpVisu.global.astProgramGenerator[1].stPscStatusData.udiRemainigStartDelayTime;
// Program repeat counterJCmpVisu.global.astProgramGenerator[1].stPscStatusData.udiRepeatCounter;
// Maximum section durationJCmpVisu.global.astProgramGenerator[1].stPscStatusData.udiSectionMaxRunTime;
// Actual section durationJCmpVisu.global.astProgramGenerator[1].stPscStatusData.udiSectionRunTime;
// Real actual section runtimeJCmpVisu.global.astProgramGenerator[1].stPscStatusData.udiSectionRunTimeReal;
// Remaining section time JCmpVisu.global.astProgramGenerator[1].stPscStatusData.udiSectionRunTimeRmg;
// Warning Flags, if one of the actual values is out of the tolerance band limitsJCmpVisu.global.astProgramGenerator[1].stPscStatusData.xToleranceWarning;
Program selection
In addition to the structure variable, the program selection object is required for program selection.
The structure variable for program generator 1 would be as follows:
// Program selection for generator 1JCmpVisu.global.astProgramGenerator[1].stSelectionBoxPrograms
The PscSelectionElement object is inserted into the custom visualisation in the JCmpPgVisu library. As a transfer parameter, the structure variable (see infobox) is entered.

Start via parameters
The following structure variables are required for the start parameters:
// Start parameter for generator 1JCmpVisu.global.astProgramGenerator[1].stDialogProgStartt
The OnMouseClick property is now edited for an object (e.g. button) in the process screen. OnMouseClick receives the function Open Dialog. The prepared dialogue window JCmpPgVisu.DialogProgramStart is selected as Dialog. For the transfer parameter stPscData, the structure variable (see infobox) is transferred.

If you want to use the Ready-made buttons from the library JCmpVisuBasic, then the following supplements must be made in addition to the above description.
:No1: Declaration of a variable for the button type stVisuButtonType.
:No2: Assign the new variable to the button as a transfer parameter.
:No3: The following configurations are solely for animation of the button:
OnMouseDown: Execute ST-Code :
stButtonDialog.xButtonFeedback := TRUE;
OnMouseLeave: Execute ST-Code :
stButtonDialog.xButtonFeedback := FALSE;
OnMouseUp: Execute ST-Code :
stButtonDialog.xButtonFeedback := FALSE;
