09-04-2015 11:51 AM
Hi,
I can potentially have three or more HMIs (Labview executables) running at the same time, but from different host computers. There is also a real time labview VI running on the CRio. I need to implement something similar to a "master/slave configuration" using shared variables only.
- Where only one HMI, the Master, writes to the CRio at a time while others are read only.
- There is one main Master which has a fixed IP address, and at Rio start up the Rio or itself should know that it is a Master and give it control
- When the main Master is in control (has write access) no other HMI can write, but they can read. They becomes the "Slaves".
- When the main Master releases control, any other HMI can request and gain control
- BUT if the main Master wants control back it can kick any other HMI out of control at which time, they go from "temporary" Masters to Slaves.
- Note that when the main Master has control, no other HMI can request control but when temporary masters have control, any HMI can request control
Do you all have an idea on how I can implement this control strategy?
Thanks,
TeamHalli
09-04-2015 12:40 PM
You could have a TCP listener on your cRIO. When something connects to it, that system becomes the "master". If it is the real master, then just keep pings going back and forth to keep the port alive. If it is a slave that connects, create another listener to attempt to connect to the real master if it wants to take over. If that happens, send a message to the slave saying that you are disconnecting and let the real master take over.
This has not been fully thought out. I'm just throwing out ideas.
09-04-2015 12:44 PM
Thank you. What is a TCP listener ?
TeamHalli
09-04-2015 12:55 PM
@TeamHalli wrote:
Thank you. What is a TCP listener ?
It is something that waits for a TCP/IP connection. TCP Listen VI Be sure to look up Simple TCP example project to see how to communicate over TCP/IP.
09-04-2015 02:20 PM
Is there a way to log on and off to the VI which will lock and lock to other HMIs?
09-07-2015 07:20 AM
@TeamHalli wrote:
Is there a way to log on and off to the VI which will lock and lock to other HMIs?
You can just simply close the connection from your HMI and then the cRIO will catch that error and release the "master" status, allowing another HMI to connect.