07-26-2017 12:51 AM
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
07-26-2017 01:09 AM
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, …)
07-26-2017 01:29 AM
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 ?
07-26-2017 01:53 AM
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…
07-26-2017 04:41 AM
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 .
07-26-2017 04:45 AM - edited 07-26-2017 04:55 AM
@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
07-26-2017 05:15 AM
is this Vi ok ?? please read the previous conversations too .. i think you will get idea
07-26-2017 05:59 AM
@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.
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?
07-26-2017 06:09 AM
ya . i need that data in other loops too . i need to call that in different vi's.
07-26-2017 06:32 AM
2 shift registers means ? 1 read case itself enough ? or have to create 2 read cases ?