Link with the 'TcLinkTo' attribute

This example shows how the 'TcLinkTo' attribute can be used for linking with EtherCAT or K-bus terminals. The FB variants with the suffix IO (K-bus) and ECAT (EtherCAT Terminals) are available.

The 'TcLinkToOSO' attribute in the EL3068 terminal example also shows how the underrange and overrange states can be mapped to the terminal channel state (nRawState).

In general, the state of the terminal channel is mapped via the variable nRawState. The variable nRawECatState is used to additionally map the EtherCAT status of the communication with the terminal.

The TIID path can be taken from the properties of the respective terminal channel in the development environment and copied from there.

Variables

// general structured view object
View : FB_BACnet_View := (sObjectName:='IoBus_0_Device_3_EtherCAT');

// EtherCAT terminals

(* Term 2 (EL1809) *)
{attribute 'TcLinkTo' :=
    '.bRawVal :=TIID^Device 3 (EtherCAT)^Term 1 (EK1100)^Term 2 (EL1809)^Channel 1^Input;
    .nRawECatState:=TIID^Device 3 (EtherCAT)^Term 1 (EK1100)^Term 2 (EL1809)^InfoData^State'}
Term_2_EL1809_Chn1 : FB_BACnet_BI_ECAT := (iParent:=View, sObjectName:='Term_2_EL1809_Chn1', nIoBusNr:=0, sDeviceType:='EL1809 16Ch. Dig. Input 24V, 3ms');

(* Term 3 (EL2809) *)
{attribute 'TcLinkTo' :=
    '.bRawVal :=TIID^Device 3 (EtherCAT)^Term 1 (EK1100)^Term 3 (EL2809)^Channel 1^Output;
    .nRawECatState:=TIID^Device 3 (EtherCAT)^Term 1 (EK1100)^Term 3 (EL2809)^InfoData^State'}
Term_3_EL2809_Chn1 : FB_BACnet_BO_ECAT := (iParent:=View, sObjectName:='Term_3_EL2809_Chn1', nIoBusNr:=0, sDeviceType:='EL2809 16Ch. Dig. Output 24V, 0.5A');

(* Term 4 (EL3068) *)
{attribute 'TcLinkTo' :=
    '.nRawVal :=TIID^Device 3 (EtherCAT)^Term 1 (EK1100)^Term 4 (EL3068)^AI Standard Channel 1^Value;
    .nRawECatState:=TIID^Device 3 (EtherCAT)^Term 1 (EK1100)^Term 4 (EL3068)^InfoData^State'}
{attribute 'TcLinkToOSO' :=
    '.nRawState:=<0,1,0>TIID^Device 3 (EtherCAT)^Term 1 (EK1100)^Term 4 (EL3068)^AI Standard Channel 1^Status^Underrange;
    .nRawState:=<1,1,0>TIID^Device 3 (EtherCAT)^Term 1 (EK1100)^Term 4 (EL3068)^AI Standard Channel 1^Status^Overrange'}
Term_4_EL3068_Chn1 : FB_BACnet_AI_ECAT := (iParent:=View, sObjectName:='Term_4_EL3068_Chn1', nIoBusNr:=0, sDeviceType:='EL3068 8Ch. Ana. Input 0-10V');

(* Term 5 (EL4132) *)
{attribute 'TcLinkTo' :=
    '.nRawVal :=TIID^Device 3 (EtherCAT)^Term 1 (EK1100)^Term 5 (EL4132)^Channel 1^Output;
    .nRawECatState:=TIID^Device 3 (EtherCAT)^Term 1 (EK1100)^Term 5 (EL4132)^InfoData^State'}
Term_5_EL4132_Chn1 : FB_BACnet_AO_ECAT := (iParent:=View, sObjectName:='Term_5_EL4132_Chn1', nIoBusNr:=0, sDeviceType:='EL4132 2Ch. Ana. Output +/-10V');


// Bus Terminals (K-Bus)

(* Term 2 (KL1104) *)
{attribute 'TcLinkTo' :=
    '.bRawVal :=TIID^Device 3 (EtherCAT)^Box 6 (BK1150)^Term 2 (KL1104)^Channel 1^Input'}
Term_2_KL1104_Chn1 : FB_BACnet_BI_IO := (iParent:=View, sObjectName:='Term_2_KL1104_Chn1', nIoBusNr:=0, sDeviceType:='KL 1104, 4 Ch. Input (24V, 3.0ms)');

(* Term 3 (KL2408) *)
{attribute 'TcLinkTo' :=
    '.bRawVal :=TIID^Device 3 (EtherCAT)^Box 6 (BK1150)^Term 3 (KL2408)^Channel 1^Output'}
Term_3_KL2408_Chn1 : FB_BACnet_BO_IO := (iParent:=View, sObjectName:='Term_3_KL2408_Chn1', nIoBusNr:=0, sDeviceType:='KL 2408, 8 Ch. Output (24V, 0.5 A, 3 A max)');

(* Term 4 (KL3208-0010-4) *)
{attribute 'TcLinkTo' :=
    '.nRawVal :=TIID^Device 3 (EtherCAT)^Box 6 (BK1150)^Term 4 (KL3208-0010-4)^Channel 1^Data In;
    .nRawState:=TIID^Device 3 (EtherCAT)^Box 6 (BK1150)^Term 4 (KL3208-0010-4)^Channel 1^State'}
Term_4_KL3208_0010_4_Chn1 : FB_BACnet_AI_IO := (iParent:=View, sObjectName:='Term_4_KL3208_0010_4_Chn1', nIoBusNr:=0, sDeviceType:='KL 3208-0010, 4 of 8 Ch. ana. Input PT1000, Ni1000 (RTD)');

(* Term 6 (KL4022) *)
{attribute 'TcLinkTo' :=
    '.nRawVal :=TIID^Device 3 (EtherCAT)^Box 6 (BK1150)^Term 6 (KL4022)^Channel 1^Data Out'}
Term_6_KL4022_Chn1 : FB_BACnet_AO_IO := (iParent:=View, sObjectName:='Term_6_KL4022_Chn1', nIoBusNr:=0, sDeviceType:='KL 4022, 2 Ch. ana. Output (4...20mA)');


Code

View();
Term_2_EL1809_Chn1();
Term_3_EL2809_Chn1();
Term_4_EL3068_Chn1();
Term_5_EL4132_Chn1();
Term_2_KL1104_Chn1();
Term_3_KL2408_Chn1();
Term_4_KL3208_0010_4_Chn1();
Term_6_KL4022_Chn1();