LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

slider

Solved!
Go to solution

Hi Everyone,

 

I'm a beginner and newbie to Labview forum. I am trying to produce a Train Driving Simulator using Labview 8.6.

I have attach the file which I am still working on. I have a few issues that I don't seem to solve.

 

1. The Dead Man's Handle slider is suppose to return to minimum (bottom) position everytime the user 'leaves' the slider.

But as you can see, the slider remains at last position.

2. The target speed is suppose to vary; for eg 10 sec of 20kph, 30 sec 0f 50kph something like that.

At the moment I have fixed it to random number of 79-80kph.

3. After I stop the VI and play it again, the chart continues from the previous values.

The chart screen should clear and start fresh everytime the VI is played.

 

Also, I think my front panel codes can be simplified but not too sure how.

 

 Any ideas or advice would be very much appreciated. Thank you.

0 Kudos
Message 1 of 8
(2,973 Views)

Hi OSMAN,

i can't open your vi at the moment.

 

Use a property node of the chart and select "history data", should be the last entry and connect an empty array to it.

 

Mike

0 Kudos
Message 2 of 8
(2,967 Views)

I've accomplished your first point with an Event Structure and Notifier.  Take a look and lemme know if it doesn't help.

Use the Code Capture Tool

Message Edited by jcarmody on 04-15-2009 08:21 AM
Jim
You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
For he does not know what will happen; So who can tell him when it will occur? Eccl. 8:7

Download All
0 Kudos
Message 3 of 8
(2,949 Views)

When you say the user "leaves" the slider, do you mean releases the mouse button, or moves the mouse away from the slider?  You'll need to use an event structure to accomplish this; look at the Mouse Up and Mouse Leave events.  When you receive one of those events (which one depends on the behavior you want), you can use a local variable to reset the value of the slider to 0 (or whatever the appropriate value is).

 

For the variation in target speed, you could use the "Elapsed Time" Express VI (I don't usually like express VIs but in this case it's probably the simplest solution).  You can feed the amount of time in seconds as an input; configure it to reset automatically when the time is reached.  Whenever the "Time has Elapsed" output is true, set a new speed and a new target time, both of which you'll want to store in a shift register.

 

 

0 Kudos
Message 4 of 8
(2,945 Views)

Hi Jim,

 

Thank you for helping me with the Dead Man's Handle.

 

Yes, the handle does return to zero now. I have amended it to drop to -15 (bottom position). However, I placed a probe at the slider output going into the case structure, I notice that as I move the handle the value changes but when I hold the handle stationary or reach the top position, the value becomes zero. This causes the speedometer not to 'accelerate' anymore. Is there any way to overcome this?

 

Rgds.

0 Kudos
Message 5 of 8
(2,927 Views)
Solution
Accepted by topic author OSMAN
Try this modification to jcarmody's version; it eliminates the notifier and should solve the problem.
Message 6 of 8
(2,916 Views)

OSMAN, nathand's solution is better than mine.  I never think to use events like that, although I'm familiar with the concept.

 

One thing I couldn't overcome is the behavior when you move your mouse away from the control without letting go.  It doesn't trigger the Mouse Up event and the Dead Man has rigor mortis.

Jim
You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
For he does not know what will happen; So who can tell him when it will occur? Eccl. 8:7

0 Kudos
Message 7 of 8
(2,909 Views)

Thanks Nathand!! Thanks Jim!!

Just what I needed. Smiley Very Happy

 

That leaves 2 problems out of 3. Still trying out the recommendations from the others.

 

Best Rgds.

0 Kudos
Message 8 of 8
(2,904 Views)