04-20-2016 01:16 AM
Hello
I'm quite new to Labview and I think I've taken water over my head...
I'm trying to build a program that can ramp up and down an output in real-time depending on a knob-value. One issue I'm having is that if the output is ramping the program will finish the ramp before disabling the output if the user does so from the front panel. I also want to ramp down to zero if user disables the output.
I've tried different things like a state machine but I'm not quite getting there.Triggering on knob value change dosent work very well etc.
So I'm wondering how I should attack this problem?
04-20-2016 01:20 AM - edited 04-20-2016 01:20 AM
Hi Adaptine,
So I'm wondering how I should attack this problem?
I suggest to use a state machine - as you already mentioned!
Start by drawing the state machine on a sheet of paper before coding in LabVIEW…
I've tried different things like a state machine but I'm not quite getting there.
Well, it's a big problem when people aren't able to describe the problems they have with their code.
And an even bigger problem when they forget to attach their code…
04-20-2016 02:12 AM
Hello
See attached program. Theres probably a lot to put the finger on in this program, but as you can see the knob isnt turning very smoothly. Probably because of the event trigger?
04-20-2016 02:26 AM
Hi Adaptine,
Theres probably a lot to put the finger on in this program
Yes, sure!
but as you can see the knob isnt turning very smoothly. Probably because of the event trigger?
The event structure isn't the source of the problem, the problem is the program structure you have implemented!
- Never hide event structures in cases of a case structure!
- Don't use so many local variables!
- Create a proper state machine!
- When you want to react on events: put the event in a parallel loop and use a queue-driven state machine approach!
What's the point of the ramping loop in the stop state? You just countdown the "ramp pattern" value with a 10ms delay - without any interaction with hardware. Then you set those "out" values to zero…
04-20-2016 03:02 AM
Thanks for your suggestion. I'll check out the queue-state machine thingy.
The point of the ramping loop in the stop-state is to stop the motor slowly. The out values is disabling the power to the motor from hardware (when zero). I havent implemented any hardware yet, so I just created the indicator for simulation purposes. "Ramping Pattern" is going to be the signal out to the motor-IC.
04-20-2016 09:26 AM
Alright, I've been doing some research on the queue-based state machine. There's howerer one thing I dont quite understand. How can I implement a ramping function if using wait-VI would block off the program making the state-producer unable to trigger on button-pushes, knob changes etc?