LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Buttons stop response at one state

Solved!
Go to solution

I am practicing the sample CLD exam of Car Wash. The logic seems to be fine for me so far. But there is one thing i don't know why. The program is responsive until I change the click start and change Car Position Slider once. Which means the program is in Working Case. For example, if I select High Pressure Wash and I change the slider to the correct one, then the program stop response to any click until it finishes. If the first change of slider is not the correct one, then i can only abort it. Since I can see the timer changes properly, I don't think it freezes. Based on Task Manager, it is using reasonable resources. I tried adding wait 100ms per iteration, it didn't help. I have attached the zip file. Can anyone point out where I get wrong? Thank you in advance.

 

Yumeng

0 Kudos
Message 1 of 20
(2,773 Views)

Why is the "car position slider" a control, it seem to be used mostly as indicator controlled by the state. Make it an indicator (possibly keep it in a shift register to eliminate all the locals) and remove the associated event.

Your events are also configured to lock the front panel until the event completes, so if you have wrong code logic somewhere and the event structure cannot be reached in a reasonable time, the computer will lockup forever.

 

(I haven't looked at your code logic, but the above should give you some pointers.)

0 Kudos
Message 2 of 20
(2,754 Views)

@altenbach wrote:

Why is the "car position slider" a control, it seem to be used mostly as indicator controlled by the state. Make it an indicator (possibly keep it in a shift register to eliminate all the locals) and remove the associated event.

Your events are also configured to lock the front panel until the event completes, so if you have wrong code logic somewhere and the event structure cannot be reached in a reasonable time, the computer will lockup forever.

 

(I haven't looked at your code logic, but the above should give you some pointers.)


If I recall correctly, the slider controls the car as well as indicates where the car is.  You should be able to manually move it away from the "correct" position.  I believe test gives you the main VI with the front panel already configured.

 

Unfortunately I can't open this version of LabVIEW, so I can only make general comments.

  • You shouldn't need anything fancy like unlocking the front panel in this exercise.  it's all pretty straightforward.
  • If your "timer" is simply a wait, expect nothing to happen until it finishes.  You have to loop through the code, checking elapsed time every time through the loop in order for this to work.
Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
Message 3 of 20
(2,733 Views)

Thank you Bill. Indeed, I don't think any part of my code is fancy. That's also why its frustrating when it doesn't work as expected. I have attached the file that were saved for earlier version of LabVIEW. Hopefully it helps. 

0 Kudos
Message 4 of 20
(2,718 Views)

The car position slider is control because that serves as an input. So that the person manually changes it. As for the enable and disable, it is from the requirement of the sample test. It asks explicit enable and disable in initializing and working mode. 

0 Kudos
Message 5 of 20
(2,716 Views)

Okay, a teachable moment.  Turn on highlight execution - the lightbulb.  (You may want to increase the allowable time for each station a bunch, so the elapsed time doesn't time out before the program has a chance to go through a couple of loops in lightbulb mode.)  If you cannot guess what is wrong, at least tell me what you are observing.

 

BTW - it's a-OK to use the elapsed time express VI.  Anything in LabVIEW that can make your life easier is in fair play.  And the elapsed time express VI is one express VI that is actually worth using.  🙂

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 6 of 20
(2,705 Views)

I have tried this technique before, i didn't notice any weird behavior, except that once the position is clicked, then the flow just continuous without taking any input. It only starts taking input, if it can get out of the working case in the while loop.

0 Kudos
Message 7 of 20
(2,675 Views)

Thank you for describing this to me.  Do you ever see the state with the event structure pop up?  The event structure doesn't just magically work; it follows the same data flow rules as everything else.  In order for it to service an event, it needs to be fired.  Since it never reaches that state ever again, no events are serviced.  The front panel becomes unresponsive.

 

Two things to take away here.  You have flawed logic.  It never goes back to the idle state; therefore, none of the events are ever serviced.  But even more basic is that you need to have the event structure available when you need it.  It needs access every time the loop iterates.  It can't hide inside a state.

 

Although it's probably a little overkill for this situation, the QMH design pattern guarantees access to the event structure all the time.  I did use the QMH for my CLD test, though, because that's what I was comfortable with, but I've seen solutions that didn't even use an event structure.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 8 of 20
(2,666 Views)

Thank you, Bill. The event structure pops up when in idle state, which is right after the init. That is when i was able to select wash mode and start the program. As for the logic, my idea is to init-wait for start(where the event structure is at) -- work -- go back to init once done or stop. That is why I left both stop and position slider in the main loop instead of any state. So that they should be available as soon as any value changes. 

 

I may have to see how can I change to that structure. What bothers me the most is that the program stops allowing any input at some state. It happened before, and i can't figure out what triggers that state. It behaves as if the front panel is disabled.

 

I have attached a link to the video. Everything outside the work case is working fine. When the program is in working mode, it defers all inputs until the working mode is not involved. 

0 Kudos
Message 9 of 20
(2,639 Views)

Your VI enters the idle state exactly one time (at least for me), at the beginning, so you can interact with the front panel exactly once.  After that, it never sees the idle state again, so whichever events the event structure is handling - which is most likely every single button and slider - will never fire.  In any case, the idle state doesn't fire often enough for the event structure to service an event in a timely fashion, leaving the front panel locked.

 

The reason why I'm not giving you outright answers isn't so much that I don't want to do the work for you; because you are looking to take your LabVIEW learning to a higher level, I want you to be able to figure out these things with just a little nudge, at the most.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 10 of 20
(2,634 Views)