function [ret,x0,str,ts,xts]=eng(t,x,u,flag);
%ENG	is the M-file description of the SIMULINK system named ENG.
%	The block-diagram can be displayed by typing: ENG.
%
%	SYS=ENG(T,X,U,FLAG) returns depending on FLAG certain
%	system values given time point, T, current state vector, X,
%	and input vector, U.
%	FLAG is used to indicate the type of output to be returned in SYS.
%
%	Setting FLAG=1 causes ENG to return state derivatives, FLAG=2
%	discrete states, FLAG=3 system outputs and FLAG=4 next sample
%	time. For more information and other options see SFUNC.
%
%	Calling ENG with a FLAG of zero:
%	[SIZES]=ENG([],[],[],0),  returns a vector, SIZES, which
%	contains the sizes of the state vector and other parameters.
%		SIZES(1) number of states
%		SIZES(2) number of discrete states
%		SIZES(3) number of outputs
%		SIZES(4) number of inputs
%		SIZES(5) number of roots (currently unsupported)
%		SIZES(6) direct feedthrough flag
%		SIZES(7) number of sample times
%
%	For the definition of other parameters in SIZES, see SFUNC.
%	See also, TRIM, LINMOD, LINSIM, EULER, RK23, RK45, ADAMS, GEAR.

% Note: This M-file is only used for saving graphical information;
%       after the model is loaded into memory an internal model
%       representation is used.

% the system will take on the name of this mfile:
sys = mfilename;
new_system(sys)
simver(1.3)
if (0 == (nargin + nargout))
     set_param(sys,'Location',[4,42,788,560])
     open_system(sys)
end;
set_param(sys,'algorithm',     'Linear')
set_param(sys,'Start time',    '0.0')
set_param(sys,'Stop time',     '10')
set_param(sys,'Min step size', '0.00005')
set_param(sys,'Max step size', '0.05')
set_param(sys,'Relative error','1e-3')
set_param(sys,'Return vars',   '')

add_block('built-in/Note',[sys,'/','Pm'])
set_param([sys,'/','Pm'],...
		'position',[450,50,455,55])

add_block('built-in/Note',[sys,'/','aceleração'])
set_param([sys,'/','aceleração'],...
		'position',[460,230,465,235])

add_block('built-in/Note',[sys,'/','TORQUE'])
set_param([sys,'/','TORQUE'],...
		'position',[455,275,460,280])

add_block('built-in/Note',[sys,'/',['m''ai']])
set_param([sys,'/',['m''ai']],...
		'position',[450,185,455,190])

add_block('built-in/Note',[sys,'/','ma'])
set_param([sys,'/','ma'],...
		'position',[455,140,460,145])

add_block('built-in/Note',[sys,'/',['m''ao']])
set_param([sys,'/',['m''ao']],...
		'position',[455,94,460,101])

add_block('built-in/Note',[sys,'/',['m''fi']])
set_param([sys,'/',['m''fi']],...
		'position',[450,5,455,10])

add_block('built-in/Constant',[sys,'/','Ve'])
set_param([sys,'/','Ve'],...
		'Value','0.0027',...
		'position',[70,267,155,293])

add_block('built-in/Constant',[sys,'/','MAX'])
set_param([sys,'/','MAX'],...
		'Value','0.1843',...
		'position',[190,44,270,66])

add_block('built-in/Constant',[sys,'/','Vm'])
set_param([sys,'/','Vm'],...
		'Value','0.0038',...
		'position',[180,244,260,266])

add_block('built-in/Constant',[sys,'/','Ma'])
set_param([sys,'/','Ma'],...
		'Value','28.84',...
		'position',[70,219,150,241])

add_block('built-in/Constant',[sys,'/','SA'])
set_param([sys,'/','SA'],...
		'position',[200,94,235,116])

add_block('built-in/Constant',[sys,'/','Ct'])
set_param([sys,'/','Ct'],...
		'Value','498636',...
		'position',[65,67,165,93])

add_block('built-in/Constant',[sys,'/','BETA'])
set_param([sys,'/','BETA'],...
		'Value','14.7',...
		'position',[70,19,140,41])

add_block('built-in/Note',[sys,'/','Ma=0.003'])
set_param([sys,'/','Ma=0.003'],...
		'position',[155,1145,165,1155])

add_block('built-in/Note',[sys,'/',['O ajuste dos parâmetros do modelo foi feito',13,'para a velocidade inicial de 100 rad//s e',13,'para o ângulo inicial da borboleta de 0.3 rad']])
set_param([sys,'/',['O ajuste dos parâmetros do modelo foi feito',13,'para a velocidade inicial de 100 rad//s e',13,'para o ângulo inicial da borboleta de 0.3 rad']],...
		'position',[225,1093,230,1098])

add_block('built-in/Note',[sys,'/',['Para outro valor da velocidade inicial é preciso',13,'modificar o valor de Ma inicial (o valor inicial',13,'do integrador) e recalcular os valores iniciais ',13,'dos elementos de atraso variável (veja submodelo',13,'TORQUE)',13,'']])
set_param([sys,'/',['Para outro valor da velocidade inicial é preciso',13,'modificar o valor de Ma inicial (o valor inicial',13,'do integrador) e recalcular os valores iniciais ',13,'dos elementos de atraso variável (veja submodelo',13,'TORQUE)',13,'']],...
		'position',[205,1183,210,1188])


%     Subsystem  'ENGINE'.

new_system([sys,'/','ENGINE'])
set_param([sys,'/','ENGINE'],'Location',[4,42,788,560])


%     Subsystem  'ENGINE/FUEL'.

new_system([sys,'/','ENGINE/FUEL'])
set_param([sys,'/','ENGINE/FUEL'],'Location',[4,42,788,560])

add_block('built-in/Mux',[sys,'/','ENGINE/FUEL/Mux1'])
set_param([sys,'/','ENGINE/FUEL/Mux1'],...
		'position',[220,262,245,348])

add_block('built-in/Mux',[sys,'/','ENGINE/FUEL/Mux'])
set_param([sys,'/','ENGINE/FUEL/Mux'],...
		'inputs','2',...
		'position',[140,38,165,142])

add_block('built-in/Inport',[sys,'/',['ENGINE/FUEL/m''ai']])
set_param([sys,'/',['ENGINE/FUEL/m''ai']],...
		'position',[40,55,60,75])

add_block('built-in/Inport',[sys,'/','ENGINE/FUEL/BETA'])
set_param([sys,'/','ENGINE/FUEL/BETA'],...
		'Port','2',...
		'position',[40,95,60,115])

add_block('built-in/Fcn',[sys,'/','ENGINE/FUEL/Fcn'])
set_param([sys,'/','ENGINE/FUEL/Fcn'],...
		'Expr','u[1]/u[2]',...
		'position',[210,79,365,101])

add_block('built-in/Inport',[sys,'/','ENGINE/FUEL/OMEGA'])
set_param([sys,'/','ENGINE/FUEL/OMEGA'],...
		'Port','3',...
		'position',[40,305,60,325])

add_block('built-in/Inport',[sys,'/','ENGINE/FUEL/MAX'])
set_param([sys,'/','ENGINE/FUEL/MAX'],...
		'Port','4',...
		'position',[105,325,125,345])


%     Subsystem  'ENGINE/FUEL/FUEL_1'.

new_system([sys,'/','ENGINE/FUEL/FUEL_1'])
set_param([sys,'/','ENGINE/FUEL/FUEL_1'],'Location',[93,153,553,428])

