Chuyển đến nội dung

Bài 5 · Modelling and Transfer Functions

Modelling Physical Systems

Derive differential equations for mass-spring-damper, RC circuit, DC motor and tank systems, see their analogies, and linearize nonlinear models in Python.

Before you can control a system you need equations that describe it. This lesson shows how to derive models from basic physical laws for mechanical, electrical, electromechanical and fluid systems. The result is always a differential equation relating an input to an output. The remaining lessons of this chapter turn those equations into transfer functions and block diagrams.

The strategy is the same everywhere: pick the variables, write one balance law per energy-storing element (Newton's law, Kirchhoff's law, mass or energy conservation), and eliminate the extra variables.

Mechanical translation: mass, spring, damper

A mass m is pushed by a force F(t). A spring pulls back with k x and a viscous damper resists with c x'. Newton's second law (sum of forces equals mass times acceleration) gives

Text
m x'' + c x' + k x = F(t)

This is a second-order equation because it has two energy stores: the mass (kinetic energy) and the spring (potential energy). The damper dissipates energy. Car suspensions, door closers and many sensors follow this model.

Electrical: the RC and RLC circuits

For a resistor R in series with a capacitor C driven by voltage v_in, Kirchhoff's voltage law with i = C dv_out/dt gives

Text
R C v_out' + v_out = v_in

This is first order with time constant R C. Adding an inductor L in series gives the RLC circuit:

Text
L C v_out'' + R C v_out' + v_out = v_in

Compare it with the mass-spring-damper. They are the same equation with different names.

Mechanical Electrical (series RLC) Role
Force F Voltage v Effort or source
Velocity x' Current i Flow
Mass m Inductance L Stores kinetic-type energy
Spring 1/k Capacitance C Stores potential energy
Damper c Resistance R Dissipates energy

This analogy is why one theory serves many fields: learn the second-order equation once and you can handle suspensions, circuits and more.

One equation, many systems

Mass-spring-damper m x'' + c x' + k x = F
Series RLC circuit L q'' + R q' + q/C = v
Thermal mass First-order lag with R and C.

Same maths, different symbols.

1 / 2

Electromechanical: the DC motor

A DC motor is the workhorse of control examples. Its electrical side is an inductor and resistor driven by the armature voltage V, and the motor produces a back-EMF proportional to speed. Its mechanical side has inertia J and viscous friction b.

  • Electrical: L di/dt + R i = V - Ke w (back-EMF Ke w)
  • Mechanical: J dw/dt + b w = Kt i (torque Kt i)

Here w is angular speed. When the inductance is small, set L = 0 to get i = (V - Ke w)/R and substitute:

Text
J w' + (b + Kt Ke / R) w = (Kt / R) V

That is a first-order system in speed: the electrical coupling acts as extra damping. With J = 0.01, b = 0.1, Kt = Ke = 0.01 and R = 1, the equation is 0.01 w' + 0.1001 w = 0.01 V, with time constant 0.01 / 0.1001 = 0.0999 s and DC gain 0.01 / 0.1001 = 0.0999 (rad/s)/V.

Fluid and thermal systems

A tank with inlet flow q_in, cross-section area A, and an outlet whose flow is proportional to level h (q_out = h / Rh) satisfies mass conservation:

Text
A h' = q_in - h / Rh      =>      (A Rh) h' + h = Rh q_in

A thermal mass works identically: heat stored C_th T' equals heat in minus heat lost (T - T_amb)/R_th. Many industrial processes are first-order lags like this, sometimes with a transport delay.

Linearization

Most real systems are nonlinear. A pendulum of length l with damping obeys

Text
theta'' = -(g/l) sin(theta) - b theta'

The sin makes it nonlinear, and the whole machinery of transfer functions needs linear equations. The fix is to linearize around an operating point. Near theta = 0, sin(theta) is approximately theta, giving theta'' + b theta' + (g/l) theta = 0. In general, replace f(x) near x0 by f(x0) + f'(x0)(x - x0): the tangent line.

The approximation is excellent for small deviations and poor for large ones. Check it by simulation:

Python Nonlinear pendulum versus its linearization

Press Run (or Ctrl + Enter) to see the result here.

Program input · what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

The relative error grows with the starting angle. For 0.1 rad it is small; for 1.5 rad (86 degrees) the linear model is clearly wrong. A controller designed on the linear model is trustworthy only while the system stays near the operating point.

Simulating the motor

Use the motor equation from above to see the first-order behaviour.

Python DC motor speed response

Press Run (or Ctrl + Enter) to see the result here.

Program input · what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

The speed approaches gain * V = 1.199 rad/s, reaching 63% after one time constant of about 0.1 s.

Check your understanding

Quick check · 5 questions

of 5 answered You scored / 5 · perfect!

  1. 1. Which pair is analogous in the mechanical and series-RLC electrical systems?

    The damper dissipates energy like a resistor. Mass corresponds to inductance, the spring to capacitance, and force to voltage.
  2. 2. Why does a mass-spring-damper give a second-order equation?

    The mass and the spring each store energy, so the system has two independent state variables and a second-order differential equation.
  3. 3. What is the linearization of sin(theta) near theta = 0?

    The tangent line of sin at 0 has slope cos(0) = 1 and passes through 0, so sin(theta) is approximately theta for small angles.
  4. 4. A tank has area A and outlet resistance Rh. What is its time constant?

    From (A Rh) h' + h = Rh q_in, the time constant is A Rh.
  5. 5. When is a linearized model reliable?

    The tangent-line approximation is accurate only for small deviations from the point where it was computed.

Summary

  • Models come from balance laws: Newton for mechanics, Kirchhoff for circuits, conservation for tanks and heat.
  • Mass-spring-damper and series RLC are the same second-order equation, so analogies transfer results between fields.
  • A DC motor reduces to a first-order speed model when armature inductance is neglected.
  • Linearize nonlinear models with a tangent line around an operating point, and check the range of validity by simulation.

Next: The Laplace Transform for Control

Theo dõi tiến độ của bạn

Tạo tài khoản miễn phí để đánh dấu bài đã học và tiếp tục từ chỗ bạn dừng lại trên mọi thiết bị.