LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Reset PID.vi only once upon state transition

Solved!
Go to solution

Hi,

 

I am controlling a gear fatigue test frame using LabVIEW and I am using the PID.vi to control the hydraulics. Upon the transition from the start state to the testing state, I need the PID values (the integrated error) to be re-initialized once upon the transition. The current setup continously resets the PID causing the hydraulic output voltage to be lower than the set point. I cannot figure out how to have the default boolean value of false to switch to true upon the state transition and then revert back to false to prevent further resets. I have attached the current revision of my code.

 

Thank you for your assistance!

 

Trace

0 Kudos
Message 1 of 5
(3,482 Views)

Store the state in a shift register. Compare the current state with the previous state. If the state changed, reset the PID. In your specific case, you might want to store the two most recent states, and compare those - just pull down the shift register on the left side to expose an additional terminal.

0 Kudos
Message 2 of 5
(3,474 Views)

Hi,

 

Thank you for your valuble insight and help with my question. I was wondering if this is what you were suggesting. I only ask because I have not used LabVIEW much before starting my graduate thesis project and occasionally struggle with certain functions.

0 Kudos
Message 3 of 5
(3,437 Views)
Solution
Accepted by topic author trimroth

That's the right idea, but there's no need for the Select block with True and False as inputs, just change the Equal to Not Equal and use the output directly for the Reset.

 

Also I see that you have PID blocks in two separate cases. Note that those will act independently of each other - if you reset the one in one state, then switch to the other state, the other one will not have reset. Maybe that's what you want, and maybe it's not, but be careful about putting multiple instances of the PID block that control the same thing in different cases. You may also see weird integral issues when you switch cases, if a long time passes between when you run the same instance.

Message 4 of 5
(3,427 Views)

Hi,

 

Thank you so much for your input. That stabilized my hydraulic voltage!

 

Kudos to you!

 

Thanks!

 

Trace

0 Kudos
Message 5 of 5
(3,410 Views)