add_block('built-in/Inport',[sys,'/','ENGINE/FUEL/FUEL_1/TAUf'])
set_param([sys,'/','ENGINE/FUEL/FUEL_1/TAUf'],...
		'Port','2',...
		'position',[35,220,55,240])

add_block('built-in/Inport',[sys,'/',['ENGINE/FUEL/FUEL_1/m''fc']])
set_param([sys,'/',['ENGINE/FUEL/FUEL_1/m''fc']],...
		'position',[60,80,80,100])

add_block('built-in/Fcn',[sys,'/','ENGINE/FUEL/FUEL_1/Fcn'])
set_param([sys,'/','ENGINE/FUEL/FUEL_1/Fcn'],...
		'Expr','1/u',...
		'position',[100,220,140,240])

add_block('built-in/Product',[sys,'/','ENGINE/FUEL/FUEL_1/Product'])
set_param([sys,'/','ENGINE/FUEL/FUEL_1/Product'],...
		'position',[115,80,165,120])

add_block('built-in/Product',[sys,'/','ENGINE/FUEL/FUEL_1/Product1'])
set_param([sys,'/','ENGINE/FUEL/FUEL_1/Product1'],...
		'orientation',2,...
		'position',[245,149,290,191])

add_block('built-in/Sum',[sys,'/','ENGINE/FUEL/FUEL_1/Sum'])
set_param([sys,'/','ENGINE/FUEL/FUEL_1/Sum'],...
		'inputs','+-',...
		'position',[200,92,230,123])

add_block('built-in/Integrator',[sys,'/','ENGINE/FUEL/FUEL_1/Integrator'])
set_param([sys,'/','ENGINE/FUEL/FUEL_1/Integrator'],...
		'position',[290,100,310,120])

add_block('built-in/Outport',[sys,'/',['ENGINE/FUEL/FUEL_1/m''fi']])
set_param([sys,'/',['ENGINE/FUEL/FUEL_1/m''fi']],...
		'position',[425,100,445,120])
add_line([sys,'/','ENGINE/FUEL/FUEL_1'],[60,230;95,230])
add_line([sys,'/','ENGINE/FUEL/FUEL_1'],[85,90;110,90])
add_line([sys,'/','ENGINE/FUEL/FUEL_1'],[145,230;165,230;165,160;100,160;110,110])
add_line([sys,'/','ENGINE/FUEL/FUEL_1'],[170,100;195,100])
add_line([sys,'/','ENGINE/FUEL/FUEL_1'],[235,110;285,110])
add_line([sys,'/','ENGINE/FUEL/FUEL_1'],[315,110;420,110])
add_line([sys,'/','ENGINE/FUEL/FUEL_1'],[350,110;350,160;295,160])
add_line([sys,'/','ENGINE/FUEL/FUEL_1'],[165,220;320,220;320,180;295,180])
add_line([sys,'/','ENGINE/FUEL/FUEL_1'],[240,170;185,170;195,115])


%     Finished composite block 'ENGINE/FUEL/FUEL_1'.

set_param([sys,'/','ENGINE/FUEL/FUEL_1'],...
		'Drop Shadow',4,...
		'position',[495,77,525,128])

add_block('built-in/Outport',[sys,'/',['ENGINE/FUEL/m''fi']])
set_param([sys,'/',['ENGINE/FUEL/m''fi']],...
		'position',[620,95,640,115])

add_block('built-in/Fcn',[sys,'/','ENGINE/FUEL/TAUf'])
set_param([sys,'/','ENGINE/FUEL/TAUf'],...
		'Expr','0.05+(1.5*pi*u[1]*u[2])/(u[3]*u[4])',...
		'position',[290,286,575,324])

add_block('built-in/Note',[sys,'/',['ENGINE/FUEL/m''fc']])
set_param([sys,'/',['ENGINE/FUEL/m''fc']],...
		'position',[445,65,450,70])
add_line([sys,'/','ENGINE/FUEL'],[250,305;285,305])
add_line([sys,'/','ENGINE/FUEL'],[370,90;490,90])
add_line([sys,'/','ENGINE/FUEL'],[170,90;205,90])
add_line([sys,'/','ENGINE/FUEL'],[65,105;105,105;105,295;215,295])
add_line([sys,'/','ENGINE/FUEL'],[65,65;135,65])
add_line([sys,'/','ENGINE/FUEL'],[530,105;615,105])
add_line([sys,'/','ENGINE/FUEL'],[65,315;215,315])
add_line([sys,'/','ENGINE/FUEL'],[130,335;215,335])
add_line([sys,'/','ENGINE/FUEL'],[105,115;135,115])
add_line([sys,'/','ENGINE/FUEL'],[580,305;615,305;615,185;445,185;445,115;490,115])
add_line([sys,'/','ENGINE/FUEL'],[385,90;385,160;180,160;180,275;215,275])


%     Finished composite block 'ENGINE/FUEL'.

set_param([sys,'/','ENGINE/FUEL'],...
		'Drop Shadow',4,...
		'position',[270,26,300,169])


%     Subsystem  'ENGINE/TORQUE'.

new_system([sys,'/','ENGINE/TORQUE'])
set_param([sys,'/','ENGINE/TORQUE'],'Location',[0,38,784,556])

add_block('built-in/Inport',[sys,'/',['ENGINE/TORQUE/m''ao']])
set_param([sys,'/',['ENGINE/TORQUE/m''ao']],...
		'position',[60,90,80,110])

add_block('built-in/Inport',[sys,'/',['ENGINE/TORQUE/m''fi']])
set_param([sys,'/',['ENGINE/TORQUE/m''fi']],...
		'Port','2',...
		'position',[105,130,125,150])

add_block('built-in/Inport',[sys,'/','ENGINE/TORQUE/SA'])
set_param([sys,'/','ENGINE/TORQUE/SA'],...
		'Port','4',...
		'position',[105,210,125,230])

add_block('built-in/Inport',[sys,'/','ENGINE/TORQUE/MTB'])
set_param([sys,'/','ENGINE/TORQUE/MTB'],...
		'Port','5',...
		'position',[165,250,185,270])

add_block('built-in/Inport',[sys,'/','ENGINE/TORQUE/Ct'])
set_param([sys,'/','ENGINE/TORQUE/Ct'],...
		'Port','3',...
		'position',[60,170,80,190])


%     Subsystem  'ENGINE/TORQUE/torque_1'.

new_system([sys,'/','ENGINE/TORQUE/torque_1'])
set_param([sys,'/','ENGINE/TORQUE/torque_1'],'Location',[4,42,788,560])

add_block('built-in/Mux',[sys,'/','ENGINE/TORQUE/torque_1/Mux2'])
set_param([sys,'/','ENGINE/TORQUE/torque_1/Mux2'],...
		'inputs','2',...
		'position',[110,259,135,361])

add_block('built-in/Variable Transport Delay',[sys,'/',['ENGINE/TORQUE/torque_1/Variable',13,'Transport Delay1']])
set_param([sys,'/',['ENGINE/TORQUE/torque_1/Variable',13,'Transport Delay1']],...
		'Maximum delay:','10',...
		'Initial Input','0.014',...
		'Maximum points:','6000',...
		'position',[480,282,520,313])

