Pragma \ for nonpersistent data types¶
Normally the following is valid: Even if only one local variable in a function block or a structure is declared persistent, at usage of an instance automatically all components will be stored in the persistent information (persist.dat) on the runtime system. In order to save space you can use the pragma
{nonpersistent}
in the declaration of the function block resp. the structure. It effects that only those components of the function block resp. structure, which are declared as “persistent”, will be entered to the persistent info.
Example:
If an instance of the following function block is declared as persistent, only variables local and fblevel3 will be written to the persistent info. Without pragma {nonpersistent} all function block variables would be stored there.
FUNCTION_BLOCK FB_Level_2
{nonpersistent}
VAR_INPUT
bvar_in : BOOL;
END_VAR
VAR_OUTPUT
bvar_out : BOOL;
END_VAR
VAR
ivar2 : INT;
END_VAR
VAR PERSISTENT
local : INT := 33;
fblevel3 : FB_Level_3;
END_VAR