%
% Invoke this script to create the corresponding model
%

% Create the system (either model or library) and open it

new_system('F16_control','Model');
load_system('simulink');
open_system('F16_control');
set_param('F16_control','Location', [70, 200, 670, 960]);
% pause(0.1); - disabled with R2006b/7.3; causes typeahead buffer overflow

% Execute the setup script to create the data structure
% in the model workspace for clarity

mws = get_param('F16_control','modelworkspace');
if ~exist('mws')
  error('Unable to open model workspace - aborting');
end
mws.clear;
mws.evalin('F16_control_data','F16_control_setup');
clear mws;

% Create the subsystem with proper size to accomodate in/out ports

add_block('built-in/subsystem','F16_control/F16_control','Position',[210, 45, 390, 710]);

% Flesh out subsystem with internal blocks

    add_block('built-in/Constant','F16_control/F16_control/const_11','ShowName','off','Value','360.0','Position',[30,39,90,69]);
    add_block('built-in/Sum','F16_control/F16_control/minus_11','IconShape','rectangular','Inputs','+-','Position',[410,35,440,74]);
    add_block('built-in/Switch','F16_control/F16_control/switch_10','Threshold','0.5','Position',[480,27,510,81]);
    add_block('built-in/Switch','F16_control/F16_control/switch_9','Threshold','0.5','Position',[550,27,580,81]);
    add_block('built-in/Product','F16_control/F16_control/times_20','Multiplication','Element-wise(.*)','SaturateOnIntegerOverflow','on','Inputs','2','Position',[620,35,650,74]);
    add_block('built-in/Saturate','F16_control/F16_control/autopilotCommandedBankAngle_unlim_limiter','ShowName','off','LowerLimit','-30.0','UpperLimit','30.0','AttributesFormatString','%<LowerLimit> to %<UpperLimit>','Position',[690,39,720,69]);
    add_block('built-in/Switch','F16_control/F16_control/switch_27','Threshold','0.5','Position',[760,27,790,81]);
    add_block('built-in/Sum','F16_control/F16_control/minus_33','IconShape','rectangular','Inputs','+-','Position',[830,35,860,74]);
    add_block('built-in/Product','F16_control/F16_control/times_49','Multiplication','Element-wise(.*)','SaturateOnIntegerOverflow','on','Inputs','2','Position',[900,35,930,74]);
    add_block('built-in/Sum','F16_control/F16_control/plus_48','IconShape','rectangular','Inputs','++++','Position',[970,20,1000,89]);
    add_block('built-in/Gain','F16_control/F16_control/minus_47','Gain','-1','Position',[1040,39,1070,69]);
    add_block('built-in/Switch','F16_control/F16_control/switch_67','Threshold','0.5','Position',[1110,27,1140,81]);
    add_block('built-in/Sum','F16_control/F16_control/plus_92','IconShape','rectangular','Inputs','++','Position',[1180,35,1210,74]);
    add_block('built-in/Saturate','F16_control/F16_control/totalLatCmd_unlim_limiter','ShowName','off','LowerLimit','-1.0','UpperLimit','1.0','AttributesFormatString','%<LowerLimit> to %<UpperLimit>','Position',[1250,39,1280,69]);
    add_block('built-in/Product','F16_control/F16_control/times_97','Multiplication','Element-wise(.*)','SaturateOnIntegerOverflow','on','Inputs','2','Position',[1320,35,1350,74]);
    add_block('built-in/Product','F16_control/F16_control/times_102','Multiplication','Element-wise(.*)','SaturateOnIntegerOverflow','on','Inputs','2','Position',[1390,35,1420,74]);
    add_block('built-in/Sum','F16_control/F16_control/plus_99','IconShape','rectangular','Inputs','++','Position',[1460,35,1490,74]);
    add_block('built-in/Outport','F16_control/F16_control/rudderDeflection','Position',[1530,47,1560,61]);
    add_block('built-in/Outport','F16_control/F16_control/aileronDeflection','Position',[1390,109,1420,123]);
    add_block('built-in/Product','F16_control/F16_control/times_55','Multiplication','Element-wise(.*)','SaturateOnIntegerOverflow','on','Inputs','2','Position',[900,158,930,197]);
    add_block('built-in/Sum','F16_control/F16_control/plus_54','IconShape','rectangular','Inputs','++++','Position',[970,143,1000,212]);
    add_block('built-in/Gain','F16_control/F16_control/minus_53','Gain','-1','Position',[1040,162,1070,192]);
    add_block('built-in/Switch','F16_control/F16_control/switch_71','Threshold','0.5','Position',[1110,150,1140,204]);
    add_block('built-in/Sum','F16_control/F16_control/plus_93','IconShape','rectangular','Inputs','++','Position',[1180,158,1210,197]);
    add_block('built-in/Saturate','F16_control/F16_control/totalDirCmd_unlim_limiter','ShowName','off','LowerLimit','-1.0','UpperLimit','1.0','AttributesFormatString','%<LowerLimit> to %<UpperLimit>','Position',[1250,162,1280,192]);
    add_block('built-in/Product','F16_control/F16_control/times_100','Multiplication','Element-wise(.*)','SaturateOnIntegerOverflow','on','Inputs','2','Position',[1320,158,1350,197]);
    add_block('built-in/Constant','F16_control/F16_control/const_13','ShowName','off','Value','0.','Position',[30,236,90,266]);
    add_block('built-in/RelationalOperator','F16_control/F16_control/gt_13','Position',[410,232,440,271],'Operator','>');
    add_block('built-in/Constant','F16_control/F16_control/const_15','ShowName','off','Value','360.0','Position',[30,295,90,325]);
    add_block('built-in/Sum','F16_control/F16_control/plus_15','IconShape','rectangular','Inputs','++','Position',[410,291,440,330]);
    add_block('built-in/Constant','F16_control/F16_control/const_18','ShowName','off','Value','180.0','Position',[30,354,90,384]);
    add_block('built-in/RelationalOperator','F16_control/F16_control/gt_17','Position',[480,350,510,389],'Operator','>');
    add_block('built-in/Constant','F16_control/F16_control/const_22','ShowName','off','Value','0.5','Position',[30,428,90,458]);
    add_block('built-in/RelationalOperator','F16_control/F16_control/gt_22','Position',[130,424,160,463],'Operator','>');
    add_block('built-in/Switch','F16_control/F16_control/switch_21','Threshold','0.5','Position',[200,416,230,470]);
    add_block('built-in/Sum','F16_control/F16_control/minus_31','IconShape','rectangular','Inputs','+-','Position',[270,424,300,463]);
    add_block('built-in/Product','F16_control/F16_control/times_37','Multiplication','Element-wise(.*)','SaturateOnIntegerOverflow','on','Inputs','2','Position',[340,424,370,463]);
    add_block('built-in/Sum','F16_control/F16_control/plus_36','IconShape','rectangular','Inputs','++++','Position',[620,409,650,478]);
    add_block('built-in/Gain','F16_control/F16_control/minus_35','Gain','-1','Position',[690,428,720,458]);
    add_block('built-in/Switch','F16_control/F16_control/switch_59','Threshold','0.5','Position',[760,416,790,470]);
    add_block('built-in/Sum','F16_control/F16_control/plus_91','IconShape','rectangular','Inputs','+++','Position',[830,416,860,470]);
    add_block('built-in/Saturate','F16_control/F16_control/totalLongCmd_unlim_limiter','ShowName','off','LowerLimit','-1.0','UpperLimit','1.0','AttributesFormatString','%<LowerLimit> to %<UpperLimit>','Position',[900,428,930,458]);
    add_block('built-in/Product','F16_control/F16_control/times_95','Multiplication','Element-wise(.*)','SaturateOnIntegerOverflow','on','Inputs','2','Position',[970,424,1000,463]);
    add_block('built-in/Outport','F16_control/F16_control/elevatorDeflection','Position',[1040,436,1070,450]);
    add_block('built-in/Product','F16_control/F16_control/times_43','Multiplication','Element-wise(.*)','SaturateOnIntegerOverflow','on','Inputs','2','Position',[340,513,370,552]);
    add_block('built-in/Sum','F16_control/F16_control/plus_42','IconShape','rectangular','Inputs','++++','Position',[620,498,650,567]);
    add_block('built-in/Gain','F16_control/F16_control/minus_41','Gain','-1','Position',[690,517,720,547]);
    add_block('built-in/Switch','F16_control/F16_control/switch_63','Threshold','0.5','Position',[760,505,790,559]);
    add_block('built-in/Sum','F16_control/F16_control/plus_94','IconShape','rectangular','Inputs','+++','Position',[830,505,860,559]);
    add_block('built-in/Saturate','F16_control/F16_control/totalThrottle_unlim_limiter','ShowName','off','LowerLimit','0.0','UpperLimit','1.0','AttributesFormatString','%<LowerLimit> to %<UpperLimit>','Position',[900,517,930,547]);
    add_block('built-in/Product','F16_control/F16_control/times_104','Multiplication','Element-wise(.*)','SaturateOnIntegerOverflow','on','Inputs','2','Position',[970,513,1000,552]);
    add_block('built-in/Outport','F16_control/F16_control/powerLeverAngle','Position',[1040,525,1070,539]);
    add_block('built-in/Constant','F16_control/F16_control/const_25','ShowName','off','Value','0.5','Position',[30,599,90,629]);
    add_block('built-in/RelationalOperator','F16_control/F16_control/gt_25','Position',[130,595,160,634],'Operator','>');
    add_block('built-in/Switch','F16_control/F16_control/switch_24','Threshold','0.5','Position',[410,587,440,641]);
    add_block('built-in/Sum','F16_control/F16_control/minus_34','IconShape','rectangular','Inputs','+-','Position',[480,595,510,634]);
    add_block('built-in/Product','F16_control/F16_control/times_40','Multiplication','Element-wise(.*)','SaturateOnIntegerOverflow','on','Inputs','2','Position',[550,595,580,634]);
    add_block('built-in/Product','F16_control/F16_control/times_46','Multiplication','Element-wise(.*)','SaturateOnIntegerOverflow','on','Inputs','2','Position',[550,661,580,700]);
    add_block('built-in/Constant','F16_control/F16_control/const_28','ShowName','off','Value','0.5','Position',[30,724,90,754]);
    add_block('built-in/RelationalOperator','F16_control/F16_control/gt_28','Position',[130,720,160,759],'Operator','>');
    add_block('built-in/Constant','F16_control/F16_control/const_29','ShowName','off','Value','0.','Position',[30,779,90,809]);
    add_block('built-in/Constant','F16_control/F16_control/const_60','ShowName','off','Value','0.5','Position',[30,833,90,863]);
    add_block('built-in/RelationalOperator','F16_control/F16_control/gt_60','Position',[200,829,230,868],'Operator','>');
    add_block('built-in/Constant','F16_control/F16_control/const_61','ShowName','off','Value','0','Position',[30,888,90,918]);
    add_block('built-in/Constant','F16_control/F16_control/const_64','ShowName','off','Value','0.5','Position',[30,942,90,972]);
    add_block('built-in/RelationalOperator','F16_control/F16_control/gt_64','Position',[200,938,230,977],'Operator','>');
    add_block('built-in/Constant','F16_control/F16_control/const_65','ShowName','off','Value','0','Position',[30,997,90,1027]);
    add_block('built-in/Constant','F16_control/F16_control/const_68','ShowName','off','Value','0.5','Position',[30,1051,90,1081]);
    add_block('built-in/RelationalOperator','F16_control/F16_control/gt_68','Position',[200,1047,230,1086],'Operator','>');
    add_block('built-in/Constant','F16_control/F16_control/const_69','ShowName','off','Value','0','Position',[30,1106,90,1136]);
    add_block('built-in/Constant','F16_control/F16_control/const_72','ShowName','off','Value','0.5','Position',[30,1160,90,1190]);
    add_block('built-in/RelationalOperator','F16_control/F16_control/gt_72','Position',[200,1156,230,1195],'Operator','>');
    add_block('built-in/Constant','F16_control/F16_control/const_73','ShowName','off','Value','0','Position',[30,1215,90,1245]);
    add_block('built-in/Constant','F16_control/F16_control/const_76','ShowName','off','Value','0.5','Position',[30,1277,90,1307]);
    add_block('built-in/RelationalOperator','F16_control/F16_control/lt_76','Position',[130,1273,160,1312],'Operator','<');
    add_block('built-in/Switch','F16_control/F16_control/switch_75','Threshold','0.5','Position',[200,1265,230,1319]);
    add_block('built-in/Constant','F16_control/F16_control/const_77','ShowName','off','Value','0','Position',[30,1339,90,1369]);
    add_block('built-in/Constant','F16_control/F16_control/const_80','ShowName','off','Value','0.5','Position',[30,1401,90,1431]);
    add_block('built-in/RelationalOperator','F16_control/F16_control/lt_80','Position',[130,1397,160,1436],'Operator','<');
    add_block('built-in/Switch','F16_control/F16_control/switch_79','Threshold','0.5','Position',[200,1389,230,1443]);
    add_block('built-in/Constant','F16_control/F16_control/const_81','ShowName','off','Value','0','Position',[30,1463,90,1493]);
    add_block('built-in/Constant','F16_control/F16_control/const_84','ShowName','off','Value','0.5','Position',[30,1525,90,1555]);
    add_block('built-in/RelationalOperator','F16_control/F16_control/lt_84','Position',[130,1521,160,1560],'Operator','<');
    add_block('built-in/Switch','F16_control/F16_control/switch_83','Threshold','0.5','Position',[200,1513,230,1567]);
    add_block('built-in/Constant','F16_control/F16_control/const_85','ShowName','off','Value','0','Position',[30,1587,90,1617]);
    add_block('built-in/Constant','F16_control/F16_control/const_88','ShowName','off','Value','0.5','Position',[30,1649,90,1679]);
    add_block('built-in/RelationalOperator','F16_control/F16_control/lt_88','Position',[130,1645,160,1684],'Operator','<');
    add_block('built-in/Switch','F16_control/F16_control/switch_87','Threshold','0.5','Position',[200,1637,230,1691]);
    add_block('built-in/Constant','F16_control/F16_control/const_89','ShowName','off','Value','0','Position',[30,1711,90,1741]);
    add_block('built-in/Constant','F16_control/F16_control/const_95','ShowName','off','Value','-25.','Position',[30,1761,90,1791]);
    add_block('built-in/Constant','F16_control/F16_control/const_97','ShowName','off','Value','-21.5','Position',[30,1811,90,1841]);
    add_block('built-in/Constant','F16_control/F16_control/const_100','ShowName','off','Value','-30.','Position',[30,1861,90,1891]);
    add_block('built-in/Constant','F16_control/F16_control/const_102','ShowName','off','Value','0.008','Position',[30,1911,90,1941]);
    add_block('built-in/Constant','F16_control/F16_control/const_104','ShowName','off','Value','100.','Position',[30,1961,90,1991]);
    add_block('built-in/Inport','F16_control/F16_control/pilotControl_throttle','Position',[45,2027,75,2041]);
    add_block('built-in/Saturate','F16_control/F16_control/pilotControl_throttle_unlim_limiter','ShowName','off','LowerLimit','0.0','UpperLimit','1.0','AttributesFormatString','%<LowerLimit> to %<UpperLimit>','Position',[130,2011,160,2041]);
    add_block('built-in/Inport','F16_control/F16_control/pilotControl_long','Position',[45,2077,75,2091]);
    add_block('built-in/Saturate','F16_control/F16_control/pilotControl_long_unlim_limiter','ShowName','off','LowerLimit','-1.0','UpperLimit','1.0','AttributesFormatString','%<LowerLimit> to %<UpperLimit>','Position',[130,2061,160,2091]);
    add_block('built-in/Inport','F16_control/F16_control/pilotControl_lat','Position',[45,2127,75,2141]);
    add_block('built-in/Saturate','F16_control/F16_control/pilotControl_lat_unlim_limiter','ShowName','off','LowerLimit','-1.0','UpperLimit','1.0','AttributesFormatString','%<LowerLimit> to %<UpperLimit>','Position',[130,2111,160,2141]);
    add_block('built-in/Inport','F16_control/F16_control/pilotControl_yaw','Position',[45,2177,75,2191]);
    add_block('built-in/Saturate','F16_control/F16_control/pilotControl_yaw_unlim_limiter','ShowName','off','LowerLimit','-1.0','UpperLimit','1.0','AttributesFormatString','%<LowerLimit> to %<UpperLimit>','Position',[130,2161,160,2191]);
    add_block('built-in/Inport','F16_control/F16_control/stabilityAugmentationOn_disc','Position',[45,2231,75,2245]);
    add_block('built-in/Sum','F16_control/F16_control/plus_1','IconShape','rectangular','Inputs','++','Position',[130,2211,160,2250]);
    add_block('built-in/Inport','F16_control/F16_control/autopilotOn_disc','Position',[45,2278,75,2292]);
    add_block('built-in/Inport','F16_control/F16_control/equivalentAirspeedCommand','Position',[45,2312,75,2326]);
    add_block('built-in/Inport','F16_control/F16_control/altitudeMslCommand','Position',[45,2358,75,2372]);
    add_block('built-in/Sum','F16_control/F16_control/minus_2','IconShape','rectangular','Inputs','+-','Position',[130,2338,160,2377]);
    add_block('built-in/Product','F16_control/F16_control/times_3','Multiplication','Element-wise(.*)','SaturateOnIntegerOverflow','on','Inputs','2','Position',[200,2338,230,2377]);
    add_block('built-in/Saturate','F16_control/F16_control/autopilotDeltaPitchCmd_unlim_limiter','ShowName','off','LowerLimit','-5.0','UpperLimit','5.0','AttributesFormatString','%<LowerLimit> to %<UpperLimit>','Position',[270,2342,300,2372]);
    add_block('built-in/Sum','F16_control/F16_control/plus_4','IconShape','rectangular','Inputs','++','Position',[340,2338,370,2377]);
    add_block('built-in/Inport','F16_control/F16_control/lateralDeviationError','Position',[45,2417,75,2431]);
    add_block('built-in/Product','F16_control/F16_control/times_6','Multiplication','Element-wise(.*)','SaturateOnIntegerOverflow','on','Inputs','2','Position',[130,2397,160,2436]);
    add_block('built-in/Saturate','F16_control/F16_control/autopilotCourseCorrection_unlim_limiter','ShowName','off','LowerLimit','-30.0','UpperLimit','30.0','AttributesFormatString','%<LowerLimit> to %<UpperLimit>','Position',[200,2401,230,2431]);
    add_block('built-in/Sum','F16_control/F16_control/plus_7','IconShape','rectangular','Inputs','++','Position',[270,2397,300,2436]);
    add_block('built-in/Sum','F16_control/F16_control/minus_8','IconShape','rectangular','Inputs','+-','Position',[340,2397,370,2436]);
    add_block('built-in/Abs','F16_control/F16_control/abs_18','Position',[410,2456,440,2486]);
    add_block('built-in/Inport','F16_control/F16_control/trueBaseCourseCommand','Position',[45,2514,75,2528]);
    add_block('built-in/Inport','F16_control/F16_control/altitudeMsl','Position',[45,2548,75,2562]);
    add_block('built-in/Inport','F16_control/F16_control/equivalentAirspeed','Position',[45,2582,75,2596]);
    add_block('built-in/Inport','F16_control/F16_control/angleOfAttack','Position',[45,2628,75,2642]);
    add_block('built-in/Sum','F16_control/F16_control/minus_32','IconShape','rectangular','Inputs','+-','Position',[130,2608,160,2647]);
    add_block('built-in/Product','F16_control/F16_control/times_38','Multiplication','Element-wise(.*)','SaturateOnIntegerOverflow','on','Inputs','2','Position',[200,2608,230,2647]);
    add_block('built-in/Product','F16_control/F16_control/times_44','Multiplication','Element-wise(.*)','SaturateOnIntegerOverflow','on','Inputs','2','Position',[200,2667,230,2706]);
    add_block('built-in/Inport','F16_control/F16_control/angleOfSideslip','Position',[45,2746,75,2760]);
    add_block('built-in/Sum','F16_control/F16_control/plus_5','IconShape','rectangular','Inputs','++','Position',[130,2726,160,2765]);
    add_block('built-in/Product','F16_control/F16_control/times_50','Multiplication','Element-wise(.*)','SaturateOnIntegerOverflow','on','Inputs','2','Position',[130,2785,160,2824]);
    add_block('built-in/Product','F16_control/F16_control/times_56','Multiplication','Element-wise(.*)','SaturateOnIntegerOverflow','on','Inputs','2','Position',[130,2844,160,2883]);
    add_block('built-in/Inport','F16_control/F16_control/eulerAngle_Roll','Position',[45,2911,75,2925]);
    add_block('built-in/Inport','F16_control/F16_control/eulerAngle_Pitch','Position',[45,2945,75,2959]);
    add_block('built-in/Inport','F16_control/F16_control/eulerAngle_Yaw','Position',[45,2979,75,2993]);
    add_block('built-in/Inport','F16_control/F16_control/bodyAngularRate_Roll','Position',[45,3025,75,3039]);
    add_block('built-in/Product','F16_control/F16_control/times_51','Multiplication','Element-wise(.*)','SaturateOnIntegerOverflow','on','Inputs','2','Position',[130,3005,160,3044]);
    add_block('built-in/Product','F16_control/F16_control/times_57','Multiplication','Element-wise(.*)','SaturateOnIntegerOverflow','on','Inputs','2','Position',[130,3064,160,3103]);
    add_block('built-in/Inport','F16_control/F16_control/bodyAngularRate_Pitch','Position',[45,3143,75,3157]);
    add_block('built-in/Product','F16_control/F16_control/times_39','Multiplication','Element-wise(.*)','SaturateOnIntegerOverflow','on','Inputs','2','Position',[130,3123,160,3162]);
    add_block('built-in/Product','F16_control/F16_control/times_45','Multiplication','Element-wise(.*)','SaturateOnIntegerOverflow','on','Inputs','2','Position',[130,3182,160,3221]);
    add_block('built-in/Inport','F16_control/F16_control/bodyAngularRate_Yaw','Position',[45,3261,75,3275]);
    add_block('built-in/Product','F16_control/F16_control/times_52','Multiplication','Element-wise(.*)','SaturateOnIntegerOverflow','on','Inputs','2','Position',[130,3241,160,3280]);
    add_block('built-in/Product','F16_control/F16_control/times_58','Multiplication','Element-wise(.*)','SaturateOnIntegerOverflow','on','Inputs','2','Position',[130,3300,160,3339]);
    add_block('built-in/Inport','F16_control/F16_control/trimmedPilotControl_throttle','Position',[45,3367,75,3381]);
    add_block('built-in/Inport','F16_control/F16_control/trimmedPilotControl_long','Position',[45,3401,75,3415]);
    add_block('built-in/Constant','F16_control/F16_control/const_131','ShowName','off','Value','-0.05','Position',[30,3427,90,3457]);
    add_block('built-in/Constant','F16_control/F16_control/const_133','ShowName','off','Value','-0.01','Position',[30,3477,90,3507]);
    add_block('built-in/Constant','F16_control/F16_control/const_134','ShowName','off','Value','-10','Position',[30,3527,90,3557]);
    add_block('built-in/Constant','F16_control/F16_control/const_137','ShowName','off','Value','2.653813535191715','Position',[30,3577,90,3607]);
    add_block('built-in/Constant','F16_control/F16_control/const_138','ShowName','off','Value','2.653813535191715','Position',[30,3627,90,3657]);
    add_block('built-in/Constant','F16_control/F16_control/const_139','ShowName','off','Value','2.878088596053291e+02','Position',[30,3677,90,3707]);
    add_block('built-in/Constant','F16_control/F16_control/const_140','ShowName','off','Value','-0.063009074230494','Position',[30,3727,90,3757]);
    add_block('built-in/Constant','F16_control/F16_control/const_141','ShowName','off','Value','0.113230403179271','Position',[30,3777,90,3807]);
    add_block('built-in/Constant','F16_control/F16_control/const_142','ShowName','off','Value','10.113432224566077','Position',[30,3827,90,3857]);
    add_block('built-in/Constant','F16_control/F16_control/const_143','ShowName','off','Value','3.154983341632913','Position',[30,3877,90,3907]);
    add_block('built-in/Constant','F16_control/F16_control/const_144','ShowName','off','Value','0.997260602961658','Position',[30,3927,90,3957]);
    add_block('built-in/Constant','F16_control/F16_control/const_145','ShowName','off','Value','-0.025467711176391','Position',[30,3977,90,4007]);
    add_block('built-in/Constant','F16_control/F16_control/const_146','ShowName','off','Value','1.213308488207827','Position',[30,4027,90,4057]);
    add_block('built-in/Constant','F16_control/F16_control/const_147','ShowName','off','Value','0.208744369535208','Position',[30,4077,90,4107]);
    add_block('built-in/Constant','F16_control/F16_control/const_148','ShowName','off','Value','3.078043941515770','Position',[30,4127,90,4157]);
    add_block('built-in/Constant','F16_control/F16_control/const_149','ShowName','off','Value','0.032365863044163','Position',[30,4177,90,4207]);
    add_block('built-in/Constant','F16_control/F16_control/const_150','ShowName','off','Value','4.557858908828332','Position',[30,4227,90,4257]);
    add_block('built-in/Constant','F16_control/F16_control/const_151','ShowName','off','Value','0.589443156647647','Position',[30,4277,90,4307]);
    add_block('built-in/Constant','F16_control/F16_control/const_152','ShowName','off','Value','-0.705817452754520','Position',[30,4327,90,4357]);
    add_block('built-in/Constant','F16_control/F16_control/const_153','ShowName','off','Value','-0.256362860634868','Position',[30,4377,90,4407]);
    add_block('built-in/Constant','F16_control/F16_control/const_154','ShowName','off','Value','-1.073666149713151','Position',[30,4427,90,4457]);
    add_block('built-in/Constant','F16_control/F16_control/const_155','ShowName','off','Value','0.822114635953878','Position',[30,4477,90,4507]);
    h=add_line('F16_control/F16_control','pilotControl_throttle/1','pilotControl_throttle_unlim_limiter/1','autorouting','on');
    set_param(h,'Name','pilotControl_throttle_unlim');
    h=add_line('F16_control/F16_control','pilotControl_long/1','pilotControl_long_unlim_limiter/1','autorouting','on');
    set_param(h,'Name','pilotControl_long_unlim');
    h=add_line('F16_control/F16_control','pilotControl_lat/1','pilotControl_lat_unlim_limiter/1','autorouting','on');
    set_param(h,'Name','pilotControl_lat_unlim');
    h=add_line('F16_control/F16_control','pilotControl_yaw/1','pilotControl_yaw_unlim_limiter/1','autorouting','on');
    set_param(h,'Name','pilotControl_yaw_unlim');
    h=add_line('F16_control/F16_control','stabilityAugmentationOn_disc/1','plus_1/1','autorouting','on');
    set_param(h,'Name','stabilityAugmentationOn_disc');
    h=add_line('F16_control/F16_control','autopilotOn_disc/1','plus_1/2','autorouting','on');
    set_param(h,'Name','autopilotOn_disc');
    h=add_line('F16_control/F16_control','autopilotOn_disc/1','gt_22/1','autorouting','on');
    set_param(h,'Name','autopilotOn_disc');
    h=add_line('F16_control/F16_control','autopilotOn_disc/1','gt_25/1','autorouting','on');
    set_param(h,'Name','autopilotOn_disc');
    h=add_line('F16_control/F16_control','autopilotOn_disc/1','gt_28/1','autorouting','on');
    set_param(h,'Name','autopilotOn_disc');
    h=add_line('F16_control/F16_control','autopilotOn_disc/1','lt_76/1','autorouting','on');
    set_param(h,'Name','autopilotOn_disc');
    h=add_line('F16_control/F16_control','autopilotOn_disc/1','lt_80/1','autorouting','on');
    set_param(h,'Name','autopilotOn_disc');
    h=add_line('F16_control/F16_control','autopilotOn_disc/1','lt_84/1','autorouting','on');
    set_param(h,'Name','autopilotOn_disc');
    h=add_line('F16_control/F16_control','autopilotOn_disc/1','lt_88/1','autorouting','on');
    set_param(h,'Name','autopilotOn_disc');
    h=add_line('F16_control/F16_control','equivalentAirspeedCommand/1','switch_21/1','autorouting','on');
    set_param(h,'Name','equivalentAirspeedCommand');
    h=add_line('F16_control/F16_control','altitudeMslCommand/1','minus_2/2','autorouting','on');
    set_param(h,'Name','altitudeMslCommand');
    h=add_line('F16_control/F16_control','lateralDeviationError/1','times_6/2','autorouting','on');
    set_param(h,'Name','lateralDeviationError');
    h=add_line('F16_control/F16_control','trueBaseCourseCommand/1','plus_7/2','autorouting','on');
    set_param(h,'Name','trueBaseCourseCommand');
    h=add_line('F16_control/F16_control','altitudeMsl/1','minus_2/1','autorouting','on');
    set_param(h,'Name','altitudeMsl');
    h=add_line('F16_control/F16_control','equivalentAirspeed/1','minus_31/1','autorouting','on');
    set_param(h,'Name','equivalentAirspeed');
    h=add_line('F16_control/F16_control','angleOfAttack/1','minus_32/1','autorouting','on');
    set_param(h,'Name','angleOfAttack');
    h=add_line('F16_control/F16_control','angleOfSideslip/1','plus_5/1','autorouting','on');
    set_param(h,'Name','angleOfSideslip');
    h=add_line('F16_control/F16_control','angleOfSideslip/1','times_50/2','autorouting','on');
    set_param(h,'Name','angleOfSideslip');
    h=add_line('F16_control/F16_control','angleOfSideslip/1','times_56/2','autorouting','on');
    set_param(h,'Name','angleOfSideslip');
    h=add_line('F16_control/F16_control','eulerAngle_Roll/1','minus_33/1','autorouting','on');
    set_param(h,'Name','eulerAngle_Roll');
    h=add_line('F16_control/F16_control','eulerAngle_Pitch/1','minus_34/1','autorouting','on');
    set_param(h,'Name','eulerAngle_Pitch');
    h=add_line('F16_control/F16_control','eulerAngle_Yaw/1','plus_5/2','autorouting','on');
    set_param(h,'Name','eulerAngle_Yaw');
    h=add_line('F16_control/F16_control','bodyAngularRate_Roll/1','times_51/2','autorouting','on');
    set_param(h,'Name','bodyAngularRate_Roll');
    h=add_line('F16_control/F16_control','bodyAngularRate_Roll/1','times_57/2','autorouting','on');
    set_param(h,'Name','bodyAngularRate_Roll');
    h=add_line('F16_control/F16_control','bodyAngularRate_Pitch/1','times_39/2','autorouting','on');
    set_param(h,'Name','bodyAngularRate_Pitch');
    h=add_line('F16_control/F16_control','bodyAngularRate_Pitch/1','times_45/2','autorouting','on');
    set_param(h,'Name','bodyAngularRate_Pitch');
    h=add_line('F16_control/F16_control','bodyAngularRate_Yaw/1','times_52/2','autorouting','on');
    set_param(h,'Name','bodyAngularRate_Yaw');
    h=add_line('F16_control/F16_control','bodyAngularRate_Yaw/1','times_58/2','autorouting','on');
    set_param(h,'Name','bodyAngularRate_Yaw');
    h=add_line('F16_control/F16_control','trimmedPilotControl_throttle/1','plus_94/1','autorouting','on');
    set_param(h,'Name','trimmedPilotControl_throttle');
    h=add_line('F16_control/F16_control','trimmedPilotControl_long/1','plus_91/1','autorouting','on');
    set_param(h,'Name','trimmedPilotControl_long');
    h=add_line('F16_control/F16_control','plus_1/1','gt_60/1','autorouting','on');
    set_param(h,'Name','forceStabAugOn_disc');
    h=add_line('F16_control/F16_control','plus_1/1','gt_64/1','autorouting','on');
    set_param(h,'Name','forceStabAugOn_disc');
    h=add_line('F16_control/F16_control','plus_1/1','gt_68/1','autorouting','on');
    set_param(h,'Name','forceStabAugOn_disc');
    h=add_line('F16_control/F16_control','plus_1/1','gt_72/1','autorouting','on');
    set_param(h,'Name','forceStabAugOn_disc');
    h=add_line('F16_control/F16_control','const_131/1','times_3/2','autorouting','on');
    set_param(h,'Name','autopilotAltErrorFeedbackGain');
    h=add_line('F16_control/F16_control','minus_2/1','times_3/1','autorouting','on');
    set_param(h,'Name','autopilotAltitudeError');
    h=add_line('F16_control/F16_control','times_3/1','autopilotDeltaPitchCmd_unlim_limiter/1','autorouting','on');
    set_param(h,'Name','autopilotDeltaPitchCmd_unlim');
    h=add_line('F16_control/F16_control','plus_4/1','switch_24/1','autorouting','on');
    set_param(h,'Name','autopilotPitchCmd');
    h=add_line('F16_control/F16_control','plus_5/1','minus_8/1','autorouting','on');
    set_param(h,'Name','trackAngleEst');
    h=add_line('F16_control/F16_control','const_133/1','times_6/1','autorouting','on');
    set_param(h,'Name','autopilotLatOffsetErrorFeedbackGain');
    h=add_line('F16_control/F16_control','const_134/1','times_20/1','autorouting','on');
    set_param(h,'Name','autopilotTrackErrorFeedbackGain');
    h=add_line('F16_control/F16_control','times_6/1','autopilotCourseCorrection_unlim_limiter/1','autorouting','on');
    set_param(h,'Name','autopilotCourseCorrection_unlim');
    h=add_line('F16_control/F16_control','plus_7/1','minus_8/2','autorouting','on');
    set_param(h,'Name','autopilotCourseCommand');
    h=add_line('F16_control/F16_control','minus_8/1','switch_9/3','autorouting','on');
    set_param(h,'Name','autopilotTrackError');
    h=add_line('F16_control/F16_control','minus_8/1','minus_11/1','autorouting','on');
    set_param(h,'Name','autopilotTrackError');
    h=add_line('F16_control/F16_control','minus_8/1','gt_13/1','autorouting','on');
    set_param(h,'Name','autopilotTrackError');
    h=add_line('F16_control/F16_control','minus_8/1','plus_15/1','autorouting','on');
    set_param(h,'Name','autopilotTrackError');
    h=add_line('F16_control/F16_control','minus_8/1','abs_18/1','autorouting','on');
    set_param(h,'Name','autopilotTrackError');
    h=add_line('F16_control/F16_control','switch_9/1','times_20/2','autorouting','on');
    set_param(h,'Name','autopilotTrackErrorWrapped');
    h=add_line('F16_control/F16_control','switch_10/1','switch_9/1','autorouting','on');
    set_param(h,'Name','unnamed');
    h=add_line('F16_control/F16_control','minus_11/1','switch_10/1','autorouting','on');
    set_param(h,'Name','unnamed');
    h=add_line('F16_control/F16_control','const_11/1','minus_11/2','autorouting','on');
    set_param(h,'Name','const_11');
    h=add_line('F16_control/F16_control','gt_13/1','switch_10/2','autorouting','on');
    set_param(h,'Name','unnamed');
    h=add_line('F16_control/F16_control','const_13/1','gt_13/2','autorouting','on');
    set_param(h,'Name','const_13');
    h=add_line('F16_control/F16_control','plus_15/1','switch_10/3','autorouting','on');
    set_param(h,'Name','unnamed');
    h=add_line('F16_control/F16_control','const_15/1','plus_15/2','autorouting','on');
    set_param(h,'Name','const_15');
    h=add_line('F16_control/F16_control','gt_17/1','switch_9/2','autorouting','on');
    set_param(h,'Name','unnamed');
    h=add_line('F16_control/F16_control','abs_18/1','gt_17/1','autorouting','on');
    set_param(h,'Name','unnamed');
    h=add_line('F16_control/F16_control','const_18/1','gt_17/2','autorouting','on');
    set_param(h,'Name','const_18');
    h=add_line('F16_control/F16_control','times_20/1','autopilotCommandedBankAngle_unlim_limiter/1','autorouting','on');
    set_param(h,'Name','autopilotCommandedBankAngle_unlim');
    h=add_line('F16_control/F16_control','const_137/1','minus_32/2','autorouting','on');
    set_param(h,'Name','designAngleOfAttack');
    h=add_line('F16_control/F16_control','const_138/1','plus_4/2','autorouting','on');
    set_param(h,'Name','designEulerAngle_Pitch');
    h=add_line('F16_control/F16_control','const_138/1','switch_24/3','autorouting','on');
    set_param(h,'Name','designEulerAngle_Pitch');
    h=add_line('F16_control/F16_control','const_139/1','switch_21/3','autorouting','on');
    set_param(h,'Name','designEquivalentAirspeed');
    h=add_line('F16_control/F16_control','switch_21/1','minus_31/2','autorouting','on');
    set_param(h,'Name','switchedKEAScmd');
    h=add_line('F16_control/F16_control','gt_22/1','switch_21/2','autorouting','on');
    set_param(h,'Name','unnamed');
    h=add_line('F16_control/F16_control','const_22/1','gt_22/2','autorouting','on');
    set_param(h,'Name','const_22');
    h=add_line('F16_control/F16_control','switch_24/1','minus_34/2','autorouting','on');
    set_param(h,'Name','switchedThetaCmd');
    h=add_line('F16_control/F16_control','gt_25/1','switch_24/2','autorouting','on');
    set_param(h,'Name','unnamed');
    h=add_line('F16_control/F16_control','const_25/1','gt_25/2','autorouting','on');
    set_param(h,'Name','const_25');
    h=add_line('F16_control/F16_control','switch_27/1','minus_33/2','autorouting','on');
    set_param(h,'Name','switchedPhiCmd');
    h=add_line('F16_control/F16_control','gt_28/1','switch_27/2','autorouting','on');
    set_param(h,'Name','unnamed');
    h=add_line('F16_control/F16_control','const_28/1','gt_28/2','autorouting','on');
    set_param(h,'Name','const_28');
    h=add_line('F16_control/F16_control','const_29/1','switch_27/3','autorouting','on');
    set_param(h,'Name','const_29');
    h=add_line('F16_control/F16_control','const_140/1','times_37/1','autorouting','on');
    set_param(h,'Name','longLQR_gain_matrix_11');
    h=add_line('F16_control/F16_control','const_141/1','times_38/1','autorouting','on');
    set_param(h,'Name','longLQR_gain_matrix_12');
    h=add_line('F16_control/F16_control','const_142/1','times_39/1','autorouting','on');
    set_param(h,'Name','longLQR_gain_matrix_13');
    h=add_line('F16_control/F16_control','const_143/1','times_40/1','autorouting','on');
    set_param(h,'Name','longLQR_gain_matrix_14');
    h=add_line('F16_control/F16_control','const_144/1','times_43/1','autorouting','on');
    set_param(h,'Name','longLQR_gain_matrix_21');
    h=add_line('F16_control/F16_control','const_145/1','times_44/1','autorouting','on');
    set_param(h,'Name','longLQR_gain_matrix_22');
    h=add_line('F16_control/F16_control','const_146/1','times_45/1','autorouting','on');
    set_param(h,'Name','longLQR_gain_matrix_23');
    h=add_line('F16_control/F16_control','const_147/1','times_46/1','autorouting','on');
    set_param(h,'Name','longLQR_gain_matrix_24');
    h=add_line('F16_control/F16_control','const_148/1','times_49/1','autorouting','on');
    set_param(h,'Name','latdLQR_gain_matrix_11');
    h=add_line('F16_control/F16_control','const_149/1','times_50/1','autorouting','on');
    set_param(h,'Name','latdLQR_gain_matrix_12');
    h=add_line('F16_control/F16_control','const_150/1','times_51/1','autorouting','on');
    set_param(h,'Name','latdLQR_gain_matrix_13');
    h=add_line('F16_control/F16_control','const_151/1','times_52/1','autorouting','on');
    set_param(h,'Name','latdLQR_gain_matrix_14');
    h=add_line('F16_control/F16_control','const_152/1','times_55/1','autorouting','on');
    set_param(h,'Name','latdLQR_gain_matrix_21');
    h=add_line('F16_control/F16_control','const_153/1','times_56/1','autorouting','on');
    set_param(h,'Name','latdLQR_gain_matrix_22');
    h=add_line('F16_control/F16_control','const_154/1','times_57/1','autorouting','on');
    set_param(h,'Name','latdLQR_gain_matrix_23');
    h=add_line('F16_control/F16_control','const_155/1','times_58/1','autorouting','on');
    set_param(h,'Name','latdLQR_gain_matrix_24');
    h=add_line('F16_control/F16_control','minus_31/1','times_37/2','autorouting','on');
    set_param(h,'Name','disturbedEquivalentAirspeed');
    h=add_line('F16_control/F16_control','minus_31/1','times_43/2','autorouting','on');
    set_param(h,'Name','disturbedEquivalentAirspeed');
    h=add_line('F16_control/F16_control','minus_32/1','times_38/2','autorouting','on');
    set_param(h,'Name','disturbedAngleOfAttack');
    h=add_line('F16_control/F16_control','minus_32/1','times_44/2','autorouting','on');
    set_param(h,'Name','disturbedAngleOfAttack');
    h=add_line('F16_control/F16_control','minus_33/1','times_49/2','autorouting','on');
    set_param(h,'Name','disturbedEulerAngle_roll');
    h=add_line('F16_control/F16_control','minus_33/1','times_55/2','autorouting','on');
    set_param(h,'Name','disturbedEulerAngle_roll');
    h=add_line('F16_control/F16_control','minus_34/1','times_40/2','autorouting','on');
    set_param(h,'Name','disturbedEulerAngle_pitch');
    h=add_line('F16_control/F16_control','minus_34/1','times_46/2','autorouting','on');
    set_param(h,'Name','disturbedEulerAngle_pitch');
    h=add_line('F16_control/F16_control','minus_35/1','switch_59/1','autorouting','on');
    set_param(h,'Name','deltaLongLQR');
    h=add_line('F16_control/F16_control','plus_36/1','minus_35/1','autorouting','on');
    set_param(h,'Name','unnamed');
    h=add_line('F16_control/F16_control','times_37/1','plus_36/1','autorouting','on');
    set_param(h,'Name','unnamed');
    h=add_line('F16_control/F16_control','times_38/1','plus_36/2','autorouting','on');
    set_param(h,'Name','unnamed');
    h=add_line('F16_control/F16_control','times_39/1','plus_36/3','autorouting','on');
    set_param(h,'Name','unnamed');
    h=add_line('F16_control/F16_control','times_40/1','plus_36/4','autorouting','on');
    set_param(h,'Name','unnamed');
    h=add_line('F16_control/F16_control','minus_41/1','switch_63/1','autorouting','on');
    set_param(h,'Name','deltaThrottleLQR');
    h=add_line('F16_control/F16_control','plus_42/1','minus_41/1','autorouting','on');
    set_param(h,'Name','unnamed');
    h=add_line('F16_control/F16_control','times_43/1','plus_42/1','autorouting','on');
    set_param(h,'Name','unnamed');
    h=add_line('F16_control/F16_control','times_44/1','plus_42/2','autorouting','on');
    set_param(h,'Name','unnamed');
    h=add_line('F16_control/F16_control','times_45/1','plus_42/3','autorouting','on');
    set_param(h,'Name','unnamed');
    h=add_line('F16_control/F16_control','times_46/1','plus_42/4','autorouting','on');
    set_param(h,'Name','unnamed');
    h=add_line('F16_control/F16_control','minus_47/1','switch_67/1','autorouting','on');
    set_param(h,'Name','deltaLatLQR');
    h=add_line('F16_control/F16_control','plus_48/1','minus_47/1','autorouting','on');
    set_param(h,'Name','unnamed');
    h=add_line('F16_control/F16_control','times_49/1','plus_48/1','autorouting','on');
    set_param(h,'Name','unnamed');
    h=add_line('F16_control/F16_control','times_50/1','plus_48/2','autorouting','on');
    set_param(h,'Name','unnamed');
    h=add_line('F16_control/F16_control','times_51/1','plus_48/3','autorouting','on');
    set_param(h,'Name','unnamed');
    h=add_line('F16_control/F16_control','times_52/1','plus_48/4','autorouting','on');
    set_param(h,'Name','unnamed');
    h=add_line('F16_control/F16_control','minus_53/1','switch_71/1','autorouting','on');
    set_param(h,'Name','deltaDirLQR');
    h=add_line('F16_control/F16_control','plus_54/1','minus_53/1','autorouting','on');
    set_param(h,'Name','unnamed');
    h=add_line('F16_control/F16_control','times_55/1','plus_54/1','autorouting','on');
    set_param(h,'Name','unnamed');
    h=add_line('F16_control/F16_control','times_56/1','plus_54/2','autorouting','on');
    set_param(h,'Name','unnamed');
    h=add_line('F16_control/F16_control','times_57/1','plus_54/3','autorouting','on');
    set_param(h,'Name','unnamed');
    h=add_line('F16_control/F16_control','times_58/1','plus_54/4','autorouting','on');
    set_param(h,'Name','unnamed');
    h=add_line('F16_control/F16_control','switch_59/1','plus_91/3','autorouting','on');
    set_param(h,'Name','switchedDeltaLongLQR');
    h=add_line('F16_control/F16_control','gt_60/1','switch_59/2','autorouting','on');
    set_param(h,'Name','unnamed');
    h=add_line('F16_control/F16_control','const_60/1','gt_60/2','autorouting','on');
    set_param(h,'Name','const_60');
    h=add_line('F16_control/F16_control','const_61/1','switch_59/3','autorouting','on');
    set_param(h,'Name','const_61');
    h=add_line('F16_control/F16_control','switch_63/1','plus_94/3','autorouting','on');
    set_param(h,'Name','switchedDeltaThrottleLQR');
    h=add_line('F16_control/F16_control','gt_64/1','switch_63/2','autorouting','on');
    set_param(h,'Name','unnamed');
    h=add_line('F16_control/F16_control','const_64/1','gt_64/2','autorouting','on');
    set_param(h,'Name','const_64');
    h=add_line('F16_control/F16_control','const_65/1','switch_63/3','autorouting','on');
    set_param(h,'Name','const_65');
    h=add_line('F16_control/F16_control','switch_67/1','plus_92/2','autorouting','on');
    set_param(h,'Name','switchedDeltaLatLQR');
    h=add_line('F16_control/F16_control','gt_68/1','switch_67/2','autorouting','on');
    set_param(h,'Name','unnamed');
    h=add_line('F16_control/F16_control','const_68/1','gt_68/2','autorouting','on');
    set_param(h,'Name','const_68');
    h=add_line('F16_control/F16_control','const_69/1','switch_67/3','autorouting','on');
    set_param(h,'Name','const_69');
    h=add_line('F16_control/F16_control','switch_71/1','plus_93/2','autorouting','on');
    set_param(h,'Name','switchedDeltaDirLQR');
    h=add_line('F16_control/F16_control','gt_72/1','switch_71/2','autorouting','on');
    set_param(h,'Name','unnamed');
    h=add_line('F16_control/F16_control','const_72/1','gt_72/2','autorouting','on');
    set_param(h,'Name','const_72');
    h=add_line('F16_control/F16_control','const_73/1','switch_71/3','autorouting','on');
    set_param(h,'Name','const_73');
    h=add_line('F16_control/F16_control','switch_75/1','plus_91/2','autorouting','on');
    set_param(h,'Name','switchedPilotControl_long');
    h=add_line('F16_control/F16_control','lt_76/1','switch_75/2','autorouting','on');
    set_param(h,'Name','unnamed');
    h=add_line('F16_control/F16_control','const_76/1','lt_76/2','autorouting','on');
    set_param(h,'Name','const_76');
    h=add_line('F16_control/F16_control','const_77/1','switch_75/3','autorouting','on');
    set_param(h,'Name','const_77');
    h=add_line('F16_control/F16_control','switch_79/1','plus_94/2','autorouting','on');
    set_param(h,'Name','switchedPilotControl_throttle');
    h=add_line('F16_control/F16_control','lt_80/1','switch_79/2','autorouting','on');
    set_param(h,'Name','unnamed');
    h=add_line('F16_control/F16_control','const_80/1','lt_80/2','autorouting','on');
    set_param(h,'Name','const_80');
    h=add_line('F16_control/F16_control','const_81/1','switch_79/3','autorouting','on');
    set_param(h,'Name','const_81');
    h=add_line('F16_control/F16_control','switch_83/1','plus_92/1','autorouting','on');
    set_param(h,'Name','switchedPilotControl_lat');
    h=add_line('F16_control/F16_control','lt_84/1','switch_83/2','autorouting','on');
    set_param(h,'Name','unnamed');
    h=add_line('F16_control/F16_control','const_84/1','lt_84/2','autorouting','on');
    set_param(h,'Name','const_84');
    h=add_line('F16_control/F16_control','const_85/1','switch_83/3','autorouting','on');
    set_param(h,'Name','const_85');
    h=add_line('F16_control/F16_control','switch_87/1','plus_93/1','autorouting','on');
    set_param(h,'Name','switchedPilotControl_yaw');
    h=add_line('F16_control/F16_control','lt_88/1','switch_87/2','autorouting','on');
    set_param(h,'Name','unnamed');
    h=add_line('F16_control/F16_control','const_88/1','lt_88/2','autorouting','on');
    set_param(h,'Name','const_88');
    h=add_line('F16_control/F16_control','const_89/1','switch_87/3','autorouting','on');
    set_param(h,'Name','const_89');
    h=add_line('F16_control/F16_control','plus_91/1','totalLongCmd_unlim_limiter/1','autorouting','on');
    set_param(h,'Name','totalLongCmd_unlim');
    h=add_line('F16_control/F16_control','plus_92/1','totalLatCmd_unlim_limiter/1','autorouting','on');
    set_param(h,'Name','totalLatCmd_unlim');
    h=add_line('F16_control/F16_control','plus_93/1','totalDirCmd_unlim_limiter/1','autorouting','on');
    set_param(h,'Name','totalDirCmd_unlim');
    h=add_line('F16_control/F16_control','plus_94/1','totalThrottle_unlim_limiter/1','autorouting','on');
    set_param(h,'Name','totalThrottle_unlim');
    h=add_line('F16_control/F16_control','times_95/1','elevatorDeflection/1','autorouting','on');
    set_param(h,'Name','elevatorDeflection');
    h=add_line('F16_control/F16_control','const_95/1','times_95/1','autorouting','on');
    set_param(h,'Name','const_95');
    h=add_line('F16_control/F16_control','times_97/1','times_102/2','autorouting','on');
    set_param(h,'Name','aileronDeflection');
    h=add_line('F16_control/F16_control','times_97/1','aileronDeflection/1','autorouting','on');
    set_param(h,'Name','aileronDeflection');
    h=add_line('F16_control/F16_control','const_97/1','times_97/1','autorouting','on');
    set_param(h,'Name','const_97');
    h=add_line('F16_control/F16_control','plus_99/1','rudderDeflection/1','autorouting','on');
    set_param(h,'Name','rudderDeflection');
    h=add_line('F16_control/F16_control','times_100/1','plus_99/1','autorouting','on');
    set_param(h,'Name','unnamed');
    h=add_line('F16_control/F16_control','const_100/1','times_100/1','autorouting','on');
    set_param(h,'Name','const_100');
    h=add_line('F16_control/F16_control','times_102/1','plus_99/2','autorouting','on');
    set_param(h,'Name','unnamed');
    h=add_line('F16_control/F16_control','const_102/1','times_102/1','autorouting','on');
    set_param(h,'Name','const_102');
    h=add_line('F16_control/F16_control','times_104/1','powerLeverAngle/1','autorouting','on');
    set_param(h,'Name','powerLeverAngle');
    h=add_line('F16_control/F16_control','const_104/1','times_104/1','autorouting','on');
    set_param(h,'Name','const_104');
    h=add_line('F16_control/F16_control','pilotControl_throttle_unlim_limiter/1','switch_79/1','autorouting','on');
    set_param(h,'Name','pilotControl_throttle');
    h=add_line('F16_control/F16_control','pilotControl_long_unlim_limiter/1','switch_75/1','autorouting','on');
    set_param(h,'Name','pilotControl_long');
    h=add_line('F16_control/F16_control','pilotControl_lat_unlim_limiter/1','switch_83/1','autorouting','on');
    set_param(h,'Name','pilotControl_lat');
    h=add_line('F16_control/F16_control','pilotControl_yaw_unlim_limiter/1','switch_87/1','autorouting','on');
    set_param(h,'Name','pilotControl_yaw');
    h=add_line('F16_control/F16_control','autopilotDeltaPitchCmd_unlim_limiter/1','plus_4/1','autorouting','on');
    set_param(h,'Name','autopilotDeltaPitchCmd');
    h=add_line('F16_control/F16_control','autopilotCourseCorrection_unlim_limiter/1','plus_7/1','autorouting','on');
    set_param(h,'Name','autopilotCourseCorrection');
    h=add_line('F16_control/F16_control','autopilotCommandedBankAngle_unlim_limiter/1','switch_27/1','autorouting','on');
    set_param(h,'Name','autopilotCommandedBankAngle');
    h=add_line('F16_control/F16_control','totalLongCmd_unlim_limiter/1','times_95/2','autorouting','on');
    set_param(h,'Name','totalLongCmd');
    h=add_line('F16_control/F16_control','totalLatCmd_unlim_limiter/1','times_97/2','autorouting','on');
    set_param(h,'Name','totalLatCmd');
    h=add_line('F16_control/F16_control','totalDirCmd_unlim_limiter/1','times_100/2','autorouting','on');
    set_param(h,'Name','totalDirCmd');
    h=add_line('F16_control/F16_control','totalThrottle_unlim_limiter/1','times_104/2','autorouting','on');
    set_param(h,'Name','totalThrottle');
    
    % Correct output numbers
    
    set_param('F16_control/F16_control/elevatorDeflection','Port','1');
    set_param('F16_control/F16_control/aileronDeflection','Port','2');
    set_param('F16_control/F16_control/rudderDeflection','Port','3');
    set_param('F16_control/F16_control/powerLeverAngle','Port','4');

