# $Revision: 1.1 $
Model {
  Name			  "predcstr"
  Version		  3.00
  SimParamPage		  "Solver"
  SampleTimeColors	  off
  InvariantConstants	  off
  WideVectorLines	  off
  ShowLineWidths	  off
  ShowPortDataTypes	  off
  StartTime		  "0.0"
  StopTime		  "120"
  SolverMode		  "SingleTasking"
  Solver		  "ode45"
  RelTol		  "1e-3"
  AbsTol		  "1e-6"
  Refine		  "1"
  MaxStep		  "auto"
  InitialStep		  "auto"
  FixedStep		  "auto"
  MaxOrder		  5
  OutputOption		  "RefineOutputTimes"
  OutputTimes		  "[]"
  LoadExternalInput	  off
  ExternalInput		  "[t, u]"
  SaveTime		  on
  TimeSaveName		  "tout"
  SaveState		  off
  StateSaveName		  "xout"
  SaveOutput		  off
  OutputSaveName	  "yout"
  LoadInitialState	  off
  InitialState		  "xInitial"
  SaveFinalState	  off
  FinalStateName	  "xFinal"
  SaveFormat		  "Matrix"
  LimitMaxRows		  off
  MaxRows		  "1000"
  Decimation		  "1"
  AlgebraicLoopMsg	  "warning"
  MinStepSizeMsg	  "warning"
  UnconnectedInputMsg	  "warning"
  UnconnectedOutputMsg	  "warning"
  UnconnectedLineMsg	  "warning"
  InheritedTsInSrcMsg	  "warning"
  IntegerOverflowMsg	  "warning"
  UnnecessaryDatatypeConvMsg "none"
  Int32ToFloatConvMsg	  "warning"
  SignalLabelMismatchMsg  "none"
  ConsistencyChecking	  "off"
  ZeroCross		  on
  SimulationMode	  "normal"
  TunableVars		  "prueba"
  TunableVarsStorageClass "Auto"
  BlockDataTips		  on
  BlockParametersDataTip  off
  BlockAttributesDataTip  off
  BlockPortWidthsDataTip  off
  BlockDescriptionStringDataTip	off
  BlockMaskParametersDataTip off
  ToolBar		  on
  StatusBar		  on
  BrowserShowLibraryLinks off
  BrowserLookUnderMasks	  off
  OptimizeBlockIOStorage  on
  BufferReuse		  on
  BooleanDataType	  off
  RTWSystemTargetFile	  "grt.tlc"
  RTWInlineParameters	  off
  RTWRetainRTWFile	  off
  RTWTemplateMakefile	  "grt_vc.tmf"
  RTWMakeCommand	  "make_rtw"
  RTWGenerateCodeOnly	  off
  ExtModeMexFile	  "ext_comm"
  ExtModeBatchMode	  off
  ExtModeTrigType	  "manual"
  ExtModeTrigMode	  "oneshot"
  ExtModeTrigPort	  "1"
  ExtModeTrigElement	  "any"
  ExtModeTrigDuration	  1000
  ExtModeTrigHoldOff	  0
  ExtModeTrigDelay	  0
  ExtModeTrigDirection	  "rising"
  ExtModeTrigLevel	  0
  ExtModeArchiveMode	  "off"
  ExtModeAutoIncOneShot	  off
  ExtModeIncDirWhenArm	  off
  ExtModeAddSuffixToVar	  off
  ExtModeWriteAllDataToWs off
  ExtModeArmWhenConnect	  off
  Created		  "Fri Oct 16 21:07:47 1998"
  UpdateHistory		  "UpdateHistoryNever"
  ModifiedByFormat	  "%<Auto>"
  LastModifiedBy	  "Administrator"
  ModifiedDateFormat	  "%<Auto>"
  LastModifiedDate	  "Sun Feb 27 19:44:34 2000"
  ModelVersionFormat	  "1.%<AutoIncrement:196>"
  ConfigurationManager	  "none"
  BlockDefaults {
    Orientation		    "right"
    ForegroundColor	    "black"
    BackgroundColor	    "white"
    DropShadow		    off
    NamePlacement	    "normal"
    FontName		    "Helvetica"
    FontSize		    10
    FontWeight		    "normal"
    FontAngle		    "normal"
    ShowName		    on
  }
  AnnotationDefaults {
    HorizontalAlignment	    "center"
    VerticalAlignment	    "middle"
    ForegroundColor	    "black"
    BackgroundColor	    "white"
    DropShadow		    off
    FontName		    "Helvetica"
    FontSize		    10
    FontWeight		    "normal"
    FontAngle		    "normal"
  }
  LineDefaults {
    FontName		    "Helvetica"
    FontSize		    9
    FontWeight		    "normal"
    FontAngle		    "normal"
  }
  System {
    Name		    "predcstr"
    Location		    [94, 141, 839, 460]
    Open		    on
    ModelBrowserVisibility  off
    ModelBrowserWidth	    200
    ScreenColor		    "white"
    PaperOrientation	    "landscape"
    PaperPositionMode	    "auto"
    PaperType		    "usletter"
    PaperUnits		    "inches"
    ZoomFactor		    "100"
    AutoZoom		    on
    ReportName		    "simulink-default.rpt"
    Block {
      BlockType		      Clock
      Name		      "Clock"
      Position		      [600, 50, 620, 70]
      DisplayTime	      off
      Decimation	      "10"
    }
    Block {
      BlockType		      SubSystem
      Name		      "More Info"
      Ports		      [0, 0, 0, 0, 0]
      Position		      [415, 245, 442, 270]
      DropShadow	      on
      ShowName		      off
      ShowPortLabels	      on
      MaskDisplay	      "disp('?')"
      MaskIconFrame	      on
      MaskIconOpaque	      on
      MaskIconRotate	      "none"
      MaskIconUnits	      "autoscale"
      System {
	Name			"More Info"
	Location		[648, 482, 996, 665]
	Open			off
	ModelBrowserVisibility	off
	ModelBrowserWidth	200
	ScreenColor		"white"
	PaperOrientation	"landscape"
	PaperPositionMode	"auto"
	PaperType		"usletter"
	PaperUnits		"inches"
	ZoomFactor		"100"
	AutoZoom		on
	Annotation {
	  Position		  [162, 22]
	  Text			  "This system simulates predictive control\no"
"f a continous stirred tank reactor."
	}
	Annotation {
	  Position		  [162, 67]
	  Text			  "Double-click on the NN Predictive Controlle"
"r block\nto set the controller parameters and train the plant model."
	}
	Annotation {
	  Position		  [162, 122]
	  Text			  "For more information on what the controller"
" \ndoes, look under the mask of the NN Predictive \nController block and look"
" at the S-function p_opt2.m."
	}
      }
    }
    Block {
      BlockType		      SubSystem
      Name		      "More Info2"
      Ports		      [0, 0, 0, 0, 0]
      Position		      [565, 240, 667, 291]
      DropShadow	      on
      ShowName		      off
      OpenFcn		      "simcad(bdroot)"
      ShowPortLabels	      on
      MaskDisplay	      "disp('Double click\\nhere for\\nSimulink Help')"
      MaskIconFrame	      on
      MaskIconOpaque	      on
      MaskIconRotate	      "none"
      MaskIconUnits	      "autoscale"
      System {
	Name			"More Info2"
	Location		[128, 280, 487, 453]
	Open			off
	ModelBrowserVisibility	off
	ModelBrowserWidth	200
	ScreenColor		"white"
	PaperOrientation	"landscape"
	PaperPositionMode	"auto"
	PaperType		"usletter"
	PaperUnits		"inches"
	ZoomFactor		"100"
	AutoZoom		on
      }
    }
    Block {
      BlockType		      SubSystem
      Name		      "NN Predictive Controller"
      Ports		      [2, 1, 0, 0, 0]
      Position		      [170, 35, 335, 170]
      BackgroundColor	      "cyan"
      DropShadow	      on
      NamePlacement	      "alternate"
      OpenFcn		      "nncontrolutil('nnpredict','',gcbh,gcb);"
      ShowPortLabels	      on
      MaskType		      "NN Predictive Controller"
      MaskDescription	      "NN Predictive Controller.  You first train a ne"
"ural network model of the plant to be controlled.  The controller uses the pl"
"ant model to predict plant performance over a specified time horizon.  An opt"
"imization algorithm determines the control signal that optimizes plant perfor"
"mance over this horizon.  Double click the NN Predictive Controller block to "
"train the plant model and set the controller parameters."
      MaskPromptString	      "N2|Nu|Sample time|rho (typically = 0.03)|alpha "
"(typically = 0.001)|Minimization rutine|maxiter|S1|Ni|Nj|sim_file|Training fu"
"nction|Use_Validation|Use_Testing|max_i|min_i|sam_training|epochs|minp|maxp|m"
"int|maxt|Normalize|IW|LW1_2|LW2_1|B1|B2|max_i_int|min_i_int|limit_output|max_"
"output|min_output|Use_Previous_Weights"
      MaskStyleString	      "edit,edit,edit,edit,edit,popup(csrchgol|csrchba"
"c|csrchhyb|csrchbre|csrchcha),edit,edit,edit,edit,edit,popup(trainbfg|trainbr"
" |traincgb|traincgf|traincgp|traingd|traingdm|traingda|traingdx|trainlm |trai"
"noss|trainrp |trainscg),edit,edit,edit,edit,edit,edit,edit,edit,edit,edit,edi"
"t,edit,edit,edit,edit,edit,edit,edit,edit,edit,edit,edit"
      MaskTunableValueString  "on,on,on,on,on,on,on,on,on,on,on,on,on,on,on,on"
",on,on,on,on,on,on,on,on,on,on,on,on,on,on,on,on,on,on"
      MaskCallbackString      "|||||||||||||||||||||||||||||||||"
      MaskEnableString	      "on,on,on,on,on,on,on,on,on,on,on,on,on,on,on,on"
",on,on,on,on,on,on,on,on,on,on,on,on,on,on,on,on,on,on"
      MaskVisibilityString    "on,on,on,on,on,on,on,on,on,on,on,on,on,on,on,on"
",on,on,on,on,on,on,on,on,on,on,on,on,on,on,on,on,on,on"
      MaskVariables	      "N2=@1;Nu=@2;Ts=@3;rho=@4;alpha=@5;csrchfun=@6;m"
"axiter=@7;S1=@8;Ni=@9;Nj=@10;sim_file=&11;trainfun=@12;Use_validation=@13;Use"
"_Testing=@14;max_i=@15;min_i=@16;sam_training=@17;epochs=@18;minp=@19;maxp=@2"
"0;mint=@21;maxt=@22;Normalize=@23;IW=@24;LW1_2=@25;LW2_1=@26;B1=@27;B2=@28;ma"
"x_i_int=@29;min_i_int=@30;limit_output=@31;max_output=@32;min_output=@33;Use_"
"Previous_Weights=@34;"
      MaskInitialization      "xl = [0   .53   .53     .85   .85  .53  .53  Na"
"N .85  .92 .92];\nyl = [.95 .95 1.05  1.05   .82  .82  .95  NaN  .95 .95 .65]"
";\nx2 = [0 .53    NaN .92 1.2 NaN .53 .85 .85 .53 .53 ];\ny2 = [.39 .39   NaN"
" .65 .65 NaN .59 .59 .29 .29  .59];\nx3 = [.67 .67 NaN .64 .67 .70 NaN .53 .4"
"   .4   .53 NaN .46 .53 .46];\ny3 = [.59 .82 NaN .66 .59 .66 NaN .55 .55 .86 "
".86 NaN  .89 .86 .83];\n\nx1t=.03; y1t=.31;\nx2t=.03; y2t=.8;\nx8t=.03;y8t=.2"
"1;\nx3t=.77; y3t=.53;\nx4t=.77; y4t=.44;\nx5t=.45; y5t=.76;\nx6t=.45; y6t=.35"
";\nx7t=.45; y7t=.25;\n"
      MaskDisplay	      "plot([[xl NaN x2]*.9-.075 ], [[yl  NaN y2]*.9-."
"1 ]);\nplot([[x3]*.9-.075 ], [[y3]*.9-.1 ]);\ntext(x1t,y1t,'Plant');\ntext(x8"
"t,y8t,'Output');\ntext(x2t,y2t,'Reference');\ntext(x3t,y3t,'Control');\ntext("
"x4t,y4t,'Signal');\ntext(x5t,y5t,'Optim.');\ntext(x6t,y6t,'NN');\ntext(x7t,y7"
"t,'Model');\n"
      MaskIconFrame	      on
      MaskIconOpaque	      on
      MaskIconRotate	      "none"
      MaskIconUnits	      "normalized"
      MaskValueString	      "7|2|0.2|0.05|0.001|csrchbac|2|7|2|2|CSTR|trainl"
"m |1|0|4|0|8000|200|0.02233575679015197|3.977181962055679|19.990542740630676|"
"23.003707300214998|0|[-20.531997924598212 18.706482494882994;0.00416814879317"
"33516 -0.003898180117493663;0.0027271331329927679 -0.0026383962298670975;-4.2"
"884263047654887 -2.5242458681173563;-7.5376751481296909 11.798966620249038;0."
"12631450792955951 0.63090781487873226;-9.0327138502332947 3.9557193990027328]"
"|[14.94314250694182 -17.959099344431603;-0.81834808440118445 0.41655850750692"
"763;0.364433114947604 -0.17752308649608817;55.505918973874849 -51.27199648544"
"6365;-3.4857289415608221 2.5155674023943493;-1.0383681172774319 -0.1649807357"
"299794;-1.7354318305331962 4.1593615744767991]|[0.0026508898559841616 -1.0458"
"797145936556 5.0292698388067745 0.00010141072535827776 0.0032962551987542432 "
"0.58061299674354561 8.9082702971420182e-005]|[18.565258582766731;9.6542761594"
"756836;-3.6577882481482806;-67.658021555936102;-2.7052627837062393;0.46399572"
"090641622;-40.321245764315009]|21.149686119715415|20|5|1|23|20|1"
      Port {
	PortNumber		1
	Name			"Flow Rate"
	TestPoint		off
	RTWStorageClass		"Auto"
      }
      System {
	Name			"NN Predictive Controller"
	Location		[478, 121, 887, 511]
	Open			off
	ModelBrowserVisibility	off
	ModelBrowserWidth	200
	ScreenColor		"automatic"
	PaperOrientation	"landscape"
	PaperPositionMode	"auto"
	PaperType		"usletter"
	PaperUnits		"inches"
	ZoomFactor		"100"
	AutoZoom		on
	Block {
	  BlockType		  Inport
	  Name			  "Reference"
	  Position		  [105, 85, 135, 100]
	  Orientation		  "down"
	  NamePlacement		  "alternate"
	  Port			  "1"
	  PortWidth		  "-1"
	  SampleTime		  "-1"
	  DataType		  "auto"
	  SignalType		  "auto"
	  Interpolate		  on
	}
	Block {
	  BlockType		  Inport
	  Name			  "Plant output"
	  Position		  [160, 355, 190, 370]
	  Orientation		  "up"
	  Port			  "2"
	  PortWidth		  "-1"
	  SampleTime		  "-1"
	  DataType		  "auto"
	  SignalType		  "auto"
	  Interpolate		  on
	}
	Block {
	  BlockType		  Mux
	  Name			  "Mux"
	  Ports			  [4, 1, 0, 0, 0]
	  Position		  [103, 135, 242, 190]
	  Orientation		  "down"
	  NamePlacement		  "alternate"
	  ShowName		  off
	  Inputs		  "4"
	  DisplayOption		  "signals"
	}
	Block {
	  BlockType		  SubSystem
	  Name			  "NN model"
	  Ports			  [2, 2, 0, 0, 0]
	  Position		  [210, 274, 280, 316]
	  ShowPortLabels	  on
	  System {
	    Name		    "NN model"
	    Location		    [43, 213, 1011, 586]
	    Open		    off
	    ModelBrowserVisibility  off
	    ModelBrowserWidth	    200
	    ScreenColor		    "automatic"
	    PaperOrientation	    "landscape"
	    PaperPositionMode	    "auto"
	    PaperType		    "usletter"
	    PaperUnits		    "inches"
	    ZoomFactor		    "100"
	    AutoZoom		    on
	    Block {
	      BlockType		      Inport
	      Name		      "u"
	      Position		      [75, 223, 105, 237]
	      Port		      "1"
	      PortWidth		      "-1"
	      SampleTime	      "-1"
	      DataType		      "auto"
	      SignalType	      "auto"
	      Interpolate	      on
	    }
	    Block {
	      BlockType		      Inport
	      Name		      "y"
	      Position		      [25, 78, 55, 92]
	      Port		      "2"
	      PortWidth		      "-1"
	      SampleTime	      "-1"
	      DataType		      "auto"
	      SignalType	      "auto"
	      Interpolate	      on
	    }
	    Block {
	      BlockType		      Constant
	      Name		      "Constant"
	      Position		      [395, 280, 415, 300]
	      Value		      "B1"
	    }
	    Block {
	      BlockType		      Constant
	      Name		      "Constant1"
	      Position		      [565, 290, 585, 310]
	      Value		      "B2"
	    }
	    Block {
	      BlockType		      Constant
	      Name		      "Constant2"
	      Position		      [135, 270, 155, 290]
	      Value		      "Normalize"
	    }
	    Block {
	      BlockType		      Constant
	      Name		      "Constant3"
	      Position		      [105, 145, 125, 165]
	      Value		      "Normalize"
	    }
	    Block {
	      BlockType		      Constant
	      Name		      "Constant4"
	      Position		      [780, 255, 800, 275]
	      Value		      "Normalize"
	    }
	    Block {
	      BlockType		      DiscreteStateSpace
	      Name		      "Discrete State-Space1"
	      Position		      [255, 211, 365, 249]
	      A			      "[zeros(1,Ni-1);eye(Ni-2,Ni-1)] %0 %[0 0"
";1 0]"
	      B			      "eye(Ni-1,1) %1 %[1;0]"
	      C			      "[zeros(1,Ni-1);eye(Ni-1,Ni-1)] %[0;1] %"
"[1 0;0 1]"
	      D			      "eye(Ni,1)  %[1;0] %[0;0]"
	      X0		      "0"
	      SampleTime	      "Ts"
	    }
	    Block {
	      BlockType		      DiscreteStateSpace
	      Name		      "Discrete State-Space2"
	      Position		      [260, 66, 370, 104]
	      A			      "[zeros(1,Nj-1);eye(Nj-2,Nj-1)] %0 %[0 0"
";1 0]"
	      B			      "eye(Nj-1,1) %1 %[1;0]"
	      C			      "[zeros(1,Nj-1);eye(Nj-1,Nj-1)] %[0;1] %"
"[1 0;0 1]"
	      D			      "eye(Nj,1)  %[1;0] %[0;0]"
	      X0		      "0"
	      SampleTime	      "Ts"
	    }
	    Block {
	      BlockType		      Fcn
	      Name		      "Fcn"
	      Position		      [135, 220, 170, 250]
	      Expr		      "(u(1)-minp)*2/(maxp-minp) - 1"
	    }
	    Block {
	      BlockType		      Fcn
	      Name		      "Fcn1"
	      Position		      [95, 70, 130, 100]
	      Expr		      "(u(1)-mint)*2/(maxt-mint) - 1"
	    }
	    Block {
	      BlockType		      Fcn
	      Name		      "Fcn2"
	      Position		      [710, 225, 745, 255]
	      Expr		      "(maxt-mint)*(u(1)+1)/2 + mint"
	    }
	    Block {
	      BlockType		      Reference
	      Name		      "Matrix\nGain"
	      Ports		      [1, 1, 0, 0, 0]
	      Position		      [395, 215, 425, 245]
	      SourceBlock	      "simulink3/Math/Matrix\nGain"
	      SourceType	      "Matrix Gain"
	      K			      "IW"
	    }
	    Block {
	      BlockType		      Reference
	      Name		      "Matrix\nGain1"
	      Ports		      [1, 1, 0, 0, 0]
	      Position		      [390, 70, 420, 100]
	      SourceBlock	      "simulink3/Math/Matrix\nGain"
	      SourceType	      "Matrix Gain"
	      K			      "LW1_2"
	    }
	    Block {
	      BlockType		      Reference
	      Name		      "Matrix\nGain2"
	      Ports		      [1, 1, 0, 0, 0]
	      Position		      [560, 215, 590, 245]
	      SourceBlock	      "simulink3/Math/Matrix\nGain"
	      SourceType	      "Matrix Gain"
	      K			      "LW2_1"
	    }
	    Block {
	      BlockType		      Switch
	      Name		      "Switch"
	      Position		      [200, 270, 230, 300]
	      Threshold		      "0.5"
	    }
	    Block {
	      BlockType		      Switch
	      Name		      "Switch1"
	      Position		      [160, 145, 190, 175]
	      Threshold		      "0.5"
	    }
	    Block {
	      BlockType		      Switch
	      Name		      "Switch2"
	      Position		      [835, 255, 865, 285]
	      Threshold		      "0.5"
	    }
	    Block {
	      BlockType		      UnitDelay
	      Name		      "Unit Delay1"
	      Position		      [210, 70, 240, 100]
	      X0		      "0"
	      SampleTime	      "Ts"
	    }
	    Block {
	      BlockType		      SubSystem
	      Name		      "netsum"
	      Ports		      [3, 1, 0, 0, 0]
	      Position		      [450, 209, 475, 251]
	      ShowPortLabels	      on
	      MaskDisplay	      "disp('+')"
	      MaskIconFrame	      on
	      MaskIconOpaque	      on
	      MaskIconRotate	      "none"
	      MaskIconUnits	      "autoscale"
	      System {
		Name			"netsum"
		Location		[320, 85, 820, 386]
		Open			off
		ModelBrowserVisibility	off
		ModelBrowserWidth	200
		ScreenColor		"automatic"
		PaperOrientation	"landscape"
		PaperPositionMode	"auto"
		PaperType		"usletter"
		PaperUnits		"inches"
		ZoomFactor		"100"
		AutoZoom		on
		Block {
		  BlockType		  Inport
		  Name			  "In1"
		  Position		  [20, 50, 40, 70]
		  Port			  "1"
		  PortWidth		  "-1"
		  SampleTime		  "-1"
		  DataType		  "auto"
		  SignalType		  "auto"
		  Interpolate		  on
		}
		Block {
		  BlockType		  Inport
		  Name			  "In2"
		  Position		  [20, 90, 40, 110]
		  Port			  "2"
		  PortWidth		  "-1"
		  SampleTime		  "-1"
		  DataType		  "auto"
		  SignalType		  "auto"
		  Interpolate		  on
		}
		Block {
		  BlockType		  Inport
		  Name			  "In3"
		  Position		  [20, 130, 40, 150]
		  Port			  "3"
		  PortWidth		  "-1"
		  SampleTime		  "-1"
		  DataType		  "auto"
		  SignalType		  "auto"
		  Interpolate		  on
		}
		Block {
		  BlockType		  Sum
		  Name			  "netsum"
		  Ports			  [3, 1, 0, 0, 0]
		  Position		  [90, 59, 115, 101]
		  IconShape		  "rectangular"
		  Inputs		  "3"
		  SaturateOnIntegerOverflow on
		}
		Block {
		  BlockType		  Outport
		  Name			  "Out1"
		  Position		  [145, 80, 165, 100]
		  Port			  "1"
		  OutputWhenDisabled	  "held"
		  InitialOutput		  "[]"
		}
		Line {
		  SrcBlock		  "In1"
		  SrcPort		  1
		  DstBlock		  "netsum"
		  DstPort		  1
		}
		Line {
		  SrcBlock		  "In2"
		  SrcPort		  1
		  DstBlock		  "netsum"
		  DstPort		  2
		}
		Line {
		  SrcBlock		  "In3"
		  SrcPort		  1
		  DstBlock		  "netsum"
		  DstPort		  3
		}
		Line {
		  SrcBlock		  "netsum"
		  SrcPort		  1
		  DstBlock		  "Out1"
		  DstPort		  1
		}
	      }
	    }
	    Block {
	      BlockType		      SubSystem
	      Name		      "netsum1"
	      Ports		      [2, 1, 0, 0, 0]
	      Position		      [620, 220, 645, 255]
	      ShowPortLabels	      on
	      MaskDisplay	      "disp('+')"
	      MaskIconFrame	      on
	      MaskIconOpaque	      on
	      MaskIconRotate	      "none"
	      MaskIconUnits	      "autoscale"
	      System {
		Name			"netsum1"
		Location		[320, 85, 820, 386]
		Open			off
		ModelBrowserVisibility	off
		ModelBrowserWidth	200
		ScreenColor		"automatic"
		PaperOrientation	"landscape"
		PaperPositionMode	"auto"
		PaperType		"usletter"
		PaperUnits		"inches"
		ZoomFactor		"100"
		AutoZoom		on
		Block {
		  BlockType		  Inport
		  Name			  "In1"
		  Position		  [20, 65, 40, 85]
		  Port			  "1"
		  PortWidth		  "-1"
		  SampleTime		  "-1"
		  DataType		  "auto"
		  SignalType		  "auto"
		  Interpolate		  on
		}
		Block {
		  BlockType		  Inport
		  Name			  "In2"
		  Position		  [20, 105, 40, 125]
		  Port			  "2"
		  PortWidth		  "-1"
		  SampleTime		  "-1"
		  DataType		  "auto"
		  SignalType		  "auto"
		  Interpolate		  on
		}
		Block {
		  BlockType		  Sum
		  Name			  "netsum1"
		  Ports			  [2, 1, 0, 0, 0]
		  Position		  [90, 60, 115, 95]
		  IconShape		  "rectangular"
		  Inputs		  "2"
		  SaturateOnIntegerOverflow on
		}
		Block {
		  BlockType		  Outport
		  Name			  "Out1"
		  Position		  [145, 80, 165, 100]
		  Port			  "1"
		  OutputWhenDisabled	  "held"
		  InitialOutput		  "[]"
		}
		Line {
		  SrcBlock		  "In1"
		  SrcPort		  1
		  DstBlock		  "netsum1"
		  DstPort		  1
		}
		Line {
		  SrcBlock		  "In2"
		  SrcPort		  1
		  DstBlock		  "netsum1"
		  DstPort		  2
		}
		Line {
		  SrcBlock		  "netsum1"
		  SrcPort		  1
		  DstBlock		  "Out1"
		  DstPort		  1
		}
	      }
	    }
	    Block {
	      BlockType		      SubSystem
	      Name		      "purelin"
	      Ports		      [1, 1, 0, 0, 0]
	      Position		      [660, 228, 685, 252]
	      ShowPortLabels	      on
	      MaskDisplay	      "plot([-1 1],[0 0],[-1 1],[-1 1])"
	      MaskIconFrame	      on
	      MaskIconOpaque	      on
	      MaskIconRotate	      "none"
	      MaskIconUnits	      "autoscale"
	      System {
		Name			"purelin"
		Location		[144, 218, 404, 300]
		Open			off
		ModelBrowserVisibility	off
		ModelBrowserWidth	200
		ScreenColor		"white"
		PaperOrientation	"landscape"
		PaperPositionMode	"auto"
		PaperType		"usletter"
		PaperUnits		"inches"
		ZoomFactor		"100"
		AutoZoom		on
		Block {
		  BlockType		  Inport
		  Name			  "n"
		  Position		  [25, 33, 55, 47]
		  Port			  "1"
		  PortWidth		  "-1"
		  SampleTime		  "-1"
		  DataType		  "auto"
		  SignalType		  "auto"
		  Interpolate		  on
		}
		Block {
		  BlockType		  Outport
		  Name			  "a"
		  Position		  [205, 33, 235, 47]
		  Port			  "1"
		  OutputWhenDisabled	  "held"
		  InitialOutput		  "[]"
		}
		Line {
		  SrcBlock		  "n"
		  SrcPort		  1
		  DstBlock		  "a"
		  DstPort		  1
		}
	      }
	    }
	    Block {
	      BlockType		      SubSystem
	      Name		      "tansig"
	      Ports		      [1, 1, 0, 0, 0]
	      Position		      [500, 218, 525, 242]
	      ShowPortLabels	      on
	      MaskDisplay	      "plot([-1 1],[0 0],[-1 -.9 -.8 -.7 -.6 -"
".5 -.4 -.3 -.2 -.1 0 .1 .2 .3 .4 .5 .6 .7 .8 .9 1],2./(1+exp(-8*[-1 -.9 -.8 -"
".7 -.6 -.5 -.4 -.3 -.2 -.1 0 .1 .2 .3 .4 .5 .6 .7 .8 .9 1]))-1)"
	      MaskIconFrame	      on
	      MaskIconOpaque	      on
	      MaskIconRotate	      "none"
	      MaskIconUnits	      "autoscale"
	      System {
		Name			"tansig"
		Location		[0, 38, 640, 480]
		Open			off
		ModelBrowserVisibility	off
		ModelBrowserWidth	200
		ScreenColor		"white"
		PaperOrientation	"landscape"
		PaperPositionMode	"auto"
		PaperType		"usletter"
		PaperUnits		"inches"
		ZoomFactor		"100"
		AutoZoom		on
		Block {
		  BlockType		  Inport
		  Name			  "n"
		  Position		  [25, 33, 55, 47]
		  Port			  "1"
		  PortWidth		  "-1"
		  SampleTime		  "-1"
		  DataType		  "auto"
		  SignalType		  "auto"
		  Interpolate		  on
		}
		Block {
		  BlockType		  Math
		  Name			  "Exp"
		  Ports			  [1, 1, 0, 0, 0]
		  Position		  [155, 25, 185, 55]
		  Operator		  "exp"
		  OutputSignalType	  "auto"
		  MaskIconFrame		  on
		  MaskIconOpaque	  on
		  MaskIconRotate	  "none"
		  MaskIconUnits		  "autoscale"
		}
		Block {
		  BlockType		  Gain
		  Name			  "Gain"
		  Position		  [90, 25, 120, 55]
		  Gain			  "-2"
		  SaturateOnIntegerOverflow on
		}
		Block {
		  BlockType		  Gain
		  Name			  "Gain1"
		  Position		  [370, 30, 400, 60]
		  Gain			  "2"
		  SaturateOnIntegerOverflow on
		}
		Block {
		  BlockType		  Math
		  Name			  "Reciprocal"
		  Ports			  [1, 1, 0, 0, 0]
		  Position		  [295, 30, 325, 60]
		  Operator		  "reciprocal"
		  OutputSignalType	  "auto"
		  MaskIconFrame		  on
		  MaskIconOpaque	  on
		  MaskIconRotate	  "none"
		  MaskIconUnits		  "autoscale"
		}
		Block {
		  BlockType		  Sum
		  Name			  "Sum"
		  Ports			  [2, 1, 0, 0, 0]
		  Position		  [225, 27, 255, 58]
		  IconShape		  "rectangular"
		  Inputs		  "++"
		  SaturateOnIntegerOverflow on
		}
		Block {
		  BlockType		  Sum
		  Name			  "Sum1"
		  Ports			  [2, 1, 0, 0, 0]
		  Position		  [445, 27, 475, 58]
		  IconShape		  "rectangular"
		  Inputs		  "+-"
		  SaturateOnIntegerOverflow on
		}
		Block {
		  BlockType		  Constant
		  Name			  "one"
		  Position		  [160, 85, 180, 105]
		  Value			  "1"
		}
		Block {
		  BlockType		  Constant
		  Name			  "one1"
		  Position		  [375, 85, 395, 105]
		  Value			  "1"
		}
		Block {
		  BlockType		  Outport
		  Name			  "a"
		  Position		  [515, 38, 545, 52]
		  Port			  "1"
		  OutputWhenDisabled	  "held"
		  InitialOutput		  "[]"
		}
		Line {
		  SrcBlock		  "n"
		  SrcPort		  1
		  DstBlock		  "Gain"
		  DstPort		  1
		}
		Line {
		  SrcBlock		  "Gain"
		  SrcPort		  1
		  DstBlock		  "Exp"
		  DstPort		  1
		}
		Line {
		  SrcBlock		  "Exp"
		  SrcPort		  1
		  Points		  [20, 0]
		  DstBlock		  "Sum"
		  DstPort		  1
		}
		Line {
		  SrcBlock		  "one"
		  SrcPort		  1
		  Points		  [25, 0]
		  DstBlock		  "Sum"
		  DstPort		  2
		}
		Line {
		  SrcBlock		  "Sum"
		  SrcPort		  1
		  DstBlock		  "Reciprocal"
		  DstPort		  1
		}
		Line {
		  SrcBlock		  "Reciprocal"
		  SrcPort		  1
		  DstBlock		  "Gain1"
		  DstPort		  1
		}
		Line {
		  SrcBlock		  "Gain1"
		  SrcPort		  1
		  Points		  [25, 0]
		  DstBlock		  "Sum1"
		  DstPort		  1
		}
		Line {
		  SrcBlock		  "one1"
		  SrcPort		  1
		  Points		  [30, 0]
		  DstBlock		  "Sum1"
		  DstPort		  2
		}
		Line {
		  SrcBlock		  "Sum1"
		  SrcPort		  1
		  DstBlock		  "a"
		  DstPort		  1
		}
	      }
	    }
	    Block {
	      BlockType		      Outport
	      Name		      "yhat"
	      Position		      [885, 263, 915, 277]
	      Port		      "1"
	      OutputWhenDisabled      "held"
	      InitialOutput	      "[]"
	    }
	    Block {
	      BlockType		      Outport
	      Name		      "yhat1"
	      Position		      [585, 153, 615, 167]
	      Port		      "2"
	      OutputWhenDisabled      "held"
	      InitialOutput	      "[]"
	    }
	    Line {
	      SrcBlock		      "netsum1"
	      SrcPort		      1
	      DstBlock		      "purelin"
	      DstPort		      1
	    }
	    Line {
	      SrcBlock		      "Constant1"
	      SrcPort		      1
	      Points		      [10, 0; 0, -55]
	      DstBlock		      "netsum1"
	      DstPort		      2
	    }
	    Line {
	      SrcBlock		      "Matrix\nGain2"
	      SrcPort		      1
	      DstBlock		      "netsum1"
	      DstPort		      1
	    }
	    Line {
	      SrcBlock		      "netsum"
	      SrcPort		      1
	      DstBlock		      "tansig"
	      DstPort		      1
	    }
	    Line {
	      SrcBlock		      "Constant"
	      SrcPort		      1
	      Points		      [15, 0]
	      DstBlock		      "netsum"
	      DstPort		      3
	    }
	    Line {
	      SrcBlock		      "Matrix\nGain1"
	      SrcPort		      1
	      Points		      [10, 0]
	      DstBlock		      "netsum"
	      DstPort		      1
	    }
	    Line {
	      SrcBlock		      "Matrix\nGain"
	      SrcPort		      1
	      DstBlock		      "netsum"
	      DstPort		      2
	    }
	    Line {
	      SrcBlock		      "tansig"
	      SrcPort		      1
	      Points		      [5, 0]
	      Branch {
		DstBlock		"Matrix\nGain2"
		DstPort			1
	      }
	      Branch {
		Points			[0, -70]
		DstBlock		"yhat1"
		DstPort			1
	      }
	    }
	    Line {
	      SrcBlock		      "Discrete State-Space1"
	      SrcPort		      1
	      DstBlock		      "Matrix\nGain"
	      DstPort		      1
	    }
	    Line {
	      SrcBlock		      "Fcn"
	      SrcPort		      1
	      Points		      [0, 40]
	      DstBlock		      "Switch"
	      DstPort		      1
	    }
	    Line {
	      SrcBlock		      "Switch"
	      SrcPort		      1
	      Points		      [5, 0]
	      DstBlock		      "Discrete State-Space1"
	      DstPort		      1
	    }
	    Line {
	      SrcBlock		      "u"
	      SrcPort		      1
	      Points		      [5, 0]
	      Branch {
		Points			[5, 0]
		DstBlock		"Fcn"
		DstPort			1
	      }
	      Branch {
		Points			[0, 110; 70, 0]
		DstBlock		"Switch"
		DstPort			3
	      }
	    }
	    Line {
	      SrcBlock		      "Constant2"
	      SrcPort		      1
	      Points		      [25, 0]
	      DstBlock		      "Switch"
	      DstPort		      2
	    }
	    Line {
	      SrcBlock		      "Discrete State-Space2"
	      SrcPort		      1
	      DstBlock		      "Matrix\nGain1"
	      DstPort		      1
	    }
	    Line {
	      SrcBlock		      "Unit Delay1"
	      SrcPort		      1
	      DstBlock		      "Discrete State-Space2"
	      DstPort		      1
	    }
	    Line {
	      SrcBlock		      "Constant3"
	      SrcPort		      1
	      Points		      [15, 0]
	      DstBlock		      "Switch1"
	      DstPort		      2
	    }
	    Line {
	      SrcBlock		      "Switch1"
	      SrcPort		      1
	      DstBlock		      "Unit Delay1"
	      DstPort		      1
	    }
	    Line {
	      SrcBlock		      "Fcn1"
	      SrcPort		      1
	      Points		      [10, 0]
	      DstBlock		      "Switch1"
	      DstPort		      1
	    }
	    Line {
	      SrcBlock		      "y"
	      SrcPort		      1
	      Points		      [10, 0]
	      Branch {
		DstBlock		"Fcn1"
		DstPort			1
	      }
	      Branch {
		Points			[0, 110; 75, 0]
		DstBlock		"Switch1"
		DstPort			3
	      }
	    }
	    Line {
	      SrcBlock		      "Constant4"
	      SrcPort		      1
	      Points		      [15, 0]
	      DstBlock		      "Switch2"
	      DstPort		      2
	    }
	    Line {
	      SrcBlock		      "Switch2"
	      SrcPort		      1
	      DstBlock		      "yhat"
	      DstPort		      1
	    }
	    Line {
	      SrcBlock		      "Fcn2"
	      SrcPort		      1
	      Points		      [70, 0]
	      DstBlock		      "Switch2"
	      DstPort		      1
	    }
	    Line {
	      SrcBlock		      "purelin"
	      SrcPort		      1
	      Points		      [0, 0]
	      Branch {
		DstBlock		"Fcn2"
		DstPort			1
	      }
	      Branch {
		Points			[0, 40]
		DstBlock		"Switch2"
		DstPort			3
	      }
	    }
	  }
	}
	Block {
	  BlockType		  "S-Function"
	  Name			  "S-Function"
	  Ports			  [1, 1, 0, 0, 0]
	  Position		  [145, 210, 205, 240]
	  Orientation		  "down"
	  NamePlacement		  "alternate"
	  FunctionName		  "predopt"
	  Parameters		  "N2,Ts,Nu,maxiter,csrchfun,rho,alpha,S1,IW,L"
"W1_2,LW2_1,B1,B2,Ni,Nj,min_i,max_i,minp,maxp,mint,maxt,Normalize"
	  PortCounts		  "[]"
	  SFunctionModules	  "''"
	}
	Block {
	  BlockType		  Outport
	  Name			  "Control Signal"
	  Position		  [105, 300, 135, 315]
	  Orientation		  "down"
	  NamePlacement		  "alternate"
	  Port			  "1"
	  OutputWhenDisabled	  "held"
	  InitialOutput		  "[]"
	}
	Line {
	  Labels		  [0, 0]
	  SrcBlock		  "Mux"
	  SrcPort		  1
	  DstBlock		  "S-Function"
	  DstPort		  1
	}
	Line {
	  SrcBlock		  "S-Function"
	  SrcPort		  1
	  Points		  [0, 40]
	  Branch {
	    DstBlock		    "NN model"
	    DstPort		    1
	  }
	  Branch {
	    DstBlock		    "Control Signal"
	    DstPort		    1
	  }
	}
	Line {
	  SrcBlock		  "NN model"
	  SrcPort		  2
	  Points		  [40, 0; 0, -185]
	  DstBlock		  "Mux"
	  DstPort		  4
	}
	Line {
	  SrcBlock		  "NN model"
	  SrcPort		  1
	  Points		  [15, 0; 0, -255; -110, 0]
	  DstBlock		  "Mux"
	  DstPort		  3
	}
	Line {
	  SrcBlock		  "Reference"
	  SrcPort		  1
	  DstBlock		  "Mux"
	  DstPort		  1
	}
	Line {
	  SrcBlock		  "Plant output"
	  SrcPort		  1
	  Points		  [0, -15]
	  Branch {
	    Points		    [0, -30]
	    DstBlock		    "NN model"
	    DstPort		    2
	  }
	  Branch {
	    Points		    [-155, 0; 0, -275; 135, 0]
	    DstBlock		    "Mux"
	    DstPort		    2
	  }
	}
      }
    }
    Block {
      BlockType		      SubSystem
      Name		      "Plant\n(Continuous Stirred Tank Reactor)"
      Ports		      [1, 1, 0, 0, 0]
      Position		      [405, 68, 525, 142]
      ShowPortLabels	      on
      MaskType		      "Continuous Stirred Tank Reactor"
      MaskInitialization      "xl = [0    .45  .45  NaN   .3   .3  1.   1.    "
"NaN ];\nyl = [1   1    .7    NaN   .8   .2    .2   .8  NaN  ]+.1;\nx2 = [.85 "
".85   1.2   NaN .8 .85 .9 NaN .4 .45 .5 ];\ny2 = [.7   1      1      NaN .8 ."
"7   .8 NaN  .8 .7 .8]+.1;\nx3 = [.3 1 NaN .8 .8 1.1 NaN 1 1.1 1];\ny3 = [.6 ."
"6 NaN .2 .1 .1 NaN .15 .1 .05]+.1;\nt=(0:24)/24*2*pi;\nxs = .07*cos(t)+.9;\ny"
"s = .07*sin(t)+.75;\n\n"
      MaskDisplay	      "plot([[xl NaN x2 NaN x3]*.9-.075 ], [[yl  NaN y"
"2 NaN y3]*.9-.1 ]);\n"
      MaskIconFrame	      on
      MaskIconOpaque	      on
      MaskIconRotate	      "none"
      MaskIconUnits	      "normalized"
      Port {
	PortNumber		1
	Name			"Concentration"
	TestPoint		off
	RTWStorageClass		"Auto"
      }
      System {
	Name			"Plant\n(Continuous Stirred Tank Reactor)"
	Location		[103, 226, 986, 662]
	Open			off
	ModelBrowserVisibility	off
	ModelBrowserWidth	200
	ScreenColor		"automatic"
	PaperOrientation	"landscape"
	PaperPositionMode	"auto"
	PaperType		"usletter"
	PaperUnits		"inches"
	ZoomFactor		"100"
	AutoZoom		on
	Block {
	  BlockType		  Inport
	  Name			  "w1"
	  Position		  [60, 113, 90, 127]
	  Port			  "1"
	  PortWidth		  "-1"
	  SampleTime		  "-1"
	  DataType		  "auto"
	  SignalType		  "auto"
	  Interpolate		  on
	}
	Block {
	  BlockType		  Constant
	  Name			  "Cb1"
	  Position		  [135, 295, 165, 325]
	  Value			  "24.9"
	}
	Block {
	  BlockType		  Constant
	  Name			  "Cb2"
	  Position		  [135, 365, 165, 395]
	  Value			  "0.10"
	}
	Block {
	  BlockType		  Integrator
	  Name			  "Concentration"
	  Ports			  [1, 1, 0, 0, 0]
	  Position		  [750, 222, 785, 258]
	  ExternalReset		  "none"
	  InitialConditionSource  "internal"
	  InitialCondition	  "22"
	  LimitOutput		  off
	  UpperSaturationLimit	  "inf"
	  LowerSaturationLimit	  "0"
	  ShowSaturationPort	  off
	  ShowStatePort		  off
	  AbsoluteTolerance	  "auto"
	}
	Block {
	  BlockType		  Constant
	  Name			  "Constant"
	  Position		  [390, 215, 420, 245]
	  Value			  "1"
	}
	Block {
	  BlockType		  Constant
	  Name			  "Constant1"
	  Position		  [20, 135, 50, 165]
	  Value			  "0.1"
	}
	Block {
	  BlockType		  Gain
	  Name			  "Gain"
	  Position		  [110, 40, 140, 70]
	  Gain			  "0.2"
	  SaturateOnIntegerOverflow on
	}
	Block {
	  BlockType		  Integrator
	  Name			  "Height"
	  Ports			  [1, 1, 0, 0, 0]
	  Position		  [220, 109, 260, 141]
	  ExternalReset		  "none"
	  InitialConditionSource  "internal"
	  InitialCondition	  "30"
	  LimitOutput		  on
	  UpperSaturationLimit	  "inf"
	  LowerSaturationLimit	  "1"
	  ShowSaturationPort	  off
	  ShowStatePort		  off
	  AbsoluteTolerance	  "auto"
	}
	Block {
	  BlockType		  Product
	  Name			  "Product"
	  Ports			  [2, 1, 0, 0, 0]
	  Position		  [595, 202, 625, 233]
	  Inputs		  "*/"
	  SaturateOnIntegerOverflow on
	}
	Block {
	  BlockType		  Product
	  Name			  "Product1"
	  Ports			  [3, 1, 0, 0, 0]
	  Position		  [300, 259, 330, 291]
	  Inputs		  "/**"
	  SaturateOnIntegerOverflow on
	}
	Block {
	  BlockType		  Product
	  Name			  "Product2"
	  Ports			  [3, 1, 0, 0, 0]
	  Position		  [300, 324, 330, 356]
	  Inputs		  "/**"
	  SaturateOnIntegerOverflow on
	}
	Block {
	  BlockType		  Math
	  Name			  "Square"
	  Ports			  [1, 1, 0, 0, 0]
	  Position		  [510, 208, 540, 242]
	  Operator		  "square"
	  OutputSignalType	  "auto"
	}
	Block {
	  BlockType		  Math
	  Name			  "SquareRoot"
	  Ports			  [1, 1, 0, 0, 0]
	  Position		  [45, 38, 75, 72]
	  Operator		  "sqrt"
	  OutputSignalType	  "auto"
	}
	Block {
	  BlockType		  Sum
	  Name			  "Sum"
	  Ports			  [3, 1, 0, 0, 0]
	  Position		  [175, 106, 200, 144]
	  ShowName		  off
	  IconShape		  "rectangular"
	  Inputs		  "-++"
	  SaturateOnIntegerOverflow on
	}
	Block {
	  BlockType		  Sum
	  Name			  "Sum1"
	  Ports			  [3, 1, 0, 0, 0]
	  Position		  [700, 221, 725, 259]
	  ShowName		  off
	  IconShape		  "rectangular"
	  Inputs		  "-++"
	  SaturateOnIntegerOverflow on
	}
	Block {
	  BlockType		  Sum
	  Name			  "Sum2"
	  Ports			  [2, 1, 0, 0, 0]
	  Position		  [460, 213, 485, 237]
	  ShowName		  off
	  IconShape		  "rectangular"
	  Inputs		  "++"
	  SaturateOnIntegerOverflow on
	}
	Block {
	  BlockType		  Sum
	  Name			  "Sum3"
	  Ports			  [2, 1, 0, 0, 0]
	  Position		  [215, 303, 240, 327]
	  ShowName		  off
	  IconShape		  "rectangular"
	  Inputs		  "+-"
	  SaturateOnIntegerOverflow on
	}
	Block {
	  BlockType		  Sum
	  Name			  "Sum4"
	  Ports			  [2, 1, 0, 0, 0]
	  Position		  [210, 373, 235, 397]
	  ShowName		  off
	  IconShape		  "rectangular"
	  Inputs		  "+-"
	  SaturateOnIntegerOverflow on
	}
	Block {
	  BlockType		  Terminator
	  Name			  "Terminator"
	  Position		  [300, 115, 320, 135]
	}
	Block {
	  BlockType		  Outport
	  Name			  "Cb"
	  Position		  [830, 233, 860, 247]
	  Port			  "1"
	  OutputWhenDisabled	  "held"
	  InitialOutput		  "[]"
	}
	Line {
	  SrcBlock		  "Sum"
	  SrcPort		  1
	  DstBlock		  "Height"
	  DstPort		  1
	}
	Line {
	  SrcBlock		  "Gain"
	  SrcPort		  1
	  Points		  [15, 0]
	  DstBlock		  "Sum"
	  DstPort		  1
	}
	Line {
	  SrcBlock		  "SquareRoot"
	  SrcPort		  1
	  DstBlock		  "Gain"
	  DstPort		  1
	}
	Line {
	  SrcBlock		  "Height"
	  SrcPort		  1
	  Points		  [5, 0]
	  Branch {
	    Points		    [0, -100; -240, 0]
	    DstBlock		    "SquareRoot"
	    DstPort		    1
	  }
	  Branch {
	    Points		    [0, 140]
	    Branch {
	      DstBlock		      "Product1"
	      DstPort		      1
	    }
	    Branch {
	      Points		      [0, 65]
	      DstBlock		      "Product2"
	      DstPort		      1
	    }
	  }
	  Branch {
	    DstBlock		    "Terminator"
	    DstPort		    1
	  }
	}
	Line {
	  SrcBlock		  "w1"
	  SrcPort		  1
	  Points		  [30, 0]
	  Branch {
	    Points		    [35, 0]
	    DstBlock		    "Sum"
	    DstPort		    2
	  }
	  Branch {
	    Points		    [0, 155]
	    DstBlock		    "Product1"
	    DstPort		    2
	  }
	}
	Line {
	  SrcBlock		  "Constant1"
	  SrcPort		  1
	  Points		  [25, 0]
	  Branch {
	    Points		    [80, 0]
	    DstBlock		    "Sum"
	    DstPort		    3
	  }
	  Branch {
	    Points		    [0, 190]
	    DstBlock		    "Product2"
	    DstPort		    2
	  }
	}
	Line {
	  SrcBlock		  "Cb1"
	  SrcPort		  1
	  DstBlock		  "Sum3"
	  DstPort		  1
	}
	Line {
	  SrcBlock		  "Cb2"
	  SrcPort		  1
	  DstBlock		  "Sum4"
	  DstPort		  1
	}
	Line {
	  SrcBlock		  "Sum3"
	  SrcPort		  1
	  Points		  [40, 0]
	  DstBlock		  "Product1"
	  DstPort		  3
	}
	Line {
	  SrcBlock		  "Sum4"
	  SrcPort		  1
	  Points		  [45, 0]
	  DstBlock		  "Product2"
	  DstPort		  3
	}
	Line {
	  SrcBlock		  "Concentration"
	  SrcPort		  1
	  Points		  [20, 0]
	  Branch {
	    Points		    [0, 165; -625, 0; 0, -15]
	    Branch {
	      Points		      [0, -70]
	      DstBlock		      "Sum3"
	      DstPort		      2
	    }
	    Branch {
	      DstBlock		      "Sum4"
	      DstPort		      2
	    }
	  }
	  Branch {
	    Points		    [0, 0]
	    Branch {
	      Points		      [0, -85; -245, 0]
	      Branch {
		Points			[-120, 0]
		DstBlock		"Sum2"
		DstPort			1
	      }
	      Branch {
		Points			[0, 55]
		DstBlock		"Product"
		DstPort			1
	      }
	    }
	    Branch {
	      DstBlock		      "Cb"
	      DstPort		      1
	    }
	  }
	}
	Line {
	  SrcBlock		  "Constant"
	  SrcPort		  1
	  DstBlock		  "Sum2"
	  DstPort		  2
	}
	Line {
	  SrcBlock		  "Sum2"
	  SrcPort		  1
	  DstBlock		  "Square"
	  DstPort		  1
	}
	Line {
	  SrcBlock		  "Sum1"
	  SrcPort		  1
	  DstBlock		  "Concentration"
	  DstPort		  1
	}
	Line {
	  SrcBlock		  "Square"
	  SrcPort		  1
	  DstBlock		  "Product"
	  DstPort		  2
	}
	Line {
	  SrcBlock		  "Product"
	  SrcPort		  1
	  Points		  [55, 0]
	  DstBlock		  "Sum1"
	  DstPort		  1
	}
	Line {
	  SrcBlock		  "Product1"
	  SrcPort		  1
	  Points		  [320, 0; 0, -35]
	  DstBlock		  "Sum1"
	  DstPort		  2
	}
	Line {
	  SrcBlock		  "Product2"
	  SrcPort		  1
	  Points		  [350, 0]
	  DstBlock		  "Sum1"
	  DstPort		  3
	}
      }
    }
    Block {
      BlockType		      UniformRandomNumber
      Name		      "Random Reference"
      Position		      [40, 54, 70, 86]
      Minimum		      "20"
      Maximum		      "23"
      Seed		      "now*10e8"
      SampleTime	      "20"
    }
    Block {
      BlockType		      SubSystem
      Name		      "X(2Y)\n Graph"
      Ports		      [3, 0, 0, 0, 0]
      Position		      [655, 82, 690, 128]
      CopyFcn		      "sfunxy2([],[],[],'CopyBlock')"
      DeleteFcn		      "sfunxy2([],[],[],'DeleteBlock')"
      LoadFcn		      "sfunxy2([],[],[],'LoadBlock')"
      StartFcn		      "sfunxy2([],[],[],'Start')"
      StopFcn		      "sfunxy2([],[],[],'Stop')"
      NameChangeFcn	      "sfunxy2([],[],[],'NameChange')"
      ShowPortLabels	      on
      MaskType		      "X(2Y) scope."
      MaskDescription	      "X(2Y) scope using MATLAB graph window.  First i"
"nput is used as time base.  Enter plotting ranges."
      MaskHelp		      "This block can be used to explore limit cycles."
" Look at the m-file sfunxy.m to see how it works."
      MaskPromptString	      "x-min:|x-max:|y-min:|y-max:|Sample time:"
      MaskStyleString	      "edit,edit,edit,edit,edit"
      MaskTunableValueString  "on,on,on,on,on"
      MaskCallbackString      "||||"
      MaskEnableString	      "on,on,on,on,on"
      MaskVisibilityString    "on,on,on,on,on"
      MaskVariables	      "xmin=@1;xmax=@2;ymin=@3;ymax=@4;st=@5;"
      MaskDisplay	      "plot([.05 .95 .95 .05 .05],[.45 .45 .95 .95 .45"
"], 0.5+cos(0:0.1:2*pi)*0.3,0.7+sin(0:0.1:2*pi)*0.2)"
      MaskSelfModifiable      on
      MaskIconFrame	      on
      MaskIconOpaque	      on
      MaskIconRotate	      "none"
      MaskIconUnits	      "normalized"
      MaskValueString	      "0|5|21|22|-1"
      System {
	Name			"X(2Y)\n Graph"
	Location		[82, 157, 342, 335]
	Open			off
	ModelBrowserVisibility	off
	ModelBrowserWidth	200
	ScreenColor		"white"
	PaperOrientation	"landscape"
	PaperPositionMode	"auto"
	PaperType		"usletter"
	PaperUnits		"inches"
	ZoomFactor		"100"
	AutoZoom		on
	Block {
	  BlockType		  Inport
	  Name			  "x"
	  Position		  [25, 27, 55, 43]
	  Port			  "1"
	  PortWidth		  "-1"
	  SampleTime		  "-1"
	  DataType		  "auto"
	  SignalType		  "auto"
	  Interpolate		  on
	}
	Block {
	  BlockType		  Inport
	  Name			  "y1"
	  Position		  [25, 67, 55, 83]
	  Port			  "2"
	  PortWidth		  "-1"
	  SampleTime		  "-1"
	  DataType		  "auto"
	  SignalType		  "auto"
	  Interpolate		  on
	}
	Block {
	  BlockType		  Inport
	  Name			  "y2"
	  Position		  [25, 107, 55, 123]
	  Port			  "3"
	  PortWidth		  "-1"
	  SampleTime		  "-1"
	  DataType		  "auto"
	  SignalType		  "auto"
	  Interpolate		  on
	}
	Block {
	  BlockType		  Mux
	  Name			  "Mux"
	  Ports			  [3, 1, 0, 0, 0]
	  Position		  [105, 48, 135, 102]
	  ShowName		  off
	  Inputs		  "3"
	  DisplayOption		  "none"
	}
	Block {
	  BlockType		  "S-Function"
	  Name			  "sfunxy"
	  Ports			  [1, 0, 0, 0, 0]
	  Position		  [175, 65, 225, 85]
	  ShowName		  off
	  FunctionName		  "sfunxy2"
	  Parameters		  "[xmin xmax ymin ymax], st"
	  PortCounts		  "[]"
	  SFunctionModules	  "''"
	}
	Line {
	  SrcBlock		  "y2"
	  SrcPort		  1
	  Points		  [15, 0; 0, -20]
	  DstBlock		  "Mux"
	  DstPort		  3
	}
	Line {
	  SrcBlock		  "y1"
	  SrcPort		  1
	  DstBlock		  "Mux"
	  DstPort		  2
	}
	Line {
	  SrcBlock		  "x"
	  SrcPort		  1
	  Points		  [15, 0; 0, 20]
	  DstBlock		  "Mux"
	  DstPort		  1
	}
	Line {
	  SrcBlock		  "Mux"
	  SrcPort		  1
	  DstBlock		  "sfunxy"
	  DstPort		  1
	}
      }
    }
    Line {
      SrcBlock		      "Clock"
      SrcPort		      1
      Points		      [0, 30]
      DstBlock		      "X(2Y)\n Graph"
      DstPort		      1
    }
    Line {
      Name		      "Flow Rate"
      Labels		      [0, 0]
      SrcBlock		      "NN Predictive Controller"
      SrcPort		      1
      DstBlock		      "Plant\n(Continuous Stirred Tank Reactor)"
      DstPort		      1
    }
    Line {
      Name		      "Concentration"
      Labels		      [0, 0]
      SrcBlock		      "Plant\n(Continuous Stirred Tank Reactor)"
      SrcPort		      1
      Points		      [70, 0]
      Branch {
	DstBlock		"X(2Y)\n Graph"
	DstPort			2
      }
      Branch {
	Points			[0, 80; -455, 0; 0, -50]
	DstBlock		"NN Predictive Controller"
	DstPort			2
      }
    }
    Line {
      SrcBlock		      "Random Reference"
      SrcPort		      1
      Points		      [40, 0]
      Branch {
	DstBlock		"NN Predictive Controller"
	DstPort			1
      }
      Branch {
	Points			[0, 140; 525, 0]
	DstBlock		"X(2Y)\n Graph"
	DstPort			3
      }
    }
    Annotation {
      Position		      [203, 252]
      Text		      "Neural Network Predictive Control of a Continou"
"s Stirred Tank Reactor\n(Double click on the \"?\" for more info)"
    }
    Annotation {
      Position		      [206, 297]
      Text		      "To start and stop the simulation, use the \"Sta"
"rt/Stop\"\nselection in the \"Simulation\" pull-down menu"
    }
  }
}
