Closed-Loop Responses with a PID Controller
Closed-Loop Responses with a PID Controller
pid = PIDTune[TransferFunctionModel[Unevaluated[{{(1/(0.4s + 1)(0.5s + 1)^2)}}], s, SamplingPeriod -> None, SystemsModelLabels -> None], "PID", "PIDData"];The output and and control responses for a SquareWave process disturbance:
d = SquareWave[t];
yres1 = OutputResponse[pid["DisturbanceOutput"], d, {t, 0, 5}];
ures1 = OutputResponse[pid["DisturbanceControl"], d, {t, 0, 5}];{Plot[yres1, {t, 0, 5}, PlotRange -> All], Plot[ures1, {t, 0, 5}, PlotRange -> All]}The output and control responses for a UnitBox reference:
r = UnitBox[t];
yres2 = OutputResponse[pid["ReferenceOutput"], r, {t, 0, 5}];
ures2 = OutputResponse[pid["ReferenceControl"], r, {t, 0, 5}];{Plot[yres2, {t, 0, 5}, PlotRange -> All], Plot[ures2, {t, 0, 5}, PlotRange -> All]}m = 0.2t;
yres3 = OutputResponse[pid["SensorOutput"], m, {t, 0, 5}];
ures3 = OutputResponse[pid["SensorControl"], m, {t, 0, 5}];{Plot[yres3, {t, 0, 5}, PlotRange -> All], Plot[ures3, {t, 0, 5}, PlotRange -> All]}