add_block('built-in/Variable Transport Delay',[sys,'/',['ENGINE/TORQUE/torque_1/Variable',13,'Transport Delay2']])
set_param([sys,'/',['ENGINE/TORQUE/torque_1/Variable',13,'Transport Delay2']],...
		'Maximum delay:','10',...
		'Initial Input','0.5',...
		'Maximum points:','6000',...
		'position',[485,167,525,198])

add_block('built-in/Variable Transport Delay',[sys,'/',['ENGINE/TORQUE/torque_1/Variable',13,'Transport Delay']])
set_param([sys,'/',['ENGINE/TORQUE/torque_1/Variable',13,'Transport Delay']],...
		'Maximum delay:','10',...
		'Initial Input','100',...
		'Maximum points:','6000',...
		'position',[375,37,415,68])

add_block('built-in/Inport',[sys,'/',['ENGINE/TORQUE/torque_1/m''ao']])
set_param([sys,'/',['ENGINE/TORQUE/torque_1/m''ao']],...
		'Port','2',...
		'position',[60,145,80,165])

add_block('built-in/Inport',[sys,'/',['ENGINE/TORQUE/torque_1/m''fi']])
set_param([sys,'/',['ENGINE/TORQUE/torque_1/m''fi']],...
		'Port','3',...
		'position',[60,185,80,205])

add_block('built-in/Inport',[sys,'/','ENGINE/TORQUE/torque_1/SA'])
set_param([sys,'/','ENGINE/TORQUE/torque_1/SA'],...
		'Port','5',...
		'position',[60,275,80,295])

add_block('built-in/Inport',[sys,'/','ENGINE/TORQUE/torque_1/MTB'])
set_param([sys,'/','ENGINE/TORQUE/torque_1/MTB'],...
		'Port','6',...
		'position',[60,325,80,345])

add_block('built-in/Inport',[sys,'/','ENGINE/TORQUE/torque_1/OMEGA'])
set_param([sys,'/','ENGINE/TORQUE/torque_1/OMEGA'],...
		'position',[20,400,35,420])

add_block('built-in/Fcn',[sys,'/','ENGINE/TORQUE/torque_1/del_Tst'])
set_param([sys,'/','ENGINE/TORQUE/torque_1/del_Tst'],...
		'Expr','1.3/u[1]',...
		'position',[170,374,280,396])

add_block('built-in/Fcn',[sys,'/','ENGINE/TORQUE/torque_1/SI'])
set_param([sys,'/','ENGINE/TORQUE/torque_1/SI'],...
		'Expr','(cos(u[1] - u[2]))^2.875',...
		'position',[170,299,365,321])

add_block('built-in/Fcn',[sys,'/','ENGINE/TORQUE/torque_1/del_Tit'])
set_param([sys,'/','ENGINE/TORQUE/torque_1/del_Tit'],...
		'Expr','5.48/u[1]',...
		'position',[140,87,220,113])

add_block('built-in/Variable Transport Delay',[sys,'/',['ENGINE/TORQUE/torque_1/Variable',13,'Transport Delay3']])
set_param([sys,'/',['ENGINE/TORQUE/torque_1/Variable',13,'Transport Delay3']],...
		'Maximum delay:','10',...
		'Initial Input','1',...
		'Maximum points:','6000',...
		'position',[400,362,440,393])

add_block('built-in/Mux',[sys,'/','ENGINE/TORQUE/torque_1/Mux'])
set_param([sys,'/','ENGINE/TORQUE/torque_1/Mux'],...
		'orientation',1,...
		'inputs','5',...
		'position',[461,495,669,525])

add_block('built-in/Inport',[sys,'/','ENGINE/TORQUE/torque_1/Ct'])
set_param([sys,'/','ENGINE/TORQUE/torque_1/Ct'],...
		'Port','4',...
		'position',[400,440,420,460])

add_block('built-in/Outport',[sys,'/','ENGINE/TORQUE/torque_1/out_1'])
set_param([sys,'/','ENGINE/TORQUE/torque_1/out_1'],...
		'position',[620,570,640,590])

add_block('built-in/Fcn',[sys,'/','ENGINE/TORQUE/torque_1/AFI'])
set_param([sys,'/','ENGINE/TORQUE/torque_1/AFI'],...
		'Expr','cos(0.12886464*( u[1]/u[2] - 13.5))',...
		'position',[165,162,415,188])

add_block('built-in/Mux',[sys,'/','ENGINE/TORQUE/torque_1/Mux1'])
set_param([sys,'/','ENGINE/TORQUE/torque_1/Mux1'],...
		'inputs','2',...
		'position',[120,135,145,215])

add_block('built-in/Relational Operator',[sys,'/',['ENGINE/TORQUE/torque_1/Relational',13,'Operator']])
set_param([sys,'/',['ENGINE/TORQUE/torque_1/Relational',13,'Operator']],...
		'Operator','<',...
		'position',[605,173,640,222])

add_block('built-in/Constant',[sys,'/','ENGINE/TORQUE/torque_1/Constant'])
set_param([sys,'/','ENGINE/TORQUE/torque_1/Constant'],...
		'Value','0',...
		'position',[530,240,550,260])

add_block('built-in/Switch',[sys,'/','ENGINE/TORQUE/torque_1/Switch'])
set_param([sys,'/','ENGINE/TORQUE/torque_1/Switch'],...
		'Threshold','0.5',...
		'position',[690,179,725,221])
add_line([sys,'/','ENGINE/TORQUE/torque_1'],[40,410;40,45;370,45])
add_line([sys,'/','ENGINE/TORQUE/torque_1'],[40,385;165,385])
add_line([sys,'/','ENGINE/TORQUE/torque_1'],[40,100;135,100])
add_line([sys,'/','ENGINE/TORQUE/torque_1'],[285,385;395,385])
add_line([sys,'/','ENGINE/TORQUE/torque_1'],[420,175;480,175])
add_line([sys,'/','ENGINE/TORQUE/torque_1'],[140,310;165,310])
add_line([sys,'/','ENGINE/TORQUE/torque_1'],[150,175;160,175])
add_line([sys,'/','ENGINE/TORQUE/torque_1'],[225,100;285,100;285,60;370,60])
add_line([sys,'/','ENGINE/TORQUE/torque_1'],[325,60;325,130;435,130;435,305;475,305])
add_line([sys,'/','ENGINE/TORQUE/torque_1'],[435,190;480,190])
add_line([sys,'/','ENGINE/TORQUE/torque_1'],[85,155;115,155])
add_line([sys,'/','ENGINE/TORQUE/torque_1'],[85,195;115,195])
add_line([sys,'/','ENGINE/TORQUE/torque_1'],[85,285;105,285])
add_line([sys,'/','ENGINE/TORQUE/torque_1'],[85,335;105,335])
add_line([sys,'/','ENGINE/TORQUE/torque_1'],[445,380;645,380;645,490])
add_line([sys,'/','ENGINE/TORQUE/torque_1'],[85,155;85,245;275,245;275,290;475,290])
add_line([sys,'/','ENGINE/TORQUE/torque_1'],[525,300;605,300;605,490])
add_line([sys,'/','ENGINE/TORQUE/torque_1'],[370,310;370,370;395,370])
add_line([sys,'/','ENGINE/TORQUE/torque_1'],[425,450;565,450;565,490])
add_line([sys,'/','ENGINE/TORQUE/torque_1'],[420,55;450,55;450,355;485,355;485,490])
add_line([sys,'/','ENGINE/TORQUE/torque_1'],[565,530;565,580;615,580])
add_line([sys,'/','ENGINE/TORQUE/torque_1'],[530,185;600,185])
add_line([sys,'/','ENGINE/TORQUE/torque_1'],[555,250;580,250;580,145;665,145;665,185;685,185])
add_line([sys,'/','ENGINE/TORQUE/torque_1'],[580,210;600,210])
add_line([sys,'/','ENGINE/TORQUE/torque_1'],[645,200;685,200])
add_line([sys,'/','ENGINE/TORQUE/torque_1'],[575,185;575,275;665,275;665,215;685,215])
add_line([sys,'/','ENGINE/TORQUE/torque_1'],[730,200;755,200;755,415;525,415;525,490])


