# $Revision: 1.24 $
Model {
  Name			  "dblpend2"
  Version		  2.20
  SimParamPage		  Solver
  SampleTimeColors	  off
  InvariantConstants	  off
  WideVectorLines	  off
  ShowLineWidths	  off
  StartTime		  "0"
  StopTime		  "10000"
  Solver		  ode45
  RelTol		  "1e-5"
  AbsTol		  "1e-6"
  Refine		  "1"
  MaxStep		  "0.05"
  InitialStep		  "auto"
  FixedStep		  "auto"
  MaxOrder		  5
  OutputOption		  RefineOutputTimes
  OutputTimes		  "[]"
  LoadExternalInput	  off
  ExternalInput		  "[]"
  SaveTime		  off
  TimeSaveName		  "tout"
  SaveState		  off
  StateSaveName		  "xout"
  SaveOutput		  off
  OutputSaveName	  "yout"
  LoadInitialState	  off
  InitialState		  "[]"
  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
  PreLoadFcn		  "l2=58.4154;w2=14.5619;n=1.084;e=.1478;"
  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		    "dblpend2"
    Location		    [73, 122, 623, 531]
    Open		    on
    ToolBar		    on
    StatusBar		    on
    ScreenColor		    white
    PaperOrientation	    landscape
    PaperPositionMode	    auto
    PaperType		    usletter
    PaperUnits		    inches
    Block {
      BlockType		      Fcn
      Name		      "(alphaDot)^2"
      Position		      [105, 80, 150, 110]
      Expr		      "u*u"
    }
    Block {
      BlockType		      Fcn
      Name		      "(gammaDot)^2"
      Position		      [105, 170, 150, 200]
      Expr		      "u*u"
    }
    Block {
      BlockType		      SubSystem
      Name		      "Animation\nFunction"
      Ports		      [1, 0, 0, 0, 0]
      Position		      [280, 34, 350, 76]
      Orientation	      left
      ShowPortLabels	      on
      MaskDisplay	      "disp('pndanim3')"
      MaskIconFrame	      on
      MaskIconOpaque	      on
      MaskIconRotate	      none
      MaskIconUnits	      autoscale
      System {
	Name			"Animation\nFunction"
	Location		[317, 87, 557, 196]
	Open			off
	ToolBar			off
	StatusBar		off
	ScreenColor		white
	PaperOrientation	landscape
	PaperPositionMode	auto
	PaperType		usletter
	PaperUnits		inches
	Block {
	  BlockType		  Inport
	  Name			  "In1"
	  Position		  [175, 38, 205, 52]
	  Orientation		  left
	  Port			  "1"
	  PortWidth		  "-1"
	  SampleTime		  "-1"
	}
	Block {
	  BlockType		  "S-Function"
	  Name			  "Animation\nFunction"
	  Ports			  [1, 0, 0, 0, 0]
	  Position		  [75, 27, 140, 63]
	  Orientation		  left
	  DeleteFcn		  "if ~isempty(findobj('type','figure','name',"
"'dblpend2 Animation'));close('dblpend2 Animation'); end;"
	  FunctionName		  "pndanim3"
	  Parameters		  "0.05"
	  PortCounts		  "[]"
	  SFunctionModules	  "''"
	}
	Line {
	  SrcBlock		  "In1"
	  SrcPort		  1
	  DstBlock		  "Animation\nFunction"
	  DstPort		  1
	}
      }
    }
    Block {
      BlockType		      Fcn
      Name		      "C"
      Position		      [105, 215, 150, 245]
      Expr		      "-sin(u(1)-u(3))"
    }
    Block {
      BlockType		      SubSystem
      Name		      "More Info"
      Ports		      [0, 0, 0, 0, 0]
      Position		      [260, 330, 287, 355]
      DropShadow	      on
      ShowName		      off
      ShowPortLabels	      on
      MaskDisplay	      "disp('?')"
      MaskIconFrame	      on
      MaskIconOpaque	      on
      MaskIconRotate	      none
      MaskIconUnits	      autoscale
      System {
	Name			"More Info"
	Location		[128, 280, 487, 453]
	Open			off
	ToolBar			off
	StatusBar		off
	ScreenColor		white
	PaperOrientation	landscape
	PaperPositionMode	auto
	PaperType		usletter
	PaperUnits		inches
	Annotation {
	  Position		  [177, 122]
	  Text			  "Try experimenting with different initial co"
"nditions for\nalpha and gamma to see some remarkable behavior.\nThis system e"
"xhibits very strong nonlinear coupling."
	}
	Annotation {
	  Position		  [170, 27]
	  Text			  "This system models a double pendulum system"
" where\nthe rest state has the pendulums balanced to hang\nat right angles to"
" one another"
	}
	Annotation {
	  Position		  [181, 77]
	  Text			  "Associated with the demo is an animation fu"
"nction that\nwill automatically open a figure window and display to it."
	}
      }
    }
    Block {
      BlockType		      SubSystem
      Name		      "More Info1"
      Ports		      [0, 0, 0, 0, 0]
      Position		      [401, 343, 503, 394]
      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 Info1"
	Location		[128, 280, 487, 453]
	Open			off
	ToolBar			off
	StatusBar		off
	ScreenColor		white
	PaperOrientation	landscape
	PaperPositionMode	auto
	PaperType		usletter
	PaperUnits		inches
	Annotation {
	  Position		  [170, 27]
	  Text			  "This system models a double pendulum system"
" where\nthe rest state has both pendulums hanging vertically."
	}
	Annotation {
	  Position		  [176, 72]
	  Text			  "Associated with the demo is an animation fu"
"nction that\nwill automatically open a figure window and display to it."
	}
	Annotation {
	  Position		  [177, 122]
	  Text			  "Try experimenting with different initial co"
"nditions for\nalpha and gamma to see the unusal coupling effects."
	}
      }
    }
    Block {
      BlockType		      Fcn
      Name		      "S"
      Position		      [105, 260, 150, 290]
      Expr		      "cos(u(1)-u(3))"
    }
    Block {
      BlockType		      Scope
      Name		      "State\nScope"
      Ports		      [1, 0, 0, 0, 0]
      Position		      [225, 245, 250, 275]
      Orientation	      left
      Floating		      off
      Location		      [85, 117, 373, 349]
      Open		      off
      Grid		      on
      TickLabels	      on
      ZoomMode		      on
      TimeRange		      "40.000000"
      YMin		      "-5"
      YMax		      "5"
      SaveToWorkspace	      off
      SaveName		      "ScopeData"
      LimitMaxRows	      on
      MaxRows		      "5000"
      Decimation	      "1"
      SampleInput	      off
      SampleTime	      "0"
    }
    Block {
      BlockType		      Integrator
      Name		      "alpha"
      Ports		      [1, 1, 0, 0, 0]
      Position		      [430, 118, 455, 152]
      ExternalReset	      none
      InitialConditionSource  internal
      InitialCondition	      "0*(pi/180)"
      LimitOutput	      off
      UpperSaturationLimit    "inf"
      LowerSaturationLimit    "-inf"
      ShowSaturationPort      off
      ShowStatePort	      off
      AbsoluteTolerance	      "auto"
    }
    Block {
      BlockType		      Fcn
      Name		      "alphaDDot"
      Position		      [260, 120, 305, 150]
      Expr		      "(-l2*u(1)+n*w2*u(5)*u(3)-n*e*u(5)*u(6)*u(2)-n*u"
"(6)*u(4))/(1-n*e*u(5)*u(5))"
    }
    Block {
      BlockType		      Integrator
      Name		      "alphaDot"
      Ports		      [1, 1, 0, 0, 0]
      Position		      [340, 118, 365, 152]
      ExternalReset	      none
      InitialConditionSource  internal
      InitialCondition	      "0"
      LimitOutput	      off
      UpperSaturationLimit    "inf"
      LowerSaturationLimit    "-inf"
      ShowSaturationPort      off
      ShowStatePort	      off
      AbsoluteTolerance	      "auto"
    }
    Block {
      BlockType		      Integrator
      Name		      "gamma"
      Ports		      [1, 1, 0, 0, 0]
      Position		      [430, 173, 455, 207]
      ExternalReset	      none
      InitialConditionSource  internal
      InitialCondition	      "80*(pi/180)"
      LimitOutput	      off
      UpperSaturationLimit    "inf"
      LowerSaturationLimit    "-inf"
      ShowSaturationPort      off
      ShowStatePort	      off
      AbsoluteTolerance	      "auto"
    }
    Block {
      BlockType		      Fcn
      Name		      "gammaDDot"
      Position		      [260, 175, 305, 205]
      Expr		      "(-w2*u(3)+e*l2*u(5)*u(1)+n*e*u(5)*u(6)*u(4)+e*u"
"(6)*u(2))/(1-n*e*u(5)*u(5))"
    }
    Block {
      BlockType		      Integrator
      Name		      "gammaDot"
      Ports		      [1, 1, 0, 0, 0]
      Position		      [340, 173, 365, 207]
      ExternalReset	      none
      InitialConditionSource  internal
      InitialCondition	      "0"
      LimitOutput	      off
      UpperSaturationLimit    "inf"
      LowerSaturationLimit    "-inf"
      ShowSaturationPort      off
      ShowStatePort	      off
      AbsoluteTolerance	      "auto"
    }
    Block {
      BlockType		      Mux
      Name		      "modified\nstate\nvector"
      Ports		      [6, 1, 0, 0, 0]
      Position		      [190, 127, 220, 193]
      Inputs		      "6"
    }
    Block {
      BlockType		      Scope
      Name		      "scope"
      Ports		      [1, 0, 0, 0, 0]
      Position		      [385, 70, 410, 100]
      Orientation	      left
      Floating		      off
      Location		      [47, 131, 335, 363]
      Open		      off
      Grid		      on
      TickLabels	      on
      ZoomMode		      on
      TimeRange		      "60.000000"
      YMin		      "-5"
      YMax		      "5"
      SaveToWorkspace	      off
      SaveName		      "ScopeData"
      LimitMaxRows	      on
      MaxRows		      "5000"
      Decimation	      "1"
      SampleInput	      off
      SampleTime	      "0"
    }
    Block {
      BlockType		      Fcn
      Name		      "sin(alpha)"
      Position		      [105, 35, 150, 65]
      Expr		      "sin(u)"
    }
    Block {
      BlockType		      Fcn
      Name		      "sin(gamma)"
      Position		      [105, 125, 150, 155]
      Expr		      "sin(u)"
    }
    Block {
      BlockType		      Mux
      Name		      "state\nvector"
      Ports		      [4, 1, 0, 0, 0]
      Position		      [340, 279, 370, 336]
      Orientation	      left
      Inputs		      "4"
    }
    Block {
      BlockType		      Demux
      Name		      "state\nvector\n[a aD g gD]"
      Ports		      [1, 4, 0, 0, 0]
      Position		      [25, 97, 65, 143]
      Outputs		      "4"
    }
    Block {
      BlockType		      Mux
      Name		      "state\nvector1"
      Ports		      [2, 1, 0, 0, 0]
      Position		      [440, 28, 470, 77]
      Orientation	      left
      Inputs		      "2"
    }
    Line {
      SrcBlock		      "alphaDDot"
      SrcPort		      1
      DstBlock		      "alphaDot"
      DstPort		      1
    }
    Line {
      SrcBlock		      "gammaDDot"
      SrcPort		      1
      DstBlock		      "gammaDot"
      DstPort		      1
    }
    Line {
      SrcBlock		      "alphaDot"
      SrcPort		      1
      Points		      [20, 0]
      Branch {
	DstBlock		"alpha"
	DstPort			1
      }
      Branch {
	Points			[0, 165]
	DstBlock		"state\nvector"
	DstPort			2
      }
    }
    Line {
      SrcBlock		      "gammaDot"
      SrcPort		      1
      Points		      [40, 0]
      Branch {
	DstBlock		"gamma"
	DstPort			1
      }
      Branch {
	Points			[0, 140]
	DstBlock		"state\nvector"
	DstPort			4
      }
    }
    Line {
      SrcBlock		      "alpha"
      SrcPort		      1
      Points		      [45, 0; 0, 0]
      Branch {
	Points			[0, 150]
	DstBlock		"state\nvector"
	DstPort			1
      }
      Branch {
	Points			[0, -95]
	DstBlock		"state\nvector1"
	DstPort			1
      }
    }
    Line {
      SrcBlock		      "gamma"
      SrcPort		      1
      Points		      [25, 0; 0, 0]
      Branch {
	Points			[0, 125]
	DstBlock		"state\nvector"
	DstPort			3
      }
      Branch {
	DstBlock		"state\nvector1"
	DstPort			2
      }
    }
    Line {
      SrcBlock		      "state\nvector1"
      SrcPort		      1
      Points		      [-10, 0]
      Branch {
	DstBlock		"Animation\nFunction"
	DstPort			1
      }
      Branch {
	DstBlock		"scope"
	DstPort			1
      }
    }
    Line {
      SrcBlock		      "state\nvector"
      SrcPort		      1
      Points		      [-50, 0]
      Branch {
	Points			[-245, 0]
	Branch {
	  Points		  [-30, 0]
	  DstBlock		  "state\nvector\n[a aD g gD]"
	  DstPort		  1
	}
	Branch {
	  Points		  [0, -35]
	  Branch {
	    Points		    [0, -45]
	    DstBlock		    "C"
	    DstPort		    1
	  }
	  Branch {
	    DstBlock		    "S"
	    DstPort		    1
	  }
	}
      }
      Branch {
	Points			[0, -50]
	DstBlock		"State\nScope"
	DstPort			1
      }
    }
    Line {
      SrcBlock		      "sin(alpha)"
      SrcPort		      1
      Points		      [20, 0]
      DstBlock		      "modified\nstate\nvector"
      DstPort		      1
    }
    Line {
      SrcBlock		      "(alphaDot)^2"
      SrcPort		      1
      Points		      [15, 0; 0, 50]
      DstBlock		      "modified\nstate\nvector"
      DstPort		      2
    }
    Line {
      SrcBlock		      "sin(gamma)"
      SrcPort		      1
      Points		      [10, 0; 0, 15]
      DstBlock		      "modified\nstate\nvector"
      DstPort		      3
    }
    Line {
      SrcBlock		      "(gammaDot)^2"
      SrcPort		      1
      Points		      [10, 0; 0, -20]
      DstBlock		      "modified\nstate\nvector"
      DstPort		      4
    }
    Line {
      SrcBlock		      "C"
      SrcPort		      1
      Points		      [15, 0; 0, -55]
      DstBlock		      "modified\nstate\nvector"
      DstPort		      5
    }
    Line {
      SrcBlock		      "S"
      SrcPort		      1
      Points		      [20, 0]
      DstBlock		      "modified\nstate\nvector"
      DstPort		      6
    }
    Line {
      SrcBlock		      "modified\nstate\nvector"
      SrcPort		      1
      Points		      [10, 0; 0, 0]
      Branch {
	Points			[0, -25]
	DstBlock		"alphaDDot"
	DstPort			1
      }
      Branch {
	Points			[0, 30]
	DstBlock		"gammaDDot"
	DstPort			1
      }
    }
    Line {
      SrcBlock		      "state\nvector\n[a aD g gD]"
      SrcPort		      4
      Points		      [15, 0; 0, 50]
      DstBlock		      "(gammaDot)^2"
      DstPort		      1
    }
    Line {
      SrcBlock		      "state\nvector\n[a aD g gD]"
      SrcPort		      3
      Points		      [20, 0]
      DstBlock		      "sin(gamma)"
      DstPort		      1
    }
    Line {
      SrcBlock		      "state\nvector\n[a aD g gD]"
      SrcPort		      2
      Points		      [20, 0]
      DstBlock		      "(alphaDot)^2"
      DstPort		      1
    }
    Line {
      SrcBlock		      "state\nvector\n[a aD g gD]"
      SrcPort		      1
      Points		      [15, 0; 0, -55]
      DstBlock		      "sin(alpha)"
      DstPort		      1
    }
    Annotation {
      Position		      [137, 342]
      Text		      "Double Pendulum System II\n(Double click on the"
" \"?\" for more info)"
    }
    Annotation {
      Position		      [166, 377]
      Text		      "To start and stop the simulation, use the \"Sta"
"rt/Stop\"\nselection in the \"Simulation\" pull-down menu"
    }
  }
}
