LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Why does the while loop does not reboot?

Solved!
Go to solution

Why does the VI "Creating" does not reboot like VI "Switch"?
I tried to implement the same while loops, but only the STOP works.
Any suggestion?

appreciate

Download All
0 Kudos
Message 1 of 4
(2,347 Views)
Solution
Accepted by topic author RM1991
  • OK, first of all, deep stacks of while loops are just a bad idea in general. 
  • If you would set the stop conditions to "stop if true", you could eliminate all your NOTs. Do you understand that comment?
  • Your code does not depend on the B1 state, because identical code executes no matter which loop is doing the spinning. (In the switch VI, the reference time resets after the inner loop restarts).
  • Can you explain what the code is supposed to do? That combination of feedback node and shift register looks suspicious. Did you wire a cycle?
  • Why are there two waits in parallel? (and why are there no waits in the "switch" example?)
  • "Reboot" is probably not the right word here. Please explain exactly how you are running this, which buttons you are pressing ands in what order, what happens, and what you expect to happen instead.

Instead of trying to figure out the convoluted logic, why not implement a simple state machine. All you need is one single while loop! Try it!

0 Kudos
Message 2 of 4
(2,326 Views)

Hello, Thanks for your view,

 

I'm going to use 3 pressure sensors:
Sensor 1 - Pressing will increase the speed to the weight placed. When you stop pressing, you return to zero, but keep the speed at the maximum you hit. If you press more than the previous maximum, the speed increases. (Running - ok)

 

Sensor 2 - Slow down, but I do not need to get the most out of it. (Running - ok)

 

Sensor 3 - not set yet, I would use to make emergency stop, so the need for a switch similar to the "switch" that allows restart everything and pause (Like B1 on "Switch") until I want it to run again. (Not working - fail)

 

Attached another Creating, I cleaned a little the code.

Download All
0 Kudos
Message 3 of 4
(2,300 Views)

Please do not attach new and different VIs that have the same name as earlier attachment. Since the browser will rename them, it will be difficult to track what's what and people might accidentally look at the wrong code.

 

It would also really help if you would document the VI and give controls reasonable names. How does B1 and B2, etc relate to sensor numbers? Why do they have different mechanical action settings? (A Latch action booleans typically does not look like a switch. Not intuitive!)

 

To keep a running max, use "min&max ptbypt". Delete the inner while loop and feedback nodes, they make no sense.

 

In your latest code, "B2 cannot get read if the inner loop is spinning (dataflow problem). You did not clean up a little, but actually made it worse.

 

You can wire your dynamic data directly to the charts and use "from DDT" to get a single scalar. Taking the array sum is not the right way to get the value of an array with one element.

 

Again, you have NOT explained how we are supposed to run this and what should happen as a function of button operations. We have absolutely no idea how the code relates to your long description of "sensors".

 

As I said, all you need is a state machine architecture with a single loop. Start with some basic LabVIEW tutorials.

0 Kudos
Message 4 of 4
(2,289 Views)