%     Finished composite block 'ENGINE/TORQUE/torque_1'.

set_param([sys,'/','ENGINE/TORQUE/torque_1'],...
		'Drop Shadow',4,...
		'position',[220,39,260,281])


%     Subsystem  'ENGINE/TORQUE/torque_2'.

new_system([sys,'/','ENGINE/TORQUE/torque_2'])
set_param([sys,'/','ENGINE/TORQUE/torque_2'],'Location',[4,42,788,560])

add_block('built-in/Outport',[sys,'/','ENGINE/TORQUE/torque_2/torque'])
set_param([sys,'/','ENGINE/TORQUE/torque_2/torque'],...
		'Port','2',...
		'position',[610,305,630,325])

add_block('built-in/Fcn',[sys,'/','ENGINE/TORQUE/torque_2/Ti'])
set_param([sys,'/','ENGINE/TORQUE/torque_2/Ti'],...
		'Expr','u[3]*u[4]*u[2]*u[5]/u[1]',...
		'position',[90,340,300,370])

add_block('built-in/Mux',[sys,'/','ENGINE/TORQUE/torque_2/Mux3'])
set_param([sys,'/','ENGINE/TORQUE/torque_2/Mux3'],...
		'inputs','2',...
		'position',[160,50,195,85])

add_block('built-in/Sum',[sys,'/','ENGINE/TORQUE/torque_2/Sum'])
set_param([sys,'/','ENGINE/TORQUE/torque_2/Sum'],...
		'inputs','+-+',...
		'position',[215,130,245,170])

add_block('built-in/Inport',[sys,'/',['ENGINE/TORQUE/torque_2/external',13,'torque']])
set_param([sys,'/',['ENGINE/TORQUE/torque_2/external',13,'torque']],...
		'Port','3',...
		'position',[30,155,50,175])

add_block('built-in/Inport',[sys,'/','ENGINE/TORQUE/torque_2/in_1'])
set_param([sys,'/','ENGINE/TORQUE/torque_2/in_1'],...
		'position',[30,345,50,365])

add_block('built-in/Integrator',[sys,'/','ENGINE/TORQUE/torque_2/Integrator'])
set_param([sys,'/','ENGINE/TORQUE/torque_2/Integrator'],...
		'Initial','100',...
		'position',[495,60,515,80])

add_block('built-in/Inport',[sys,'/','ENGINE/TORQUE/torque_2/inertia'])
set_param([sys,'/','ENGINE/TORQUE/torque_2/inertia'],...
		'Port','2',...
		'position',[35,50,55,70])

add_block('built-in/Fcn',[sys,'/','ENGINE/TORQUE/torque_2/aceleration'])
set_param([sys,'/','ENGINE/TORQUE/torque_2/aceleration'],...
		'Expr','u[2]/u[1]',...
		'position',[295,60,375,80])

add_block('built-in/Outport',[sys,'/','ENGINE/TORQUE/torque_2/out_3'])
set_param([sys,'/','ENGINE/TORQUE/torque_2/out_3'],...
		'Port','3',...
		'position',[610,145,630,165])

add_block('built-in/Fcn',[sys,'/','ENGINE/TORQUE/torque_2/Tf'])
set_param([sys,'/','ENGINE/TORQUE/torque_2/Tf'],...
		'orientation',2,...
		'Expr','0.1056*u[1] + 15.1',...
		'position',[215,225,375,245])

add_block('built-in/Outport',[sys,'/','ENGINE/TORQUE/torque_2/OMEGA'])
set_param([sys,'/','ENGINE/TORQUE/torque_2/OMEGA'],...
		'position',[605,60,625,80])
add_line([sys,'/','ENGINE/TORQUE/torque_2'],[55,355;85,355])
add_line([sys,'/','ENGINE/TORQUE/torque_2'],[55,165;210,165])
add_line([sys,'/','ENGINE/TORQUE/torque_2'],[520,70;600,70])
add_line([sys,'/','ENGINE/TORQUE/torque_2'],[200,70;290,70])
add_line([sys,'/','ENGINE/TORQUE/torque_2'],[305,355;325,355;325,305;110,305;110,135;210,135])
add_line([sys,'/','ENGINE/TORQUE/torque_2'],[325,315;605,315])
add_line([sys,'/','ENGINE/TORQUE/torque_2'],[380,70;490,70])
add_line([sys,'/','ENGINE/TORQUE/torque_2'],[60,60;155,60])
add_line([sys,'/','ENGINE/TORQUE/torque_2'],[250,150;270,150;270,105;120,105;120,75;155,75])
add_line([sys,'/','ENGINE/TORQUE/torque_2'],[425,70;425,155;605,155])
add_line([sys,'/','ENGINE/TORQUE/torque_2'],[555,70;555,235;380,235])
add_line([sys,'/','ENGINE/TORQUE/torque_2'],[210,235;175,235;175,150;210,150])


%     Finished composite block 'ENGINE/TORQUE/torque_2'.

set_param([sys,'/','ENGINE/TORQUE/torque_2'],...
		'Drop Shadow',4,...
		'position',[215,356,255,494])

add_block('built-in/Inport',[sys,'/','ENGINE/TORQUE/inertia '])
set_param([sys,'/','ENGINE/TORQUE/inertia '],...
		'Port','6',...
		'position',[60,415,80,435])

add_block('built-in/Inport',[sys,'/',['ENGINE/TORQUE/external',13,'torque']])
set_param([sys,'/',['ENGINE/TORQUE/external',13,'torque']],...
		'Port','7',...
		'position',[55,460,75,480])

add_block('built-in/Outport',[sys,'/','ENGINE/TORQUE/OMEGA'])
set_param([sys,'/','ENGINE/TORQUE/OMEGA'],...
		'position',[455,370,475,390])

add_block('built-in/Outport',[sys,'/','ENGINE/TORQUE/Outport1'])
set_param([sys,'/','ENGINE/TORQUE/Outport1'],...
		'Port','3',...
		'position',[405,415,425,435])

add_block('built-in/Outport',[sys,'/','ENGINE/TORQUE/Ti'])
set_param([sys,'/','ENGINE/TORQUE/Ti'],...
		'Port','2',...
		'position',[385,460,405,480])
add_line([sys,'/','ENGINE/TORQUE'],[85,100;215,100])
add_line([sys,'/','ENGINE/TORQUE'],[85,180;215,180])
add_line([sys,'/','ENGINE/TORQUE'],[130,220;215,220])
add_line([sys,'/','ENGINE/TORQUE'],[260,425;400,425])
add_line([sys,'/','ENGINE/TORQUE'],[130,140;215,140])
add_line([sys,'/','ENGINE/TORQUE'],[190,260;215,260])
add_line([sys,'/','ENGINE/TORQUE'],[85,425;210,425])
add_line([sys,'/','ENGINE/TORQUE'],[260,470;380,470])
add_line([sys,'/','ENGINE/TORQUE'],[80,470;210,470])
add_line([sys,'/','ENGINE/TORQUE'],[260,380;450,380])
add_line([sys,'/','ENGINE/TORQUE'],[410,380;410,25;190,25;190,60;215,60])
add_line([sys,'/','ENGINE/TORQUE'],[265,160;295,160;295,315;180,315;180,380;210,380])


