Chapter 3: Modeling of Linear Time-Invariant Systems

Lesson 3: Rotational and Electromechanical System Models

In this lesson we develop mathematical models for rotational mechanical systems (rigid bodies rotating about a fixed axis) and basic electromechanical systems, with emphasis on DC motor dynamics. We construct the governing differential equations, highlight analogies with translational mass-spring-damper models, and show how these models are implemented in Python, C++, Java, MATLAB/Simulink, and Wolfram Mathematica for robotics and mechatronic applications.

1. Rotational Motion and Newton's Law for Rotation

We consider a rigid body rotating about a fixed axis. The generalized coordinate is the angular displacement \( \theta(t) \) (in radians). Angular velocity and angular acceleration are defined by

\[ \omega(t) = \dot{\theta}(t), \qquad \alpha(t) = \ddot{\theta}(t) \]

The rotational analogue of Newton's second law is

\[ \sum T(t) = J\,\alpha(t) \]

where \( J \) is the moment of inertia of the body about the axis (units: kg m\(^2\)), and \( \sum T(t) \) is the algebraic sum of torques acting on the body about the same axis (units: N m).

For small angular displacements and velocities (so that the system can be approximated as linear), we can model the dissipative and elastic effects by:

\[ T_{\text{damping}}(t) = b\,\dot{\theta}(t), \qquad T_{\text{spring}}(t) = k\,\theta(t) \]

where \( b \) is the viscous damping coefficient (N m s/rad) and \( k \) is the torsional stiffness (N m/rad). Both are assumed constant, which ensures linear time-invariant (LTI) dynamics.

flowchart TD
  A["Translational model: \nm x'' + b x' + k x = F(t)"]
  B["Rotational model: \nJ theta'' + b theta' + k theta = T(t)"]
  A --> C["Mechanical analogies"]
  B --> C
  C --> D["m <-> J, F(t) <-> T(t), x(t) <-> theta(t)"]
        

2. Single-DOF Rotational Mass–Spring–Damper Model

Consider a rigid disk with inertia \( J \) attached to a torsional spring and damper, subjected to an external torque input \( T_{\text{in}}(t) \). Taking positive torque and rotation in the same direction, torque balance about the axis gives

\[ T_{\text{in}}(t) - T_{\text{damping}}(t) - T_{\text{spring}}(t) = J\,\ddot{\theta}(t) \]

Substituting the linear models for the spring and damper:

\[ T_{\text{in}}(t) - b\,\dot{\theta}(t) - k\,\theta(t) = J\,\ddot{\theta}(t) \]

Rearranging:

\[ J\,\ddot{\theta}(t) + b\,\dot{\theta}(t) + k\,\theta(t) = T_{\text{in}}(t) \]

This is a linear, second-order ordinary differential equation (ODE) in the angular displacement \( \theta(t) \). Using the Laplace transform (from Chapter 2), with zero initial conditions, we obtain

\[ J s^{2} \Theta(s) + b s \Theta(s) + k \Theta(s) = T_{\text{in}}(s) \]

or equivalently

\[ \left(J s^{2} + b s + k\right)\Theta(s) = T_{\text{in}}(s) \]

In the next chapter, we will interpret this relation in terms of transfer functions. For now, it is sufficient to understand it as an algebraic relation between the Laplace transforms of torque and angular displacement.

The total mechanical energy of this rotational system is

\[ E(t) = \frac{1}{2}J\,\dot{\theta}(t)^{2} + \frac{1}{2}k\,\theta(t)^{2}, \]

which directly parallels the translational mass-spring-damper energy with the analogies \( m \leftrightarrow J \), \( x \leftrightarrow \theta \).

3. Multi-Inertia Systems and Gear Trains

Many mechatronic and robotic systems involve several rotating bodies connected by shafts and gears. For example, an electric motor drives a load through a gear train. A common modeling strategy is to form coupled rotational ODEs and then reduce them to an equivalent single-inertia model when possible.

3.1 Two inertias connected by a torsional shaft

Consider two inertias \( J_1 \) and \( J_2 \) connected by a massless shaft with torsional stiffness \( k_{12} \) and damping \( b_{12} \). Let \( \theta_1(t) \) and \( \theta_2(t) \) denote their angular positions, and let \( T_1(t) \) and \( T_2(t) \) be applied torques. The shaft torques are

