LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Ramping up down depending on dial value

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?

0 Kudos
Message 1 of 6
(3,451 Views)

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…

 

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 6
(3,448 Views)

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?

Download All
0 Kudos
Message 3 of 6
(3,432 Views)

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…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 4 of 6
(3,426 Views)

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.

0 Kudos
Message 5 of 6
(3,414 Views)

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?

0 Kudos
Message 6 of 6
(3,383 Views)