Remanent Variables: Retain VS Persistent Retain
Retain variables maintain their value when the controller is restarted normally (cycling power), or when the command Reset Warm is used. When the program is restarted, the stored values will continue to be used. All other variables are re-initialized either with their defined initialization values or with the standard initializations. However, they will be reset after downloading or using a Reset Cold.
Persistent variables are identified by the keyword PERSISTENT. They must also be set as RETAIN. Like the retain variables they keep their values at a Reset Warm or Reset Cold AND after a download. PERSISTENT RETAINs only get re-initialized at a 'Reset Origin'. An example case for persistent variables is an operation-hour-counter, which should continue counting after a power fail, particularly however also after a new application downloaded.
Â
Â
Note Persistent Variable List is separate from the Global Variable List (GVL). Select the to create the Persistent Variable List. It appears with a different icon as a separate object in the application:
Â
Â
Â
Â
Online > Reset Origin for reset of PERSISTENT RETAIN
Â
VAR_GLOBAL RETAIN
END_VAR
VAR_GLOBAL PERSISTENT RETAIN
END_VAR
VAR RETAIN
END_VAR
VAR PERSISTENT RETAIN
Â
Â
Â
Â
Â
Â
END_VAR
10/12/15jh