\[ T_{12,\text{spring}}(t) = k_{12}\left(\theta_1(t) - \theta_2(t)\right), \qquad T_{12,\text{damping}}(t) = b_{12}\left(\dot{\theta}_1(t) - \dot{\theta}_2(t)\right). \]

Taking positive torque from inertia 1 toward inertia 2, the equations of motion are

\[ \begin{aligned} J_1 \ddot{\theta}_1(t) &= T_1(t) - k_{12}\left(\theta_1(t) - \theta_2(t)\right) - b_{12}\left(\dot{\theta}_1(t) - \dot{\theta}_2(t)\right), \\ J_2 \ddot{\theta}_2(t) &= T_2(t) + k_{12}\left(\theta_1(t) - \theta_2(t)\right) + b_{12}\left(\dot{\theta}_1(t) - \dot{\theta}_2(t)\right). \end{aligned} \]

This is a linear two-degree-of-freedom (2-DOF) rotational system. Writing it in vector form is straightforward using the linear algebra tools you already know.

3.2 Gear ratio and equivalent inertia

A gear train with gear 1 (motor side) having \( N_1 \) teeth and gear 2 (load side) having \( N_2 \) teeth satisfies

\[ \theta_2(t) = \frac{N_1}{N_2}\,\theta_1(t), \qquad T_1(t) = \frac{N_2}{N_1}\,T_2(t), \]

assuming ideal (lossless) gearing. Defining the gear ratio \( n = \frac{N_1}{N_2} \), the inertia \( J_2 \) seen from the motor shaft becomes

\[ J_{\text{eq}} = J_1 + \frac{J_2}{n^{2}}. \]

This equivalent inertia is widely used in robotic joint and servo drive modeling, where the motor inertia and the reflected load inertia are combined into a single parameter.

flowchart TD
  M["Motor inertia J_m"] --> G["Gear ratio n = N1/N2"]
  L["Load inertia J_l"] --> G
  G --> JE["Equivalent inertia seen at motor: J_eq = J_m + J_l / n^2"]
  JE --> CTRL["Use J_eq in single-DOF rotational model"]
        

4. DC Motor Electromechanical Model

A brushed DC motor is a canonical example of an electromechanical system. It converts electrical energy into mechanical rotational energy. Its model couples an electrical circuit with a rotational mechanical subsystem.

4.1 Electrical (armature) subsystem

The armature circuit consists of an inductance \( L_a \), resistance \( R_a \), and a back electromotive force (back-EMF) voltage \( e_b(t) \). Applying Kirchhoff's voltage law:

\[ L_a \frac{d i_a(t)}{d t} + R_a\,i_a(t) + e_b(t) = v_a(t), \]

where \( i_a(t) \) is the armature current and \( v_a(t) \) is the applied armature voltage. Experimentally and theoretically, the back-EMF is proportional to the rotor angular velocity:

\[ e_b(t) = K_e\,\omega(t), \]

where \( K_e \) is the back-EMF constant (V s/rad). For SI-consistent units, \( K_e \) equals the torque constant \( K_t \) introduced below.

4.2 Mechanical (rotor and load) subsystem

The electromagnetic torque generated by the motor is proportional to armature current:

\[ T_m(t) = K_t\,i_a(t), \]

where \( K_t \) is the torque constant (N m/A). A simple mechanical model (with load torque \( T_{\text{load}}(t) \)) is

\[ J \frac{d\omega(t)}{d t} + b\,\omega(t) + T_{\text{load}}(t) = T_m(t) = K_t\,i_a(t), \]

where \( J \) includes the rotor inertia and any reflected load inertia and \( b \) is viscous friction. Optionally, a torsional spring term \( k\,\theta(t) \) can be added if the load is elastic.

4.3 Combined state-space form

To obtain a compact LTI representation, define the state vector

\[ \mathbf{x}(t) = \begin{bmatrix} \theta(t) \\[4pt] \omega(t) \\[4pt] i_a(t) \end{bmatrix}, \qquad u(t) = v_a(t), \qquad d(t) = T_{\text{load}}(t). \]

