So I am running a simple program where I am just trying to poll data between LabVIEW Projects on 1 computer, with the final goal of doing the same from another computer over a network connection.
Problem I am running into is that I have to get a new reference every time for this to work, it isn't allowing me to use the same reference to get new data.
I'm wondering why I need to get a new reference every time to read fresh data. The VI I am reading data from is in a different project on this computer and is running within that project.
DOES NOT WORK - THIS ONLY RETURNS VALID DATA THE FIRST LOOP AND STALE DATA EVERY LOOP AFTER
DOES WORK - THIS METHOD RETURNS FRESH DATA EVERY TIME
Solved! Go to Solution.
What happens if you run the first one with out the options wired into the "Open VI" node, or copy the options to the second one? It's not actually the same code.
Also, did you mean to make the options in decimal? Usually it should be in hex to make it more obvious which ones are enabled.
I think if the VI goes idle, the references will become invalid. How are you calling it? What happens between calls?
So when I remove the options selection I get the same behavior, it returns valid data for the first iteration, and then every time after that it returns the same data and never fresh data.
So this is all there is to this test we are running (it's just a mock up of what we really intend to do).
Project 1 - VI 1
Project 2 - VI 2
The intent here is to just constantly read data from with VI 2 from VI 1.
And for whatever reason the reference goes bad after the first read. I guess my follow up question to you would be, what is considered "idle"? Neither of these are being called as SubVIs. They are running in separate projects though.
"Idle" is one of the 4 execution states (Bad, Idle, Run Top Level, Running). Idle state is indicated by a white run-arrow.
Note that each project has it's own context. When project 2 opens a VI reference, there is a copy of that VI in project 2, and it's data is isolated from the data in project 1. Therefore anything that happens in project 1 won't propagate to project 2. When you close the VI reference in project 2, the copy of VI 1 is unloaded from project 2's memory space. I'm actually surprised that reopening the VI reference yields fresh data; I would have expected to just get default values.
The "Open VI Reference" function does have an "application reference" input and if VI 2 could get a reference to project 1's application context, then VI 2 could open a reference to the copy of VI 1 that's in project 1's memory space.
Passing data between 2 projects is a very odd thing. You might want to consider rearchitecting.
Something like this:
Don't forget to close all 3 references.