View Single Post
Old December 17th, 2012, 10:57 PM   #5
Tim James
Member
United States

Tim James is offline
 
Join Date: Mar 2012
Location: Texas
Posts: 92
I have always been under the impression you could not use the MSG instruction with UDTs, only blocks of standard data types. I'm going to feel pretty dumb if I had that wrong.

Regarding setting up a producer/consumer in each direction, this UDT has operation 'setpoints' that must be adjustable from either HMI. So if A has a produced and consumed tag and B has a produced and consumed tag, I certainly get all the data I need transferred, but I have no idea which data is valid and which isn't (I'm transmitting the old value as well as the new). I have to build in the comparison logic to determine the updated value and to move it into the operational logic. If I only had one UDT that was being shared by both controllers and both HMIs there would be no need to overwrite anything or compare anything. Only one value would ever be written.

The same goes for the MSG instruction, the pain is in detecting the change and then sending the changed UDT to the other controller. Both A and B have a stored values so I have to build in dummy tag duplicates, use them to detect changes, and when changes are detected, transfer the data to the other controller and overwrite all the tags with the new data.

Unless I am missing something painfully obvious, and it wouldn't be the first time, there is no simple way to just have a tag or UDT in controller A alias a tag or UDT in controller B (that would effectively solve my problem, but only if the alias was not biased in a particular direction). I build a user defined function for this purpose that I call 'SYNC'. It basically compares one tag with another, if they don't match it moves the tag with precedent into the other. IF THERE IS NO PRECEDENT (AS IS THE CASE HERE), i.e. any change should be reflected in both locations, it compares each to a dummy tag, and whichever is not equal becomes the tag with precedent. Its value is moved into the other tag and into the dummy tag and it's ready for another comparison.

If controller A's tag changes I want it to overwrite controller B's tag, if B's changes I want it to overwrite A's. Unfortunately, I want to do this with a lot of BOOLs, INTs and REALS.

Last edited by Tim James; December 17th, 2012 at 11:06 PM.
  Reply With Quote