%     Finished composite block 'ENGINE/TORQUE'.

set_param([sys,'/','ENGINE/TORQUE'],...
		'Drop Shadow',4,...
		'position',[600,91,625,339])

add_block('built-in/Inport',[sys,'/','ENGINE/BETA'])
set_param([sys,'/','ENGINE/BETA'],...
		'position',[30,70,50,90])

add_block('built-in/Inport',[sys,'/','ENGINE/MAX_'])
set_param([sys,'/','ENGINE/MAX_'],...
		'Port','2',...
		'position',[30,140,50,160])


%     Subsystem  'ENGINE/AIR'.

new_system([sys,'/','ENGINE/AIR'])
set_param([sys,'/','ENGINE/AIR'],'Location',[4,42,792,592])

add_block('built-in/Outport',[sys,'/',['ENGINE/AIR/m''ao']])
set_param([sys,'/',['ENGINE/AIR/m''ao']],...
		'Port','2',...
		'position',[600,170,620,190])


%     Subsystem  'ENGINE/AIR/air_3'.

new_system([sys,'/','ENGINE/AIR/air_3'])
set_param([sys,'/','ENGINE/AIR/air_3'],'Location',[4,42,792,592])

add_block('built-in/Inport',[sys,'/','ENGINE/AIR/air_3/Ma'])
set_param([sys,'/','ENGINE/AIR/air_3/Ma'],...
		'position',[30,145,50,165])

add_block('built-in/Mux',[sys,'/','ENGINE/AIR/air_3/Mux3'])
set_param([sys,'/','ENGINE/AIR/air_3/Mux3'],...
		'inputs','2',...
		'position',[290,257,320,308])

add_block('built-in/Gain',[sys,'/','ENGINE/AIR/air_3/Gain'])
set_param([sys,'/','ENGINE/AIR/air_3/Gain'],...
		'Gain','4*pi',...
		'position',[115,253,195,287])

add_block('built-in/Inport',[sys,'/','ENGINE/AIR/air_3/Ve'])
set_param([sys,'/','ENGINE/AIR/air_3/Ve'],...
		'Port','4',...
		'position',[205,285,225,305])

add_block('built-in/Fcn',[sys,'/','ENGINE/AIR/air_3/C1'])
set_param([sys,'/','ENGINE/AIR/air_3/C1'],...
		'Expr','u[2]/u[1]',...
		'position',[345,274,455,296])

add_block('built-in/Inport',[sys,'/','ENGINE/AIR/air_3/OMEGA'])
set_param([sys,'/','ENGINE/AIR/air_3/OMEGA'],...
		'Port','2',...
		'position',[30,180,50,200])

add_block('built-in/Inport',[sys,'/','ENGINE/AIR/air_3/Vm'])
set_param([sys,'/','ENGINE/AIR/air_3/Vm'],...
		'Port','3',...
		'position',[30,260,50,280])

add_block('built-in/Mux',[sys,'/','ENGINE/AIR/air_3/Mux2'])
set_param([sys,'/','ENGINE/AIR/air_3/Mux2'],...
		'inputs','2',...
		'position',[90,138,115,207])

add_block('built-in/Fcn',[sys,'/','ENGINE/AIR/air_3/NUvol'])
set_param([sys,'/','ENGINE/AIR/air_3/NUvol'],...
		'Expr','(24.5*u[2] - 31000)*u[1]*u[1]+(-0.167*u[2]+222)*u[1]+(0.00081*u[2]+0.352)',...
		'position',[140,151,575,199])

add_block('built-in/Product',[sys,'/','ENGINE/AIR/air_3/Product4'])
set_param([sys,'/','ENGINE/AIR/air_3/Product4'],...
		'inputs','4',...
		'position',[630,203,660,277])

add_block('built-in/Outport',[sys,'/',['ENGINE/AIR/air_3/m''ao']])
set_param([sys,'/',['ENGINE/AIR/air_3/m''ao']],...
		'position',[690,230,710,250])
add_line([sys,'/','ENGINE/AIR/air_3'],[55,190;85,190])
add_line([sys,'/','ENGINE/AIR/air_3'],[55,155;85,155])
add_line([sys,'/','ENGINE/AIR/air_3'],[120,175;135,175])
add_line([sys,'/','ENGINE/AIR/air_3'],[200,270;285,270])
add_line([sys,'/','ENGINE/AIR/air_3'],[325,285;340,285])
add_line([sys,'/','ENGINE/AIR/air_3'],[665,240;685,240])
add_line([sys,'/','ENGINE/AIR/air_3'],[55,270;110,270])
add_line([sys,'/','ENGINE/AIR/air_3'],[230,295;285,295])
add_line([sys,'/','ENGINE/AIR/air_3'],[460,285;520,285;520,270;625,270])
add_line([sys,'/','ENGINE/AIR/air_3'],[65,190;65,225;250,225;250,250;625,250])
add_line([sys,'/','ENGINE/AIR/air_3'],[580,175;585,175;585,230;625,230])
add_line([sys,'/','ENGINE/AIR/air_3'],[70,155;70,125;600,125;600,210;625,210])


%     Finished composite block 'ENGINE/AIR/air_3'.

set_param([sys,'/','ENGINE/AIR/air_3'],...
		'Drop Shadow',4,...
		'position',[495,84,520,271])

add_block('built-in/Inport',[sys,'/','ENGINE/AIR/Ve'])
set_param([sys,'/','ENGINE/AIR/Ve'],...
		'Port','6',...
		'position',[325,235,345,255])

add_block('built-in/Inport',[sys,'/','ENGINE/AIR/OMEGA'])
set_param([sys,'/','ENGINE/AIR/OMEGA'],...
		'Port','3',...
		'position',[325,145,345,165])

add_block('built-in/Outport',[sys,'/','ENGINE/AIR/ma'])
set_param([sys,'/','ENGINE/AIR/ma'],...
		'Port','3',...
		'position',[460,410,480,430])

add_block('built-in/Integrator',[sys,'/','ENGINE/AIR/Integrator'])
set_param([sys,'/','ENGINE/AIR/Integrator'],...
		'Initial','0.0047',...
		'position',[370,360,390,380])

add_block('built-in/Inport',[sys,'/','ENGINE/AIR/Patm'])
set_param([sys,'/','ENGINE/AIR/Patm'],...
		'Port','9',...
		'position',[25,395,45,415])

add_block('built-in/Inport',[sys,'/','ENGINE/AIR/ALFA'])
set_param([sys,'/','ENGINE/AIR/ALFA'],...
		'Port','8',...
		'position',[35,350,55,370])

add_block('built-in/Sum',[sys,'/','ENGINE/AIR/Sum'])
set_param([sys,'/','ENGINE/AIR/Sum'],...
		'inputs','-+',...
		'position',[280,341,305,399])

add_block('built-in/Outport',[sys,'/',['ENGINE/AIR/m''ai']])
set_param([sys,'/',['ENGINE/AIR/m''ai']],...
		'Port','4',...
		'position',[195,340,215,360])

