LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

multiple instances of identical vi inside a while loop

We have a while loop that is monitoring 6 sensors in a heated water bath.

Each sensor has the same basic switching parameters.

While the loop runs, it does not tie the shift register value to the same instance every time it runs.

 

The 6 instances of the Switch Pass or Fail.vi in the attached project have a dummy 1, 2, 3, 4, 5, 6 value and we don't know how to tell the main program which instnace to run when a switch switches.....

 

So far, everything else works, but we can't get the Switch Pass or Fail.vi to run the same way twice...

0 Kudos
Message 1 of 9
(2,746 Views)

Is this considered a parallelism issue or a different type of issue?

0 Kudos
Message 2 of 9
(2,714 Views)

Hi llf264,

 

Could you give a brief explanation of what your desired behavior is here? What are you trying to accomplish by using these sets of shift registers? From what I can tell, you are trying to go through all 6 switches one time and do a pass/fail test. In this case, we might want to structure the code a bit differently. I would guess that parallelism is the problem, but your explanation of the desired behavior will be very useful. Also, a screenshot of the current behavior might be helpful as well.

 

Best regards,

Matt J - NI Tools Network
0 Kudos
Message 3 of 9
(2,696 Views)

I've attached some screenshots in a word doc... the section on the first page that is circled in red was changed to the configuration in red on the second page.

The third page shows how the same six VI's were combined down into one vi.  For good or bad... that was the method used.

I'm not sure that this is proper programming technique but it seems to have helped enough with the processing of temp info (circled in black on both pages) to identify some other problems with the code.

 

The operation of the program basically runs with the following logic:

The green section initializes shift registers with an arbitrary value that should update if/when each of the six switches opens or closes.

The black section is the live data coming from the water bath that each of the six switches sit in.

The red section makes various comparisons, manipulates the data and outputs values that should update the individual shift registers at the bottom of the page in green when they come out the other side.

 

the probelm was that we had no control over which shift register updated when one of the six switches opened or closed.  We want to tie the first shift register with switch number 1, the second shift register with switch 2 etc.... etc.... for all six switches.  We think that we tied them appropriately with a case structure but don't think that is very efficient.

 

 

0 Kudos
Message 4 of 9
(2,674 Views)

don't post docx's  we won't read them even if we have Word. (too many security risks and docx is bloated for those mobile users with data plans)

 

*.png's of screen captures are prefered if you can't post the vi with default data (best)


"Should be" isn't "Is" -Jay
0 Kudos
Message 5 of 9
(2,668 Views)

I uploading the project vi but guess from your response that I did not send enough data... Are there some tricks that you can point out to uploading everything appropriately?  I have default data loaded but am not familiar with loading any base data files to support uploading a project file...

Thanks in advance for the tips.

0 Kudos
Message 6 of 9
(2,664 Views)

Not completely sure, but it does look like parallelism is your problem.  In  a nutshell you are calling one VI to control multiple shift registers.  Your Record Switch Data.vi appears to be daisy-chained so it will follow LV data flow paradigm. Have you tried using the debug tools.  A word of caution:  You have way to many parameters tied to your Record Switch Data.vi.  Consider using clusters to clean up your vi.

-----------------------------------------------------------------------------------------
Reese, (former CLAD, future CLD)

Some people call me the Space Cowboy!
Some call me the gangster of love.
Some people call me MoReese!
...I'm right here baby, right here, right here, right here at home
0 Kudos
Message 7 of 9
(2,660 Views)

Sorry, I missed the earlier zip.

 

Its not a parralell execution issue- the VI copies are not re-enterant and share the same data space so only 1 will fire at a time and the rest will wait for the first to finish.  

 

Without knowing exactly whats going on I have to guess that the timing is screwy because we don't know what order the copies will execute (Basic dataflow 101)

 

I'd sugest MAKING them re-entrant but they may not be able to because they all have the same resources required (Those one-shots in the unused cases may get reserved during execution any how)

 

I gotta say the style is unusual and "re-factoring" could not hurt


"Should be" isn't "Is" -Jay
0 Kudos
Message 8 of 9
(2,647 Views)

Stepping back to our "inception" problem.. we have a problem, within a problem, within a problem...

 

Before we can answer our other problems, we need to be able to test our VI and can't figure out how to update a bank of shift registers, one at a time, without having the wires break when we don't update each output from the case structure on each case.  The VI won't let us run by populating one output from a wire to different shift registers in a "bundle" vi.

 

 

The goal of the attached VI is to have "TMP Reg" input, initial, shift register, values into the "switch pass or fail.vi" and have the output on the "trip temp out" wire update only the shift register in the "bundle" associated with that switch.

example: the first case structure entry "1" would output the "trip temp out" value to the first entry in the bundle to update the first shift register.  Then, when the second case ran, it would update the second entry in the bundle to update the second shift register, and so on, until all six cases (switches) had thier shift register values updated.

 

 

0 Kudos
Message 9 of 9
(2,624 Views)