F-14 Longitudinal Model
NOTE: You will need to have an installed and functioning version of MATLAB® and Simulink® to run this example.
Section Layout
Import the System
Simulate the System
Import the Subsystem
Initialization
withBlockImporter
BuildDE,Import,PrintSummary,SimplifyModel
We import the model with the following command. We need to specify the name of the model to import, as well as a MATLAB® script that initializes the variable names.
datadir≔BlockImporter:-DataDirectory:
model1 ≔ Importm_f14,path=datadir, init=f14_init,inplace:
Using the Summary command, we can view the model that we have imported.
PrintSummarymodel1
K0,Ka=0.677000000000000046,K0,Kf=−1.74600000000000000,K0,Ki=−3.86399999999999988,K0,Kq=0.815599999999999992,K0,Md=−6.88469999999999960,K0,Mq=−0.657100000000000017,K0,Mw=−0.00591999999999999992,K0,Swg=3.,K0,Ta=0.0500000000000000028,K0,Tal=0.395899999999999974,K0,Ts=0.100000000000000006,K0,Uo=689.399999999999977,K0,Vto=690.399999999999977,K0,W1=2.97100000000000009,K0,W2=4.14400000000000013,K0,Zd=−63.9979000000000013,K0,Zw=−0.638499999999999956,K0,a=2.53480000000000016,K0,b=64.1299999999999955
We can now simplify the model to reduce the number of equations.
smodel1 ≔ SimplifyModelmodel1:
PrintSummarysmodel1
First we take the system and build a set of differential equations, and assign the result to the variable sys.
sys1≔BuildDEsmodel1
record⁡equations,initialeqs,known,outputvars,parameters,sourceeqs
The following table illustrates the different components of the variable sys1.
Differential Equations
sys1:−equations
ⅆⅆt⁢x3,1⁡t=K0,Kf⁢ⅆⅆt⁢x33,1⁡t⁢K0,Ta+x33,1⁡t⁢K0,Ki⁢K0,Ta−x3,1⁡tK0,Ta,ⅆⅆt⁢x15,1⁡t=−3⁢K0,Swg⁢K0,Ta⁢K0,Zw⁢K0,a⁢x26,2⁡t+K0,Uo⁢x16,1⁡t⁢K0,a3⁢K0,Ta+K0,Zw⁢x15,1⁡t⁢K0,a3⁢K0,Ta−K0,Swg⁢K0,Ta⁢K0,Zw⁢x26,1⁡t+K0,Zd⁢x3,1⁡t⁢K0,a3K0,a3⁢K0,Ta,ⅆⅆt⁢x16,1⁡t=116⁢16⁢K0,Mq⁢x16,1⁡t⁢K0,b2⁢K0,a3⁢K0,Ta+16⁢K0,Mw⁢x15,1⁡t⁢K0,b2⁢K0,a3⁢K0,Ta−4⁢3⁢π⁢K0,Mq⁢K0,Swg⁢K0,Ta⁢K0,a⁢K0,b⁢x26,2⁡t+K0,a3⁢π2⁢K0,Mq⁢K0,Ta⁢K0,Vto⁢x25,1⁡t−4⁢π⁢K0,Mq⁢K0,Swg⁢K0,Ta⁢K0,b⁢x26,1⁡t−16⁢3⁢K0,Mw⁢K0,Swg⁢K0,Ta⁢K0,a⁢K0,b2⁢x26,2⁡t−16⁢K0,Mw⁢K0,Swg⁢K0,Ta⁢K0,b2⁢x26,1⁡t+16⁢K0,Md⁢x3,1⁡t⁢K0,b2⁢K0,a3K0,b2⁢K0,a3⁢K0,Ta,ⅆⅆt⁢x25,1⁡t=−14⁢−4⁢x26,2⁡t⁢3⁢K0,Swg⁢K0,a⁢K0,b+π⁢K0,Vto⁢x25,1⁡t⁢K0,a3−4⁢x26,1⁡t⁢K0,Swg⁢K0,bK0,a3⁢K0,b,ⅆⅆt⁢x26,1⁡t=x26,2⁡t,ⅆⅆt⁢x26,2⁡t=u1,1,1⁡t⁢K0,a2−2⁢x26,2⁡t⁢K0,a−x26,1⁡tK0,a2,ⅆⅆt⁢x32,1⁡t=−K0,W2⁢x32,1⁡t+x16,1⁡t,SinkScope,34,1,1⁡t=x15,1⁡tK0,Uo,SinkScope,34,2,1⁡t=x16,1⁡t,ⅆⅆt⁢x35,1⁡t=x15,1⁡t⁢K0,Tal−x35,1⁡t⁢K0,UoK0,Uo⁢K0,Tal,ⅆⅆt⁢x37,1⁡t=SourceSigGen,36,1⁡t⁢K0,Ts−x37,1⁡tK0,Ts,ⅆⅆt⁢x33,1⁡t=−K0,Kq⁢K0,Tal⁢K0,Ts⁢K0,W1⁢x32,1⁡t−K0,Kq⁢K0,Tal⁢K0,Ts⁢K0,W2⁢x32,1⁡t+K0,Kq⁢K0,Tal⁢K0,Ts⁢x16,1⁡t+K0,Ka⁢x35,1⁡t⁢K0,Ts−x37,1⁡t⁢K0,TalK0,Ts⁢K0,Tal
Parameter values
sys1:-parameters
Initial conditions
sys1:-initialeqs
x3,1⁡0=0,x15,1⁡0=0,x16,1⁡0=0,x25,1⁡0=0,x26,1⁡0=0,x26,2⁡0=0,x32,1⁡0=0,x33,1⁡0=0,x35,1⁡0=0,x37,1⁡0=0
Equations for the sources (inputs)
sys1:-sourceeqs
u1,1,1⁡t=0,SourceSigGen,36,1⁡t={−1t−4.000000000⁢π⁢trunc⁡0.2500000000⁢tπ<2.000000000⁢π1otherwise
List of sinks (outputs)
sys1:-outputvars
SinkScope,34,1,1⁡t,SinkScope,34,2,1⁡t
Using the information in the variable sys, we construct a simulation procedure.
sol1 ≔ dsolveevalevalsys1:-equations, sys1:-parameters,sys1:-sourceeqs, sys1:-initialeqs, numeric
procx_rkf45_dae...end proc
Then we plot the simulation results.
plotsodeplotsol1, t, sys1:-outputvars1, 0..20, numpoints=200, title=Angle-of-attack
plotsodeplotsol1, t, sys1:-outputvars2, 0..20, numpoints=200, title=Rate of pitch
First we want to close the Simulink model without saving it, so we can reload it with the subsystem. We send the command close_system('m_f14', 0) through the link to MATLAB®.
Matlab:-evalMclose_system ('m_f14',0)
We can import a subsystem from the model.
model2 ≔ Importm_f14, m_f14/Aircraft dynamics, path=datadir, init=f14_init,inplace=true:
The set of equations are simplified and the simplified set of equations is printed using the PrintSummary command.
smodel2 ≔ SimplifyModelmodel2:
PrintSummarysmodel2:
K0,Md=−6.88469999999999960,K0,Mq=−0.657100000000000017,K0,Mw=−0.00591999999999999992,K0,Uo=689.399999999999977,K0,Zd=−63.9979000000000013,K0,Zw=−0.638499999999999956
The differential equations are created.
sys2 ≔BuildDEsmodel2
The following table illustrates the different components of the variable sys2.
sys2:-equations
y1,1,1⁡t=x12,1⁡tK0,Uo,ⅆⅆt⁢x12,1⁡t=K0,Uo⁢y1,2,1⁡t+K0,Zd⁢u1,1,1⁡t+K0,Zw⁢x12,1⁡t−u1,2,1⁡t,ⅆⅆt⁢x13,1⁡t=K0,Md⁢u1,1,1⁡t+K0,Mq⁢x13,1⁡t+K0,Mw⁢x12,1⁡t−u1,3,1⁡t,y1,2,1⁡t=x13,1⁡t
sys2:-parameters
sys2:-initialeqs
x12,1⁡0=0,x13,1⁡0=0
sys2:-sourceeqs
u1,1,1⁡t=0,u1,2,1⁡t=0,u1,3,1⁡t=0
sys2:-outputvars
y1,1,1⁡t,y1,2,1⁡t
Download Help Document