LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Use Data output of VI in Host as Input in Main VI in Target

Solved!
Go to solution

Dear all,

I am new in LabVIEW and I would like your help if that is possible. As part of my master thesis, I have to use a project written by a PhD student several years ago. I am using LabVIEW 18 in windows 10 and a cRIO 9074 controller.

There are 2 main VIs in the project, MainSimple.vi running on the real time target and MainHost.vi running on the PC.

I attempt to run the MainSimple.vi but to achieve this a frequency table has to be loaded on the MainSimple.vi which takes values from a subvi called freqtablesTRIAL3VI.vi (which basically is a program that reads 110 txt files and converts them into a 2D numerical array).

However when I run MainSimple the table turns up with 0 values and I receive an error code 7 saying that file is not found and that I should verify that the path is correct even though freqtablesTRIAL3VI.vi works perfectly fine on the host.

I tried to move the folder in various locations in My Computer and inside cRIO using files transfer option in NI Max but nothing changed.

Then I attempted to run freqtablesTRIAL3VI.vi in the host and transfer the output on MainSimple.vi using a customized network shared variable but when I deploy it and run the Main I get errors. As I read it might be because I cannot enable the RT FIFO option due to the fact that my customized variable is a 2d array but I am not sure about it.

Then I thought to use network streams but If I realized correctly I can only use them to transfer data from cRIO to host and not the opposite direction (please correct me I have misunderstood).

 

So basically I am trying to find a way to use the data output from freqtablesTRIAL3VI running on my host as input in MainSimple. running on my target.

Any help on how can I achieve this would be greatly appreciated.

 

Sorry for the long message but I have lost a lot of time the last week running on dead ends.

I attach the 2 vis of interest and the frequency tables for your review.

 

Kind Regards,

Georgios

 

 

Download All
0 Kudos
Message 1 of 10
(1,984 Views)

Personally, I would move your tables files to the cRIO in a special location.  Then update the freqTables VI to read in that location.  It is currently set up to read from the PC harddrive, which a cRIO does not have access to.  What you should really due is update that VI to have the path passed in.  Then your host and point to the location of the tables on the PC while the cRIO can point to the location on the cRIO.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 10
(1,977 Views)
Solution
Accepted by topic author amfetam1n

@amfetam1n wrote:

Then I thought to use network streams but If I realized correctly I can only use them to transfer data from cRIO to host and not the opposite direction (please correct me I have misunderstood).


A Network Stream is unidirectional.  What this means is that data can only go in one direction.  However, you have have it goes from Host to the cRIO or the cRIO to the Host.  If you want to use Network Streams to go both ways, you need 2 Network Streams.  Personally, I just use the normal TCP/IP API to send data back and forth.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 3 of 10
(1,976 Views)

I have a number of LabVIEW Real-Time Projects that use Network Streams.  I generally have a pair of Streams for "messages" from Host to Target, and from Target to Host.  Both Host and Target run code similar to the Queued Message Handler, with a specialized "Message Receiver" from the corresponding Network Stream used to "inject" a message such as "Here are the data you need for the cRIO" (which, of course, includes the relevant data read by the Host from its disk and sent as the "Data" Variant part of the Host-to-Target Message over the Network Stream).  The Target, of course, is also generating Real-Time data that can be saved directly on the Host if streamed (by yet another Network Data Stream) to the Host.

 

Bob Schor

Message 4 of 10
(1,967 Views)

@Bob_Schor wrote:

I have a number of LabVIEW Real-Time Projects that use Network Streams.  I generally have a pair of Streams for "messages" from Host to Target, and from Target to Host.  Both Host and Target run code similar to the Queued Message Handler, with a specialized "Message Receiver" from the corresponding Network Stream used to "inject" a message such as "Here are the data you need for the cRIO" (which, of course, includes the relevant data read by the Host from its disk and sent as the "Data" Variant part of the Host-to-Target Message over the Network Stream).  The Target, of course, is also generating Real-Time data that can be saved directly on the Host if streamed (by yet another Network Data Stream) to the Host.

 

Bob Schor


Just remembered that JKI recently put out a Network Streams toolbox that does the bidirectional communication with 2 Network Streams.  I haven't looked at it in depth, but it seems like it might fit this application.  JKI Network Streams Connection 


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 5 of 10
(1,951 Views)

Hey crossrulz,

Thanks a lot for the quick reply first of all.

I moved my tables on the cRIO using the file transfer option through NI MAX. Then I updated the VI and run it on cRIO but I get an error message concerning my path(LabVIEW: (Hex 0x596) The path is empty or relative. You must use an absolute path.) even though I just copied it from the adress bar of the file explorer(it looks like this  ftp://169.254.84.198/ni-rt/Frequency%20Tables%20All%20values%2040to150/)

The VI runs but I get an empty 2D array with 0 values as u can see in the picture attached.

Cheers,

Georgios

 

0 Kudos
Message 6 of 10
(1,948 Views)

@amfetam1n wrote:

I moved my tables on the cRIO using the file transfer option through NI MAX. Then I updated the VI and run it on cRIO but I get an error message concerning my path(LabVIEW: (Hex 0x596) The path is empty or relative. You must use an absolute path.) even though I just copied it from the adress bar of the file explorer(it looks like this  ftp://169.254.84.198/ni-rt/Frequency%20Tables%20All%20values%2040to150/)


You are using the wrong path.  See here for more details: Working with File Paths on Real-Time Targets 


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 7 of 10
(1,939 Views)

Thanks for the link, I managed to finally pass the data from host to target using the network streams method.  I have an issue now however, that even though the data are read on the target as one can see on the output of probe 18 it doesn't get forward to probe 11 which is the wire that feeds the main loop of the MainSimple.vi. Do you have any clue why this can be the case?

Thanks again

Georgios

amfetam1n_1-1610110596406.png

 

0 Kudos
Message 8 of 10
(1,900 Views)

@amfetam1n wrote:

I have an issue now however, that even though the data are read on the target as one can see on the output of probe 18 it doesn't get forward to probe 11 which is the wire that feeds the main loop of the MainSimple.vi. Do you have any clue why this can be the case?


You aren't stopping the loop.  If you only expect the get the message once, then you don't even need a loop there.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 9 of 10
(1,886 Views)

Thanks a lot, yes just managed to do it.

0 Kudos
Message 10 of 10
(1,883 Views)