Welcome to our new forum
All users of the legacy CODESYS Forums, please create a new account at account.codesys.com. But make sure to use the same E-Mail address as in the old Forum. Then your posts will be matched. Close

Datalogging

leifjoh
2016-04-09
2020-04-08
  • leifjoh - 2016-04-09

    Hello,

    I have a question and hope someone can help me a bit with this.

    I have made type of Energy meter used for a water heat exchanger.
    I measure flow (L/sec), temperature in and out of water to be heated.

    With these values I have made a totalizer with the Integral function.

    I am logging the values to a txt file on a SD card continuisly as such:
    0 (kJ)
    2
    4
    6
    7
    7
    8
    9 (kJ)

    The kilojoules are counting up and the newest logged value is the total kJ.

    The problem now is that if there is a power outage and the PLC starts at zero again.
    I need to load the previous latest logged value to a variable and add it to the formula.

    Is there a way to load a value from the SD card? Or how would you solve this?

    Any input is very much appriciated

    Thank you.

     
    • dpetrutiu

      dpetrutiu - 2020-04-08

      Hi Leifjoh,

      Can you let us know how you've made the totalizer?
      Which time did you choose for the the integral function?
      I'm struggling with this choosing a right time for L/min or L/sec.

      The integral functions that I'm using come from the Util.library or CAAMathematics and Basic.OSCAT

      Thanks,
      Dragos

       
  • Anonymous - 2016-04-11

    Originally created by: scott_cunningham

    Move your variable to a VAR PERSISTENT. These are retained even after power cycle (if your hardware supports it). Then, your SD card is only a report of the value of your variable.

     
  • leifjoh - 2016-06-07

    Thanks for that answer Scott,
    A much simpler solution to this and it works perfectly.
    BR

     

Log in to post a comment.