Reading 2 values from single tag

I am working with a machine that has specific predetermined tags to read from. The machine has a tag for reading the results of the test that will last for a little bit, until returning to a 0 value. The machine is also able to run a test, which runs 2 tests back to back. Running this test causes the results tag to flip to the results of the first test, then to 0, then to the results of the second test, then back to 0.

Is there any way that I would be able to write the results of each of these tests to different individual tags so I can store the results value of each of the tests before it becomes a 0 again?

Can you get the machine fixed? Because that is just ridiculous.

Short of a proper fix, you will need to write a state machine that monitors for non-zero, then zero, then non-zero again. (And places the values into memory tags.)

I wish I could get it fixed...

Could there be a script that I could write that would accomplish this maybe?

Interesting problem. My take on it:

Create 5 tags:

  • inputVal (OPC)
  • lastChange (memory)
  • state (memory)
  • memory tag1 (memory)
  • memory tag2 (memory)

(I would put these in a UDT Definition to group it, but also in case you want to reuse it.)

In a tagChange script on inputVal:

  1. Check the current state.
  2. Check if difference between current time and lastChange is within specified bounds.
  3. Based on current state and input value, update state and execute any actions of that state if applicable.
  4. Update lastChange timestamp with current time.

This would be the state-transition table:
image

(None of this is tested; go through the logic yourself and verify it is correct.)