**3.2. Numerical simulations**

The validation of the digital attitude controller was carried through a scheme of co-simulation, where a computer performs the simulation of the satellite's motion, in MATLAB/Simulink, using models of attitude kinematics and dynamics, and a Blackfin 537 DSP device (installed on ADSP-BF537 kit, Analog Devices) plays the digital LQG controller processing, and also the PWPF modulator [7].

The interface with the computer uses the Real-Time Workshop tool, through the Embedded IDE link, as shown in the Fig. 3.

The validation tests comprise two distinct scenarios. In the first one, the tests consider the same case studied in the precedent sections, i.e. the three axes attitude stabilization. In the second scenario, the attitude control is aimed to perform a maneuver to achieve a new orientation, i.e. a task of attitude tracking.

The co-simulation scheme is based on the computer communication with the DSP (cf. Fig. 4), which is facilitated by Simulink tool, which allows integration of several external processors, including the BF537, by creating a block *Processor-In-the-Loop* (PIL) in the simulation diagram. This communication is made possible through the interaction of the Simulink with the BF537 development environment, the Visual DSP ++ (Fig. 5).

**Figure 4.** Co-simulation scheme: the DSP processes the LQG controller and the PWPF modulator, and computer simu‐

Processor-in-the-Loop Simulations Applied to the Design and Evaluation of a Satellite Attitude Control

http://dx.doi.org/10.5772/57219

167

**Figure 3.** The PIL interface screen of the Real-Time Workshop (MATLAB/Simulink).

lates the motion of the satellite attitude.

Processor-in-the-Loop Simulations Applied to the Design and Evaluation of a Satellite Attitude Control http://dx.doi.org/10.5772/57219 167


**Figure 3.** The PIL interface screen of the Real-Time Workshop (MATLAB/Simulink).

**Figure 2.** Scheme of the discret LQG controller.

The validation of the digital attitude controller was carried through a scheme of co-simulation, where a computer performs the simulation of the satellite's motion, in MATLAB/Simulink, using models of attitude kinematics and dynamics, and a Blackfin 537 DSP device (installed on ADSP-BF537 kit, Analog Devices) plays the digital LQG controller processing, and also the

The interface with the computer uses the Real-Time Workshop tool, through the Embedded

The validation tests comprise two distinct scenarios. In the first one, the tests consider the same case studied in the precedent sections, i.e. the three axes attitude stabilization. In the second scenario, the attitude control is aimed to perform a maneuver to achieve a new orientation, i.e.

The co-simulation scheme is based on the computer communication with the DSP (cf. Fig. 4), which is facilitated by Simulink tool, which allows integration of several external processors, including the BF537, by creating a block *Processor-In-the-Loop* (PIL) in the simulation diagram. This communication is made possible through the interaction of the Simulink with the BF537

**3.2. Numerical simulations**

166 Computational and Numerical Simulations

PWPF modulator [7].

IDE link, as shown in the Fig. 3.

a task of attitude tracking.

development environment, the Visual DSP ++ (Fig. 5).

**Figure 4.** Co-simulation scheme: the DSP processes the LQG controller and the PWPF modulator, and computer simu‐ lates the motion of the satellite attitude.


**Figure 5.** The session opening in Visual DSP++ environment.

The block PIL is inserted in the block diagram developed in the Simulink environment. It is responsible for the communication with the DSP, i.e. in charge of sending the information of the satellite attitude and of receiving the commands related to the control action, i.e. the gas jets driving from the PWPF modulator.

Figure 6 shows the results for the three Euler angles, of the validation tests for the case of threeaxis stabilization scheme using co-simulation. The considered initial deviation is 10 degrees for each one of the three Euler angles, as in the case of the previous simulations.

The differences are smaller than 0.1 degree for the three angles. However, we cannot conclude about the better precision scenario. Both simulations met the accuracy specifications, never‐ theless the simulation of continuous-time system lacks of realism for an experimental appli‐ cation. In fact, the small difference between the two cases shows only that the co-simulation scheme works very similarly to the idealized case, which may suggest an optimistic outcome