add_block('built-in/Inport',[sys,'/','ENGINE/AIR/MAX'])
set_param([sys,'/','ENGINE/AIR/MAX'],...
		'Port','7',...
		'position',[25,305,45,325])


%     Subsystem  'ENGINE/AIR/air_1'.

new_system([sys,'/','ENGINE/AIR/air_1'])
set_param([sys,'/','ENGINE/AIR/air_1'],'Location',[4,42,787,592])

add_block('built-in/Inport',[sys,'/','ENGINE/AIR/air_1/Pm'])
set_param([sys,'/','ENGINE/AIR/air_1/Pm'],...
		'Port','4',...
		'position',[40,380,60,400])

add_block('built-in/Inport',[sys,'/','ENGINE/AIR/air_1/Patm'])
set_param([sys,'/','ENGINE/AIR/air_1/Patm'],...
		'Port','3',...
		'position',[40,335,60,355])

add_block('built-in/Mux',[sys,'/','ENGINE/AIR/air_1/Mux'])
set_param([sys,'/','ENGINE/AIR/air_1/Mux'],...
		'inputs','2',...
		'position',[220,324,255,411])

add_block('built-in/Fcn',[sys,'/','ENGINE/AIR/air_1/Fcn_'])
set_param([sys,'/','ENGINE/AIR/air_1/Fcn_'],...
		'Expr','1-cos(1.14459*u[1] - 0.0185)',...
		'position',[170,119,400,151])

add_block('built-in/Relational Operator',[sys,'/',['ENGINE/AIR/air_1/Relational',13,'Operator']])
set_param([sys,'/',['ENGINE/AIR/air_1/Relational',13,'Operator']],...
		'Operator','<',...
		'position',[170,231,210,269])

add_block('built-in/Inport',[sys,'/','ENGINE/AIR/air_1/ALFA'])
set_param([sys,'/','ENGINE/AIR/air_1/ALFA'],...
		'Port','2',...
		'position',[25,125,45,145])

add_block('built-in/Fcn',[sys,'/','ENGINE/AIR/air_1/Fcn'])
set_param([sys,'/','ENGINE/AIR/air_1/Fcn'],...
		'Expr','1-exp(9*(u[2]/u[1] - 1))',...
		'position',[310,357,475,383])

add_block('built-in/Constant',[sys,'/','ENGINE/AIR/air_1/79.46 graus'])
set_param([sys,'/','ENGINE/AIR/air_1/79.46 graus'],...
		'Value','1.3868',...
		'position',[40,249,100,271])

add_block('built-in/Switch',[sys,'/','ENGINE/AIR/air_1/Switch'])
set_param([sys,'/','ENGINE/AIR/air_1/Switch'],...
		'Threshold','0.5',...
		'position',[445,211,470,289])

add_block('built-in/Constant',[sys,'/','ENGINE/AIR/air_1/Constant'])
set_param([sys,'/','ENGINE/AIR/air_1/Constant'],...
		'position',[290,265,310,285])

add_block('built-in/Note',[sys,'/','ENGINE/AIR/air_1/PRI'])
set_param([sys,'/','ENGINE/AIR/air_1/PRI'],...
		'position',[504,340,509,345])

add_block('built-in/Inport',[sys,'/','ENGINE/AIR/air_1/MAX'])
set_param([sys,'/','ENGINE/AIR/air_1/MAX'],...
		'position',[25,70,45,90])

add_block('built-in/Product',[sys,'/','ENGINE/AIR/air_1/Product'])
set_param([sys,'/','ENGINE/AIR/air_1/Product'],...
		'inputs','3',...
		'position',[590,70,620,140])

add_block('built-in/Outport',[sys,'/',['ENGINE/AIR/air_1/m''ai']])
set_param([sys,'/',['ENGINE/AIR/air_1/m''ai']],...
		'position',[675,95,695,115])
add_line([sys,'/','ENGINE/AIR/air_1'],[475,250;545,250;545,105;585,105])
add_line([sys,'/','ENGINE/AIR/air_1'],[315,275;440,275])
add_line([sys,'/','ENGINE/AIR/air_1'],[215,250;440,250])
add_line([sys,'/','ENGINE/AIR/air_1'],[105,260;165,260])
add_line([sys,'/','ENGINE/AIR/air_1'],[260,370;305,370])
add_line([sys,'/','ENGINE/AIR/air_1'],[50,80;585,80])
add_line([sys,'/','ENGINE/AIR/air_1'],[625,105;670,105])
add_line([sys,'/','ENGINE/AIR/air_1'],[65,390;215,390])
add_line([sys,'/','ENGINE/AIR/air_1'],[65,345;215,345])
add_line([sys,'/','ENGINE/AIR/air_1'],[50,135;165,135])
add_line([sys,'/','ENGINE/AIR/air_1'],[405,135;415,135;415,225;440,225])
add_line([sys,'/','ENGINE/AIR/air_1'],[135,135;135,240;165,240])
add_line([sys,'/','ENGINE/AIR/air_1'],[480,370;555,370;555,130;585,130])


%     Finished composite block 'ENGINE/AIR/air_1'.

set_param([sys,'/','ENGINE/AIR/air_1'],...
		'Drop Shadow',4,...
		'position',[130,287,160,478])

add_block('built-in/Outport',[sys,'/','ENGINE/AIR/Pm'])
set_param([sys,'/','ENGINE/AIR/Pm'],...
		'position',[220,70,240,90])

add_block('built-in/Inport',[sys,'/','ENGINE/AIR/Vm'])
set_param([sys,'/','ENGINE/AIR/Vm'],...
		'Port','5',...
		'position',[20,195,40,215])

add_block('built-in/Inport',[sys,'/','ENGINE/AIR/Ma'])
set_param([sys,'/','ENGINE/AIR/Ma'],...
		'Port','4',...
		'position',[20,155,40,175])

add_block('built-in/Inport',[sys,'/','ENGINE/AIR/Tm'])
set_param([sys,'/','ENGINE/AIR/Tm'],...
		'Port','2',...
		'position',[20,115,40,135])

add_block('built-in/Inport',[sys,'/','ENGINE/AIR/R'])
set_param([sys,'/','ENGINE/AIR/R'],...
		'position',[25,75,45,95])


%     Subsystem  'ENGINE/AIR/air_2'.

new_system([sys,'/','ENGINE/AIR/air_2'])
set_param([sys,'/','ENGINE/AIR/air_2'],'Location',[4,127,792,482])

add_block('built-in/Mux',[sys,'/','ENGINE/AIR/air_2/Mux1'])
set_param([sys,'/','ENGINE/AIR/air_2/Mux1'],...
		'inputs','2',...
		'position',[310,56,340,89])

add_block('built-in/Inport',[sys,'/','ENGINE/AIR/air_2/Vm'])
set_param([sys,'/','ENGINE/AIR/air_2/Vm'],...
		'Port','5',...
		'position',[80,155,100,175])

add_block('built-in/Inport',[sys,'/','ENGINE/AIR/air_2/Ma'])
set_param([sys,'/','ENGINE/AIR/air_2/Ma'],...
		'Port','4',...
		'position',[45,135,65,155])

add_block('built-in/Inport',[sys,'/','ENGINE/AIR/air_2/ma'])
set_param([sys,'/','ENGINE/AIR/air_2/ma'],...
		'position',[70,25,90,45])

