Arguments

The texts of the events can be individualized by programming with "arguments".

A marking with the notation {n} is used for this during the description of the events in the TMC editor, where n is an ascending number starting from 0.

Up to 128 arguments with a maximum size of 1024 bytes can be used at one event.

In the TMC editor, for example, such a Display Text is used for an event:

Arguments 1:

This can then be used in the source code as follows:

PLC

Arguments can be handled in the PLC as follows:

fbMsg : FB_TcMessage;
IF NOT fbMsg.EqualsToEventEntryEx(stOther:=TC_EVENTS.CalculationEventClass.DivisionByZero) THEN
    hr := fbMsg.CreateEx(TC_EVENTS.CalculationEventClass.DivisionByZero, 0 (*fbSource*) );
END_IF

fbMsg.ipArguments.Clear().AddLReal(fDividend); //set Argument

The arguments must thereby be defined after Create()/CreateEx(), but before Send().

Several arguments can be specified in concatenated form.
Arguments 2:

fbMsg.ipArguments.Clear().AddLReal(fDividend).AddLReal(fDivisor);

In this case fDividend is set in place of {0} and fDivisor in place of {1}.

C++

Arguments can be handled in the C++ as follows:

TcArgs tcArgs(m_spMessage);
tcArgs->Clear();
tcArgs.AddArgument(m_dividend);

The arguments must thereby be defined after CreateMessage()/CreateAlarm(), but before Send().

For this, TcEventLoggerTemplate.h must be included in <ProjectName>Interfaces.h.

#include"TcRouterInterfaces.h"
#include"TcEventLoggerTemplates.h"
///<AutoGeneratedContent id="Interfaces">
///</AutoGeneratedContent>

Output

The output is accordingly:

Arguments 3:

This notation can also be used as text within the translations.

Formatting

The output of the arguments can also be formatted. To do this the syntax {n,<Format>} is used accordingly in the TMC editor:

Arguments 4:

The following formats are available:

Type

Format

Description

Numerical value

d / D

Decimal representation

 

e / E

Exponential representation

 

x / X

Hexadecimal representation

 

f / F

Fixed point

Note that, for example, a REAL cannot be represented as "d" or "x" etc.

Additionally the syntax {eventID} (for the event ID) as well as {eventclass} (for the guid of the event class) are available to output the corresponding information as part of the text.