Processor-in-the-Loop Simulations Applied to the Design and Evaluation of a Satellite Attitude Control

http://dx.doi.org/10.5772/57219

169

In a second test case, the satellite is commanded to change its attitude, initially with three angles (roll, pitch, and yaw) at the same value of 10°, for a new attitude defined by the values

in relation to the expectations of an experimental application.

**Figure 6.** Co-simulation results of attitude control using a DSP (for ϕ, θ, ψ, in degrees).

A comparative analysis of the obtained results in the case of continuous LQG controller (in a simulation made only in MATLAB/ Simulink environment), and those obtained in the scheme of co-simulation (Fig. 6), can be made from a plot of the results differences. This differences plot is shown in Fig. 7.

**Figure 6.** Co-simulation results of attitude control using a DSP (for ϕ, θ, ψ, in degrees).

**Figure 5.** The session opening in Visual DSP++ environment.

jets driving from the PWPF modulator.

168 Computational and Numerical Simulations

plot is shown in Fig. 7.

The block PIL is inserted in the block diagram developed in the Simulink environment. It is responsible for the communication with the DSP, i.e. in charge of sending the information of the satellite attitude and of receiving the commands related to the control action, i.e. the gas

Figure 6 shows the results for the three Euler angles, of the validation tests for the case of threeaxis stabilization scheme using co-simulation. The considered initial deviation is 10 degrees

A comparative analysis of the obtained results in the case of continuous LQG controller (in a simulation made only in MATLAB/ Simulink environment), and those obtained in the scheme of co-simulation (Fig. 6), can be made from a plot of the results differences. This differences

for each one of the three Euler angles, as in the case of the previous simulations.

The differences are smaller than 0.1 degree for the three angles. However, we cannot conclude about the better precision scenario. Both simulations met the accuracy specifications, never‐ theless the simulation of continuous-time system lacks of realism for an experimental appli‐ cation. In fact, the small difference between the two cases shows only that the co-simulation scheme works very similarly to the idealized case, which may suggest an optimistic outcome in relation to the expectations of an experimental application.

In a second test case, the satellite is commanded to change its attitude, initially with three angles (roll, pitch, and yaw) at the same value of 10°, for a new attitude defined by the values

angular velocities. It shows that the adopted controller achieves adequate performance even with this difference between models, and it presents interesting features of robustness.

Processor-in-the-Loop Simulations Applied to the Design and Evaluation of a Satellite Attitude Control

http://dx.doi.org/10.5772/57219

171

**Figure 8.** Co-simulation results of attitude control for the three Euler's angles, considering a tracking maneuver.

In terms of adopted sampling time, it was observed that the simulation in MATLAB/ Simulink waits the DSP processing to continue the calculations, preventing it from some problem related to the interval between two controller processing and actuation. However, there is a DSP development platform tool that allows the measurement of processing time and data traffic.

**Figure 7.** Difference between the simulation results of the continuous controller and co-simulation of digital control (for ϕ, θ, ψ, in degrees).

50, 60 and 45°, respectively. The results are shown in Fig. 8. It was observed that the controller performs satisfactorily its task, with tracking maneuver time of about 45 seconds. An important remark: the gap angles between initial and final attitudes are relatively large for the considered approximations in the synthesis of LQG control law. In the controller design, we adopted a linearized model for small angle values, whereas in the simulation of the motion of the satellite attitude we used nonlinear models of kinematics and dynamics. These models, in the case of large angles, exhibit very different behaviors of the linearized model, especially for higher

angular velocities. It shows that the adopted controller achieves adequate performance even with this difference between models, and it presents interesting features of robustness.

**Figure 8.** Co-simulation results of attitude control for the three Euler's angles, considering a tracking maneuver.