add_block('built-in/Inport',[sys,'/','ENGINE/AIR/air_2/R'])
set_param([sys,'/','ENGINE/AIR/air_2/R'],...
		'Port','2',...
		'position',[20,55,40,75])

add_block('built-in/Inport',[sys,'/','ENGINE/AIR/air_2/Tm'])
set_param([sys,'/','ENGINE/AIR/air_2/Tm'],...
		'Port','3',...
		'position',[75,85,95,105])

add_block('built-in/Outport',[sys,'/','ENGINE/AIR/air_2/Pm'])
set_param([sys,'/','ENGINE/AIR/air_2/Pm'],...
		'position',[550,65,570,85])

add_block('built-in/Fcn',[sys,'/','ENGINE/AIR/air_2/Func'])
set_param([sys,'/','ENGINE/AIR/air_2/Func'],...
		'Expr','u[1]/u[2]',...
		'position',[390,64,520,86])

add_block('built-in/Product',[sys,'/','ENGINE/AIR/air_2/Product3'])
set_param([sys,'/','ENGINE/AIR/air_2/Product3'],...
		'inputs','3',...
		'position',[225,23,255,107])

add_block('built-in/Product',[sys,'/','ENGINE/AIR/air_2/Product2'])
set_param([sys,'/','ENGINE/AIR/air_2/Product2'],...
		'position',[185,133,215,177])
add_line([sys,'/','ENGINE/AIR/air_2'],[260,65;305,65])
add_line([sys,'/','ENGINE/AIR/air_2'],[345,75;385,75])
add_line([sys,'/','ENGINE/AIR/air_2'],[220,155;295,155;305,80])
add_line([sys,'/','ENGINE/AIR/air_2'],[95,35;220,35])
add_line([sys,'/','ENGINE/AIR/air_2'],[45,65;220,65])
add_line([sys,'/','ENGINE/AIR/air_2'],[525,75;545,75])
add_line([sys,'/','ENGINE/AIR/air_2'],[100,95;220,95])
add_line([sys,'/','ENGINE/AIR/air_2'],[70,145;180,145])
add_line([sys,'/','ENGINE/AIR/air_2'],[105,165;180,165])


%     Finished composite block 'ENGINE/AIR/air_2'.

set_param([sys,'/','ENGINE/AIR/air_2'],...
		'Drop Shadow',4,...
		'position',[130,26,160,224])
add_line([sys,'/','ENGINE/AIR'],[395,370;440,370;440,5;90,5;90,45;125,45])
add_line([sys,'/','ENGINE/AIR'],[165,125;215,80])
add_line([sys,'/','ENGINE/AIR'],[165,125;225,125;225,510;75,510;75,450;125,450])
add_line([sys,'/','ENGINE/AIR'],[310,370;365,370])
add_line([sys,'/','ENGINE/AIR'],[165,385;275,385])
add_line([sys,'/','ENGINE/AIR'],[50,85;125,85])
add_line([sys,'/','ENGINE/AIR'],[45,125;125,125])
add_line([sys,'/','ENGINE/AIR'],[350,155;490,155])
add_line([sys,'/','ENGINE/AIR'],[525,180;595,180])
add_line([sys,'/','ENGINE/AIR'],[45,165;125,165])
add_line([sys,'/','ENGINE/AIR'],[165,385;190,350])
add_line([sys,'/','ENGINE/AIR'],[45,205;125,205])
add_line([sys,'/','ENGINE/AIR'],[95,205;95,260;290,260;290,200;490,200])
add_line([sys,'/','ENGINE/AIR'],[350,245;490,245])
add_line([sys,'/','ENGINE/AIR'],[50,315;125,315])
add_line([sys,'/','ENGINE/AIR'],[440,110;490,110])
add_line([sys,'/','ENGINE/AIR'],[60,360;125,360])
add_line([sys,'/','ENGINE/AIR'],[50,405;125,405])
add_line([sys,'/','ENGINE/AIR'],[415,370;415,420;455,420])
add_line([sys,'/','ENGINE/AIR'],[550,180;550,320;255,320;255,355;275,355])


%     Finished composite block 'ENGINE/AIR'.

set_param([sys,'/','ENGINE/AIR'],...
		'Drop Shadow',4,...
		'position',[260,201,295,489])

add_block('built-in/Inport',[sys,'/','ENGINE/R'])
set_param([sys,'/','ENGINE/R'],...
		'Port','7',...
		'position',[35,215,55,235])

add_block('built-in/Inport',[sys,'/','ENGINE/Tm'])
set_param([sys,'/','ENGINE/Tm'],...
		'Port','8',...
		'position',[75,245,95,265])

add_block('built-in/Inport',[sys,'/','ENGINE/Mair'])
set_param([sys,'/','ENGINE/Mair'],...
		'Port','9',...
		'position',[40,305,60,325])

add_block('built-in/Inport',[sys,'/','ENGINE/Vm'])
set_param([sys,'/','ENGINE/Vm'],...
		'Port','10',...
		'position',[80,335,100,355])

add_block('built-in/Inport',[sys,'/','ENGINE/Ve'])
set_param([sys,'/','ENGINE/Ve'],...
		'Port','11',...
		'position',[35,365,55,385])

add_block('built-in/Inport',[sys,'/','ENGINE/ALFA'])
set_param([sys,'/','ENGINE/ALFA'],...
		'Port','12',...
		'position',[45,425,65,445])

add_block('built-in/Inport',[sys,'/','ENGINE/Patm'])
set_param([sys,'/','ENGINE/Patm'],...
		'Port','13',...
		'position',[90,455,110,475])

add_block('built-in/Outport',[sys,'/','ENGINE/Pm'])
set_param([sys,'/','ENGINE/Pm'],...
		'Port','2',...
		'position',[330,230,350,250])

add_block('built-in/Outport',[sys,'/','ENGINE/Ma'])
set_param([sys,'/','ENGINE/Ma'],...
		'Port','4',...
		'position',[335,370,355,390])

add_block('built-in/Outport',[sys,'/',['ENGINE/M''ai']])
set_param([sys,'/',['ENGINE/M''ai']],...
		'Port','5',...
		'position',[415,470,435,490])

add_block('built-in/Inport',[sys,'/','ENGINE/SA'])
set_param([sys,'/','ENGINE/SA'],...
		'Port','4',...
		'position',[450,205,470,225])

add_block('built-in/Inport',[sys,'/','ENGINE/MTB'])
set_param([sys,'/','ENGINE/MTB'],...
		'Port','5',...
		'position',[415,240,435,260])

add_block('built-in/Inport',[sys,'/','ENGINE/Ie'])
set_param([sys,'/','ENGINE/Ie'],...
		'Port','6',...
		'position',[470,275,490,295])

add_block('built-in/Outport',[sys,'/','ENGINE/aceleration'])
set_param([sys,'/','ENGINE/aceleration'],...
		'Port','6',...
		'position',[690,205,710,225])

add_block('built-in/Outport',[sys,'/','ENGINE/Ti'])
set_param([sys,'/','ENGINE/Ti'],...
		'Port','7',...
		'position',[690,285,710,305])

add_block('built-in/Outport',[sys,'/',['ENGINE/M''ao']])
set_param([sys,'/',['ENGINE/M''ao']],...
		'Port','3',...
		'position',[340,320,360,340])

add_block('built-in/Inport',[sys,'/',['ENGINE/extern',13,'torque']])
set_param([sys,'/',['ENGINE/extern',13,'torque']],...
		'Port','14',...
		'position',[435,310,455,330])

