Skip to content
  • There are no suggestions because the search field is empty.

"Status" never goes to True (1) after device reconnects

I have a protocol that scans a PLC and everything is working great.

However, during my testing, I discovered a problem:

I use the "Status" reserved item to see if OmniServer is communicating to a device. I get everything up and running, and Status is equal 1. I unplug the cable from the PLC, and Status goes to 0 - which I expect. But when I plug the device back up, I get updates for all my items, but Status remains at 0. Why is Status not being updated to 1 when the device comes back on line?

The problem lies in the design on the protocol.

First, a little background: Status is set by OmniServer based upon the completion of an OmniServer Host Message transaction. If the transaction was not completed, Status is set to Logical False (0). If the transaction was completed, Status will be set to Logical True (1).

The key here is how OmniServer defines a "transaction". A Host Message Transaction is a host message or a series of chained host messages that have a beginning and an end. For example, a single host message will begin with the "Request", and end with the "Response", while a chain of three host messages will begin with the "Request" on the first message, and end with the "Response" on the third host message.

In this particular case, there is an "endless loop" of chained host messages (that is, #1 chains to #2, #2 to #3, and #3 to #1). While the cable is in the PLC, everything is good. When the PLC is disconnected, OmniServer errors on the first message, and since there is no "On Failure" chain, the host message transaction ends, and Status is set to Logical False (0). When the PLC is re-connected, the messages are completed (thus updating the items), but the chain is an endless loop. Since there is never an ending to the transaction, Status is never updated, and will remain at Logical False (0) until the polling engine is restarted.

This can be fixed by setting the "On Success" chain in the last message to "None", thus ending the transaction. If you need the message chain to go on "forever", then place an Item in the "Response" of the first message, make that item "Always Activate", and it will accomplish what you need.