TC – Timer control and status

Block SymbolLicensing group: STANDARD
PIC

Function Description
The TC function block controls the internal timer of REXYGEN. It is possible to modify the actual basic tick period (e.g. the value set in the tick parameter of the EXEC block) or logical tick period (e.g. the time added to the timestamp of each tick if timer = CORETIMER is selected). By default, the logical and physical period is the same and is the EXEC:tick parameter. The discretization period of the blocks in the control algorithm is not affected by the TC block.

The actual period can be changed in two ways: set the desired value to the OsPer input or set OsAdj for one tick. OsAdj will temporarily increase or decrease the actual period until the total shift set on the OsAdj input is realized. How much the period increases is controlled by the OsMax parameter.

Example: Let’s expect the tick period to be 0.1s and OsMax=0.2, so let’s set OsAdj=1.0 to temporarily increase the real period to 0.12s (e.g. 20% defined in the OsMax parameter) until a total shift of 1s is realized, e.g. for 50 ticks.

Logical period control is the same using inputs/parameter TsPer, TsAdj, TsMax.

Note 1: The unconnected input or the input with a value of 0 is ignored.

Note 2: The actual period adjustment is not supported on Windows targets.

Note 3: The primary reason for this block is to synchronize with another controller in time-critical application, so the period should only be changed by a few percent. It is also possible to dramatically change the actual period to slow down or speed up the execution (for debugging and simulation reasons), but in this case some warning about missed tick or incorrect period could appear.

Inputs

OsPer

Physical tick period [s]

Double (F64)

TsPer

Logical (timestamp) tick period [s]

Double (F64)

OsAdj

Physical tick shift [s]

Double (F64)

TsAdj

Logical (timestamp) tick shift [s]

Double (F64)

Parameters

OsMax

Maximal relative quantum for physical adjustment   0.0  1.0 0.1

Double (F64)

TsMax

Maximal relative quantum for logical adjustment   0.0  1.0 0.1

Double (F64)

Outputs

per

Last physical tick period [s]

Double (F64)

over

Number of lost periods in the last tick

Long (I32)

ticks

Number of ticks since start

Large (I64)

SIM

Timer in simulation mode

Double (F64)

2024 © REX Controls s.r.o., www.rexygen.com