Note: This page has been translated by MathWorks. Click here to see

To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

This example shows how to tune an electric drive using a cascade control structure.

The figure shows a feedback control loop that uses a cascade control structure. The outer speed-control loop is slower acting than the inner current-control loop.

To satisfy the required control performance for a simple discrete plant model, *G _{f }(z^{-1})*, use a closed loop PI control system

$$\sigma ={e}^{\frac{-\pi \xi}{\sqrt{1-{\xi}^{2}}}}$$

where,

*σ*is overshoot.ξ is the damping factor.

The response time, *t _{r}*, depends on the damping and the natural frequency,

If ξ < 0.7,

$${t}_{r}\cong \frac{4}{{\omega}_{n}\xi}.$$

If ξ ≥ 0.7,

$${t}_{r}\cong \frac{6\xi}{{\omega}_{n}}.$$

The general workflow for designing a PI controller for a first-order system is:

Discretize the plant model using the zero-order hold (ZOH) discretization method. That is, given that the first-order equation representing the plant is

$$G(s)=\frac{{K}_{m}}{{T}_{m}s+1},$$

where,

*K*is the first-order gain._{m}*T*is time constant of the first-order system._{m}

Setting

$$s=\frac{1-{z}^{-1}}{{z}^{-1}{T}_{s}},$$

yields the discrete plant model,

$$G({z}^{-1})=\frac{{K}_{m}\left(\frac{{T}_{s}}{{T}_{m}}\right){z}^{-1}}{1+\left(\frac{{T}_{s}-{T}_{m}}{{T}_{m}}\right){z}^{-1}}=\frac{{b}_{1}{z}^{-1}}{1+{a}_{1}{z}^{-1}},$$

where

*T*is sample time for the discrete-time controller._{s}Write a discrete-time representation for the PI controller using the same transform. For

$${G}_{PI}(s)={K}_{P}+{K}_{I}\left(\frac{1}{s}\right),$$

setting

$$s=\frac{1-{z}^{-1}}{{z}^{-1}{T}_{s}},$$

yields the discrete controller model,

$${G}_{PI}({z}^{-1})=\frac{{K}_{P}+\left({K}_{I}{T}_{s}-{K}_{P}\right){z}^{-1}}{1-{z}^{-1}}=\frac{{q}_{0}+{q}_{1}{z}^{-1}}{1-{z}^{-1}}.$$

Combining the discrete equations for the plant and the controller yields the closed loop transfer function for the system,

$${G}_{0}({z}^{-1})=\frac{{q}_{0}{b}_{1}{z}^{-1}+{q}_{1}{b}_{1}{z}^{-2}}{1+\left({a}_{1}-1+{q}_{0}{b}_{1}\right){z}^{-1}+\left(-{a}_{1}+{q}_{1}{b}_{1}\right){z}^{-2}},$$

The denominator of the transfer function is the characteristic polynomial. That is,

$${P}_{c0}({z}^{-1})=1+\left({a}_{1}-1+{q}_{0}{b}_{1}\right){z}^{-1}+\left(-{a}_{1}+{q}_{1}{b}_{1}\right){z}^{-2}.$$

The characteristic polynomial for achieving the required performance is defined as

$${P}_{cd}({z}^{-1})=1+{\alpha}_{1}{z}^{-1}+{\alpha}_{2}{z}^{-2},$$

where,

$${\alpha}_{1}=-2{e}^{-\xi {\omega}_{n}{T}_{s}}\mathrm{cos}\left({\omega}_{n}{T}_{s}\sqrt{1-{\xi}^{2}}\right).$$

$${\alpha}_{2}={e}^{-2\xi {\omega}_{n}{T}_{s}}.$$

To determine the controller parameters, set the characteristic polynomial for the system equal to the characteristic polynomial for the required performance. If

$${P}_{c0}({z}^{-1})={P}_{cd}({z}^{-1}),$$

then

$${\alpha}_{1}={a}_{1}-1+{q}_{0}{b}_{1}$$

and

$${\alpha}_{2}=-{a}_{1}+{q}_{1}{b}_{1}.$$

Solving for

*q*and_{0}*q*yields_{1}$${q}_{0}=\frac{{\alpha}_{1}-{a}_{1}+1}{{b}_{1}}$$

and

$${q}_{1}=\frac{{\alpha}_{2}+{a}_{1}}{{b}_{1}}.$$

Therefore, the general equations for the proportional and integral control parameters for the first-order system are

$${K}_{P}={q}_{0}$$

and

$${K}_{I}=\frac{{q}_{1}+{K}_{p}}{{T}_{s}}.$$

Assuming that, for the system in the example model, *K _{b}* =

$${v}_{a}={L}_{a}\frac{d{i}_{a}}{dt}+{R}_{a}{i}_{a}+{K}_{b}\omega $$

and

$${T}_{e}={J}_{m}\frac{d\omega}{dt}+{B}_{m}\omega +{T}_{load}={K}_{b}{i}_{a},$$

where:

*v*is the armature voltage._{a}*i*is the armature current._{a}*L*is the armature inductance._{a}*R*is the armature resistance._{a}*ω*is the rotor angular velocity*T*is the motor torque._{e}*T*is the load torque._{load}*J*is the rotor moment of inertia._{m}*B*is the viscous friction coefficient._{m}*K*is a constant of proportionality._{b}

