LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Queued state machine with Producer Consumer

Solved!
Go to solution

Hello,

I am trying to build a VI where the user enables some boolean controls on the front panel.
The VI uses a producer consumer architecture wherein based on the booleans clicked,
certain states get queued an saved into an array.
After the user is done selecting, the booleans should get disabled and the array of states
should be indexed one after the other.
This is an attempt to solve the car wash sample exam.
However, the VI is not generating the required results.
Can someone please help me figure out what is the correct way to implement this.

Thanks,

--
Download All
0 Kudos
Message 1 of 19
(4,066 Views)
Solution
Accepted by topic author SysArch

Its because you have wired the consumer while loop stop from the first one. Remove that and in your consumer loop, do a compare of the states that you receive and if it equals shutdown, stop the consumer loop.

 

Spoiler
producer_consumer.png

CLA CTAChampionI'm attending the GLA Summit!
Subscribe to the Test Automation user group: UK Test Automation Group
0 Kudos
Message 2 of 19
(4,063 Views)

Thanks for your reply, let me check it out.

 

0 Kudos
Message 3 of 19
(4,055 Views)

Your data flow was wrong to the second loop for the parallel process...Just wire your stop control directly to your second loopQueued%20SM[1]_BD.png

0 Kudos
Message 4 of 19
(4,040 Views)

Thanks for youur replies guys, that was the problem alright.

 

Now, I have extended this VI to attempt the Car wash CLD problem in a simplified form (without pausing in between states).

However, again I am finding that the array is not building up with the selected states.

 

What I am attempting to do is build the array based on the user inputs, then once start is pressed, disable the options

and start indexing through the arrayed states with a 5s timer in each state.

 

Can you please help me figure out how to get it to work ?

 

 

Download All
0 Kudos
Message 5 of 19
(4,027 Views)

@SysArch wrote:

 

...However, again I am finding that the array is not building up with the selected states.

 

 


its working fine?Queued%20SM[1].png

0 Kudos
Message 6 of 19
(4,016 Views)

Please see the Queued SM_Sprinkler which is the new VI that I have attached in the previous post.

0 Kudos
Message 7 of 19
(4,013 Views)

Its because your consumer loop is being shutdown when the first time the consumer loop executes, your equal compare will be true and it will stop the consumer while loop. Use single stepping and debugging features available in labview to see whats happening in your vi.


CLA CTAChampionI'm attending the GLA Summit!
Subscribe to the Test Automation user group: UK Test Automation Group
0 Kudos
Message 8 of 19
(4,012 Views)

Ok thanks, let me check with those.

0 Kudos
Message 9 of 19
(4,010 Views)

I have tried to debug it but am stuck at one stage..

I am not able to get the timer to count up continuously. The states get queued alright, but the timer just counts to some randome time

and then the code seems to halt.

Can anyone please help me debug ?

Download All
0 Kudos
Message 10 of 19
(3,946 Views)