Using the identities \( \dot{\theta}(t) = \omega(t) \) and the equations above, the state-space model becomes

\[ \frac{d}{d t} \begin{bmatrix} \theta \\ \omega \\ i_a \end{bmatrix} = \underbrace{ \begin{bmatrix} 0 & 1 & 0 \\ 0 & -\dfrac{b}{J} & \dfrac{K_t}{J} \\ 0 & -\dfrac{K_e}{L_a} & -\dfrac{R_a}{L_a} \end{bmatrix} }_{\mathbf{A}} \begin{bmatrix} \theta \\ \omega \\ i_a \end{bmatrix} + \underbrace{ \begin{bmatrix} 0 \\ 0 \\ \dfrac{1}{L_a} \end{bmatrix} }_{\mathbf{B}} u(t) - \underbrace{ \begin{bmatrix} 0 \\ \dfrac{1}{J} \\ 0 \end{bmatrix} }_{\mathbf{E}} d(t). \]

This is a linear time-invariant model suitable for analysis (time response, frequency response) and controller design in later chapters and is directly implementable in robotics software libraries that support state-space models.

flowchart TD
  VA["Applied voltage v_a(t)"] --> ELEC["Electrical ODE: La di_a/dt + Ra i_a + Ke omega = v_a"]
  ELEC --> TORQ["Electromagnetic torque: T_m = K_t i_a"]
  TORQ --> MECH["Mechanical ODE: J d omega/dt + b omega + T_load = T_m"]
  MECH --> OUT["Outputs: theta(t), omega(t)"]
        

5. Python Implementation for Rotational and DC Motor Models

In Python, dynamic systems are conveniently modeled using numerical integration libraries such as scipy.integrate and, for control-oriented work, the python-control library. These tools are widely used in robotics research together with ROS-based stacks.

5.1 ODE simulation of a DC motor


import numpy as np
from scipy.integrate import solve_ivp

# Rotational + electrical parameters
J = 0.01    # kg m^2
b = 0.1     # N m s/rad
R_a = 1.0   # ohm
L_a = 0.5   # H
K_t = 0.01  # N m/A
K_e = 0.01  # V s/rad

def motor_ode(t, x, v_func, T_load_func):
    """
    x = [theta, omega, i_a]
    """
    theta, omega, i_a = x
    v_a = v_func(t)
    T_load = T_load_func(t)

    dtheta = omega
    domega = (K_t * i_a - b * omega - T_load) / J
    di_a = (v_a - R_a * i_a - K_e * omega) / L_a
    return [dtheta, domega, di_a]

# Step input voltage and zero load
v_step = lambda t: 24.0
T_load_zero = lambda t: 0.0

t_span = (0.0, 2.0)
x0 = [0.0, 0.0, 0.0]

sol = solve_ivp(
    lambda t, x: motor_ode(t, x, v_step, T_load_zero),
    t_span,
    x0,
    max_step=1e-3
)

time = sol.t
theta = sol.y[0]
omega = sol.y[1]
i_a = sol.y[2]

# In robotics/ROS, a similar ODE would be evaluated inside a control loop
# running at a fixed sampling period, e.g., using rclpy or rclcpp.
      

5.2 State-space representation with python-control

Once state-space concepts are formally introduced, the same model can be encoded using python-control, which is frequently used in robotics prototyping:


import numpy as np
import control as ctrl

A = np.array([
    [0.0, 1.0, 0.0],
    [0.0, -b / J, K_t / J],
    [0.0, -K_e / L_a, -R_a / L_a]
])
B = np.array([[0.0], [0.0], [1.0 / L_a]])
C = np.array([[1.0, 0.0, 0.0]])  # output: theta
D = np.array([[0.0]])

motor_ss = ctrl.ss(A, B, C, D)

# Time response to a step voltage can be computed by
# t, y = ctrl.step_response(motor_ss)
      

6. C++ Implementation for Real-Time Robotics Contexts

In robotic controllers implemented with C++ (e.g., ROS2 with ros2_control and Eigen), a DC motor or rotational joint is often modeled as a small class that integrates the ODE with a fixed time step. Below is a minimal forward Euler implementation of the motor model:


#include <iostream>

struct DCMotorModel {
    double J;
    double b;
    double R_a;
    double L_a;
    double K_t;
    double K_e;

