08-06-2020 03:59 AM
I am measuring data from VISA Read in while loop..Loop is running on "stop if true"..
Process 1 for storing data in SQL...Boolean Operation "Latch when released"..
Process 2 about to fetch data DATA from SQL and PDF report...Boolean Operation "Latch when released"...
Process 1 & Process 2 works only if I replace "TRUE CONSTANT" instead of "STOP CONTROL"...
08-06-2020 04:10 AM
Hi Tusharvp,
@Tusharvp4 wrote:
I am measuring data from VISA Read in while loop..Loop is running on "stop if true"..
…
Process 1 & Process 2 works only if I replace "TRUE CONSTANT" instead of "STOP CONTROL"...
As has been said several times before: do the basics courses to learn about THINK DATAFLOW!
THINK DATAFLOW: Process1 and Process2 can only execute when the loop has finished.
THINK DATAFLOW: The loop finishes on a TRUE condition.
When the loop containing your "VISA Read in while loop" never creates this TRUE condition then it will not stop iterating…
It's all in THINK DATAFLOW!
08-06-2020 06:21 PM
@GerdW wrote:
Hi Tusharvp,
@Tusharvp4 wrote:
I am measuring data from VISA Read in while loop..Loop is running on "stop if true"..
…
Process 1 & Process 2 works only if I replace "TRUE CONSTANT" instead of "STOP CONTROL"...
As has been said several times before: do the basics courses to learn about THINK DATAFLOW!
THINK DATAFLOW: Process1 and Process2 can only execute when the loop has finished.
THINK DATAFLOW: The loop finishes on a TRUE condition.
When the loop containing your "VISA Read in while loop" never creates this TRUE condition then it will not stop iterating…
It's all in THINK DATAFLOW!
Hi, @Tusharvp4,
In case you didn't notice, "THINK DATAFLOW!" is a learning module available through NI.
If it helps, here is a web page that explains LabVIEW dataflow.
And here is a (slightly) interactive tutorial that explains LabVIEW dataflow.
Keep in mind that the dataflow paradigm applies to LabVIEW's
And for each of these, in general,
So, seriously, look at LabVIEW tutorials and learn what dataflow programming is. As has been said, "THINK DATAFLOW!"
Good luck!
-joeorbob
08-06-2020 09:13 PM
Hi Tusharvp,
In your original code, the process inside the while loop is running continuously (until you hit Stop), but the processes outside the while loop (i.e. the 2 case structures) only run once. So even if you change the variable values later, the output won't be updated.
The simplest way is to add another while loop that includes the 2 case structures. These 2 while loops will run in parallel, and the local variables ensure that the values are updated in the case structures.
08-07-2020 11:45 PM - edited 08-07-2020 11:46 PM
Two while loops are working...There is being synchronous issue while loops run...Working on 2nd loop, 1st loop is being stopped work..
08-08-2020 12:21 AM
We cannot help without seeing your vi and more explanations.
@Tusharvp4 wrote:
Two while loops are working...There is being synchronous issue while loops run...Working on 2nd loop, 1st loop is being stopped work..
Is that what you want or what you don't want? What is your definition of "working"?
08-08-2020 01:26 AM - edited 08-08-2020 02:15 AM
Here is my code...When I press log button it stores data in database...When I print button, first loop of running data is being stopped to work..
08-08-2020 02:01 AM - edited 08-08-2020 02:05 AM
Sorry, I don't have a gigantic 8k monitor, so there is no way for me to analyze or troubleshoot this. Who wrote this VI?
You have multiple terminals with the same (or similar) name, local variables with similar names everywhere. Absolute nightmare! You have two tiny subVIs, so why are their diagrams maximized to the screen? Do you know that index array is resizeable (lower loop)? etc. etc.
Your tiny inner loop makes no sense and uses 100% CPU until it is stopped, the case structure afterwards can never reach the false case,
You really, really need to learn about code architecture, Only well organized code can be efficiently debugged.
You still have not explain what the problem is.
08-08-2020 07:00 AM - edited 08-08-2020 07:01 AM
CODE
08-08-2020 09:55 AM - edited 08-08-2020 09:58 AM
@User002 wrote:
@GerdW wrote:
Hi Tusharvp,
@Tusharvp4 wrote:
I am measuring data from VISA Read in while loop..Loop is running on "stop if true"..
…
Process 1 & Process 2 works only if I replace "TRUE CONSTANT" instead of "STOP CONTROL"...
As has been said several times before: do the basics courses to learn about THINK DATAFLOW!
THINK DATAFLOW: Process1 and Process2 can only execute when the loop has finished.
THINK DATAFLOW: The loop finishes on a TRUE condition.
When the loop containing your "VISA Read in while loop" never creates this TRUE condition then it will not stop iterating…
It's all in THINK DATAFLOW!
Hi, @Tusharvp4,
In case you didn't notice, "THINK DATAFLOW!" is a learning module available through NI.
- (I think - I couldn't find it via Google just barely, but I'm pretty sure I did it recently...)
If it helps, here is a web page that explains LabVIEW dataflow.
And here is a (slightly) interactive tutorial that explains LabVIEW dataflow.
Keep in mind that the dataflow paradigm applies to LabVIEW's
- functions,
- subVIs, and
- structures.
And for each of these, in general,
- If something has 0 wires going into it, it will tend to execute as quickly as possible
- If something has 1+ wires going into it, it will not start executing until every input wire has received its data
- If something has a wire going out of it, that wire will not send its data until that "something" has finished (in the case of a loop, the output wires will not have data until the loop is exited!)
So, seriously, look at LabVIEW tutorials and learn what dataflow programming is. As has been said, "THINK DATAFLOW!"
Good luck!
-joeorbob
I think this is a bit complicated and confusing. It can all be distilled into this one sentence: "Remember that a node executes only when data is available at all of its input terminals and supplies data to the output terminals only when the node finishes execution," found here. Apply this as explicitly and as literally as you can, and it will answer all your dataflow questions. ("I don't know" may sound like a bad answer, but if you apply that sentence judiciously, "I don't know" may be the correct answer.)
This applies to structures as well. Someone pointed out to me that structures are nodes, too, so it applies to them as well.