Remanent building blocks and remanent variables.
1.Remanent blocks
Variables in remanent blocks.
In order for an HSL(2.0) device to store data remanently, remanent variables must be defined.
In order for an HSL(2.0) device to store data remanently, remanent variables must be defined.
2.Remanent variable
How are remanent variables treated?
To start a block a remanent variable can be read out with the method _get_remanent. At runtime the remanent variable can be written with _set_remanent.
To start a block a remanent variable can be read out with the method _get_remanent. At runtime the remanent variable can be written with _set_remanent.
Attention
Only at initialisation _get_remanent shows the actual content of the remanent memory. If _get_remanent is called during runtime, the value is returned which was last written by _set_remanent. This does not have to correspond to the state stored in the non-volatile memory!
The HS/FS writes its remanent data into the non-volatile memory approximately every 15 minutes!
The HS/FS writes its remanent data into the non-volatile memory approximately every 15 minutes!
In the example code a remanent variable is read out at system start. If this variable contains a valid numeric value, the value is written into the result variable, otherwise the variable is initialised with 0. With each incoming telegram the counter is incremented by one, the result is written into the remanent variable, to output 1 and to the debug page. Furthermore, a counter on the debug side is incremented, which counts all telegrams during the runtime of the HS/FS.
An example for the implementation of a remanent counter with output on the debug page is enclosed
An example for the implementation of a remanent counter with output on the debug page is enclosed
10702_MyBaseModule_02.py