% Top-level inports and lines

add_block('built-in/Inport','F16_control/pilotControl_throttle','Position',[90, 58, 120, 72]);
add_line('F16_control','pilotControl_throttle/1','F16_control/1');
add_block('built-in/Inport','F16_control/pilotControl_long','Position',[90, 88, 120, 102]);
add_line('F16_control','pilotControl_long/1','F16_control/2');
add_block('built-in/Inport','F16_control/pilotControl_lat','Position',[90, 118, 120, 132]);
add_line('F16_control','pilotControl_lat/1','F16_control/3');
add_block('built-in/Inport','F16_control/pilotControl_yaw','Position',[90, 148, 120, 162]);
add_line('F16_control','pilotControl_yaw/1','F16_control/4');
add_block('built-in/Inport','F16_control/stabilityAugmentationOn_disc','Position',[90, 178, 120, 192]);
add_line('F16_control','stabilityAugmentationOn_disc/1','F16_control/5');
add_block('built-in/Inport','F16_control/autopilotOn_disc','Position',[90, 208, 120, 222]);
add_line('F16_control','autopilotOn_disc/1','F16_control/6');
add_block('built-in/Inport','F16_control/equivalentAirspeedCommand','Position',[90, 238, 120, 252]);
add_line('F16_control','equivalentAirspeedCommand/1','F16_control/7');
add_block('built-in/Inport','F16_control/altitudeMslCommand','Position',[90, 268, 120, 282]);
add_line('F16_control','altitudeMslCommand/1','F16_control/8');
add_block('built-in/Inport','F16_control/lateralDeviationError','Position',[90, 298, 120, 312]);
add_line('F16_control','lateralDeviationError/1','F16_control/9');
add_block('built-in/Inport','F16_control/trueBaseCourseCommand','Position',[90, 328, 120, 342]);
add_line('F16_control','trueBaseCourseCommand/1','F16_control/10');
add_block('built-in/Inport','F16_control/altitudeMsl','Position',[90, 358, 120, 372]);
add_line('F16_control','altitudeMsl/1','F16_control/11');
add_block('built-in/Inport','F16_control/equivalentAirspeed','Position',[90, 388, 120, 402]);
add_line('F16_control','equivalentAirspeed/1','F16_control/12');
add_block('built-in/Inport','F16_control/angleOfAttack','Position',[90, 418, 120, 432]);
add_line('F16_control','angleOfAttack/1','F16_control/13');
add_block('built-in/Inport','F16_control/angleOfSideslip','Position',[90, 448, 120, 462]);
add_line('F16_control','angleOfSideslip/1','F16_control/14');
add_block('built-in/Inport','F16_control/eulerAngle_Roll','Position',[90, 478, 120, 492]);
add_line('F16_control','eulerAngle_Roll/1','F16_control/15');
add_block('built-in/Inport','F16_control/eulerAngle_Pitch','Position',[90, 508, 120, 522]);
add_line('F16_control','eulerAngle_Pitch/1','F16_control/16');
add_block('built-in/Inport','F16_control/eulerAngle_Yaw','Position',[90, 538, 120, 552]);
add_line('F16_control','eulerAngle_Yaw/1','F16_control/17');
add_block('built-in/Inport','F16_control/bodyAngularRate_Roll','Position',[90, 568, 120, 582]);
add_line('F16_control','bodyAngularRate_Roll/1','F16_control/18');
add_block('built-in/Inport','F16_control/bodyAngularRate_Pitch','Position',[90, 598, 120, 612]);
add_line('F16_control','bodyAngularRate_Pitch/1','F16_control/19');
add_block('built-in/Inport','F16_control/bodyAngularRate_Yaw','Position',[90, 628, 120, 642]);
add_line('F16_control','bodyAngularRate_Yaw/1','F16_control/20');
add_block('built-in/Inport','F16_control/trimmedPilotControl_throttle','Position',[90, 658, 120, 672]);
add_line('F16_control','trimmedPilotControl_throttle/1','F16_control/21');
add_block('built-in/Inport','F16_control/trimmedPilotControl_long','Position',[90, 688, 120, 702]);
add_line('F16_control','trimmedPilotControl_long/1','F16_control/22');

