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

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

  1. #11
    Join Date
    22.11.2017
    Posts
    9

    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
    178

    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
    9

    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
    794

    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.



  5. #15
    Join Date
    22.11.2017
    Posts
    9

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

    Hello, 

    thank you Mr.ursulak for extra explanation. Now everything is clear to me. 

    I found one extra problem. According the reply: 

    Quote Originally Posted by felixst View Post
    Please activate the setting "Status/Timestamp for Variables of internal Driver" in the general project settings in the section "runtime settings".
    This check box "Status/Timestamp for variables of internal Driver" is just in zenon 8.0 right? I did not find it in zenon 7.60. Is here some other solution in zenon 7.60? 

    Best regards and thx for you time. 


  6. #16
    Join Date
    10.11.2010
    Posts
    1

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

    Quote Originally Posted by tsvoboda View Post

    This check box "Status/Timestamp for variables of internal Driver" is just in zenon 8.0 right? I did not find it in zenon 7.60. Is here some other solution in zenon 7.60? 
    This check box is only available in zenon >= 8.00 and has an effect on the availability of status and timestamp information of the internal driver. It is a result of the changed licensing rules, that apply to zenon since version 8.00

    For 7.60 this is not relevant for you.





  7. #17
    Join Date
    01.07.2008
    Location
    Salzburg, AT
    Posts
    794

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

    Quote Originally Posted by tsvoboda View Post
    This check box "Status/Timestamp for variables of internal Driver" is just in zenon 8.0 right? I did not find it in zenon 7.60. Is here some other solution in zenon 7.60?

    In zenon 7.60 it is controlled without check-box, but only by project.INI entry. The ini file you can find when in zenon Editor you click on project name -> Ctrl+Alt+E -> \zenon\system\project.ini
    ...
    [RT]
    INTERNALDRIVERWITHSTATUS=1


    value 1 there activates timestamps and status for internal variables (and counts then to license), value 0 - no timestamps, status; and the internal tags are "for free".
    Last edited by ursulak : 14th August 2019 at 12:26 Reason: completed

  8. #18
    Join Date
    22.11.2017
    Posts
    9

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

    Quote Originally Posted by ursulak View Post
    In zenon 7.60 it is controlled without check-box, but only by project.INI entry. The ini file you can find when in zenon Editor you click on project name -> Ctrl+Alt+E -> \zenon\system\project.ini

    ...

    [RT]

    INTERNALDRIVERWITHSTATUS=1





    value 1 there activates timestamps and status for internal variables (and counts then to license), value 0 - no timestamps, status; and the internal tags are "for free".


    Thank you, for quite useful reply, but in 7.60 the attribute "INTERNALDRIVERWITHSTATUS" is not. 
    There are just these: 
    [RT]
    DRIVER_HIDE=1
    MULTITOUCH=0
    TOUCHSCREEN=0
    KEYBOARD_PERCENT=100
    WITH_ACTION=1
    LOCKED_KEYS=1

    When i tried to add the attribute, it was removed by compilation of the project again. Please do you have other idea? 

    Thank you for your cooperation 

  9. #19
    Join Date
    01.07.2008
    Location
    Salzburg, AT
    Posts
    794

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

    In zenon there are 2 project.ini files - is as well in Editor, as in Runtime, directories. The file from Editor directory overwrites the file in Runtime directory by each project compilation. So please update the ini file in Editor (Ctrl+Alt+E), not in the Runtime directory (Ctrl+Alt+R). 

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
  •