The software in the loop simulation consists in the creation of a Simulink model that simulates the behaviour of the system formed by the autopilot and platform, without having the physical devices connected to the computer, in contrast to the HIL which has both the autopilot and platform connected to the PC. The SIL allows the user to simulate faster than real time, which allows the user to simulate a system several times.

 

Autopilot Simulation

The autopilot is implemented in Simulink with an S-Function. This kind of block takes a C, C++, Fortran or even Matlab code, and implements it in a block containing a certain number of inputs and outputs.

S-Function containing the autopilot embedded code

Besides the Inputs that appear on the figure, which are values that change continuously during the simulation (sensor readings, GPS Data, Timer…), the s-function needs another set of parameters that correspond to the configuration created in Veronte Pipe. This configuration contains the platform control parameters, layout, flight phases, automations, mission and so on. Therefore, the autopilot function uses both sensor readings and configuration files to calculate the control and guidance commands.

The dialogue box that is used to configure the S-function is presented in the following figure.

S-function Dialogue Box

The field “S_function name” contains the file with the code of the GNC algorithms that calculate the guidance and control commands. The code specified here is the same as the one that is embedded on the real autopilot. On the other hand, the field “S-function parameters” contains the route where the configuration files have been unzipped. Once the configuration is done in Veronte Pipe, save the .ver file and unzip it in a folder whose route is the one introduced here.

Sensors Simulation

The sensors readings are simulated in Simulink with two blocks that will be shown and explained as follows.

Sensor Readings

The first block calculates the sensed variables using the values of the state vector plus the Director Cosine Matrix (DCM). The name “var_2_sen” states for variables to sensor values. Here is presented the layout of that block.

Variables to Sensors Block

Basically, what these blocks does is to adapt the values of the state vector (calculated in the aircraft dynamics equations), according to the orientation and position of the sensors within the autopilot, i.e if the IMU is rotated with respect to the aircraft axes, that rotation has to be applied to the values obtained at the state vector, and the same for magnetometer and so on. Besides, the position provided by the aircraft equations comes in Flat Earth Axes, so it has also to be transformed in order to generate the values that a real GPS module would provide. In the picture shown before, the green squares mark the inputs and the red ones the outputs.

The following figure shows the block disposition used within the sub-system used to simulate the sensor reading process carried out on the microcontroller.

Signal Processing Block

The sensed variables (which are transformations from the state vector values) are now fed to the signal processing block. This block applies the bias and saturation of the real sensors for a later quantification of that variables in order to obtain what would be a digital signal, which at the end is the real signal provided by the autopilot sensors. The models presented here are totally adaptable to the sensors used by the final customer in a real situation (thanks to the block architecture implemented on Simulink) . If one operation needs the use of a certain external sensor, its model can be included in the simulation to achieve a greater degree of realism.

To sum up, in a real situation the sensors provide a certain measure according to the aircraft state. In a Software In the Loop simulation, that readings are not available so they have to be calculated according to the aircraft state vector values, and that is done in the Simulink model with the two subsystems presented before.

Complete Simulation

Combining the three main blocks presented in the previous section the whole autopilot will be implemented in Simulink (sensors simulation  + Veronte Code for GNC algorithms). In order to complete the simulation process, a model of the aircraft that will be controlled by Veronte is needed. The creation of that model can be easily done with the block architecture contained in the Simulink software, or with an S-function that contains a C code to solve the aircraft dynamics equations. Once that has been done, the autopilot and aircraft models are linked to form a whole simulation model. The following figure shows an example of a complete system.

The two visualisation blocks contain just a series of scopes a data store blocks for post-processing purposes, they are not relevant in the simulation process.