% Top-level outports and lines

add_block('built-in/Outport','F16_control/elevatorDeflection','Position',[480, 93, 510, 107]);
add_line('F16_control','F16_control/1','elevatorDeflection/1');
add_block('built-in/Outport','F16_control/aileronDeflection','Position',[480, 278, 510, 292]);
add_line('F16_control','F16_control/2','aileronDeflection/1');
add_block('built-in/Outport','F16_control/rudderDeflection','Position',[480, 463, 510, 477]);
add_line('F16_control','F16_control/3','rudderDeflection/1');
add_block('built-in/Outport','F16_control/powerLeverAngle','Position',[480, 648, 510, 662]);
add_line('F16_control','F16_control/4','powerLeverAngle/1');

% Add annotation

add_block('built-in/Note','F16_control/Auto-generated by DAVE2SL version 0.9.6 (2013-07-29)','Position',[300, 22]);

clear h;  % remove handle used for naming lines

% Pause so window can be drawn prior to verification

% pause(0.5); - disabled with R2006b/7.3; causes typeahead buffer overflow
if exist('F16_control_verify') == 2
  if F16_control_verify
    save_system('F16_control','F16_control');
    fprintf('\n"F16_control" model verified and saved.\n')
  else
    fprintf('\n"F16_control" model NOT VERIFIED; model has NOT been saved.\n')
  end
else
  save_system('F16_control','F16_control');
  fprintf('\n"F16_control" model saved.\n')
end

% F16_control model-building script was auto-generated 
% by DAVE2SL version 0.9.6 (2013-07-29)
% on Tue Oct 22 16:10:07 2013.