    double theta;
    double omega;
    double i_a;

    DCMotorModel()
        : J(0.01), b(0.1), R_a(1.0), L_a(0.5),
          K_t(0.01), K_e(0.01),
          theta(0.0), omega(0.0), i_a(0.0) {}

    void step(double v_a, double T_load, double dt) {
        double dtheta = omega;
        double domega = (K_t * i_a - b * omega - T_load) / J;
        double di_a = (v_a - R_a * i_a - K_e * omega) / L_a;

        theta += dtheta * dt;
        omega += domega * dt;
        i_a += di_a * dt;
    }
};

int main() {
    DCMotorModel motor;
    double dt = 1e-4;

    for (int k = 0; k < 20000; ++k) {
        double v_a = 24.0;
        double T_load = 0.0;
        motor.step(v_a, T_load, dt);
    }

    std::cout << "Final speed omega = " << motor.omega << std::endl;
    return 0;
}
      

This pattern is directly embeddable in a real-time servo loop. In ROS2, such a model would typically be updated inside a controller's update() method, possibly with Eigen vectors for multi-DOF joints.

7. Java Implementation and Robotics Libraries

In Java, similar models can be used in simulation environments and robot frameworks such as WPILib (for FRC robots) or ROS Java bindings. Here is a simple Euler-integrated DC motor model:


public class DCMotorModel {
    private double J = 0.01;
    private double b = 0.1;
    private double R_a = 1.0;
    private double L_a = 0.5;
    private double K_t = 0.01;
    private double K_e = 0.01;

    private double theta = 0.0;
    private double omega = 0.0;
    private double i_a = 0.0;

    public void step(double v_a, double T_load, double dt) {
        double dtheta = omega;
        double domega = (K_t * i_a - b * omega - T_load) / J;
        double di_a = (v_a - R_a * i_a - K_e * omega) / L_a;

        theta += dtheta * dt;
        omega += domega * dt;
        i_a += di_a * dt;
    }

    public double getTheta() { return theta; }
    public double getOmega() { return omega; }
    public double getCurrent() { return i_a; }

    public static void main(String[] args) {
        DCMotorModel motor = new DCMotorModel();
        double dt = 1e-3;

        for (int k = 0; k < 2000; ++k) {
            motor.step(24.0, 0.0, dt);
        }

        System.out.println("Final omega = " + motor.getOmega());
    }
}
      

Java-based robotics libraries typically provide numerical solvers and matrix classes (e.g., Apache Commons Math) that can be used to implement more advanced state-space models building on the same equations.

8. MATLAB/Simulink Implementation

MATLAB is a standard tool in control engineering, and Simulink provides graphical modeling for electromechanical systems. Below is a script using ode45 for time-domain simulation:


% Parameters
J = 0.01;   % kg m^2
b = 0.1;    % N m s/rad
R_a = 1.0;  % ohm
L_a = 0.5;  % H
K_t = 0.01; % N m/A
K_e = 0.01; % V s/rad

% ODE for [theta; omega; i_a]
motor_ode = @(t, x) [ ...
    x(2); ...
    (K_t * x(3) - b * x(2)) / J; ...
    (24.0 - R_a * x(3) - K_e * x(2)) / L_a ...
];

[t, x] = ode45(motor_ode, [0 2], [0; 0; 0]);

theta = x(:, 1);
omega = x(:, 2);
i_a   = x(:, 3);

figure;
subplot(3, 1, 1); plot(t, theta); ylabel('\theta (rad)');
subplot(3, 1, 2); plot(t, omega); ylabel('\omega (rad/s)');
subplot(3, 1, 3); plot(t, i_a);   ylabel('i_a (A)'); xlabel('t (s)');
      

In Simulink, the same model is built by connecting an electrical subsystem (voltage source, resistor, inductor, back-EMF block) to a mechanical rotational subsystem (inertia, viscous damper, load torque). Simscape Electrical and Simscape Multibody provide pre-built blocks for modeling such electromechanical systems at a higher level of detail.

9. Wolfram Mathematica Implementation

Mathematica offers symbolic and numeric capabilities for analyzing LTI models, including exact solutions, Laplace transforms, and state-space constructions.


