# $Revision: 1.11 $
Model {
  Name			  "simquat"
  Version		  2.20
  SimParamPage		  Solver
  SampleTimeColors	  off
  InvariantConstants	  off
  WideVectorLines	  on
  ShowLineWidths	  off
  StartTime		  "0.0"
  StopTime		  "999999"
  Solver		  ode1
  RelTol		  "1e-3"
  AbsTol		  "1e-6"
  Refine		  "1"
  MaxStep		  "1"
  InitialStep		  ".1"
  FixedStep		  "1"
  MaxOrder		  5
  OutputOption		  RefineOutputTimes
  OutputTimes		  "[]"
  LoadExternalInput	  off
  ExternalInput		  "[t, u]"
  SaveTime		  off
  TimeSaveName		  "tout"
  SaveState		  off
  StateSaveName		  "xout"
  SaveOutput		  off
  OutputSaveName	  "yout"
  LoadInitialState	  off
  InitialState		  "xInitial"
  SaveFinalState	  off
  FinalStateName	  "xFinal"
  LimitMaxRows		  off
  MaxRows		  "1000"
  Decimation		  "1"
  AlgebraicLoopMsg	  warning
  MinStepSizeMsg	  warning
  UnconnectedInputMsg	  warning
  UnconnectedOutputMsg	  warning
  UnconnectedLineMsg	  warning
  ConsistencyChecking	  off
  ZeroCross		  on
  SimulationMode	  normal
  RTWSystemTargetFile	  "grt.tlc"
  RTWInlineParameters	  off
  RTWPlaceOutputsASAP	  off
  RTWRetainRTWFile	  off
  RTWTemplateMakefile	  "grt_default_tmf"
  RTWMakeCommand	  "make_rtw"
  RTWGenerateCodeOnly	  off
  ExtModeMexFile	  "ext_comm"
  ExtModeBatchMode	  off
  PostLoadFcn		  "quatdemo Static Foo Bar"
  CloseFcn		  "quatdemo Close"
  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		    "simquat"
    Location		    [52, 88, 626, 364]
    Open		    on
    ToolBar		    on
    StatusBar		    on
    ScreenColor		    white
    PaperOrientation	    landscape
    PaperPositionMode	    auto
    PaperType		    usletter
    PaperUnits		    inches
    Block {
      BlockType		      Clock
      Name		      "Clock"
      Position		      [25, 180, 45, 200]
      ShowName		      off
      Location		      [30, 40, 140, 75]
    }
    Block {
      BlockType		      Display
      Name		      "Display Rates"
      Ports		      [1, 0, 0, 0, 0]
      Position		      [215, 175, 305, 245]
      Format		      short
      Decimation	      "1"
      Floating		      off
      SampleTime	      "-1"
    }
    Block {
      BlockType		      Display
      Name		      "Display Rotation"
      Ports		      [1, 0, 0, 0, 0]
      Position		      [435, 182, 525, 248]
      Format		      short
      Decimation	      "1"
      Floating		      off
      SampleTime	      "-1"
    }
    Block {
      BlockType		      SubSystem
      Name		      "Inputs"
      Ports		      [0, 3, 0, 0, 0]
      Position		      [15, 54, 80, 116]
      ShowName		      off
      OpenFcn		      "quatdemo Dynamic Foo Bar"
      ShowPortLabels	      on
      System {
	Name			"Inputs"
	Location		[423, 71, 553, 255]
	Open			off
	ToolBar			off
	StatusBar		off
	ScreenColor		white
	PaperOrientation	landscape
	PaperPositionMode	auto
	PaperType		usletter
	PaperUnits		inches
	Block {
	  BlockType		  Constant
	  Name			  "P"
	  Position		  [20, 30, 40, 50]
	  Value			  "0"
	}
	Block {
	  BlockType		  Constant
	  Name			  "Q"
	  Position		  [20, 85, 40, 105]
	  Value			  "0"
	}
	Block {
	  BlockType		  Constant
	  Name			  "R"
	  Position		  [20, 140, 40, 160]
	  Value			  "0"
	}
	Block {
	  BlockType		  Outport
	  Name			  "P (Roll Rate)"
	  Position		  [75, 33, 105, 47]
	  Port			  "1"
	  OutputWhenDisabled	  held
	  InitialOutput		  "0"
	}
	Block {
	  BlockType		  Outport
	  Name			  "Q (Pitch Rate)"
	  Position		  [75, 88, 105, 102]
	  Port			  "2"
	  OutputWhenDisabled	  held
	  InitialOutput		  "0"
	}
	Block {
	  BlockType		  Outport
	  Name			  "R (Yaw Rate)"
	  Position		  [70, 143, 100, 157]
	  Port			  "3"
	  OutputWhenDisabled	  held
	  InitialOutput		  "0"
	}
	Line {
	  SrcBlock		  "R"
	  SrcPort		  1
	  DstBlock		  "R (Yaw Rate)"
	  DstPort		  1
	}
	Line {
	  SrcBlock		  "Q"
	  SrcPort		  1
	  DstBlock		  "Q (Pitch Rate)"
	  DstPort		  1
	}
	Line {
	  SrcBlock		  "P"
	  SrcPort		  1
	  DstBlock		  "P (Roll Rate)"
	  DstPort		  1
	}
      }
    }
    Block {
      BlockType		      Mux
      Name		      "Mux"
      Ports		      [3, 1, 0, 0, 0]
      Position		      [150, 127, 155, 153]
      BackgroundColor	      black
      ShowName		      off
      Inputs		      "3"
    }
    Block {
      BlockType		      Mux
      Name		      "Mux1"
      Ports		      [3, 1, 0, 0, 0]
      Position		      [395, 132, 400, 158]
      BackgroundColor	      black
      ShowName		      off
      Inputs		      "3"
    }
    Block {
      BlockType		      SubSystem
      Name		      "Quaternion"
      Ports		      [3, 3, 0, 0, 0]
      Position		      [140, 52, 325, 118]
      ShowName		      off
      OpenFcn		      "quatdemo Static Foo Bar"
      ShowPortLabels	      on
      MaskType		      "Quaternion Calculation"
      MaskDescription	      "Calculate Psi, Theta and Phi based on P,Q,R"
      MaskHelp		      "This block calculates the Yaw (Psi), Pitch (The"
"ta) and Roll (Phi) of an aircraft using quaternion rotation calculations.  Th"
"e inputs to the block are P (Roll rate), Q(Pitch rate) and R(Yaw rate).  All "
"input units are Degrees per second.  The outputs of the block are Psi, Theta "
"and Phi all given in Degrees."
      MaskPromptString	      "Initial Psi Value (Deg.)|Initial Theta Value (D"
"eg.):|Initial Phi Value (Deg.):"
      MaskStyleString	      "edit,edit,edit"
      MaskTunableValueString  "on,on,on"
      MaskVariables	      "Psi=@1;Theta=@2;Phi=@3;"
      MaskDisplay	      "disp('Quaternion\\nCalculation')"
      MaskIconFrame	      on
      MaskIconOpaque	      off
      MaskIconRotate	      none
      MaskIconUnits	      autoscale
      MaskValueString	      "0|0|0"
      System {
	Name			"Quaternion"
	Location		[94, 178, 476, 375]
	Open			off
	ToolBar			off
	StatusBar		off
	ScreenColor		white
	PaperOrientation	landscape
	PaperPositionMode	auto
	PaperType		usletter
	PaperUnits		inches
	Block {
	  BlockType		  Inport
	  Name			  "P (Roll Rate)"
	  Position		  [40, 65, 60, 85]
	  DropShadow		  on
	  Port			  "1"
	  PortWidth		  "-1"
	  SampleTime		  "-1"
	}
	Block {
	  BlockType		  Inport
	  Name			  "Q Pitch Rate)"
	  Position		  [40, 105, 60, 125]
	  DropShadow		  on
	  Port			  "2"
	  PortWidth		  "-1"
	  SampleTime		  "-1"
	}
	Block {
	  BlockType		  Inport
	  Name			  "R (Yaw Rate)"
	  Position		  [40, 145, 60, 165]
	  DropShadow		  on
	  Port			  "3"
	  PortWidth		  "-1"
	  SampleTime		  "-1"
	}
	Block {
	  BlockType		  Demux
	  Name			  "Demux"
	  Ports			  [1, 3, 0, 0, 0]
	  Position		  [240, 55, 290, 175]
	  ShowName		  off
	  Outputs		  "3"
	}
	Block {
	  BlockType		  "S-Function"
	  Name			  "Initial Conditions:\nPsi,Theta, Phi"
	  Ports			  [1, 1, 0, 0, 0]
	  Position		  [160, 105, 210, 125]
	  FunctionName		  "eulrot"
	  Parameters		  "Psi,Theta,Phi"
	  PortCounts		  "[]"
	  SFunctionModules	  "''"
	}
	Block {
	  BlockType		  Mux
	  Name			  "Mux"
	  Ports			  [3, 1, 0, 0, 0]
	  Position		  [105, 58, 135, 172]
	  ShowName		  off
	  Inputs		  "3"
	}
	Block {
	  BlockType		  Outport
	  Name			  "Psi (Heading)"
	  Position		  [315, 65, 335, 85]
	  DropShadow		  on
	  Port			  "1"
	  OutputWhenDisabled	  held
	  InitialOutput		  "0"
	}
	Block {
	  BlockType		  Outport
	  Name			  "Theta (Pitch)"
	  Position		  [315, 105, 335, 125]
	  DropShadow		  on
	  Port			  "2"
	  OutputWhenDisabled	  held
	  InitialOutput		  "0"
	}
	Block {
	  BlockType		  Outport
	  Name			  "Phi (Roll)"
	  Position		  [315, 145, 335, 165]
	  DropShadow		  on
	  Port			  "3"
	  OutputWhenDisabled	  held
	  InitialOutput		  "0"
	}
	Line {
	  SrcBlock		  "Demux"
	  SrcPort		  3
	  DstBlock		  "Phi (Roll)"
	  DstPort		  1
	}
	Line {
	  SrcBlock		  "Demux"
	  SrcPort		  2
	  DstBlock		  "Theta (Pitch)"
	  DstPort		  1
	}
	Line {
	  SrcBlock		  "Demux"
	  SrcPort		  1
	  DstBlock		  "Psi (Heading)"
	  DstPort		  1
	}
	Line {
	  SrcBlock		  "Initial Conditions:\nPsi,Theta, Phi"
	  SrcPort		  1
	  DstBlock		  "Demux"
	  DstPort		  1
	}
	Line {
	  SrcBlock		  "R (Yaw Rate)"
	  SrcPort		  1
	  DstBlock		  "Mux"
	  DstPort		  3
	}
	Line {
	  SrcBlock		  "Q Pitch Rate)"
	  SrcPort		  1
	  DstBlock		  "Mux"
	  DstPort		  2
	}
	Line {
	  SrcBlock		  "P (Roll Rate)"
	  SrcPort		  1
	  DstBlock		  "Mux"
	  DstPort		  1
	}
	Line {
	  SrcBlock		  "Mux"
	  SrcPort		  1
	  DstBlock		  "Initial Conditions:\nPsi,Theta, Phi"
	  DstPort		  1
	}
	Annotation {
	  Position		  [322, 22]
	  VerticalAlignment	  top
	  Text			  "Units:\nDegrees"
	  FontWeight		  bold
	}
	Annotation {
	  Position		  [57, 27]
	  VerticalAlignment	  top
	  Text			  "Units:\nDegrees/Second"
	  FontWeight		  bold
	}
      }
    }
    Block {
      BlockType		      Scope
      Name		      "Rates"
      Ports		      [1, 0, 0, 0, 0]
      Position		      [245, 125, 275, 155]
      Floating		      off
      Location		      [188, 365, 512, 604]
      Open		      off
      Grid		      on
      TickLabels	      on
      ZoomMode		      on
      TimeRange		      "auto"
      YMin		      "-5"
      YMax		      "5"
      SaveToWorkspace	      off
      SaveName		      "ScopeData"
      LimitMaxRows	      on
      MaxRows		      "5000"
      Decimation	      "1"
      SampleInput	      off
      SampleTime	      "0"
    }
    Block {
      BlockType		      Scope
      Name		      "Rotation"
      Ports		      [1, 0, 0, 0, 0]
      Position		      [470, 130, 500, 160]
      Floating		      off
      Location		      [188, 365, 512, 604]
      Open		      off
      Grid		      on
      TickLabels	      on
      ZoomMode		      on
      TimeRange		      "auto"
      YMin		      "-5"
      YMax		      "5"
      SaveToWorkspace	      off
      SaveName		      "ScopeData"
      LimitMaxRows	      on
      MaxRows		      "5000"
      Decimation	      "1"
      SampleInput	      off
      SampleTime	      "0"
    }
    Block {
      BlockType		      SubSystem
      Name		      "Rotation Demo"
      Ports		      [3, 0, 0, 0, 0]
      Position		      [380, 52, 535, 118]
      ShowName		      off
      OpenFcn		      "quatdemo Static Foo Bar"
      ShowPortLabels	      on
      MaskType		      "Euler Rotation"
      MaskDisplay	      "disp('Euler\\nRotation')"
      MaskIconFrame	      on
      MaskIconOpaque	      off
      MaskIconRotate	      none
      MaskIconUnits	      normalized
      System {
	Name			"Rotation Demo"
	Location		[420, 145, 736, 328]
	Open			off
	ToolBar			off
	StatusBar		off
	ScreenColor		white
	PaperOrientation	landscape
	PaperPositionMode	auto
	PaperType		usletter
	PaperUnits		inches
	Block {
	  BlockType		  Inport
	  Name			  "Psi (Heading)"
	  Position		  [40, 50, 60, 70]
	  DropShadow		  on
	  Port			  "1"
	  PortWidth		  "-1"
	  SampleTime		  "-1"
	}
	Block {
	  BlockType		  Inport
	  Name			  "Theta (Pitch)"
	  Position		  [40, 90, 60, 110]
	  DropShadow		  on
	  Port			  "2"
	  PortWidth		  "-1"
	  SampleTime		  "-1"
	}
	Block {
	  BlockType		  Inport
	  Name			  "Phi (Roll)"
	  Position		  [40, 130, 60, 150]
	  DropShadow		  on
	  Port			  "3"
	  PortWidth		  "-1"
	  SampleTime		  "-1"
	}
	Block {
	  BlockType		  Mux
	  Name			  "Mux"
	  Ports			  [3, 1, 0, 0, 0]
	  Position		  [105, 43, 135, 157]
	  ShowName		  off
	  Inputs		  "3"
	}
	Block {
	  BlockType		  "S-Function"
	  Name			  "eulrotdisplay"
	  Ports			  [1, 0, 0, 0, 0]
	  Position		  [165, 88, 240, 112]
	  FunctionName		  "eulrotdisplay"
	  PortCounts		  "[]"
	  SFunctionModules	  "''"
	}
	Line {
	  SrcBlock		  "Phi (Roll)"
	  SrcPort		  1
	  DstBlock		  "Mux"
	  DstPort		  3
	}
	Line {
	  SrcBlock		  "Theta (Pitch)"
	  SrcPort		  1
	  DstBlock		  "Mux"
	  DstPort		  2
	}
	Line {
	  SrcBlock		  "Psi (Heading)"
	  SrcPort		  1
	  DstBlock		  "Mux"
	  DstPort		  1
	}
	Line {
	  SrcBlock		  "Mux"
	  SrcPort		  1
	  DstBlock		  "eulrotdisplay"
	  DstPort		  1
	}
	Annotation {
	  Position		  [62, 12]
	  VerticalAlignment	  top
	  Text			  "Units:\nDegrees"
	  FontWeight		  bold
	}
      }
    }
    Block {
      BlockType		      Display
      Name		      "Time"
      Ports		      [1, 0, 0, 0, 0]
      Position		      [70, 175, 160, 205]
      Format		      short
      Decimation	      "1"
      Floating		      off
      SampleTime	      "-1"
    }
    Line {
      SrcBlock		      "Clock"
      SrcPort		      1
      DstBlock		      "Time"
      DstPort		      1
    }
    Line {
      SrcBlock		      "Mux1"
      SrcPort		      1
      Points		      [15, 0]
      Branch {
	DstBlock		"Display Rotation"
	DstPort			1
      }
      Branch {
	DstBlock		"Rotation"
	DstPort			1
      }
    }
    Line {
      SrcBlock		      "Quaternion"
      SrcPort		      3
      Points		      [10, 0]
      Branch {
	Points			[0, 50]
	DstBlock		"Mux1"
	DstPort			3
      }
      Branch {
	DstBlock		"Rotation Demo"
	DstPort			3
      }
    }
    Line {
      SrcBlock		      "Quaternion"
      SrcPort		      2
      Points		      [20, 0]
      Branch {
	Points			[0, 60]
	DstBlock		"Mux1"
	DstPort			2
      }
      Branch {
	DstBlock		"Rotation Demo"
	DstPort			2
      }
    }
    Line {
      SrcBlock		      "Quaternion"
      SrcPort		      1
      Points		      [30, 0]
      Branch {
	Points			[0, 70]
	DstBlock		"Mux1"
	DstPort			1
      }
      Branch {
	DstBlock		"Rotation Demo"
	DstPort			1
      }
    }
    Line {
      SrcBlock		      "Inputs"
      SrcPort		      3
      Points		      [5, 0]
      Branch {
	Points			[0, 45]
	DstBlock		"Mux"
	DstPort			3
      }
      Branch {
	DstBlock		"Quaternion"
	DstPort			3
      }
    }
    Line {
      SrcBlock		      "Inputs"
      SrcPort		      2
      Points		      [15, 0]
      Branch {
	Points			[0, 55]
	DstBlock		"Mux"
	DstPort			2
      }
      Branch {
	DstBlock		"Quaternion"
	DstPort			2
      }
    }
    Line {
      SrcBlock		      "Inputs"
      SrcPort		      1
      Points		      [30, 0]
      Branch {
	Points			[0, 65]
	DstBlock		"Mux"
	DstPort			1
      }
      Branch {
	DstBlock		"Quaternion"
	DstPort			1
      }
    }
    Line {
      SrcBlock		      "Mux"
      SrcPort		      1
      Points		      [40, 0]
      Branch {
	DstBlock		"Rates"
	DstPort			1
      }
      Branch {
	DstBlock		"Display Rates"
	DstPort			1
      }
    }
    Annotation {
      Position		      [352, 17]
      VerticalAlignment	      top
      Text		      "Units:\nDegrees"
      FontSize		      14
      FontWeight	      bold
    }
    Annotation {
      Position		      [102, 12]
      VerticalAlignment	      top
      Text		      "Units:\nDegrees/Second"
      FontSize		      14
      FontWeight	      bold
    }
  }
}
