LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Lock an instrument that is used by 2 computers

Hi there, I have the following problem: I want to use a single instrument from two computers, but I don't want them to compete for the instrument. For the most part, this will be avoided by staggering the tests. A test is about 20 minutes, and the instrument is only needed for about 7 minutes. In case of overlap, I'd like the second computer to access it to see that the instrument is "locked", and wait until it is free before trying to use it.

 

The instrument is a Network Analyzer, costing over $100k, which is why I don't want to buy a second one. So far, I've tried saving a file to the instrument (called "InUse") which is created when a computer starts using it, and deleted when it is finished using it. The second computer will look for this file every 1 second or so, and can use the instrument if the file is not present. But this can cause errors and disrupt the test of the first computer.

 

Does anyone have good ideas for handling this situation?

0 Kudos
Message 1 of 10
(2,869 Views)

Assuming you can not write code that runs on the Network Analyzer...

 

Have the two application talk to each other and ask the other if they can use the analyzer?

 

if no reply assume the analyzer is available and the other application is not running.

 

or write your "InUse" file to mapped drives on the other machine.

 

And another approach could be...

 

Write a proxy that runs on one of the machines and acts as a gateway to the network analyzer

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 2 of 10
(2,857 Views)

Hi Ben, thank you for your suggestions!

 

Have the two application talk to each other and ask the other if they can use the analyzer?

This sounds like a good option. I'm not sure exactly how to do that, since the tests are run through TestStand. Would I need to run a separate application just letting the computers talk to each other? Would that use a TCP/IP communication? (something I'm not familiar with, but willing to learn!)

 

or write your "InUse" file to mapped drives on the other machine.

I have considered doing this, with a file on a network drive.

 

Write a proxy that runs on one of the machines and acts as a gateway to the network analyzer

This one I don't understand, but it sounds like an elegant solution!

0 Kudos
Message 3 of 10
(2,852 Views)

Network drive sounds like the easiest ... provided the availability of the drive is questionable. You may want to check time stamps of the file to cover the "other" application crashing and leaving the file on the drive. 

 

The other two methods require more work since you will have to account for the "other" application may not be running.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 4 of 10
(2,828 Views)
Thank you, the timestamp checking is a very good point! I'll leave this open a little bit longer in case anyone else has suggestions.
0 Kudos
Message 5 of 10
(2,819 Views)

Why not set this up similar to printer sharing - You can open a personal printer connected to your PC to the network.  Use this same concept. 

Have the Main/Primary system perform the following:

  1. Configure system for Main controller
  2. Service Main controller (handle queries and commands)
  3. Configure system to handle secondary system requests through main controller (only one system - Main - sends data to instrument)
  4. Service secondary requests through Main system when Main system is idle
  5. When Main system requests control, send message to secondary system to wait.
  6. Service Main controller
  7. When Main system releases control, continue to step 3.
Help the Community (and future reviewers) by marking posts as follows:
If it helped - KUDOS
If it answers the issue - SOLUTION
0 Kudos
Message 6 of 10
(2,817 Views)

I see, that sounds like the proxy that Ben mentioned. Thank you for laying it out in steps for me, I will try to think about how to implement it!

0 Kudos
Message 7 of 10
(2,813 Views)

Essentially, only one system will communicate with the instrument.  All others will communicate with that instrument through that one and will control it via a request system.  This will protect the piece of equipment and allow you to set up whatever priority interfacing and control you would like.  Possibly resetting the piece of equipment during each transition phase to return it to a known state.

Help the Community (and future reviewers) by marking posts as follows:
If it helped - KUDOS
If it answers the issue - SOLUTION
0 Kudos
Message 8 of 10
(2,807 Views)

Wouldn't a shared or network variable work here? 

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 9 of 10
(2,795 Views)

@RTSLVU wrote:

Wouldn't a shared or network variable work here? 


In theory YES but which of the two machine will host the variable... and what happens if the serving machine is down and we try to run the other machine?

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 10 of 10
(2,787 Views)