Persistent variables are not read after initialization

mike2160
2023-05-11
2024-10-20
  • mike2160 - 2023-05-11

    Hello everybody,

    I am currently working on a project on a Raspberry Pi and I need to use Persistent variables for the first time.
    My question: When i declare my variable (lamp = output (see picture)) as persistent and I do a Cold Reset it stays true. But when I start my program again it becomes false. Does this have to do with some settings I haven't configured or can this be somthing else?

    I am quite new to Codesys so any help is appreciated!

    Mike

     
  • eschwellinger

    eschwellinger - 2023-05-11

    which device?
    are they written on graceful shutdown?

     
  • mike2160 - 2023-05-11

    I am using a Raspberry Pi 4.
    What do you mean by a graceful shutdown?

    Mike

     
  • eschwellinger

    eschwellinger - 2023-05-11

    Retain/Persistent variables work that way:
    On exit/shutdown for the runtime - these retain variables will be saved to a retain file.
    On startup of the runtime they will be restored from that file.
    If you have no UPS connected how should this work on just switching off the Raspberry Pi?
    - there are only two options
    1. use a UPS (which makes the whole Pi more robust against SD card corruption
    2. an other option might be to use persistence manager from application composer
    (https://content.helpme-codesys.com/en/CODESYS%20Application%20Composer/ac_pm_overview.html)
    even here it would help to have UPS connected.

     
  • mike2160 - 2023-05-12

    Thank you, It worked using the persistence manager.

     
  • pietrobalint - 2024-09-01

    Hi, I have Raspberry Pi 5 and I would like to use persistence manager too. But Codesys support said that Application Composer not compatibile with my runtime. Could you recommend a solution?

     
  • eschwellinger

    eschwellinger - 2024-09-02

    which version of the runtime do you use?

     
  • pietrobalint - 2024-09-04

    I updated to 4.13.0.0 and now it works. Thank you!

     
  • pietrobalint - 2024-10-11

    Hi, I realized that if I replug the power supply the persistent variables lost their value with the new software too. Cold reset do not affect the variables value but hardware reboot still reset the values.
    Application Composer can't be activated.
    What is the solution?

     
  • eschwellinger

    eschwellinger - 2024-10-11

    no need to activate application composer. It is part of the licensefree part.

     

Log in to post a comment.