@@ -12,8 +12,8 @@ old_logger = global_logger(); global_logger(errlogger);
1212## Nonlinear Model
1313
1414In this example, the goal is to control the angular position `` θ `` of a pendulum
15- attached to a motor. Knowing that the manipulated input is the motor torque `` τ `` , the I/O
16- vectors are:
15+ attached to a motor. Knowing that the manipulated input is the motor torque `` τ `` in Nm , the
16+ I/O vectors are:
1717
1818``` math
1919\begin{aligned}
@@ -49,7 +49,7 @@ using ModelPredictiveControl
4949function pendulum(par, x, u)
5050 g, L, K, m = par # [m/s²], [m], [kg/s], [kg]
5151 θ, ω = x[1], x[2] # [rad], [rad/s]
52- τ = u[1] # [N m ]
52+ τ = u[1] # [Nm ]
5353 dθ = ω
5454 dω = -g/L*sin(θ) - K/m*ω + τ/m/L^2
5555 return [dθ, dω]
@@ -59,7 +59,7 @@ const par = (9.8, 0.4, 1.2, 0.3)
5959f(x, u, _ ) = pendulum(par, x, u)
6060h(x, _ ) = [180/π*x[1]] # [°]
6161nu, nx, ny, Ts = 1, 2, 1, 0.1
62- vu, vx, vy = ["\$τ\$ (N m )"], ["\$θ\$ (rad)", "\$ω\$ (rad/s)"], ["\$θ\$ (°)"]
62+ vu, vx, vy = ["\$τ\$ (Nm )"], ["\$θ\$ (rad)", "\$ω\$ (rad/s)"], ["\$θ\$ (°)"]
6363model = setname!(NonLinModel(f, h, Ts, nu, nx, ny); u=vu, x=vx, y=vy)
6464```
6565
0 commit comments