Engee documentation
Notebook

Aircraft pitch motion control

This example demonstrates the simulation of an aircraft's longitudinal motion control system. The models of aircraft dynamics and actuators are described by first-order linear approximations and connected to an analog control system. Subsystem Controller (Regulator):

  1. Uses the pitch signal from the aircraft control stick as a setpoint for the pitch angle of the aircraft.

  2. Uses the pitch angle of the aircraft and the rate of change of this angle to form control actions.

To perturb the system, a simplified subsystem Dryden Wind Gust Models (Dryden Gust Models) is implemented in the model.

Model diagram:

pitch_control--1750681440899.png

Defining the function to load and run the model:

In [ ]:
function start_model_engee()
    try
        engee.close("pitch_control", force=true) # закрытие модели 
        catch err # в случае, если нет модели, которую нужно закрыть и engee.close() не выполняется, то будет выполнена её загрузка после catch
            m = engee.load("$(@__DIR__)/pitch_control.engee") # загрузка модели
        end;

    try
        engee.run(m) # запуск модели
        catch err # в случае, если модель не загружена и engee.run() не выполняется, то будут выполнены две нижние строки после catch
            m = engee.load("$(@__DIR__)/pitch_control.engee") # загрузка модели
            engee.run(m) # запуск модели
        end
end
Out[0]:
start_model_engee (generic function with 1 method)

Running the simulation

In [ ]:
start_model_engee();

Extraction of pitch angle and setpoint signals from the simout variable:

In [ ]:
result = simout;
res = collect(result)
Out[0]:
3-element Vector{WorkspaceArray}:
 WorkspaceArray{Float64}("pitch_control/α")
 WorkspaceArray{Float64}("pitch_control/Stick")
 WorkspaceArray{Float64}("pitch_control/δe")

Writing signals to variables:

In [ ]:
alpha = collect(res[1])
stick = collect(res[2]);

Visualization of simulation results

Aircraft pitch angle graph and setpoint signal:

In [ ]:
using Plots
gr()
plot(alpha[:,1], alpha[:,2], label="Угол тангажа самолёта, град.", linewidth=3)
plot!(stick[:,1], stick[:,2], label="Уставка, град.", linewidth=3)
Out[0]: