Page 1 of 3 1 2 3 LastLast
Showing results 1 to 10 of 22

Thread: How change the state of variable in AddIn Runtime service

  1. #1
    Join Date
    22.11.2017
    Posts
    14

    Default How change the state of variable in AddIn Runtime service

    Hi copa-data, 
    (working with zenon 8.0, AddIn Runtime service)

    i am trying to change the state of variable, specifically the status bit 9 REVISION. 
    I found in documentation one method of IVariable to set a value with lowerState (http://onlinehelp.copadata.com/help/760/addin/html/Variable-IVariable.htm)

    variable.lowerState // 4333568
     variable.SetValue(variable.GetValue(0), statusInt, DateTime.Now.Minute, (Int16)DateTime.Now.Millisecond); // statusInt = 4325376
    variable.lowerState // still 4333568

    Do i something wrong ?? Is there other way how to change a variable state?? 

    Best regards
    and thank you for your time.

  2. #2
    Join Date
    01.07.2008
    Location
    Salzburg, AT
    Posts
    801

    Default Re: How change the state of variable in AddIn Runtime service

    Is it an Internal variable?

  3. #3
    Join Date
    22.11.2017
    Posts
    14

    Default Re: How change the state of variable in AddIn Runtime service

    Thank you, for fast response. 

    Yes, some of them are Internal Variable, but some are not. 
    For internal variables is not possible to set a lowerState/value ? 


    Maybe i have to check the box with "Write set value" or is enough "Write set value via VBA" though i use AddIn?

    Thank you
    Attached Thumbnails Attached Thumbnails Snímek obrazovky 2019-07-10 v*9.40.01.png  

  4. #4
    Join Date
    28.02.2013
    Posts
    157

    Default Re: How change the state of variable in AddIn Runtime service

    Please activate the setting "Status/Timestamp for Variables of internal Driver" in the general project settings in the section "runtime settings".

  5. #5
    Join Date
    22.11.2017
    Posts
    14

    Default Re: How change the state of variable in AddIn Runtime service

    Hello, 

    thank you a lot. Now i am able to set value vor internal variables, but how is it with non-internal variables with custom driver? 

    Once again thank you for fast responses. 

    Best regrads. 

  6. #6
    Join Date
    01.07.2008
    Location
    Salzburg, AT
    Posts
    801

    Default Re: How change the state of variable in AddIn Runtime service

    the value, status bits (e.g. quality) and time stamps by process variables are always like the PLC sends to zenon in telegrams, not simply like the user wish to have. When user set value to the variable then the driver sends this write request to the PLC and then in the variable you see the result from PLC.
    Last edited by ursulak : 10th July 2019 at 14:50

  7. #7
    Join Date
    01.07.2008
    Location
    Salzburg, AT
    Posts
    801

    Default Re: How change the state of variable in AddIn Runtime service

    With another words - when the status bit in Help is documented to be "set by user" the you can change this bit via API and driver will respect this, e.g. M2, REVISION, ALT_VAL . If the status bit is documented as "Set automatic" (e.g. PROGRESS, INVALID, NET_SEL) - then the manipulation will fail.  

  8. #8
    Join Date
    22.11.2017
    Posts
    14

    Default Re: How change the state of variable in AddIn Runtime service

    Thank you for comprehensive answers. 
    I tried to find this information, but probably is not defined for this driver so maybe it is not possible to set it.  
    I will try last chance and describe you more detailed my situation. 

    Is there any change to set REVISION (9bit) and SPONT (17 bit) for variable with driver S7TCP32? 
    It should stop involving alarms in my case for variable. 

    I really appreciate you cooperation. 



  9. #9
    Join Date
    01.07.2008
    Location
    Salzburg, AT
    Posts
    801

    Default Re: How change the state of variable in AddIn Runtime service

    The info is not documented by each driver (there are soo many) - it is documented as general topic - common for all variables:


    By API you can set/reset REVISION, but not SPONT. Why you want to manually set on variables SPONT while the communication is disturbed and they are INVALID?
    Attached Thumbnails Attached Thumbnails 2019-07-11_07-53-58.png  

  10. #10

    Default Re: How change the state of variable in AddIn Runtime service

    Quote Originally Posted by tsvoboda View Post
    Is there any change to set REVISION (9bit) and SPONT (17 bit) for variable with driver S7TCP32? 
    It should stop involving alarms in my case for variable. 

    Hi tsvoboda,

    It is possible to set the revision status bit for variables, in order to suppress / inhibit alarms.

    This is possible in a number of different ways.

    One way is to use Recipegroup Manager recipes.
    Executing Report Generator reports in the runtime also allows setting the revision status bit.
    You can also use Command Processing in the energy edition runtime to set the revision status bit.
    Finally, you can also use the Addin Framework or the API to set the revision status bit (see ObjectModel -> Add-In -> Variable -> IVariableIVariable -> Properties -> StateString)

    You cannot set the SPONT bit, this statusbit is set by the driver, indicating a "good" value.

    Best regards,
    Mark





Similar Threads

  1. Change BOOL state with PopUp window
    By xxxd0nixxx in forum zenon Supervisor
    Replies: 4
    Last Post: 27th September 2018, 08:26
  2. Accessing variables in Runtime wizard and service
    By emrocon in forum Add-In Framework
    Replies: 3
    Last Post: 17th October 2017, 17:12
  3. Replies: 2
    Last Post: 25th August 2017, 11:10
  4. Replies: 3
    Last Post: 23rd October 2013, 17:10

Posting Rules

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