# How to tune a PID controller when plant's step response looks like a ramp?

The system is a boat and I want to specify a yaw angle and the PID controller would operate the rudder of the boat in order to reach the desired yaw angle. So, the step response of the plant (boat) looks like a ramp (obviously) because if I keep the rudder at a certain angle the boat will continue rotating and therefore the yaw angle will never stabilize. So the tuning methods that I have studied won't work in this system.

What tuning methods for PID controllers can I apply to this application?

• Does the plant command rudder position, or rate-of-change of rudder position, like turning a steering wheel? (and are there other lags in the plant response?) Oct 22, 2021 at 0:32
• yaw angle relative to what? Does this mean a heading? Or are we trying to drive in a circle? Oct 22, 2021 at 20:35
• @PeteW The plant commands rudder position Oct 23, 2021 at 12:46
• @TigerGuy yeah, heading. Relative to the magnetic north of the earth Oct 23, 2021 at 12:46
• the rudder will center when the boat gets to the desired heading. If the setpoint is the heading any controller should do the job. Oct 24, 2021 at 6:10

If the response is really a ramp, i.e., a single integrator, you could use a P or PI controller.

If the ship has some mass to her, then the ship's turn does not start or stop immediately -- rudder position exerts a torque. That would make the system a double-integrator. So the step response is not really a ramp but rather would accelerate. In addition, there is likely to be another pole in the response of the rudder, as well as rate and value limits. The value limits (saturation) in particular affects any tuning procedure, and more so the double integrator.

In any case, for something that is approximately a double integrator, you could start with a PD controller, or a Lead controller, and make refinements from there. Set the zero to a low frequency. If using Lead, set the pole to 10x the zero or higher. Vary the gain until you find the sweet spot. Some overshoot in the step response will be unavoidable because of the zeros, but can be filtered out on the input.

This may lack disturbance rejection, which can be fixed by going to PID or PI-Lead. Try putting the additional zero in the same place as the first one. If PI-Lead, set the additional pole at 10x the zeros or higher again.

If the plant is approximately a double integrator with an extra pole, start with the controller double zeros at 1/30 to 1/100 of the plant's additional pole. If PI-Lead in this case, the controller pole should be well above the additional plant pole. Even so, there will be a narrower range of gains that can work.

The suggestion in the other answer to control yaw-velocity is also a good one, especially if the above method is too challenging. It would result in cascaded control. The idea is to have two simpler loops instead of one complicated one.

In all cases, the saturation has to be dealt with. With a cascaded loop, it's also helpful to make it so the outer loop's integrator does not wind up when the inner loop is saturating.

A couple things can help here:

1. if you want to control the desired yaw velocity of the boat, I suggest not using the yaw angle as output, but the yaw velocity.
2. if you want to control the absolute yaw angle of the boat (i.e. using a compass as reference), your rudder should not maintain a certain angle.
3. If you however do want to control the rudder angle using the yaw angle as output, an impulse response can be your answer. For a system with an integrator, applying an impulse to the system will yield a step on the output.