WOLFRAM SYSTEM MODELER
StallRecoveryModel for testing stall recovery and stall effects for Saab 2000 
SystemModel["Aircraft.Examples.StallRecovery"]
This example demonstrates the Aircraft library's model for stall and the ability of the autopilot to recover an aircraft from stall. The twinengine turboprop airliner Saab 2000 is given an extremely low initial velocity, the elevator is deflected to its maximum upward angle and the engines are set to provide zero thrust, resulting in the aircraft stalling just 0.5 seconds after the start of the simulation. At 20 seconds, the control signals to the aircraft are switched to the autopilot outputs to let the autopilot recover the aircraft from stall.
A stall occurs when the flow separates from the upper surface of the wing at high angles of attack. This results in a rapid decrease in the wing lift coefficient and an increase in the drag coefficient. Figure 1 shows the change in the wing lift coefficient as the effective angle of attack increases all the way up to 90 degrees. The effective angle of attack (α_{eff}) is the wing angle of attack when the effect by wing incidence angle, the wing zerolift angle of attack and the induced angle of attack due to dihedral in sideslip are considered such that at α_{eff} = 0° the lift coefficient is always zero.
Figure 1: Model for wing lift coefficient in stall. [1]
Figure 2 shows how the increase in drag coefficient is modeled in the library. After the maximum lift coefficient is achieved, the wing drag coefficient starts to follow a sine curve toward the maximum drag coefficient value at α_{eff} = 90°.
Figure 2: Model for wing drag coefficient in stall. [1]
The first default plot shows the effective angle of attack and lift and drag coefficients of the main wing according to the stall models presented in Figures 1 and 2. The Wing alpha stall angle refers to the angle of attack when the wing lift coefficient stops following the linear lift curve slope, i.e. at the border of the blue and yellow curves in Figure 1, and the Wing alpha for max CL is the angle of attack at which the wing maximum lift coefficient is achieved. During the first 10 seconds of the simulation, it can clearly be seen in this plot how the lift coefficient rapidly starts to decrease as the angle of attack grows beyond the Wing alpha for max CL, whereas the drag coefficient increases due to the flow separation in stall.
The stall of the horizontal tail is also modeled in the library, and the second default plot shows the horizontal tail stall behavior. It should be noted that the horizontal tail lift coefficient does not achieve its maximum value at Horizontal tail alpha for max CL in this example. This is due to the elevator being deflected upward at the beginning of the simulation and thus decreasing the horizontal tail lift coefficient. The maximum lift coefficient for horizontal tail is calculated for an undeflected elevator.
Further explanation about stall and how it is modeled in the library can be found in the documentation for WingBody and HorizontalTail and in section 3.3.3 in Reference [1].
[1] EräEsko, N. (2022). "Development and Use of System Modeler 6DOF Flight Mechanics Model in Aircraft Conceptual Design."
Available at: modelica://Aircraft/Resources/Documents/EraeEskoThesis.pdf.
startAlt 
Value: 8000 Type: Height (m) Description: Initial altitude 

startVtot 
Value: 22.2222222222222 Type: Velocity (m/s) Description: Initial total velocity 
startTheta 
Value: 0 Type: Angle (rad) Description: Initial pitch angle 
startGamma 
Value: 0 Type: Angle (rad) Description: Initial flight path angle 
world 
Type: World Description: World coordinate system + gravity field + default animation definition 


saab2000 
Type: Saab2000 Description: Highspeed turboprop airliner: Saab 2000 

deltaaSwitch 
Type: Switch Description: Switches between constant zero and autopilot signal 

deltaeSwitch 
Type: Switch Description: Switches between constant zero and autopilot signal 

deltarSwitch 
Type: Switch Description: Switches between constant zero and autopilot signal 

deltaTSwitch 
Type: Switch Description: Switches between constant zero and autopilot signal 

booleanStep 
Type: BooleanStep Description: Boolean step to trigger autopilot 

constZero 
Type: Constant Description: Constant zero signal to ailerons, rudder and throttle position 

deg2RadDelv 
Type: From_deg Description: Convert from degree to radian 

autopilotTurboprop 
Type: AutopilotTurboprop Description: Autopilot for passenger aircraft with turboprop propulsion 

constVtot 
Type: Constant Description: Generate constant signal of type Real 

constTrack 
Type: Constant Description: Generate constant signal of type Real 

constAlt 
Type: Constant Description: Generate constant signal of type Real 

deg2RadTrack 
Type: From_deg Description: Convert from degree to radian 

constDeltaElv 
Type: Constant Description: Generate constant signal of type Real 

kmh2ms 
Type: From_kmh Description: Convert from kilometre per hour to metre per second 