add_block('built-in/Outport',[sys,'/',['ENGINE/M''fi']])
set_param([sys,'/',['ENGINE/M''fi']],...
		'position',[580,45,600,65])

add_block('built-in/Outport',[sys,'/','ENGINE/OMEGAe'])
set_param([sys,'/','ENGINE/OMEGAe'],...
		'Port','8',...
		'position',[680,125,700,145])

add_block('built-in/Inport',[sys,'/','ENGINE/Ct'])
set_param([sys,'/','ENGINE/Ct'],...
		'Port','3',...
		'position',[420,170,440,190])
add_line([sys,'/','ENGINE'],[305,100;440,100;440,145;595,145])
add_line([sys,'/','ENGINE'],[105,345;255,345])
add_line([sys,'/','ENGINE'],[55,80;265,80])
add_line([sys,'/','ENGINE'],[305,100;495,100;495,55;575,55])
add_line([sys,'/','ENGINE'],[55,150;265,150])
add_line([sys,'/','ENGINE'],[445,180;595,180])
add_line([sys,'/','ENGINE'],[475,215;595,215])
add_line([sys,'/','ENGINE'],[440,250;595,250])
add_line([sys,'/','ENGINE'],[495,285;595,285])
add_line([sys,'/','ENGINE'],[60,225;255,225])
add_line([sys,'/','ENGINE'],[100,255;255,255])
add_line([sys,'/','ENGINE'],[65,315;255,315])
add_line([sys,'/','ENGINE'],[460,320;595,320])
add_line([sys,'/','ENGINE'],[630,295;685,295])
add_line([sys,'/','ENGINE'],[300,450;365,450;365,510;140,510;140,45;265,45])
add_line([sys,'/','ENGINE'],[300,240;325,240])
add_line([sys,'/','ENGINE'],[300,380;330,380])
add_line([sys,'/','ENGINE'],[630,215;685,215])
add_line([sys,'/','ENGINE'],[60,375;255,375])
add_line([sys,'/','ENGINE'],[120,150;120,405;255,405])
add_line([sys,'/','ENGINE'],[70,435;255,435])
add_line([sys,'/','ENGINE'],[115,465;255,465])
add_line([sys,'/','ENGINE'],[630,135;675,135])
add_line([sys,'/','ENGINE'],[365,480;410,480])
add_line([sys,'/','ENGINE'],[300,310;320,310;320,330;335,330])
add_line([sys,'/','ENGINE'],[320,310;380,310;380,110;595,110])
add_line([sys,'/','ENGINE'],[645,135;645,20;215,20;215,115;265,115])
add_line([sys,'/','ENGINE'],[215,110;215,285;255,285])


%     Finished composite block 'ENGINE'.

set_param([sys,'/','ENGINE'],...
		'Drop Shadow',4,...
		'position',[365,6,415,379])

add_block('built-in/Sine Wave',[sys,'/',['extern',13,'torque']])
set_param([sys,'/',['extern',13,'torque']],...
		'amplitude','0',...
		'position',[155,337,210,373])

add_block('built-in/Constant',[sys,'/','Patm'])
set_param([sys,'/','Patm'],...
		'Value','110000',...
		'position',[50,319,145,341])


%     Subsystem  'Omega'.

new_system([sys,'/','Omega'])
set_param([sys,'/','Omega'],'Location',[0,59,274,252])

add_block('built-in/Inport',[sys,'/','Omega/x'])
set_param([sys,'/','Omega/x'],...
		'position',[65,55,85,75])

add_block('built-in/S-Function',[sys,'/',['Omega/S-function',13,'M-file which plots',13,'lines',13,'']])
set_param([sys,'/',['Omega/S-function',13,'M-file which plots',13,'lines',13,'']],...
		'function name','sfunyst',...
		'parameters','ax, color, npts, dt',...
		'position',[130,55,180,75])
add_line([sys,'/','Omega'],[90,65;125,65])
set_param([sys,'/','Omega'],...
		'Mask Display','plot(0,0,100,100,[83,76,63,52,42,38,28,16,11,84,11,11,11,90,90,11],[75,58,47,54,72,80,84,74,65,65,65,90,40,40,90,90])',...
		'Mask Type','Storage scope.')
set_param([sys,'/','Omega'],...
		'Mask Dialogue','Storage scope using MATLAB graph window.\nEnter plotting ranges and line type.|Initial Time Range:|Initial y-min:|Initial y-max:|Storage pts.:|Line type (rgbw-.:xo):')
set_param([sys,'/','Omega'],...
		'Mask Translate','npts = @4; color = @5; ax = [0, @1, @2, @3]; dt=-1;')
set_param([sys,'/','Omega'],...
		'Mask Help','This block uses a MATLAB figure window to plot the input signal.  The graph limits are automatically scaled to the min and max values of the signal stored in the scope''s signal buffer.  Line type must be in quotes.  See the M-file sfunyst.m.')
set_param([sys,'/','Omega'],...
		'Mask Entries','5\/-10\/10\/6000\/''k-/g--/c-./w:/m*/ro/b+''\/')


%     Finished composite block 'Omega'.

set_param([sys,'/','Omega'],...
		'position',[465,330,495,370])

add_block('built-in/Constant',[sys,'/','ALFA'])
set_param([sys,'/','ALFA'],...
		'position',[280,415,300,435])

add_block('built-in/Constant',[sys,'/','R'])
set_param([sys,'/','R'],...
		'Value','8314.3',...
		'position',[220,169,305,191])

add_block('built-in/Constant',[sys,'/','Ie'])
set_param([sys,'/','Ie'],...
		'Value','0.1454',...
		'position',[135,142,200,168])

add_block('built-in/Constant',[sys,'/','MTB'])
set_param([sys,'/','MTB'],...
		'position',[75,120,95,140])

add_block('built-in/Constant',[sys,'/','Tm'])
set_param([sys,'/','Tm'],...
		'Value','300',...
		'position',[160,194,235,216])
add_line(sys,[145,30;360,30])
add_line(sys,[275,55;360,55])
add_line(sys,[170,80;360,80])
add_line(sys,[240,105;360,105])
add_line(sys,[100,130;360,130])
add_line(sys,[205,155;360,155])
add_line(sys,[310,180;360,180])
add_line(sys,[240,205;360,205])
add_line(sys,[155,230;360,230])
add_line(sys,[265,255;360,255])
add_line(sys,[160,280;360,280])
add_line(sys,[150,330;360,330])
add_line(sys,[215,355;360,355])
add_line(sys,[305,425;315,425;315,305;360,305])
add_line(sys,[420,35;460,35])
add_line(sys,[420,80;460,80])
add_line(sys,[420,125;460,125])
add_line(sys,[420,170;460,170])
add_line(sys,[420,215;460,215])
add_line(sys,[420,260;455,260])
add_line(sys,[420,305;460,305])
add_line(sys,[420,350;460,350])

drawnow

% Return any arguments.
if (nargin | nargout)
	% Must use feval here to access system in memory
	if (nargin > 3)
		if (flag == 0)
			eval(['[ret,x0,str,ts,xts]=',sys,'(t,x,u,flag);'])
		else
			eval(['ret =', sys,'(t,x,u,flag);'])
		end
	else
		[ret,x0,str,ts,xts] = feval(sys);
	end
else
	drawnow % Flash up the model and execute load callback
end
