Page 2 of 2 FirstFirst 1 2
Showing results 11 to 14 of 14

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

  1. #11
    Join Date
    22.11.2017
    Posts
    6

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

    Hello ursulak and markclemens, 

    thank you both, for your replies they were very helpful. At least i realized that set SPONT makes no sence and new options how to do it.
    I would like to run the option in AddIn framework. 

    But still struggle with to set state for no-internal variables. 

    I tried many solutions i code like: 
    variable.SetValue(variable.GetValue(0), newStatusInt, DateTime.Now.Minute, (Int16)DateTime.Now.Millisecond); -> This works me for internal variables
    variable.StateString = "REVISION," + variable.StateString;
    variable.StateString = "REVISION";
    variable.StateString = "REV = 1"; -> accorgind https://forum.copadata.com/showthread.php?2884-Switch-limit-active-inactive-in-Realtime
    variable.StateString = "REVISION = 1"; 

    varialble.lowerState = newStatusInt; -> // Error: lowerState just get property
    variable.set_StateValue(newStatusInt);  // Not suported in AddIns

    Log results: 


    Do you have any idea where could be problem?
    Big thanks for your time. 

    Best regards. 
    Attached Thumbnails Attached Thumbnails internal-log-result.png   no-internal-log-result.png  

  2. #12
    Join Date
    10.12.2007
    Posts
    177

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

    Hi,
    I did this in an older project with VBA, not sure wether this works the same way as in AddIn, but did you try
    variable.StatusString = "REVISION=1" //Remark: no blanks! same with REVISION=0
    in AddIn it's probably .StateString

  3. #13
    Join Date
    22.11.2017
    Posts
    6

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

    Hi everyone who participated on this problem,

    thank you all for your replies and at this time we can mark this thread as [SOLVED]. 

    This is result: 
    Only way how to change a state of variable in AddIn is by use this method: 
    variable.SetValue(variable.GetValue(0), newStatusInt, DateTime.Now.Minute, (Int16)DateTime.Now.Millisecond);

    It works me too almost whole time, but i didnt notice it. I expected that the result would be seen immediately on next row of code, because 
    the return value of method is Void, so we cant wait on result.
    The set of state can be expected on next row in code just for Internal variables, but for others you should count with some time spacing. 

    Once again thank you for help everyone. 
    Best regards.



  4. #14
    Join Date
    01.07.2008
    Location
    Salzburg, AT
    Posts
    765

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

    Quote Originally Posted by tsvoboda View Post

    It works me too almost whole time, but i didnt notice it. I expected that the result would be seen immediately on next row of code [..]
    The set of state can be expected on next row in code just for Internal variables, but for others you should count with some time spacing. 
    right. Thank you, now I understand your difficulties.

    Just to complete explanation: the Internal driver is a pure memory access, the write to memory is then immediately the result in the variable; value of variable = memory content. The Internal driver is not an independent application (no separated exe), it is integrated in the Runtime. Other drivers are not "pure" memory access and they are separated applications. There is special routine for information exchange between zenon Runtime and driver: when RT writes (pokes) a value/status bit to the driver the variable in RT has still the previous value and status bits and only driver knows as well old as new. Then driver sends back to the RT the update of the variable. If driver didn't need to send this value to PLC (e.g. it is only update of status bit like REVISION), and the RT - drivers data exchange has low traffic, then I would expect the delay <=100ms.

    The update of a variable is an event, so for check of result (if needed) - catch the events.



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
  •