Showing results 1 to 9 of 9

Thread: Calculation from <seconds> to <date>?

  1. #1
    Join Date
    23.04.2009
    Posts
    56

    Default Calculation from <seconds> to <date>?

    Hi,

    I receive some data (by the drive IEC61850) who represents the seconds since the midnight (00:00:00) of 1970-01-01.

    The question is, how can I change these data (with a value like 43759353732..) to a readable form? For example, 17:30:45 04/04/2010?

    Have I no other convenient solution but the use of VBA?

    Thanks in advance.

  2. #2

    Default Re: Calculation from <seconds> to <date>?

    you can use the dynamic element "clock" and link a UDINT or DWORD variable. At the display type choose "absolute time" and choose your desired format, and the clock element will show the time in the appropriate format

    please note, that timestamps from the IED for variables of the IEC850 dríver are automatically linked to the variable in zenon by the driver. (e.g. data attribute "t" is linked to to the variable displaying data attribute "stVal", even if the data attribute "t" is not created as a variable in zenon)

  3. #3
    Join Date
    23.04.2009
    Posts
    56

    Default Re: Calculation from <seconds> to <date>?

    Thank you Mark for this splendid solution!

    But I don't understand very well your note.. Why you said the "t" is automatically linked to the "stVal"? What is its behavior? How can I profit this link?

    By the way, I know well the "q" is automatically linked to the "stVal" for example. And if "q" is not equal to zero, we can see the famous little red point at right side of the variable "stVal". But I don't know how about the time "t"? Do you have a document to present precisely the behavior of 61850 driver (more precisions than your help document IEC850.pdf)?

  4. #4

    Default Re: Calculation from <seconds> to <date>?

    Variables in zenon do not only have a value, but also a timestamp and 64 statusbits.

    The timestamp can be generated from the zenon runtime, if the PLC does not provide a value for time with a value. This is the case with many drivers which cyclically request the PLC for the values required by the zenon runtime.

    However if the PLC provides a timestamp in the message with the value, the timestamp for this value is used in zenon.

    The timestamp at the variable in zenon is e.g. used in the CEL and in the Alarm list, and in historian.

    If e.g. the zenon runtime is not running for a period of time, while a value changes in the PLC which is normally recorded as an Alarm in the alarm list, the Alarm will be recorded with the timestamp it occurred (in the PLC) for drivers which use external timestamping, but will be recorded with the timestamp it was detected (on startup of the zenon runtime) for drivers which use timestamping by the zenon runtime.

  5. #5
    Join Date
    23.04.2009
    Posts
    56

    Default Re: Calculation from <seconds> to <date>?

    Thank you Mark a lot for this detailed explanation!

    I have just another question about data acquisition if you please:

    - How can I make a calculation as : VariableA = VariableA + VariableB every 0.2 second?


    A litte more explanation:
    1. I know I can use “Time Control” to execute a function every 1 second. But how can I do for every 0.2 second?

    2. I know also I can use the function “Send value to hardware” to calculate an increment by a constant as VariableA = VariableA + 1. But I can I calculate an increment by a dynamic variable as : VariableA = VariableA + VariableB?

  6. #6

    Default Re: Calculation from <seconds> to <date>?

    you could take a look at the mathematics driver, which allows such calculations. The mathematics driver normally runs in an approximate 500 ms cycle, however in zenon 6.50 you can also trigger calculations for the mathematics driver through a variable.

    If you need a faster or more deterministic calculation cycle, take a look at straton.

    A license for the straton runtime for 8 variables is included with your zenon runtime license.

    In this case you would need to set the option "externally visible" to TRUE in the zenon editor, for the variables VariableA and VariableB. Then create a straton project.

    In the straton IO configuration, the you need to add the "straton to zenon runtime connection" shared memory driver.

    In the straton project, you can create a small "ST" program with one line:

    VariableA := VariableA + VariableB;

    which adds the two variables.

  7. #7
    Join Date
    23.04.2009
    Posts
    56

    Default Re: Calculation from <seconds> to <date>?

    Thanks Mark for the Straton solution. I will try it a little later.

    But the mathematics driver doesn't work for this case (by my zenon 6.22). That is what I tried first. It shows nothing for VariableA when I make a calculation of VariableA(Formula) := VariableA(X01) + VariableB(X02). Or I should still configure something?

  8. #8

    Default Re: Calculation from <seconds> to <date>?

    the value of the variable from the mathematics driver actually is the outcome of the calculation X01 + X02. (VariableA + VariableB) you would need an additional allocation to write the value from the mathematics driver back to VariableA.

    take a look at straton. I think you will find it easier and more flexible there.

  9. #9
    Join Date
    23.04.2009
    Posts
    56

    Default Re: Calculation from <seconds> to <date>?

    Yeah, by using allocation, it works. I will try the straton a little later.

    As always, thank you sincerely for your helps!

Similar Threads

  1. Replies: 2
    Last Post: 19th November 2009, 12:16

Posting Rules

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •