System Variables

What is a system variable?

A system variable is a symbol in the symbol table that provides specific information. The content of these variables is provided by the Grafcet engine.

Use of system variables:

Examples with system variables:

  • Let an output blink with 1 Hz
  • Switch something on or off depending on the time of day
  • Time measurements: if a step is active for too long, then react to it or program your own timers.

Below you will find concrete examples.

How to use a system variable?

First you insert the system variable into the symbol table and then you can use it like any other symbol. All system variables can be inserted in the symbol table via the context menu. Then simply delete the symbols you do not need.

In the following animated GIF file you can see how to insert the system variables. Variables that are not required are then deleted.



Which system variables are available?

Table System Variables:

System variable Data type Description
_SI_RTC_YEAR UInt16 Returns the current year
_SI_RTC_MONTH Byte Returns the current month
_SI_RTC_DAY Byte Returns the current day
_SI_RTC_H Byte Returns the current hour
_SI_RTC_M Byte Returns the current minute
_SI_RTC_S Byte Returns the current second
_SI_RTC_MS UInt16 Returns the current millisecond
_SI_TOGGLE Bool Changes with every cycle: True, False, True, ...
_SI_1HZ Bool Delivers a 1 Hz clock pulse (e.g. for signal lamps)
_SI_10HZ Bool Delivers a 10 Hz clock pulse. Maybe the cycle time may not be adequate to deliver a 10 Hz clock. Available in version 2.0.0.0 or newer.
_SI_100HZ Bool Delivers a 100 Hz clock pulse. Maybe the cycle time may not be adequate to deliver a 100 Hz clock. Available in version 2.0.0.0 or newer.
_SI_TICKS UInt32 Is a millisecond counter. Time measurements possible
_SI_CYCLIC_COUNTER UInt16 Is always incremented by 1 during each cycle.
_SI_CYCLIC_TIME UInt16 Returns the current cycle time in milliseconds
_SI_VERSION UInt16 Returns the current Grafcet Engine version
_SI_WBYTES UInt16 If >0, then the monitoring/watch mode of Grafcet-Studio is active

Grafcet examples

Example: Let an output blink at 1 Hz

Example: Switch on the output at 12:00 and switch it off again at 13:00. The following picture shows 2 variants:

Example: If a step is active for more than 5 seconds, switch the output 'TimeOut' to '1'.

Info

Download examples as a Grafcet-Studio project file System-Variables-Examples

Info

Grafcet-Studio version 1.0.3.2 or newer required