How I/O attributes are handled by an app engine regarding writing/reading to/from it?

Hi,

Back in the days there were power points describing how this works but I don't have access to these anymore.

My basic scenario:

1) App Engine 500ms
2) One integer attribute (e.g. MyInt) and one I/O integer attribute (e.g. MyIOInt) which is pointing to MyInt
3) Then I do have a script which switches the value of MyIOInt between 5 and 10 over and over again.
4) Two data change scripts for the MyInt and MyIOInt which just give me the value in the logger.

When executing the script I would expect the following:
Because it's an IO attribute the change of value happens not instantly and I would have expected to have the correct value in the next scan cycle but according to my tests the value switches every second.

It seems the write value of the I/O attribute is the same in the first two script executions and on the third it changes for the next two script executions.

Is there anyone who has experience with that and can give me a hint where to look at? I've tested in 2020 R2 SP1 and 2023 R2 and the behavior is identical, so I doubt this is an issue.

Thanks
Peter

Some screenshots

MyIOInt which points to MyInt

MyInt

Switch script, triggers while true

DataChangeIO Script

Result in logger to see the timing:

Parents
  • It is quite a broad question but please reefer to the following image describing the scancycle

      

    When working with OI Attributes you also have the Write interrupts that could effect the behavior.

    There are multiple things that effect the path of an IO attribute and especially if your data is coming from a PLC and not the same object.

    Also cross engine communication could also effect how data is managed.

    You could also monitor Me.MyIOInt.WriteValue to verify pending writes.
    Value of Me.MyOIInt (or Me.MyOIInt.Value) is also verified value from source.

    You can not expect a IO attribute to have the value you are writing within the same script cycle.

    Me.MyIOInt = 10;

    If Me.MyIOInt == 10 then

    'This is not expected to happen on first execution

    LogMessage("Value is 10");

    else

    LogMessage("Value is not 10, but write pending is: "+Me.MyIOInt.WriteValue);

    endif;

      

    Please describe what you are trying to achieve and then I can see if I have some better explanations. 

  • Hi Richard,

    Unfortunately I have to downvote your answer.
    I also have the circle with the Scan cycle setup.
    But this apparently is old and has changed in new versions.

    I do know a colleague of mine had a session about this with Ernst van Wyk.
    I still need to check this outcome. and will update that here.

    I think it is best to get in this thread.

  • I understand Slight smile

    Yes, good information is better served fresh, and sometimes changes are made without this is updated. It is highly appreciated if you are able to revise the way it works.

Reply Children
No Data