Showing results 1 to 6 of 6

Thread: Set and archive values of internal variables

  1. #1
    Join Date
    11.02.2019
    Posts
    11

    Default Set and archive values of internal variables

    Good afternoon,
     
    I’m, trying to set and archive the values of some internal variables in Zenon 8.0 project. I’m using a C# application to set the values of each variable through the “SetValueWithStatus” method, in this regard I’ve the folowing questions:

    1. What should be the “int” value of the argument “Status” that we should pass on the method “SetValueWithStatus”?
    2. When  I set the value on the internal variable I want also set the time stamp (which is not the actual Zenon time stamp), using the method “SetValueWithStatus” will make the time stamp of the sent value same as the arguments I’ll pass in the method?
    3. The time stamp value that I want to set have the following format “190617174042”. In the method “SetValueWithStatus” we have the arguments “int Time” and “short TimeMiliSec”. What is your suggestion to make correspond my time stamp format to these arguments format?
    4. After setting the value of the internal variables I want to log/register these values along with the time stamp, what is the right procedure to make after setting the values? Does the internal variables have some method that we may use to automatically register and log the values?
     
     
    Regards,
     
     
    Carlos

  2. #2
    Join Date
    28.02.2013
    Posts
    164

    Default Re: Set and archive values of internal variables

    Hi Carlos,

    first of all you need to enable time and status processing for internal variables in your general project settings. Please note that this will have the effect, that all internal variables are also considered for tag count for the licensing.
    Based on your mentioned function SetValueWithStatus I guess you are using VSTA? Please use the actual technology, our AddIn-Framework. There the function is called SetValue with multiple overloads.

    1. Every variable value in zenon is handled with 64 status bits. (See our manual -> status processing). The integer value here is just the decimal representation of those 64 status bits.
    2. Yes.
    3. The timestamp in zenon is based on unixtime. So please convert your timestamp to unixtime (seconds passed since 1970-01-01) for int Time and take TimeMiliSec for storing the milliseconds.
    4. Sorry, I don't understand that question. Can you please explain?

    Regards,
    Felix

  3. #3
    Join Date
    11.02.2019
    Posts
    11

    Default Re: Set and archive values of internal variables

    Hi Felix,

    Thanks for your comments and recomendations. The C# application is working very well now, all the variables are archieved with the values read from the external files.

    The only thing that is not working yet is the external timpestamp. I've tryed for several ways to set the external time stamp on each variable value archiving process but at the end the time stamp engraved is the actual time stamp of the computer.
    I'm using the method "myVar.SetValueWithStatus(valor, 21, 1560685695, 123);" . In the status argument I've tried diferent options according the manual and also I'm using  directly an 'int' number as argument for the 'time' and 'miliseconds' to be sure I'm introducing a right format but still not work.

    If you can give me this final help it would be great to finalyse this project!

    Regards,

    Carlos

  4. #4
    Join Date
    01.07.2008
    Location
    Salzburg, AT
    Posts
    808

    Default Re: Set and archive values of internal variables

    If your variables for archiving are INTERNAL driver variables, then like Felix advised: make sure you have activated the project settings - 'Runtime settings' - 'State/Timestamp for Intern Driver variables'.

    If the variables are from a process driver then you cannot manipulate the timestamp of the value, the value poked by RT to the driver (e.g. when you call SetValueWithStatus method then the RT pokes this value to the responsible driver) will have anyway the timestamp given by the driver. And by process drivers this is the time when driver gets the value from the PLC - so the moment after the poke - when the PLC acknowledges the write request or sends updated value.

    If the variables are from stratonNG driver, then instead the API you can set the value and timestamp in zenon Logic code - using SymbVSI (or VSI*) functions available there. Then your PLC - the zenon Logic - will deliver values with manipulated timestamps.

    Please note that the Historian is not storing values with timestamp from the past into already closed (saved) capsules. You can store values only in the last, currently still open capsule, so having timestamps still in range of current 'Saving cycle'.

  5. #5
    Join Date
    11.02.2019
    Posts
    11

    Default Re: Set and archive values of internal variables

    Dear Ursula,

    Problem solved

    I just had to activated the project settings - 'Runtime settings' - 'State/Timestamp for Intern Driver variables'.

    Thanks a lot!


    Regards,

    Carlos

  6. #6
    Join Date
    26.11.2019
    Posts
    1

    Default Re: Set and archive values of internal variables

    Quote Originally Posted by ursulak View Post
    If your variables for archiving are INTERNAL driver variables, then like Felix advised: make sure you have activated the project settings - 'Runtime settings' - 'State/Timestamp for Intern Driver variables'. short life

    If the variables are from a process driver then you cannot manipulate the timestamp of the value, the value poked by RT to the driver (e.g. when you call SetValueWithStatus method then the RT pokes this value to the responsible driver) will have anyway the timestamp given by the driver. And by process drivers this is the time when driver gets the value from the PLC - so the moment after the poke - when the PLC acknowledges the write request or sends updated value.

    If the variables are from stratonNG driver, then instead the API you can set the value and timestamp in zenon Logic code - using SymbVSI (or VSI*) functions available there. Then your PLC - the zenon Logic - will deliver values with manipulated timestamps.

    Please note that the Historian is not storing values with timestamp from the past into already closed (saved) capsules. You can store values only in the last, currently still open capsule, so having timestamps still in range of current 'Saving cycle'.

    Thank you very much for the very detailed help!

Similar Threads

  1. Archive values after communication loss
    By joelprasad in forum zenon Supervisor
    Replies: 1
    Last Post: 10th September 2018, 09:06
  2. Remanence of the internal variables
    By andrey_k in forum zenon Supervisor
    Replies: 7
    Last Post: 25th October 2013, 12:13
  3. Writing Cell values from Reports to Internal Variables
    By shikra in forum zenon Energy Edition
    Replies: 3
    Last Post: 24th February 2013, 00:55
  4. problem with archive values in report
    By shahramkh59 in forum zenon Supervisor
    Replies: 1
    Last Post: 20th October 2009, 13:40
  5. Internal Variables
    By jamesleary in forum zenon Supervisor
    Replies: 1
    Last Post: 13th November 2008, 14:36

Posting Rules

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