**4. Real-Time Distributed System**

This section exposes the RTDS used for implementation purposes, it is a 2-DOF helicopter prototype [13]. The following section briefly introduces and describes this 2-DOF helicopter prototype and its controller design.

*x*˙ =

*y* =

��

�

*Vm*,*p*, *Vm*,*<sup>y</sup>*

measurable.

⎡ ⎢ ⎢ ⎢ ⎢ ⎣

⎡ ⎢ ⎢ ⎣ 00 1 0 00 0 1

0

⎤ ⎥ ⎥ ⎥ ⎥ ⎦ *x* +

where *Kpp*, *Kyy*, *Kpy*, *Kyp* are the torque-constants used to obtain coupled torques acting on the pitch and yaw axes; for the state space model the input *u* and output *y* vectors are *u* =

yaw motor voltage. Notice that, since the output matrix is the identity matrix, all states are

The model makes use of several Simulink and Matlab programs to develop the helicopter basic dynamics, by running a simulation of the closed-loop response, using the position controller. Regarding control issues, two controllers are designed: a FF-LQR and a FF+LQR+I. The FF+LQR regulates the pitch axis of the helicopter, using feed-forward (FF) and proportional-velocity (PV) compensators, while the yaw axis only makes use of a PV control. The FF+LQR+I controller uses an integrator in the feedback loop to reduce the steady-state error, by a feed-forward and proportional-integral-velocity (PIV) algorithms to regulate the pitch, and only a PIV to control the yaw angle. This work focuses on the FF+LQR+I controller,

⎡ ⎢ ⎢ ⎢ ⎢ ⎣

0 0 0 0

Issues on Communication Network Control System Based Upon Scheduling Strategy Using Numerical Simulations

, *Vmp* is the input pitch motor voltage and *Vmy* is the input

*θd*, *ψ*˙

0 0 0 0

0 0 0 0

*Kpy Jeq*,*p*+*mhelil*<sup>2</sup> *cm*

<sup>−</sup> *Kyy Jeq*,*y*+*mhelil*<sup>2</sup> *cm*

*Kpp Jeq*,*p*+*mhelil*<sup>2</sup> *cm*

<sup>−</sup> *Kyp Jeq*,*y*+*mhelil*<sup>2</sup> *cm*

*Kpy Jeq*,*p*+*mhelil*<sup>2</sup> *cm* ⎤ ⎥ ⎥ ⎥ ⎥ ⎦ *u*, 59

*<sup>d</sup>*) where *θ<sup>d</sup>* is the desired

⎤ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎦

*u*,

<sup>−</sup> *Kyy Jeq*,*y*+*mhelil*<sup>2</sup> *cm*

*Kpp Jeq*,*p*+*mhelil*<sup>2</sup> *cm*

<sup>−</sup> *Kyp Jeq*,*y*+*mhelil*<sup>2</sup> *cm*

