|
FhSim
3.1.0
Marine systems simulation
|
Class modelling a simple PID controller.
Collaboration diagram for Simple PID Controller:This class forms error = measurement - reference, which is the opposite of the usual convention, and sfh::filters::PID then forms -kP * error, and likewise for the integral and derivative parts. The two inversions cancel, so the composition is the ordinary
\[ \mathrm{Out} = k_P (r - y) + k_I \int (r - y)\,\mathrm{d}t + k_D \frac{\mathrm{d}(r - y)}{\mathrm{d}t}, \]
and each gain simply takes the sign of the plant it drives: positive when the measurement rises as the output rises, negative when it falls. An AUV heading loop on Auv.RudderYaw takes positive gains; an AUV pitch loop on Auv.RudderDive takes negative ones, because that port is named for its effect and a dive is a negative pitch. See tests/in/Auv/Auv_ClosedLoop_in.xml for all three worked out.
Neither inversion may be removed on its own, and removing both at once is pointless: the pair is already correct, and touching either would silently flip every gain in every existing trawl model. See FISH-0035 (resolved).
| Name | Width | Description |
|---|---|---|
| Measurement | 1 | The measured value. |
| Reference | 1 | The desired value. |
| Name | Width | Description |
|---|---|---|
| Out | 1 | The output from the PID controller. |
| Name | Width | Description @addoption{InitOutput, 1, The value of the Out port before the first accepted step, and the initial value of the integrator part. } |
|---|---|---|
| ProportionalGain | 1 | Proportional gain on Reference - Measurement. Negative for a plant whose measurement falls when Out rises; see "The sign of the gains". @addoption{IntegratorGain, 1, Integral gain on Reference - Measurement. Takes the sign of the plant, like ProportionalGain. } @addoption{DerivativeGain, 1, Derivative gain on Reference - Measurement. Takes the sign of the plant, like ProportionalGain.} |
| MinOut | 1 | Minimum out value. |
| MaxOut | 1 | Maximum out value. |
| MaxDerivativePart | 1 | Maximum derivative part. |
| MaxIntegratorPart | 1 | Maximum integrator part. |
This simObject does not have initial conditions.
This SimObject is referred to as Trawl/PIDController