取消
顯示結果 
搜尋替代 
您的意思是: 

Functional global variable

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.

Capture.JPG

0 積分
1 條訊息(共 13 條)
5,208 檢視

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…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 積分
2 條訊息(共 13 條)
5,175 檢視

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).

----------------------------------------------------------------------------------------------------------------
Palanivel Thiruvenkadam | பழனிவேல் திருவெங்கடம்
LabVIEW™ Champion |Certified LabVIEW™ Architect |Certified TestStand Developer

Kidlin's Law -If you can write the problem down clearly then the matter is half solved.
-----------------------------------------------------------------------------------------------------------------
0 積分
3 條訊息(共 13 條)
5,171 檢視

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.



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 積分
4 條訊息(共 13 條)
5,153 檢視

@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.

fgv.png

"If you weren't supposed to push it, it wouldn't be a button."
5 條訊息(共 13 條)
5,149 檢視

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. 

0 積分
6 條訊息(共 13 條)
5,129 檢視

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.



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
7 條訊息(共 13 條)
5,115 檢視

Almost the same (output will be the previous value even when Write is true):

 

FGV.png

 

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.

 

8 條訊息(共 13 條)
5,084 檢視

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.  

0 積分
9 條訊息(共 13 條)
5,056 檢視

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.



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
10 條訊息(共 13 條)
5,042 檢視