Showing results 1 to 3 of 3

Thread: How turn on/off the revision for external variables

  1. #1
    Join Date
    22.11.2017
    Posts
    14

    Default How turn on/off the revision for external variables

    Hello COPA-DATA,


    i would like to sent the write request to a PLC device to change the status of an external variable to REVISION.
    We found in documentation for the AddIn only the option to SetValue for an IVariable. This option works well for
    the internal variables but for the external variables which communicates with the real devices it does not.


    At this point we try to do that with the following piece of code:
    variable.SetValue(variable.GetValue(0), newStatusInt, DateTime.Now.Minute, (Int16)DateTime.Now.Millisecond);


    By definition it is understandable that these external variables do not have writable a value, so question is:
    Is there any option how to change just the Status of a variable?
    Because probably the command SetValue is denied by these variables.


    Currently it works for

    • internal variables after checking “State / Timestamp for Intern Driver variables” option in runtime setting
    • internal variables after added the parameter to editor’s project.ini file (in zenon 7.60)
    • external variables, but only in simulation mode and with checked option “Write set value”


    But it does not work for external variables linked by the drivers to real devices.

  2. #2
    Join Date
    23.11.2016
    Posts
    7

    Default Re: How turn on/off the revision for external variables

    Hello Tsvoboda, 

    the SetValue method is not intended to do this for PLC driver variables. 

    Anyway you can do this by modifying the StateString of a variable. (See zenon help for further information: ObjectModel Add-In --> Variable --> IVariable --> IVariable Properties --> StateString)


    IVariable myVariable = context.VariableCollection["MyVariable"]; 
    myVariable.StateString = "REVISION=1";

    Best Regards, 
    Michael 

  3. #3
    Join Date
    22.11.2017
    Posts
    14

    Default Re: How turn on/off the revision for external variables

    Hello Copa-data,

    thank you for your help. We done it finally.!
    The problem was that in the beginning i tried the option .StateString, but i observed the change only for Internal variables and for them it does not work.
    Then i leaved this option and forgot on it, but it works for External variables.

    The result is this:
    For internal variables - use SetValue() method of IVariable
    For external variables - use .StateString property to set state

    Once again thank you and mark this thread as RESOLVED

Similar Threads

  1. Counting Number of Variables with Revision Bit Active
    By adrian.mcgranaghan in forum zenon Energy Edition
    Replies: 1
    Last Post: 23rd January 2019, 08:50
  2. variables external use
    By nikabena in forum straton / zenon Logic
    Replies: 2
    Last Post: 10th June 2015, 16:39
  3. zenon logic doesn't communicate with external variables in zenon
    By mashjj in forum straton / zenon Logic
    Replies: 6
    Last Post: 27th February 2015, 13:10
  4. Re: zenon logic doesn't communicate with external variables in zenon
    By anjali.gk.nair@gmail.com in forum straton / zenon Logic
    Replies: 2
    Last Post: 22nd August 2014, 10:51
  5. External IEC 60850 variables names not recognised in ZenonLogic
    By djgaunt in forum straton / zenon Logic
    Replies: 3
    Last Post: 12th August 2013, 07:53

Posting Rules

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