To tune the current controller, assume that the model is linear, that is, that the back electromotive force, as represented by *K _{b}ω*, is negligible. This assumption allows for an approximation of the plant model using this first-order Laplace equation:

$${G}_{i}(s)=\frac{\frac{1}{{R}_{a}}}{\left(\frac{{L}_{a}}{{R}_{a}}\right)s+1}.$$

Given the system requirements, you can now solve for *K _{P}* and

Sample time,

*T*= 1 ms._{s}Overshoot, σ = 5%.

Response time,

*t*= 0.11 s._{r}

Therefore, the proportional and integral parameters for the current controller are:

$${K}_{P}=\mathrm{7.7099.}$$

$${K}_{I}=\mathrm{455.1491.}$$

To tune the speed controller, approximate the plant model with a simple model. First assume that the inner loop is much faster than the outer loop. Also assume that there is no steady-state error. These assumptions allow for the use a first-order system by considering a transfer function of 1 for the inner current loop.

To output rotational velocity in revolutions per minute, the transfer function is multiplied by a factor of 30/π. To take as control input the armature current instead of the motor torque, the transfer function is multiplied by the proportionality constant, *K _{b}*. The resulting approximation for the outer-loop plant model is

$${G}_{n}(s)=\frac{\frac{30{K}_{b}}{\pi {B}_{m}}}{\left(\frac{{J}_{m}}{{B}_{m}}\right)s+1}.$$

The speed controller has the same sample time and overshoot requirements as the current controller, but the response time is slower, such that:

Sample time

*T*= 1 ms._{s}Overshoot σ = 5%.

Response time

*t*= 0.50 s._{r}

Therefore, the proportional and integral parameters for the speed controller are:

$${K}_{P}=0.0045$$

$${K}_{I}=0.0405$$

Explore the components of the DC motor and the cascaded controller.

Open the model. At the MATLAB

^{®}command prompt, enter`model = 'ee_dc_motor_control' open_system(model)`

The

**Control**subsystem contains the model of the cascaded control system built using blocks from the Simulink^{®}library.The Four Quadrant Chopper block represents a four-quadrant DC-DC chopper that contains two bridge arms, each of which has two IGBT (Ideal, Switching) blocks. When the input voltage exceeds the threshold of

`0.5`

V, the IGBT (Ideal, Switching) blocks behave like linear diodes with a forward-voltage of`0.8 V`

and a resistance of`1e-4`

ohm. When the threshold voltage is not exceeded, the IGBT (Ideal, Switching) blocks act like linear resistors with an off-state conductance of`1e-5`

1/ohm.

Simulate the model.

sim(model)

View the results. Open the

**Scope**block.At 1.5 seconds, there is a load torque that results in a steady-state error.

Tune the DC motor controller. The

`ee_getDCMotorFirstOrderPIParams`

function calculates the proportional gain,*K*, and the integral gain,_{P}*K*, for the first-order system in this example._{I}The function syntax is

`[Kp, Ki] = getParamPI(Km,Tm,Ts,sigma,tr)`

.The input arguments for the function are the system parameters and the requirements for the controller:

`Km`

is the first-order gain.`Tm`

is the time constant of the first-order system.`T`

is the sample time for the discrete-time controller._{s}`sigma`

is the desired maximum overshoot,*σ*.`t`

is the desired response time._{r}

To examine the equations in the function, enter

`edit ee_getDCMotorFirstOrderPIParams`

To calculate the controller parameters using the function, save these system parameters to the workspace:

Ra=4.67; % [Ohm] La=170e-3; % [H] Bm=47.3e-6; % [N*m/(rad/s)] Jm=42.6e-6; % [Kg*m^2] Kb=14.7e-3; % [V/(rad/s)] Tsc=1e-3; % [s]

Calculate the parameters for tuning the current controller as a function of the parameters and requirements for the inner controller:

`Km`

=`1/Ra`

.`Tm`

=`La/Ra`

.`Ts`

=`Tsc`

.`sigma`

=`0.05`

.`Tr`

=`0.11`

.

[Kp_i, Ki_i] = ee_getDCMotorFirstOrderPIParams(1/Ra,La/Ra,Tsc,0.05,0.11)

Kp_i = 7.7099 Ki_i = 455.1491

The gain parameters for the current controller are saved to the workspace.

Calculate the parameters for tuning the speed controller based on the parameters and requirements for the outer controller:

`Km`

=`Kb*(30/pi)`

.`Tm`

=`Jm/Ra`

.`Ts`

=`Tsc`

.`sigma`

=`0.05`

.`Tr`

=`0.5`

.

[Kp_n, Ki_n] = ee_getDCMotorFirstOrderPIParams((Kb*(30/pi))/Bm,Jm/Bm,Tsc,0.05,0.5)

Kp_n = 0.0045 Ki_n = 0.0405

The gain parameters for the speed controller are saved to the workspace.

Simulate the model using the saved gain parameters for the speed and controllers.

sim(model)

View the results. Open the

**Scope**block.

There is slightly more overshoot, however, the controller responds much faster to the load torque change.

Inertia | Rotational Electromechanical Converter | Rotational Friction