*<sup>θ</sup>*, *<sup>ψ</sup>*˙) <sup>→</sup> (*θd*, *<sup>ψ</sup>d*, ˙

� .

*Kf f mheliglcmcosθ<sup>d</sup> Kpp* 0

The addition of an integrator requires to introduce the states *x*˙5 = *θ* and *x*˙6 = *ψ*, so the linear

⎤ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎦

*x* +

⎡ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎣

0 00

*Jeq*,*y*+*mhelil*<sup>2</sup> *cm* 0 0

*Jeq*,*y*+*mhelil*<sup>2</sup> *cm*

�

*Jeq*,*p*+*mhelil*<sup>2</sup> *cm*

00 0 <sup>−</sup> *By*

0 0 <sup>−</sup> *Bp*

⎤ ⎥ ⎥ ⎦ *x*.

and *y* = [*x*1, *x*2, *x*3, *x*4]

as follows. The FF+LQR control converges (*θ*, *ψ*, ˙

state-space model is augmented as:

0 0 <sup>−</sup> *Bp*

*Jeq*,*p*+*mhelil*<sup>2</sup> *cm*

00 0 <sup>−</sup> *By*

⎤ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎦

*x*.

*x*˙ =

*y* =

⎡ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎣

⎡ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎣

pitch angle and *ψ<sup>d</sup>* is the desired yaw angle, such that:

� *up uy* � = �

00 1 0 00 00 0 1 00

10 0 0 00 01 0 0 00

The case of study is a prototype of a helicopter system integrated to a CanBus network with two propellers that are driven by DC motors. The front propeller controls the elevation of the helicopter nose about the pitch axis (*θ*) and the back propeller controls the side to side motions of the helicopter about the yaw axis (*ψ*). The pitch and yaw angles are measured using high-resolution encoders. A brief description of the helicopter model is presented, however detailed information can be found in [13]. The dynamics of the helicopter is developed based on kinetic and potential energy, this model is used to design a position controller. The helicopter centre of mass is described in *xyz* cartesian coordinates with respect the pitch and yaw angles, see Fig. 3.

**Figure 3.** Dynamics of the 2DOF helicopter

The Euler-Lagrange equations are used to obtain nonlinear equations of motion for the 2 DOF Helicopter, which are used to derive the linear state model, and subsequently, to design the position controller. As the helicopter represents a non-linear system, it is required to perform a linearization around a point, this linearization point is

$$\left[\theta\_0 = 0, \psi\_0 = 0, \dot{\theta}\_0 = 0, \psi\_0 = 0\right].$$

From this, the linearization of the motion equation is obtained as follows:

 *Jeq*,*<sup>p</sup>* + *mhelil* 2 *cm* ¨ *<sup>θ</sup>* <sup>=</sup> *KppVm*,*<sup>p</sup>* <sup>+</sup> *KpyVm*,*<sup>y</sup>* <sup>−</sup> *Bp* ˙ *θ* − *mheliglcm*, (3)

$$\left(\|\!\_{eq,y} + m\_{\text{heli}}\!\!\_{cm}\right)\ddot{\psi} = K\_{pp}V\_{m,y} + K\_{yp}V\_{m,p} - B\_p\dot{\psi} - 2m\_{\text{heli}}\!\!\_{cm}^2\theta\dot{\psi}\theta. \tag{4}$$

Substituing *x* = *θ*, *ψ*, ˙ *θ*, *ψ*˙ � in (3) and (4) and solving for *x*˙ the following linear model of state space is obtained:

$$\begin{aligned} \dot{\mathbf{x}} &= \begin{bmatrix} 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 \\ 0 & 0 - \frac{B\_p}{I\_{\mathrm{d\,p},p} + m\_{\mathrm{hdl}}I\_{\mathrm{d\,m}}^2} & 0 \\ 0 & 0 & -\frac{B\_y}{I\_{\mathrm{d\,p},y} + m\_{\mathrm{hdl}}I\_{\mathrm{d\,m}}^2} \end{bmatrix} \mathbf{x} + \begin{bmatrix} 0 & 0 \\ 0 & 0 \\ \frac{K\_{pp}}{I\_{\mathrm{d\,p},p} + m\_{\mathrm{hdl}}I\_{\mathrm{d\,m}}^2} & \frac{K\_{pp}}{I\_{\mathrm{d\,p},p} + m\_{\mathrm{hdl}}I\_{\mathrm{d\,m}}^2} \\ -\frac{K\_{pp}}{I\_{\mathrm{d\,p},p} + m\_{\mathrm{hdl}}I\_{\mathrm{d\,m}}^2} - \frac{K\_{pp}}{I\_{\mathrm{d\,p},p} + m\_{\mathrm{hdl}}I\_{\mathrm{d\,m}}^2} \end{bmatrix} \mathbf{u} \\ \mathbf{y} = \begin{bmatrix} 1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \end{bmatrix} \mathbf{x} .\end{aligned}$$

10 Will-be-set-by-IN-TECH

This section exposes the RTDS used for implementation purposes, it is a 2-DOF helicopter prototype [13]. The following section briefly introduces and describes this 2-DOF helicopter

The case of study is a prototype of a helicopter system integrated to a CanBus network with two propellers that are driven by DC motors. The front propeller controls the elevation of the helicopter nose about the pitch axis (*θ*) and the back propeller controls the side to side motions of the helicopter about the yaw axis (*ψ*). The pitch and yaw angles are measured using high-resolution encoders. A brief description of the helicopter model is presented, however detailed information can be found in [13]. The dynamics of the helicopter is developed based on kinetic and potential energy, this model is used to design a position controller. The helicopter centre of mass is described in *xyz* cartesian coordinates with respect the pitch and

Yaw axis

y>0

rp

*θ*<sup>0</sup> = 0, *ψ*˙

*<sup>ψ</sup>*¨ <sup>=</sup> *KppVm*,*<sup>y</sup>* <sup>+</sup> *KypVm*,*<sup>p</sup>* <sup>−</sup> *Bpψ*˙ <sup>−</sup> <sup>2</sup>*mhelil*

*<sup>θ</sup>* <sup>=</sup> *KppVm*,*<sup>p</sup>* <sup>+</sup> *KpyVm*,*<sup>y</sup>* <sup>−</sup> *Bp* ˙

<sup>0</sup> = 0 .

in (3) and (4) and solving for *x*˙ the following linear model of state

Fp

*θ* − *mheliglcm*, (3)

*θ*. (4)

2 *cmθψ*˙ ˙

cm Fg

The Euler-Lagrange equations are used to obtain nonlinear equations of motion for the 2 DOF Helicopter, which are used to derive the linear state model, and subsequently, to design the position controller. As the helicopter represents a non-linear system, it is required to perform

l

q>0

*θ*<sup>0</sup> = 0, *ψ*<sup>0</sup> = 0, ˙

From this, the linearization of the motion equation is obtained as follows:

**4. Real-Time Distributed System**

Pitch axis

a linearization around a point, this linearization point is

2 *cm* ¨

2 *cm* 

Fy

**Figure 3.** Dynamics of the 2DOF helicopter

Substituing *x* =

space is obtained:

*Jeq*,*<sup>p</sup>* + *mhelil*

*Jeq*,*<sup>y</sup>* + *mhelil*

*θ*, *ψ*, ˙ *θ*, *ψ*˙ � ry

prototype and its controller design.

yaw angles, see Fig. 3.

where *Kpp*, *Kyy*, *Kpy*, *Kyp* are the torque-constants used to obtain coupled torques acting on the pitch and yaw axes; for the state space model the input *u* and output *y* vectors are *u* = � *Vm*,*p*, *Vm*,*<sup>y</sup>* �� and *y* = [*x*1, *x*2, *x*3, *x*4] � , *Vmp* is the input pitch motor voltage and *Vmy* is the input yaw motor voltage. Notice that, since the output matrix is the identity matrix, all states are measurable.

The model makes use of several Simulink and Matlab programs to develop the helicopter basic dynamics, by running a simulation of the closed-loop response, using the position controller. Regarding control issues, two controllers are designed: a FF-LQR and a FF+LQR+I. The FF+LQR regulates the pitch axis of the helicopter, using feed-forward (FF) and proportional-velocity (PV) compensators, while the yaw axis only makes use of a PV control. The FF+LQR+I controller uses an integrator in the feedback loop to reduce the steady-state error, by a feed-forward and proportional-integral-velocity (PIV) algorithms to regulate the pitch, and only a PIV to control the yaw angle. This work focuses on the FF+LQR+I controller, as follows. The FF+LQR control converges (*θ*, *ψ*, ˙ *<sup>θ</sup>*, *<sup>ψ</sup>*˙) <sup>→</sup> (*θd*, *<sup>ψ</sup>d*, ˙ *θd*, *ψ*˙ *<sup>d</sup>*) where *θ<sup>d</sup>* is the desired pitch angle and *ψ<sup>d</sup>* is the desired yaw angle, such that:

$$
\begin{bmatrix} \boldsymbol{\mu}\_p \\ \boldsymbol{\mu}\_y \end{bmatrix} = \begin{bmatrix} \boldsymbol{K}\_{ff} \frac{\boldsymbol{m}\_{heli} \mathcal{J}\_{cm} \cos \theta\_d}{\mathcal{K}\_{pp}} \\ \mathbf{0} \end{bmatrix}.
$$

The addition of an integrator requires to introduce the states *x*˙5 = *θ* and *x*˙6 = *ψ*, so the linear state-space model is augmented as:

$$\begin{aligned} \dot{\mathbf{x}} &= \begin{bmatrix} 0 & 0 & 1 & 0 & 0 & 0 \\ 0 & 0 & 0 & 1 & 0 & 0 \\ 0 & 0 & -\frac{\mathbf{B}\_p}{I\_{\text{dyl}} + \eta\_{\text{mid}} I\_{\text{m}}^2} & 0 & 0 & 0 \\ 0 & 0 & -\frac{\mathbf{B}\_p}{I\_{\text{dyl}} + \eta\_{\text{mid}} I\_{\text{m}}^2} & 0 & 0 \\ 0 & 0 & -\frac{\mathbf{B}\_p}{I\_{\text{dyl}} + \eta\_{\text{mid}} I\_{\text{m}}^2} & 0 & 0 \\ 1 & 0 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 & 0 \end{bmatrix} \mathbf{x} + \begin{bmatrix} 0 & 0 & 0 \\ 0 & 0 \\ -\frac{\mathbf{K}\_{\text{pp}}}{I\_{\text{dyl}} + \eta\_{\text{mid}} I\_{\text{m}}^2} & \frac{\mathbf{K}\_{\text{pp}}}{I\_{\text{dyl}} + \eta\_{\text{mid}} I\_{\text{m}}^2} \\ -\frac{\mathbf{K}\_{\text{pp}}}{I\_{\text{dyl}} + \eta\_{\text{mid}} I\_{\text{m}}^2} & \frac{\mathbf{K}\_{\text{pp}}}{I\_{\text{dyl}} + \eta\_{\text{mid}} I\_{\text{m}}^2} \end{bmatrix} \mathbf{u}, \\\ y = \begin{bmatrix} 1 & 0 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 & 0 \\ 0 & 0 & 1 & 0 & 0 \\ 0 & 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 0 & 1 \end{bmatrix} \mathbf{x}. \end{aligned}$$

#### 12 Will-be-set-by-IN-TECH 60 Numerical Simulation – From Theory to Industry Issues on Communication Network Control System Based Upon Scheduling Strategy Using Numerical Simulations <sup>13</sup>

Using the adequate Q and R weighting matrices, the control gain is as follows:

$$k = \begin{bmatrix} 18.9 & 1.98 & 7.48 & 1.53 & 7.03 & 0.77\\ -2.22 & 19.4 & -0.45 & 11.9 & -0.77 & 7.03 \end{bmatrix}$$

.

control signals are *x* = (*θ*, *ψ*, ˙

communication network.

x\_d

u\_vol

x\_sim

FF+LQR+I Ctrl

required integrated performance.

the error (commonly expressed as IAE) is used:

*IAE* =

 *tf t*0

the initial and final continuous(discrete) times of evaluation period [15].

u\_yaw

*θ*, *ψ*˙). This model has a controller node, depicted on the left

Issues on Communication Network Control System Based Upon Scheduling Strategy Using Numerical Simulations

x\_sim

RTDS Nonlinear Model

u\_yaw

u\_pitch

u\_yaw


v\_m\_sim

x\_sim

61

side (Fig. 4). This controller takes the control law from the FF+LQR module by means of a task, which activates by event. The time consumption of the controller task is the maximum average time it takes to compute the control law. The controller node uses the values from sensors, and sends control outputs *up* and *uy*, that correspond to the pitch and yaw voltages. Two actuator nodes, located on the bottom right corner (Fig. 4), receive signals from the controller node. Finally, the scheduler node, located on the top right corner (Fig. 4), organizes the activity of the other seven nodes, and it is responsible for periodic allocation bandwidth, used by these nodes. Each node initializes, specifying the number of inputs and outputs of the respective TrueTime kernel block, defining a scheduling policy, and creating periodic tasks for the simulation. These tasks involve parameters about the periodic times and the consumption times. The task periodic times define the time interval between tasks, whereas the consumption times refer to the execution time of the task. Fig. 5 shows the 2-DOF Helicopter model, with a RTDS, where feedback control loop is closed through a

u\_pitch

u\_pitch u\_pitch

u\_yaw

x\_sim

**Figure 5.** Networked control integrated into closed control loop of the 2DOF Helicopter

Changes on the real-time task parameters of the RTDS commonly impact on network utilization, and therefore, on the control performance [8, 9]. The problem to tackle, thus, is to find a proper way to schedule the common communication network of the RTDS, based on managing an accurate sampling period, capable of keeping both, the network load and

A criteria to quantify the system's quality performance is the integral of the absolute value of

where *r*(*t*) is reference signal or setpoint, *y*(*t*) is system output signal, *t*0(*k*0) and *tf*(*k <sup>f</sup>*) are

*k f* ∑ *k*=*k*<sup>0</sup>


Thus, the FF+LQR+I controller is:

$$
\begin{split}
\begin{bmatrix} u\_p \\ u\_{\dot{\theta}} \end{bmatrix} &= \begin{bmatrix} K\_{ff} \frac{m\_{hil}g\_{cm}\cos\theta\_d}{K\_{pp}} \\ 0 \end{bmatrix} - \begin{bmatrix} k\_{11} \ k\_{12} \ k\_{13} \ k\_{14} \\ k\_{21} \ k\_{22} \ k\_{23} \ k\_{24} \end{bmatrix} \\ & \begin{bmatrix} \theta - \theta\_d \\ \psi - \psi\_d \\ \dot{\theta} \\ \dot{\psi} \end{bmatrix} - \begin{bmatrix} k\_{15}(\theta - \theta\_d) + \int k\_{16}(\psi - \psi\_d) \\ k\_{25}(\theta - \theta\_d) + \int k\_{26}(\psi - \psi\_d) \end{bmatrix}.
\end{split}
$$
