From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Consumer Loops Does not work. conflict.

I am changing a operating project. I attached both of the projects which are the normal one working as desired and problematic one. In problematic project, only the main producer loop operates but consumers do not. I really do not understand why this happens. Most probably, I missed out something but I could not find. Can anyone help me on it. Thanks in advance.

Egemen
0 Kudos
Message 1 of 9
(2,752 Views)

I believe you must have given "Running" instead of "Setup"

 

Debug-Running.png

-----

The best solution is the one you find it by yourself
0 Kudos
Message 2 of 9
(2,725 Views)

You may also have to set the Mechanical action of the Start button to "Switch" instead of "Latch".

-----

The best solution is the one you find it by yourself
0 Kudos
Message 3 of 9
(2,709 Views)

No it is true. I use start button a few times during the run. If you have a chance to run the program with simulated DAQ devices you can see clearly what I meant.

Egemen
0 Kudos
Message 4 of 9
(2,691 Views)

What I see from the code is as long as the "Running" State is not executed your consumer loop will not work, since they are waiting indefenetly. If you see the working code you attached there the start button is monitored only once and then the state machine works monitoring the stop button alone and goes to the Running state. In your case you must have to keep the state of the Start button to True (Switch mechanical action) so that the state machine can go to Running state since it is also monitoring the Start button.

-----

The best solution is the one you find it by yourself
0 Kudos
Message 5 of 9
(2,686 Views)

There is nothing wrong with the states and start button. After running the code, firstly, it is initialized then go through idle state. When you press the start button in idle, it goes to the setup and it stays in the setup state until the start button is pressed again. The same situation is valid for the vsc setup state also. In running state, start button has no function, only the stop and pause buttons have functions. Just try to press stop button in any state to stop the whole code. You must see the code would not stop completely, at least it does in my PC.

Egemen
0 Kudos
Message 6 of 9
(2,669 Views)

Why are you making the user press the start button so many times to get this thing to run?  The way you have it set up currently, you are setting up those DAQ tasks over and over again until the Start button is pressed.  That is just very inefficient and likely causing memory leaks.  You should only have to hit it once to start your test.  After the first button press of the start, you should sequence through your state machine from Setup, VSC Setup, Record, and Running.  You should not be looking at any of the button presses during this time.

 

You also have a lot of redundant waits.  Looking at the running case alone, I see three sets of waits that much happen for that single state.  Just have the outside loop have the wait.  None of the inner cases/states need waits.

 

And I don't see your queues to your first set of consumer loops being closed.  The consumer loops are waiting for the queue to be destroyed in order to stop.


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
0 Kudos
Message 7 of 9
(2,654 Views)

Yes I know about waits, I just tried which one is sufficient during the run. I have forgotten to delete them. I attached 2 projects. The normal one is the same with the problematic one. Why does the normal one run while the problematic one make trouble? That's why I do not understand. I coded start button to work in this way because I built an exe. It is getting frustrating to pop up error at every false adjustment of the inputs.

Egemen
0 Kudos
Message 8 of 9
(2,646 Views)

Additionally if you see the code your stop button is not really going to help you. Check what will happen if you press start and also Stop, you cannot expect the loop to stop since you are deriving the next state finally from the Start button and that state preceeds the other.

 

Coming to your code, the consumer loop started executing once I get to the Running state but since I don't have all the files in place I am getting error. What is the problem you face while executing, are you keep on getting error and the code goes to the error state?

-----

The best solution is the one you find it by yourself
0 Kudos
Message 9 of 9
(2,619 Views)