Correct Way To Verify The Compensator When Plant is Cont. & Comp. is Discrete #1235
|
Hello, as you know, the plant / process is analog (continuous) by default. If we design a discrete time compensator, using the control library, do we have to convert the plant to discrete time as well along with the compensator as shown in the following example? I designed a digital compensator for the following plant. In the real world, the plant stays in its natural state and we only design the compensator. Can someone please help in clarifying how to implement it such that we leave the plant as is - without converting or including it for conversion into discrete time. |
Replies: 2 comments
|
Your physical intuition is correct: the real plant remains continuous. However, for sample-to-sample analysis of a digitally controlled loop, you still need a discrete equivalent of the plant. That conversion does not mean the physical plant becomes discrete. The construction in the question: T_s = ct.feedback(Gp * Gc)
T_z = ct.c2d(T_s, Ts, method="zoh")first creates a fully continuous closed loop, in which As written, both import control as ct
k = 5.4
Ts = 0.003
Gp = ct.tf([1740], [0.25, 1, 0])
Gc = ct.tf([k, 250], [1, k * 50])
# Exact sample-to-sample plant model for a zero-order-held input
Gp_z = ct.c2d(Gp, Ts, method="zoh")
# Example controller discretization; use the method chosen in your design
Gc_z = ct.c2d(Gc, Ts, method="bilinear")
# Sampled-data closed loop at the sampling instants
T_z = ct.feedback(Gp_z * Gc_z, 1)If the controller was designed directly in discrete time, define Gc_z = ct.tf(num_z, den_z, Ts)
T_z = ct.feedback(Gp_z * Gc_z, 1)
Gp * Gc_zwith For your numerical values, the two approaches are measurably different: The ZOH plant model is sufficient when you only need behavior at the controller's sampling instants. To inspect behavior between samples, model delays, or simulate a nonlinear continuous plant, use a sampled-data simulation that integrates the plant between controller updates. The python-control documentation includes an example of that approach: https://python-control.readthedocs.io/en/latest/examples/simulating_discrete_nonlinear.html One small plotting detail: plt.xlabel("Time (s)")or plot against an explicit sample index: import numpy as np
sample_index = np.arange(response.time.size)
plt.stem(sample_index, response.outputs)
plt.xlabel("Sample index k") |
|
Thank you @AMBRA7592, yes, this follows from an earlier inquiry that I posted of which you eloquenty answered. You have been most helpul. Very much appreciated! 💯🙂 |

Your physical intuition is correct: the real plant remains continuous. However, for sample-to-sample analysis of a digitally controlled loop, you still need a discrete equivalent of the plant.
That conversion does not mean the physical plant becomes discrete.
c2d(Gp, Ts, method="zoh")represents the map from one sampling instant to the next under the assumption that the controller output is held constant between updates by a zero-order hold.The construction in the question:
first creates a fully continuous closed loop, in which
Gcacts continuously, and only then samples that closed loop. It therefore does not represent a dig…