This is short note for new users to CODESYS on how to use local, retain, and persistent retain variables.
Local or Global Vars - Values that will be re-initialized when the PLC is rebooted or turned on and off. An example could be speed feedback from a VFD, or variable for the current temperature.
Retain Vars - Used for variables where only a cold reset will re-initialize these values. This might be a user configured setpoint where a maintenance tech could perform a cold reset to return a value to a factory state.
Persistent Retain Vars - Used for variables like system configuration, that should not re-initialize. The user could use a persistent variable for the number of run hours since the machine was last serviced.
Since V3.3.0.1 PERSISTENT RETAIN and PERSISTENT are treated the same, no need to specify both.
Today I would just avoid PERSISTENT entirely, too many caveats and one corrupted write during a power outage will ruin your day. WAGO supports the Persistence Manager, a bit more initial setup, but a better experience overall.