4. Configuration
165
byCmdType:= 102,
byPulseTime:=
DWORD_TO_BYTE(CmdReceive.sCommand.sOperateParameters.sValue.sDoublePoint.sPulseConfig.dwOffDu
ration/10),
ptDbpVarAdr:= ADR(dbpIEC104),
stQuality:= IOQualities.QUALITY_NX2020[5],
byStatus=> byResult);
END_IF
ELSE
// Returns “command not supported”
byResult:= 1;
END_IF
COMMAND_TYPE.CANCEL:
// Returns “command finished with success”
// (controlled by IEC104 protocol)
byResult:= 7;
END_CASE
// Treats the pulsed command function result
// and generates the answer to the intercepted command
CASE byResult OF
1: // Invalid type of command
CmdReceive.eCommandResult:= COMMAND_RESULT.NOT_SUPPORTED;
CmdReceive.bDone:= TRUE;
2: // Invalid input parameters
CmdReceive.eCommandResult:= COMMAND_RESULT.INCONSISTENT_PARAMETERS;
CmdReceive.bDone:= TRUE;
3: // Parameter change in running
CmdReceive.eCommandResult:= COMMAND_RESULT.PARAMETER_CHANGE_IN_EXECUTION;
CmdReceive.bDone:= TRUE;
4: // Module didn’t answered the command(absent)
CmdReceive.eCommandResult:= COMMAND_RESULT.HARDWARE_ERROR;
CmdReceive.bDone:= TRUE;
5: // Command started and in running (doesn’t returns nothing)
6: // Another command has been sent to this point and it is running.
CmdReceive.eCommandResult:= COMMAND_RESULT.LOCKED_BY_OTHER_CLIENT;
CmdReceive.bDone:= TRUE;
7: // Command finished with success
CmdReceive.eCommandResult:= COMMAND_RESULT.SUCCESS;
CmdReceive.bDone:= TRUE;
END_CASE
END_IF
CmdReceive();
IF CmdReceive.bDone THEN
CmdReceive.bDone:= FALSE;
END_IF
As can be observed in the previous code, to help in the pulse generation in Nexto's digital double
outputs, it was created and used a function block equivalent to PulsedCommand function of library
LibRtuStandard. The PulsedCommandNexto() function block shows up coded in ST language.
FUNCTION_BLOCK PulsedCommandNexto
VAR_INPUT
byCmdType: BYTE; // command type:
// 100 = status
// 101 = close/on
// 102 = trip/off
byPulseTime: BYTE; // Pulse duration (in hundredths of second)
ptDbpVarAdr: POINTER TO DBP; // DBP variable address (can be mapped)
stQuality: QUALITY; // DBP point quality(digital module)
END_VAR
VAR_OUTPUT
bON: BOOL; // Odd output mapped on Nexto DO module
bOFF: BOOL; // Even output mapped on Nexto DO module
byStatus: BYTE:= 7; // Function return:
// 1 = invalid command
// 2 = Time out of valid range (2..255)
// 3 = command changed in running time