Always free. For everyone.
Course outline
Module 03 of 20 · Foundations

Model physical systems

Translate force, voltage, heat, and flow balances into dynamic models. This module has 3 lessons and takes about 2h 25m. Each lesson has a practice exercise that runs real Python in your browser and a short quiz.

Start module 03 in the Learning Lab
LESSON 1 OF 3

Mechanical and electrical balances

35 minControl engineering
WHAT YOU WILL DO

Derive a mass model and an RC circuit model from conservation laws.

Newton gives m*x_ddot = F - b*x_dot - k*x for a mass, spring, and damper. After rearranging, m*x_ddot + b*x_dot + k*x = F. With zero initial conditions, displacement per force is G(s)=1/(m*s^2+b*s+k).

For an RC circuit with output capacitor voltage v, current is C*dv/dt and also (u-v)/R. Therefore R*C*dv/dt + v = u. Its transfer function is 1/(R*C*s+1), with time constant R*C seconds.

State assumptions explicitly: constant parameters, linear spring and damper, and no actuator dynamics. A transfer function describes input to output with zero initial conditions; initial stored energy requires a separate response.

See it in action

example.pyPython 3
from scipy import signal
m, b, k = 2., 6., 8.
plant = signal.TransferFunction([1.], [m,b,k])
print('Mechanical poles:', plant.poles)
resistance, capacitance = 1000., 100e-6
print('RC time constant:', resistance*capacitance, 's')
Keep this in mind

Start with a physical balance, then identify coefficients and units.

LESSON 2 OF 3

Thermal and liquid level models

35 minControl engineering
WHAT YOU WILL DO

Find gain and time constant from energy and flow balances.

For a well mixed thermal body, Cth*dT/dt = q - h*(T-Ta). Cth is thermal capacity in J/K, h is heat loss in W/K, and q is heater power in W. Use theta=T-Ta to obtain G(s)=1/(Cth*s+h). Gain is 1/h K/W and tau=Cth/h seconds.

For a tank with cross section A and linear outlet flow h_level/Rh, volume balance gives A*dh_level/dt = q_in - h_level/Rh. Gain from flow to level is Rh, and time constant is A*Rh. Real gravity outlets often follow sqrt(height), so this linear model is local.

An equilibrium balances inflow and outflow, or heat input and loss. Write a model for deviations around that operating point. Do not mix an absolute temperature reference with a temperature deviation.

See it in action

example.pyPython 3
capacity, loss = 600., 15.
ambient, heater = 25., 60.
tau = capacity/loss
equilibrium = ambient + heater/loss
print('Time constant:', tau, 's')
print('Equilibrium:', equilibrium, 'deg C')
Keep this in mind

Stored energy sets the speed of response; losses set the steady gain.

LESSON 3 OF 3

Practical: identify a first order plant

75 minControl engineering
WHAT YOU WILL DO

Estimate gain and time constant from a simulated step test.

For a step of size du into G(s)=K/(tau*s+1), the output change is dy(t)=K*du*(1-exp(-t/tau)). The final change gives K=dy_final/du. At one time constant, 63.2% of that change has occurred.

Subtract the pre-step baseline before fitting. When the final value is known, ln(1-dy/dy_final) = -t/tau. This formula is useful on clean data away from the final value, where the logarithm is not dominated by noise.

This lab uses exact synthetic readings. In a real experiment, use a long enough record, inspect noise and delays, repeat the test, and keep a separate run for validation. A fitted model is a hypothesis, not the plant itself.

GUIDED PRACTICAL · 75 MIN

Your experiment plan

Use the browser editor or the downloadable notebook. All plant data are simulated. Keep a notebook with parameters, predictions, results, and units.

  1. Generate step readings at 0.2 s intervals for 20 seconds.
  2. Recover gain and time constant from the clean record.
  3. Add reproducible noise and compare the estimates across three time windows.
  4. Validate the fitted curve on a different input step size.

What to hand in

  • A measured-versus-fitted response plot.
  • Estimated parameters with units and an error comparison.
  • A note on baseline, noise, and record length.
Reflect on your results

Which assumption matters most? Describe one result that surprised you and one experiment that would test your explanation.

The automatic exercise checks the core code behaviour. Review observations and written deliverables yourself or with a mentor.

See it in action

example.pyPython 3
import numpy as np
t = np.array([0., 2., 4., 6., 8.])
du, baseline, gain, tau = 2., 10., 3., 4.
y = baseline + gain*du*(1-np.exp(-t/tau))
print('Time (s):', t)
print('Output:', y)
print('Fraction at tau:', (y[2]-baseline)/(gain*du))
Keep this in mind

Estimate on one experiment and validate on another.

ABOUT THE LEARNING LAB

Free, open and run by a nonprofit.

This page is part of Control Engineering, a free course of 20 modules and 60 lessons in the engineering.fit( ) Learning Lab. The Learning Lab is built and run by engineering.fit( ), a nonprofit founded by Abdullateef Opeyemi Bakare that helps African engineering students gain research experience. You do not need an account or pay a fee to learn.

Course outline · Project lab · Visit engineering-fit.org