Data PLC attributes

Variables inside the FB should be declared with the data PLC attribute "TcHmi.ProcessLibrary" in order to be linked to the control properties automatically. The full template is:

{attribute 'TcHmi.ProcessLibrary' := '[Attribute Name]'}
Data PLC attributes 1:

Data attribute positioning

Data attributes should be used within VAR_ area right before the declaration of the variable that is to be linked to an element of the control.

Examples of how to use data PLC attributes

Linking an sName variable to the LabelText property:

{attribute 'TcHmi.ProcessLibrary' := 'LabelText'}
sName: STRING := 'CustomPLC';

Linking an nStateMode variable to the LabelStateMode property:

{attribute 'TcHmi.ProcessLibrary' := 'LabelStateMode'}
nStateMode: INT := 1;

Using configuration PLC attributes for functions with data PLC attributes

Formatting functions can be applied to the properties via declaration in a PLC code. The attribute pragma "TcHmi.ProcessLibrary.Format" should be used:

{attribute 'TcHmi.ProcessLibrary.Format' := '[FormattingFunctionName]'}

FormattingFunctionName is the name of a formatting function listed in the Functions chapter (category: Formatting). The attribute with the function should follow the data PLC attribute.

Below are some examples of how variables can be declared with the attribute pragmas:

{attribute 'TcHmi.ProcessLibrary' := 'LabelValue'}
{attribute 'TcHmi.ProcessLibrary.Format' := 'TcHmi.Functions.Beckhoff.PI.ProcessLibrary.AnalogCompressionValueFormatter,4'}
fValue: REAL;

{attribute 'TcHmi.ProcessLibrary' := 'LabelValueUnit'}
{attribute 'TcHmi.ProcessLibrary.Format' := 'TcHmi.Functions.Beckhoff.PI.ProcessLibrary.MTPUnitValueFormatter'}
nUnit: INT := 1001;

{attribute 'TcHmi.ProcessLibrary' := 'LabelValue'}
{attribute 'TcHmi.ProcessLibrary.Format' := 'TcHmi.Functions.Beckhoff.PI.ProcessLibrary.BinaryValueFormatter,EMERG,NORM'}
_V: BOOL;

Using PLC attributes when a control needs to show several values

Sometimes several values need to be shown for a control element, e.g. for PID control. To implement that, the LabelValueAdd1 and LabelValueAdd2 attributes can be used along with LabelValueUnitAdd1 and LabelValueUnitAdd2 to show units. Here are examples of how to use the attributes:

{attribute 'TcHmi.ProcessLibrary' := 'LabelValue'}
{attribute 'TcHmi.ProcessLibrary.Format' := 'TcHmi.Functions.Beckhoff.PI.ProcessLibrary.AnalogCompressionValueFormatter,4'}
_SP: REAL;

{attribute 'TcHmi.ProcessLibrary' := 'LabelValueAdd1'}
{attribute 'TcHmi.ProcessLibrary.Format' := 'TcHmi.Functions.Beckhoff.PI.ProcessLibrary.AnalogCompressionValueFormatter,4'}
_PV: REAL;

{attribute 'TcHmi.ProcessLibrary' := 'LabelValueAdd2'}
{attribute 'TcHmi.ProcessLibrary.Format' := 'TcHmi.Functions.Beckhoff.PI.ProcessLibrary.AnalogCompressionValueFormatter,4'}
_MV: REAL;

{attribute 'TcHmi.ProcessLibrary' := 'LabelValueUnit'}
{attribute 'TcHmi.ProcessLibrary.Format' := 'TcHmi.Functions.Beckhoff.PI.ProcessLibrary.MTPUnitValueFormatter'}
nSPUnit: INT;

{attribute 'TcHmi.ProcessLibrary' := 'LabelValueUnitAdd1'}
{attribute 'TcHmi.ProcessLibrary.Format' := 'TcHmi.Functions.Beckhoff.PI.ProcessLibrary.MTPUnitValueFormatter'}
nPVUnit: INT := 1010;

{attribute 'TcHmi.ProcessLibrary' := 'LabelValueUnitAdd2'}
{attribute 'TcHmi.ProcessLibrary.Format' := 'TcHmi.Functions.Beckhoff.PI.ProcessLibrary.MTPUnitValueFormatter'}
nMVUnit: INT := 1342;