LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

use of FGV

Hello all, 

I have attached a file which consists of the global variable ( Model No ) .that is recalled in other programs too  I found that when writing the files in spreadsheet , race conditions are occurring. I know that we need to use an FGV to avoid race conditions. But I was in dilemma to create an FGV. help me to create an FGV for calling the (Model no) and ( test name)  in various other programs for the project

0 Kudos
Message 1 of 23
(3,806 Views)

Hi bhuvanesh,

 

But I was in dilemma to create an FGV. help me to create an FGV

What was your "dilemma"?

Where are you stuck?

What have you tried? (Mind to attach your FGV VI?)

 

General hint:

- FGVs store data in a shift register (or feedback node).

- FGVs usually have an additional input to select the operation (read, write, init, …)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 23
(3,797 Views)

Hi gerdW,..

i have a attached a Vi . review that and tell me.. is it correct or not ? 

if i want to use a ( model no ) or ( Test name ) in some other programs . How i should call ?

0 Kudos
Message 3 of 23
(3,784 Views)

Hi bhuvanesh,

 

is it correct or not ?

No, it's not correct…

 

- You have two cases/states where data is stored in the FGV - but there is no state to read the stored data!

- You store both items in the very same shift register "variable": either use two shift registers to store two items or store both strings in an array/cluster in one shift register…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 23
(3,774 Views)

no state to read means >>? sometimes i need to call " Model No " sometimes i need to call " test Name " . could you please develop a Vi and send me . i cant get you . 

0 Kudos
Message 5 of 23
(3,755 Views)

@Mrtechie wrote:

 I know that we need to use an FGV to avoid race conditions.


No. This is wrong. FGVs which just have a "get" and "set" method, like the one you are creating, do not do anything to solve race conditions (you are more or less making a global variable...). In order to solve a race condition, you need to put the functionality INSIDE the FGV (often these type of FGV are called Action Engines). The other ways to avoid race conditions is only writing the value once, then you know exactly what you are reading.

 

 

EDIT - looking at your JPG, I think you could probably solve your issue by using a wire instead of a global variable. Wires are good at preventing race conditions

Ian
LabVIEW since 2012
0 Kudos
Message 6 of 23
(3,754 Views)

is this Vi ok ?? please read the previous conversations too .. i think you will get idea 

0 Kudos
Message 7 of 23
(3,746 Views)

@Mrtechie wrote:

is this Vi ok ?? please read the previous conversations too .. i think you will get idea 


No.  As said previously, that VI is no better at solving race conditions than a global variable.  In fact, you have just made a slow global variable that does not actually store the data.

A Look At Race Conditions

Action Engine

 

So let's take a step back.  Where are those values actually set?  Are they in the same loop or a parallel loop?  Do other loops need that data?


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 8 of 23
(3,735 Views)

ya .  i need that data in other loops too . i need to call that in different vi's.

0 Kudos
Message 9 of 23
(3,732 Views)

2 shift registers means ? 1 read case itself enough ? or  have to create 2  read cases ? 

0 Kudos
Message 10 of 23
(3,726 Views)