Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

2.2 Continuous- and Discrete-Time Dynamic Models

Two time descriptions

Physical laws are often expressed continuously,

x˙(t)=A(p)x(t)+B(p)u(t)+E(p)d(t),\dot{x}(t)=A(p)x(t)+B(p)u(t)+E(p)d(t),

while digital controllers update at sample times tk=kTst_k=kT_s,

xk+1=Ad(p,Ts)xk+Bd(p,Ts)uk+Ed(p,Ts)dk.x_{k+1}=A_d(p,T_s)x_k+B_d(p,T_s)u_k+E_d(p,T_s)d_k.

Under a zero-order hold,

Ad=eATs,Bd=0TseAτBdτ.A_d=e^{AT_s}, \qquad B_d=\int_0^{T_s}e^{A\tau}B\,d\tau.

Discretization is therefore not a clerical conversion. Sampling time interacts with plant eigenvalues, actuator bandwidth, delay, estimator quality, computational cost, and the number of decision variables in an optimal-control transcription.

A CCD interpretation

A lighter or more flexible plant may introduce a faster mode. The old sample time can then become inadequate. A faster controller may require a more expensive processor or sensor, increasing power and cost. If sample time is fixed while the plant changes, the optimizer may select a design that is acceptable in the continuous model but unstable or poorly damped when implemented.

For a rough rule, the sample frequency should exceed the important closed-loop bandwidth by a comfortable factor. The correct factor depends on delay, filtering, phase margin, and implementation method; it must be verified rather than assumed.

Exact discretization in Python

import numpy as np
from scipy.signal import cont2discrete

m, c, k = 2.0, 8.0, 120.0
A = np.array([[0.0, 1.0], [-k/m, -c/m]])
B = np.array([[0.0], [1.0/m]])
C = np.eye(2)
D = np.zeros((2, 1))

for Ts in (0.001, 0.01, 0.05):
    Ad, Bd, _, _, _ = cont2discrete((A, B, C, D), Ts, method="zoh")
    print(f"Ts={Ts:0.3f} s, discrete poles={np.linalg.eigvals(Ad)}")
m = 2; c = 8; k = 120;
A = [0 1; -k/m -c/m];
B = [0; 1/m];
sysc = ss(A,B,eye(2),zeros(2,1));
for Ts = [0.001 0.01 0.05]
    sysd = c2d(sysc,Ts,'zoh');
    fprintf('Ts = %.3f s, max pole magnitude = %.5f\n', ...
            Ts,max(abs(eig(sysd.A))));
end

Time-step convergence

Simulation and optimization time steps serve different purposes. A simulation step must resolve dynamic behavior accurately. A controller sample time defines information and command updates. A transcription mesh also controls optimization accuracy. These can differ, but each needs a convergence study.

Activity 2.2: sampling as a design constraint