LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Change Target of Shared Variable Library Programmatically

Solved!
Go to solution

I have an Real-Time project with code that runs on both a Host PC and a cRIO that communicate using a library of shared variables on the cRIO. I am hosting the variables on the cRIO because that has worked much better than hosting on the Host PC. For normal operation, this structure works perfectly.

 

However, I am now trying to implement a system that will allow the user to choose if they want to actually run the code on the cRIO or run a simulated system. The simulated system would be located on the Host PC so it makes sense for this application for the variables to be located on the Host PC.

 

To account for both of these cases, I would like to change the target of the shared variable library depending on whether the Real-Time system is being run or if the simuation is being run. I can do that easily manually by just dragging the library in the project explorer but would prefer to automate this process.

 

In short, I am looking to develop code which will change the target of a shared variable library.

 

I have tried doing this by opening a reference to the project file, using properties to get the reference of the library, and changing the target. However, the target property is read only. Is there another way to go about doing this or am I stuck having to do this manually? 

0 Kudos
Message 1 of 2
(2,117 Views)
Solution
Accepted by topic author martian101

As it turns out, I had a version of the Shared Variable library on the cRIO, so even when I hosted the shared variables on the Host PC, it still wrote to the cRIO. By fixing that issue, I was able to host the library on the Host PC and get everything to run much more simply.

Message 2 of 2
(2,097 Views)