I am building my first PID controller.
My process variable and my actuator value are inversly related, meaning if actuator value increases process variable decreases, and vice versa.
So I have tried with a negative value of P and positive value of I.
It works fine for a while and then process variable keeps increasing with actuator becoming as 0.
Can some one help me with what might be the reason for this? Is it okay to have P as negative and I as postive?
Best Answer
Except when you're driving a very strange plant, you want the sign of all of your gains to be the same -- all positive, or all negative.
If you have a fairly normal plant (i.e. it has a minimum phase response in dynamic systems terms, meaning that all of its poles and zeros are in the left-half plane) then you need to use negative gains for both proportional and integral gains, or you need to take @gregb212's suggestion and do your calculation, then multiply it by -1 at the end.