01-10-2018 12:52 PM
I'm trying to send files from my cRIO device to my PC. The way I need it to work is I press a button/flick a switch and that indicates that the files need to be saved. I want the files to contain data from N amount of seconds before the button is pressed. Where N is given at the users discretion. I feel like I am over complicating it, because it seems like a pretty straightforward task.
Someone in another forum suggested using the lossy enqueue function, which I understand why, because it would only be storing values that I have requested. LabVIEW isn't my strong suite so what I am not understanding is how I would:
1) Create/set the queue's size to a time period
2) Send/Stream?/Transfer? the queue to a file on the PC
01-10-2018 02:46 PM
I've found some post with people using arrays with time stamps for similar things, but I still don't know how I would get the last N amount of seconds.
01-11-2018 02:28 AM
Hi atokad,
LabvIEW comes with several predefined example RealTime projects. All of them show how to transfer data between PC host ans RT target. Did you examine them?
You can also look for examples in the example finder. I suggest to play with those network stream examples…
01-12-2018 09:10 AM
I didn't see any examples that work the way I want the project to work
01-12-2018 09:40 AM - edited 01-12-2018 09:40 AM
This request is absolutely trivial if you figure out how to use;
A) a Lossy queue
B) VI Server Remote access
C) Action Engines
D) VI server call by reference
"elevator speech"
the cRIO continuously collect data and puts it in a lossy queues of the size required.
Init an action enigine that holds the queue reference.
Serve the Action using VI server to the PC.
The PC when it starts opens a ref to the app running on the cRIO and then a ref to the Action Engine mentioned above.
When the user clicks the button the Action Engine is invoked (that is running on the cRIO) via VI server call by reference node using a "Get data" action which uses the queue ref to get the entire queue contents and returns it via connector on the icon connector.
PLot the returned data.
Done!
Ben
01-12-2018 10:30 AM
I'm struggling to understand how to set the "size required" for the queue though
01-12-2018 10:37 AM
When the queus is created use the "max queueu size" input to limit the size of the queue.
When applying updates to eh queue use the "lossy Enqueue Element".
As long as the # samples queue up each time you enqueue, the queue will fill to max size then only retain the most recent number of updates.
Ben
01-12-2018 10:38 AM
I want something like the VI attached, but where the the trigger sends data from the N seconds before triggering instead of the next N seconds.
01-12-2018 10:51 AM
@atokad wrote:
I want something like the VI attached, but where the the trigger sends data from the N seconds before triggering instead of the next N seconds.
Yes that is what I outlined above. When you fetch from the queue you will get all of the data that has pilled up in the queue waiting for the user to start the transfer.
When you get around to VI server, look at the example;
C:\Program Files\National Instruments\LabVIEW 2017\examples\Application Control\VI Server\Exporting VIs\Exporting VIs.lvproj
Ben