FB_IEC870_5_104Master
An instance of the FB_IEC870_5_104Master function block can be used to implement an IEC60870-5-104 central station (master) in the TwinCAT PLC. A connection to the slave is established for each instance of the function block.
The function block features the following tasks:
- STARTDT (starts the data exchange);
- STOPDT (stops the data exchange);
Normally the data exchange is started automatically once the connection is established. This is the default configuration of the function block. If required the data exchange can be stopped or started by calling the actions.
VAR_IN_OUT
VAR_IN_OUT
hTable : T_HAODBTable;
END_VAR
hTable: Application object database handle (hash table handle). The table handle must be initialized once with the function F_iecCreateTableHnd before it can be used.
VAR_INPUT
VAR_INPUT
sSrvNetID : T_AmsNetID := '';
protPara : ST_IEC870_5_104ProtocolParams := ( bControlDT := TRUE,
bDTControlled := FALSE,
sRemoteHost := '',
nRemotePort := 2404 );
sysPara : ST_IEC870_5_101SystemParams := ( bEndOfInit := FALSE,
asduAddr := 11,
tSyncTimeut := T#0s );
acqPara : ST_IEC870_5_101AcquisitionParams;
pAOEntries : POINTER TO ARRAY[0..IEC870_ANYSIZE_ARRAY] OF ST_IEC870_5_101AODBEntry := 0;
cbAOEntries : UDINT := 0;
pInputs : POINTER TO ARRAY[0..IEC870_ANYSIZE_ARRAY] OF BYTE := 0;
cbInputs : UDINT := 0;
pOutputs : POINTER TO ARRAY[0..IEC870_ANYSIZE_ARRAY] OF BYTE := 0;
cbOutputs : UDINT := 0;
pMemory : POINTER TO ARRAY[0..IEC870_ANYSIZE_ARRAY] OF BYTE := 0;
cbMemory : UDINT := 0;
pData : POINTER TO ARRAY[0..IEC870_ANYSIZE_ARRAY] OF BYTE := 0;
cbData : UDINT := 0;
bEnable : BOOL := TRUE;
END_VAR
sSrvNetID: String containing the network address of the TwinCAT TCP/IP Connection Server. For the local computer (default) an empty string may be specified.
protPara: IEC60870-5-104 protocol parameter.
sysPara: System parameter.
acqPara: Parameter for cyclic data acquisition.
pAOEntries: Address of the application object database variables.
cbAOEntries: Byte size of the application object database variables.
pInputs: Address of the PLC process data area for the inputs.
cbInputs: Byte size of the PLC process data area for the inputs.
pOutputs: Address of the PLC process data area for the outputs.
cbOutputs: Byte size of the PLC process data area for the outputs.
pMamory: Address of the PLC process data area for the flags.
cbMamory: Byte size of the PLC process data area for the flags.
pData: Address of the PLC data area.
cbData: Byte size of the PLC data area.
bEnable : Activates/deactivates the function block (communication and connections).
The addresses can be determined with the ADR operator and the byte sizes with the SIZEOF operator.
VAR_OUTPUT
VAR_OUTPUT
system : ST_IEC870_5_104ExSystemInterface;
eConnState : E_SocketConnectionState := eSOCKET_DISCONNECTED;
eDTState : E_IEC870_5_104DataTransferState := eIEC870_STOPDT;
END_VAR
system: system interface. This variable is used by other IEC application functions as a communication interface for the IEC device (here: central station).
- Member variable system.device is expected by the F_iecSetAOQuality function as VAR_IN_OUT parameter, for example.
- Member variable system.device.errors is a device error FIFO. The PLC application can read and analyse registered errors.
eConnState: Status of the TCP/IP connection with the slave..
eDTState: Status of the IEC60870-5-104 data exchange (STARTDT, STOPDT)
Example in ST:IEC60870-5-104 central station
Requirements
Development environment | Target system type | PLC libraries to be linked |
---|---|---|
TwinCAT v2.10.0 Build >= 1301 | PC or CX (X86) | TcIEC870_5_104Master.Lib |