50, 60 and 45°, respectively. The results are shown in Fig. 8. It was observed that the controller performs satisfactorily its task, with tracking maneuver time of about 45 seconds. An important remark: the gap angles between initial and final attitudes are relatively large for the considered approximations in the synthesis of LQG control law. In the controller design, we adopted a linearized model for small angle values, whereas in the simulation of the motion of the satellite attitude we used nonlinear models of kinematics and dynamics. These models, in the case of large angles, exhibit very different behaviors of the linearized model, especially for higher

**Figure 7.** Difference between the simulation results of the continuous controller and co-simulation of digital control

(for ϕ, θ, ψ, in degrees).

170 Computational and Numerical Simulations

In terms of adopted sampling time, it was observed that the simulation in MATLAB/ Simulink waits the DSP processing to continue the calculations, preventing it from some problem related to the interval between two controller processing and actuation. However, there is a DSP development platform tool that allows the measurement of processing time and data traffic. Consequently, it is possible to verify if the DSP processing time remains inferior to the maximum time period provided for sampling (10ms in this study). This tool is the *Cycle Counter*, which considers the frequency of the DSP core, 500MHz. The obtained result was processing and traffic time, much smaller than the time available due to the sampling period. It's possible to conclude that there are no problems in this application related to the aspect of the controller discretization and the use of a digital processor to perform the function of controlling and modulating the actuators.

**References**

2009; 2(4) 53-59.

lands, 2010.

II(3) 29-38.

agement 2012, 4(1) 15-24.

Sciences 1993 41(4) 439-517.

ics. New York: Springer, 2012.

Jersey, USA: Prentice Hall, 1998.

2009, ID 750945.

ings, Kitakyushu, Japan. 2011.

zilian Institute for Space Researches, 2009.

– DASIA: conference proceedings, Sevilla, Spain, 1997.

[1] Shokry H, Hinchey M. Model-based verification of embedded software. Computer

Processor-in-the-Loop Simulations Applied to the Design and Evaluation of a Satellite Attitude Control

http://dx.doi.org/10.5772/57219

173

[2] Juang JC, Chong CY, Tsai YF, Miau JJ, Tsai JR, Pan HP. Design, Implementation and Verification of Microsatellite Attitude Determination and Control Subsystem Based on Processor-in-the-loop. The 3rd Nano-Satellite Symposium: conference proceed‐

[3] Gaias G, D'Amico S, Ardeans JS, Boge T. Hardware-in-the-loop Multi-satellite Simu‐ lator for Proximity Operations. The 11th International Workshop on Simulation & EGSE facilities for Space Programmes: conference proceedings, Noordwijk, Nether‐

[4] Seelaender G. Emulation and co-simulation of attitude control system for the PMM satellite and electro-hydraulic system for an aircraft using FPGAs. MSc. Thesis. Bra‐

[5] França Jr JA, Morgado JA. Real time implementation of a low-cost INS/GPS system using xPC Target. Journal of Aerospace Engineering, Sciences and Applications 2010,

[6] Sabatini P, De Marchi E, Lupi T. Development and validation of attitude control sys‐ tems using advanced off-the-shelf computer-based tools. Data Systems in Aerospace

[7] Santana AC, Martins-Filho LS, Duarte RO, Arantes Jr G, Casella IRS. Satellite attitude control using a digital signal processor. Journal of Aerospace Technology and Man‐

[8] Wie HWB, Arapostathis A. Quaternion feedback regulator for spacecraft eigenaxis

[9] Shuster, M.D. A survey of attitude representations. The Journal of the Astronautical

[10] Arantes Jr G, Martins-Filho LS, Santana AC. Optimal on-off attitude control for the Brazilian multi-mission platform satellite. Mathematical Problems in Engineering V.

[11] Awrejcewicz J, Koruba Z. Classical Mechanics. Applied Mechanics and Mechatron‐

[12] Dorato P, Abdallah CT, Cerone V. Linear Quadratic Control: an Introduction. New

rotations. Journal of Guidance Control and Dynamics 1989 12(3) 375-380.
