04-09-2018 08:00 PM
I'm working on LVRT project acquiring data from cRIO and expansion chassis at 40Hz and put into a queue for later calibration, can anyone show me how to make a functional global variable for all the data then I can get the value to make plots. Thank you very much. Best.
04-10-2018 02:00 AM - edited 04-10-2018 02:01 AM
Hi Xiao,
how to make a functional global variable for all the data
Store the data in a shift register and you're done…
Do you know how a FGV works? Have you tried to create your own one? Can you attach your code?
- What's the point of all those Decimate/BuildArray combinations? When reading the shared variables you should use ReshapeArray, for those ScanEngine scalar values a simple BuildArray should be fine!
- Why don't you use a loop to read the shared variables?
- Why don't you name the ScanEngine variables more descriptive? It's quite irritiating to see you read "AI7" 4 times…
04-10-2018 02:06 AM
Its always good to attach code snippet/VI For better results.
Functional Global Variable is nothing but holding values in a shift register using (SINGLE RUN WHILE LOOP).
04-10-2018 06:21 AM
Xiao@Gemini wrote:
can anyone show me how to make a functional global variable for all the data then I can get the value to make plots.
If you want to plot all of the data, then you should be using a Queue to pass the data to another loop. And if you are then passing that data to a PC, use Network Streams.
A Get/Set FGV is nothing more than a more complicated and slow Global Variable. But those are only good for TAG data (single value, only storing the latest). What I am inferring that you need is actually a STREAM type of data (fast, lossless data), which a Queue is much better equipped to handle.
04-10-2018 06:53 AM - edited 04-10-2018 06:54 AM
@PalanivelThiruvenkadam wrote:
Its always good to attach code snippet/VI For better results.
Functional Global Variable is nothing but holding values in a shift register using (SINGLE RUN WHILE LOOP).
I like to make FGVs with a feedback node instead of a loop.
04-10-2018 08:30 AM
Actually, I'm using the queue to pass data to another while loop for calibration and plot. Considering a large amount of data (14 waveform charts each have at least 8 plots), I may not be able to set a large chart history buffer to view historical data (I want at least 12 hours history). So, I'm thinking of using FGV to store data and waveform graph to plot it.
04-10-2018 09:29 AM
Xiao@Gemini wrote:
Actually, I'm using the queue to pass data to another while loop for calibration and plot. Considering a large amount of data (14 waveform charts each have at least 8 plots), I may not be able to set a large chart history buffer to view historical data (I want at least 12 hours history). So, I'm thinking of using FGV to store data and waveform graph to plot it.
Still use the queue. Let your display loop(s) take care of the history/buffer. There is a simple VI called Data Queue PtByPt that can hold your history. But instead of holding all of that data in memory, I would just log it to a file and just read off the data you need.
04-11-2018 08:04 AM
Almost the same (output will be the previous value even when Write is true):
You can make a FG that hold a history of values (write adds values to arrays, read returns the array(s) and optionally clears them). It will get more complicated then one node and a few wires.
04-11-2018 03:32 PM
I'm using queue to pass data to plot loop with waveform charts to display real time data. I also need to view the historical plot as long as possible at least 12 hours, 40Hz sample rate, the buffer would be 40x60x60x12=1,728,000 for 14 charts. I'm worried about the memory. My colleague suggest me to store the data in functional global and use graph to plot.
04-11-2018 08:09 PM
Xiao@Gemini wrote:
I also need to view the historical plot as long as possible at least 12 hours, 40Hz sample rate, the buffer would be 40x60x60x12=1,728,000 for 14 charts. I'm worried about the memory.
Well, that does come up to ~185MB. If also stored in a FGV, that needs doubled. I would just use the Chart and make life easier on yourself.