for a project I'm working on (a cruise control) I'm using the PID_v1 library. For smoothness sake I want to change the starting output of the PID. e.g. when I start the PID I want to have it calculate the output starting from the output I am applying myself. So: if I put 40 on the throttle I want to have it that the PID starts with that 40 and not with a previous output it had (like 80), which would jerk my motor.
Is there a library with this option? Am I overlooking something? I could write some functions myself if this isn't possible with any library.
PID is driven by a target and determines an output to reach a target with limited overshoot. For example, the target might be a position and PID determines the speed.
what are you trying to control with PID? what is the input to your PID?
For my bachelorthesis in Electromechanical Engineering I am setting up a datacom system for a solar boat and one of the requirements is a cruise control. Since we can't test on the water due to the lockdown, I'm limiting myself to an rpm regulator. I've had several courses on the subject of PID and quite familiar with it now.
a
The input is the rpm, which is read from the controller via rs232. The output is a value between 1710 and 2200 via rs232 to the controller. The controller has a potentiometer input also and the rs232 is overriding that. I want to switch smoothly between the two so I want the PID algorithm to start computing from the value the potentiometer is inputting so we don't get a jerk on the motor etc.
Assuming that that link gets you there, the whole thing is worth reading, but the section I was trying to send you to was the part on Initialization which deals with changing modes between manual and automatic.
You could write your own PID algorithm , but the library is good .
I think it’s just a question of loading the correct terms into the algorithm at the point of switch over so the output doesn’t suddenly change .
Probably re setting ( zeroing) the integral
Term may do it ?
Btw using an Arduino for a Cruise Control system on a car is not the safest of plans
I think I see what I did wrong in my code: I stopped computing the PID, and thus updating the values, while not overriding the potentiometer. I'll fix that and report back!
hammy:
Btw using an Arduino for a Cruise Control system on a car is not the safest of plans
We are well aware of that this is a proof of concept kind of deal and this program/system would be implemented in the on board PLC next year. And it's a boat btw haha. I've implemented some safety features (being able to sail without my arduino, deadman switch, extra fuses etc.) so nothing can really go wrong.