RETAIN PERSISTENT only stored at gracefully shutdown?

DavidBo
2025-11-17
2025-11-26
  • DavidBo - 2025-11-17

    I have

    {attribute 'checksumnoinit_override' := '2629838988'}
    {attribute 'init_related_code' := '5c6efcf8-e0f4-4166-a9fa-17eadd8908df'}
    VAR_GLOBAL RETAIN PERSISTENT
        {attribute 'order_in_persistent_editor' := '0'}
        segmentValue: ARRAY[0..49] OF REAL;
        {attribute 'order_in_persistent_editor' := '1'}
        segmentTime: ARRAY[0..49] OF REAL;
    
        // Generated instance path of persistent variable
        PRG.test: INT;
        // Generated instance path of persistent variable
        PRG.nw_storage: SysSocket_Implementation.SysSocket_Interfaces.SOCK_ADAPTER_INFORMATION2;
    END_VAR
    

    When I have changed PRG.nw_storage it will not be stored at a power off, but if I do a:
    sudo systemctl restart codesycontrol and then a power off it will be stored.

    Is there a way to store persistent variables without a restart of codesyscontrol?
    Can anyone explain how and when CODESYS store persistent variables?

     
  • dinesh-vamtec - 2025-11-26

    I have an idea to save the persistent variable. Currently in testing processs. If testing completed I share the solution to you.

     

Log in to post a comment.