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.

remanent_5057-20240521-001110.jpg

 

var_pers_declare1_5058-20240521-001110.jpg

 

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