J  = 0.01;
b  = 0.1;
Ra = 1.0;
La = 0.5;
Kt = 0.01;
Ke = 0.01;

theta = theta;
omega = omega;
ia    = ia;

eqs = {
  theta'[t] == omega[t],
  J*omega'[t] == Kt*ia[t] - b*omega[t],
  La*ia'[t] == 24.0 - Ra*ia[t] - Ke*omega[t],
  theta[0] == 0, omega[0] == 0, ia[0] == 0
};

sol = NDSolve[eqs, {theta, omega, ia}, {t, 0, 2}];

Plot[Evaluate[omega[t] /. sol], {t, 0, 2},
     AxesLabel -> {"t", "\[Omega](t)"}]
      

For more advanced analysis, one can use StateSpaceModel, TransferFunctionModel, and OutputResponse to work with LTI models derived from the above equations.

10. Problems and Solutions

Problem 1 (Rotational Mass–Damper): A solid disk with inertia \( J \) about its axis is actuated by an external torque \( T_{\text{in}}(t) \) and subject only to viscous friction with coefficient \( b \). Derive the ODE relating \( \theta(t) \) to \( T_{\text{in}}(t) \), and express the relation between \( \Theta(s) \) and \( T_{\text{in}}(s) \) in the Laplace domain (zero initial conditions).

Solution: Torque balance gives

\[ T_{\text{in}}(t) - b\,\dot{\theta}(t) = J\,\ddot{\theta}(t), \]

or

\[ J\,\ddot{\theta}(t) + b\,\dot{\theta}(t) = T_{\text{in}}(t). \]

Taking Laplace transforms with zero initial conditions:

\[ J s^{2} \Theta(s) + b s \Theta(s) = T_{\text{in}}(s), \]

so that

\[ \Theta(s) = \frac{1}{J s^{2} + b s}\,T_{\text{in}}(s). \]

Problem 2 (Gear Train Equivalent Inertia): A motor with inertia \( J_m \) drives a load with inertia \( J_L \) through an ideal gear pair with \( N_m \) teeth on the motor gear and \( N_L \) teeth on the load gear. Show that the equivalent inertia referred to the motor shaft is \( J_{\text{eq}} = J_m + \frac{J_L}{n^{2}} \), where \( n = \frac{N_m}{N_L} \).

Solution: For an ideal gear,

\[ \theta_L(t) = \frac{N_m}{N_L}\,\theta_m(t) = n\,\theta_m(t), \qquad \omega_L(t) = n\,\omega_m(t). \]

The torque relation is

\[ T_m(t) = \frac{N_L}{N_m}\,T_L(t) = \frac{1}{n}\,T_L(t). \]

The kinetic energy of the load expressed in terms of motor variables is

\[ E_L(t) = \frac{1}{2}J_L \omega_L(t)^{2} = \frac{1}{2}J_L (n\,\omega_m(t))^{2} = \frac{1}{2}\left(\frac{J_L}{n^{2}}\right) \omega_m(t)^{2}. \]

Thus, the load is equivalent to an inertia \( J_L/n^{2} \) at the motor shaft. Adding the motor inertia yields

\[ J_{\text{eq}} = J_m + \frac{J_L}{n^{2}}. \]

Problem 3 (Steady-State Speed of DC Motor): For the DC motor model of Section 4, assume constant armature voltage \( v_a(t) = V_0 \) and constant load torque \( T_{\text{load}}(t) = T_L \). Find the steady-state angular speed \( \omega_{\text{ss}} \), assuming \( L_a \) is small enough to neglect the inductive term in steady state.

Solution: At steady state, time derivatives are zero. From the electrical equation (neglecting inductance):

\[ R_a\,i_{a,\text{ss}} + K_e\,\omega_{\text{ss}} = V_0. \]

From the mechanical equation:

\[ b\,\omega_{\text{ss}} + T_L = K_t\,i_{a,\text{ss}}. \]

Solve the electrical equation for \( i_{a,\text{ss}} \):

\[ i_{a,\text{ss}} = \frac{V_0 - K_e\,\omega_{\text{ss}}}{R_a}. \]

Substitute into the mechanical equation:

