Dans: Technical

How to manage Retain variables and handle cold start and warm start

With the standard integration of straton:

The retain are save when we shutdown the straton runtime, you can also save by using a function F_SAVERETAIN, when you will call this function, all the retain variable will be saved.

Then you can also use the function F_LOADRETAIN, to load all the value of the retain variable save when you want during the project execution.

For the warm start, when you shut down the straton application "properly" (no power faild or other) straton save the value of the project elements on a file call t5.hot.

Then you can restart you application, in hot restart mode and find your application on the same state before stop it.

For the cold restart, you can do two types of cold restart, the first who start the application on the initial state (no value load) and a second who load the retain variable. Be careful retain variable is different to hot restart

RETAIN : save all the value of the retain variable (no save of the local variable, no save of the global variable and no save of the function block instance)

Hot: we save everything.