\[ b\,\omega_{\text{ss}} + T_L = K_t \frac{V_0 - K_e\,\omega_{\text{ss}}}{R_a} = \frac{K_t}{R_a}V_0 - \frac{K_t K_e}{R_a}\omega_{\text{ss}}. \]

Collecting terms in \( \omega_{\text{ss}} \):

\[ \left(b + \frac{K_t K_e}{R_a}\right)\omega_{\text{ss}} = \frac{K_t}{R_a}V_0 - T_L, \]

so

\[ \omega_{\text{ss}} = \frac{\frac{K_t}{R_a}V_0 - T_L} {b + \frac{K_t K_e}{R_a}}. \]

This expression shows explicitly how steady-state speed decreases with load torque \( T_L \) and friction \( b \), and increases with applied voltage \( V_0 \).

Problem 4 (Energy in Rotational Mass–Spring–Damper): For the single-DOF rotational system with inertia \( J \), torsional stiffness \( k \), and viscous damping \( b \), show that

\[ \frac{dE(t)}{d t} = T_{\text{in}}(t)\,\omega(t) - b\,\omega(t)^{2}, \]

where \( E(t) = \frac{1}{2}J\omega(t)^{2} + \frac{1}{2}k\theta(t)^{2} \). Interpret this energy balance.

Solution: Differentiate \( E(t) \):

\[ \frac{dE}{d t} = J\,\omega(t)\,\dot{\omega}(t) + k\,\theta(t)\,\dot{\theta}(t). \]

Using \( \dot{\theta}(t) = \omega(t) \):

\[ \frac{dE}{d t} = J\,\omega(t)\,\dot{\omega}(t) + k\,\theta(t)\,\omega(t) = \omega(t)\left(J\,\dot{\omega}(t) + k\,\theta(t)\right). \]

The equation of motion is

\[ J\,\dot{\omega}(t) + b\,\omega(t) + k\,\theta(t) = T_{\text{in}}(t), \]

hence

\[ J\,\dot{\omega}(t) + k\,\theta(t) = T_{\text{in}}(t) - b\,\omega(t). \]

Substituting into the expression for \( dE/d t \):

\[ \frac{dE}{d t} = \omega(t)\left(T_{\text{in}}(t) - b\,\omega(t)\right) = T_{\text{in}}(t)\,\omega(t) - b\,\omega(t)^{2}. \]

The term \( T_{\text{in}}(t)\,\omega(t) \) is the mechanical power input, while \( b\,\omega(t)^{2} \) is the power dissipated in the viscous damper. This is a rotational analogue of the translational energy balance and confirms the physical consistency of the model.

11. Summary

In this lesson we constructed LTI models for rotational mechanical systems and a basic DC motor electromechanical system. Starting from Newton's law for rotation, we derived rotational mass–spring–damper equations and extended them to multi-inertia systems with gear trains, introducing the concept of equivalent inertia. We built a coupled electrical–mechanical model of a brushed DC motor and expressed it in state-space form suitable for later analysis and control design.

We then illustrated how these models are implemented numerically in Python, C++, Java, MATLAB/Simulink, and Wolfram Mathematica, as is common in modern robotics and mechatronics workflows. These models form the foundation for transfer function derivation, time-response analysis, and controller design in the subsequent chapters.

12. References

  1. Kalman, R. E. (1960). Contributions to the theory of optimal control. Boletín de la Sociedad Matemática Mexicana, 5(2), 102–119.
  2. Ogata, K. (2010). Modern Control Engineering (5th ed.). Prentice Hall.
  3. Franklin, G. F., Powell, J. D., & Emami-Naeini, A. (2015). Feedback Control of Dynamic Systems (7th ed.). Pearson.
  4. Nise, N. S. (2015). Control Systems Engineering (7th ed.). Wiley.
  5. Leonhard, W. (1985). Control of electrical drives. IEEE Transactions on Industrial Electronics, IE-32(3), 182–191.
  6. Slotine, J.-J. E., & Li, W. (1987). On the adaptive control of robot manipulators. International Journal of Robotics Research, 6(3), 49–59.
  7. Hutter, M., Gehring, C., Jud, D., et al. (2014). Anymal: A highly mobile and dynamic quadrupedal robot. IEEE/RSJ International Conference on Intelligent Robots and Systems, 38–44.