⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rotary double inverted pendulum;sim mechanics model.m

📁 利用matlab编了一个pendulum仿真的例子
💻 M
📖 第 1 页 / 共 3 页
字号:
	  PortType		  "env"
	  PhysicalDomain	  "Mechanical"
	  ClassName		  "Environment"
	  DialogTemplateClass	  "MECH.MachineEnvironment"
	  SyncWhenCopied	  "off"
	  Gravity		  "[0 -9.81 0]"
	  GravityUnits		  "m/s^2"
	  GravityAsSignal	  off
	  Dimensionality	  "Auto-detect"
	  AnalysisType		  "Forward dynamics"
	  LinearAssemblyTolerance "1e-3"
	  LinearAssemblyToleranceUnits "m"
	  AngularAssemblyTolerance "1e-3"
	  AngularAssemblyToleranceUnits	"rad"
	  ConstraintSolverType	  "Stabilizing"
	  ConstraintRelTolerance  "1e-4"
	  ConstraintAbsTolerance  "1e-4"
	  UseRobustSingularityHandling off
	  StatePerturbationType	  "Fixed"
	  PerturbationSize	  "1e-5"
	  VisualizeMachine	  on
	}
	Block {
	  BlockType		  RandomNumber
	  Name			  "Random\nNumber"
	  Position		  [375, 120, 405, 150]
	  SampleTime		  "0"
	}
	Block {
	  BlockType		  RandomNumber
	  Name			  "Random\nNumber1"
	  Position		  [380, 325, 410, 355]
	  SampleTime		  "0"
	}
	Block {
	  BlockType		  Reference
	  Name			  "Revolute"
	  Ports			  [0, 0, 0, 0, 0, 2, 2]
	  Position		  [410, 216, 460, 269]
	  SourceBlock		  "mblibv1/Joints/Revolute"
	  SourceType		  "msb"
	  PhysicalDomain	  "mechanical"
	  SubClassName		  "Unknown"
	  LeftPortType		  "blob"
	  RightPortType		  "blob"
	  LConnTagsString	  "__newl0|SA1"
	  RConnTagsString	  "__newr0|SA1"
	  NumSAPorts		  "2"
	  CutJoint		  "off"
	  MarkAsCut		  "off"
	  Primitives		  "revolute"
	  PrimitiveProps	  "R1$WORLD$[0 1 0]$revolute"
	  ClassName		  "Joint"
	  DialogClass		  "JointBlock"
	}
	Block {
	  BlockType		  Reference
	  Name			  "Revolute1"
	  Ports			  [0, 0, 0, 0, 0, 3, 2]
	  Position		  [600, 193, 650, 247]
	  SourceBlock		  "mblibv1/Joints/Revolute"
	  SourceType		  "msb"
	  PhysicalDomain	  "mechanical"
	  SubClassName		  "Unknown"
	  LeftPortType		  "blob"
	  RightPortType		  "blob"
	  LConnTagsString	  "__newl0|SA1|SA2"
	  RConnTagsString	  "__newr0|SA1"
	  NumSAPorts		  "3"
	  CutJoint		  "off"
	  MarkAsCut		  "off"
	  Primitives		  "revolute"
	  PrimitiveProps	  "R1$Base$[0 0 1]$revolute"
	  ClassName		  "Joint"
	  DialogClass		  "JointBlock"
	}
	Block {
	  BlockType		  Reference
	  Name			  "Revolute2"
	  Ports			  [0, 0, 0, 0, 0, 3, 2]
	  Position		  [755, 93, 805, 147]
	  SourceBlock		  "mblibv1/Joints/Revolute"
	  SourceType		  "msb"
	  PhysicalDomain	  "mechanical"
	  SubClassName		  "Unknown"
	  LeftPortType		  "blob"
	  RightPortType		  "blob"
	  LConnTagsString	  "__newl0|SA1|SA2"
	  RConnTagsString	  "__newr0|SA1"
	  NumSAPorts		  "3"
	  CutJoint		  "off"
	  MarkAsCut		  "off"
	  Primitives		  "revolute"
	  PrimitiveProps	  "R1$Base$[0 0 1]$revolute"
	  ClassName		  "Joint"
	  DialogClass		  "JointBlock"
	}
	Block {
	  BlockType		  Outport
	  Name			  "Arm angle"
	  Position		  [505, 388, 535, 402]
	  IconDisplay		  "Port number"
	  BusOutputAsStruct	  off
	}
	Block {
	  BlockType		  Outport
	  Name			  "Pendulum angle"
	  Position		  [785, 288, 815, 302]
	  Port			  "2"
	  IconDisplay		  "Port number"
	  BusOutputAsStruct	  off
	}
	Block {
	  BlockType		  Outport
	  Name			  "pendulum2 angle"
	  Position		  [990, 193, 1020, 207]
	  Port			  "3"
	  IconDisplay		  "Port number"
	  BusOutputAsStruct	  off
	}
	Block {
	  BlockType		  Outport
	  Name			  "Arm velocity"
	  Position		  [505, 418, 535, 432]
	  Port			  "4"
	  IconDisplay		  "Port number"
	  BusOutputAsStruct	  off
	}
	Block {
	  BlockType		  Outport
	  Name			  "Pendulum velocity"
	  Position		  [785, 333, 815, 347]
	  Port			  "5"
	  IconDisplay		  "Port number"
	  BusOutputAsStruct	  off
	}
	Block {
	  BlockType		  Outport
	  Name			  "Pendulum2 velocity1"
	  Position		  [970, 253, 1000, 267]
	  Port			  "6"
	  IconDisplay		  "Port number"
	  BusOutputAsStruct	  off
	}
	Line {
	  LineType		  "Connection"
	  SrcBlock		  "Ground"
	  SrcPort		  RConn1
	  Points		  [5, 0]
	  DstBlock		  "Revolute"
	  DstPort		  LConn1
	}
	Line {
	  LineType		  "Connection"
	  SrcBlock		  "Revolute"
	  SrcPort		  RConn1
	  Points		  [0, -15]
	  DstBlock		  "Body"
	  DstPort		  LConn1
	}
	Line {
	  LineType		  "Connection"
	  SrcBlock		  "Machine\nEnvironment"
	  SrcPort		  RConn1
	  Points		  [0, 0]
	  DstBlock		  "Ground"
	  DstPort		  LConn1
	}
	Line {
	  LineType		  "Connection"
	  SrcBlock		  "Revolute1"
	  SrcPort		  RConn2
	  Points		  [5, 0; 0, 55; -50, 0; 0, 30]
	  DstBlock		  "Joint Sensor"
	  DstPort		  LConn1
	}
	Line {
	  LineType		  "Connection"
	  SrcBlock		  "Body1"
	  SrcPort		  LConn1
	  Points		  [5, 0]
	  DstBlock		  "Revolute1"
	  DstPort		  RConn1
	}
	Line {
	  LineType		  "Connection"
	  SrcBlock		  "Joint Actuator1"
	  SrcPort		  RConn1
	  Points		  [45, 0; 0, -85]
	  DstBlock		  "Revolute"
	  DstPort		  LConn2
	}
	Line {
	  LineType		  "Connection"
	  SrcBlock		  "Joint Initial Condition"
	  SrcPort		  RConn1
	  Points		  [0, -30; 40, 0]
	  DstBlock		  "Revolute1"
	  DstPort		  LConn2
	}
	Line {
	  SrcBlock		  "Joint Sensor"
	  SrcPort		  1
	  Points		  [0, -5; 10, 0; 0, -10]
	  DstBlock		  "Pendulum angle"
	  DstPort		  1
	}
	Line {
	  SrcBlock		  "Joint Sensor"
	  SrcPort		  2
	  Points		  [0, -10; 35, 0; 0, 20]
	  DstBlock		  "Pendulum velocity"
	  DstPort		  1
	}
	Line {
	  SrcBlock		  "Gain1"
	  SrcPort		  1
	  Points		  [-25, 0; 0, -105]
	  DstBlock		  "Add1"
	  DstPort		  2
	}
	Line {
	  SrcBlock		  "Torque Input"
	  SrcPort		  1
	  Points		  [25, 0; 0, 15]
	  DstBlock		  "Add1"
	  DstPort		  1
	}
	Line {
	  SrcBlock		  "Add1"
	  SrcPort		  1
	  DstBlock		  "Joint Actuator1"
	  DstPort		  1
	}
	Line {
	  LineType		  "Connection"
	  SrcBlock		  "Revolute"
	  SrcPort		  RConn2
	  Points		  [5, 0; 0, 40; -85, 0; 0, 85; -60, 0; 0, 30]
	  DstBlock		  "Joint Sensor1"
	  DstPort		  LConn1
	}
	Line {
	  SrcBlock		  "Joint Sensor1"
	  SrcPort		  1
	  Points		  [5, 0; 0, -5]
	  DstBlock		  "Arm angle"
	  DstPort		  1
	}
	Line {
	  SrcBlock		  "Joint Sensor1"
	  SrcPort		  2
	  Points		  [15, 0; 0, 10]
	  Branch {
	    Points		    [0, 20]
	    DstBlock		    "Gain1"
	    DstPort		    1
	  }
	  Branch {
	    Points		    [0, -5]
	    DstBlock		    "Arm velocity"
	    DstPort		    1
	  }
	}
	Line {
	  LineType		  "Connection"
	  SrcBlock		  "Body"
	  SrcPort		  RConn1
	  Points		  [0, -15]
	  DstBlock		  "Revolute1"
	  DstPort		  LConn1
	}
	Line {
	  LineType		  "Connection"
	  SrcBlock		  "Body1"
	  SrcPort		  RConn1
	  DstBlock		  "Revolute2"
	  DstPort		  LConn1
	}
	Line {
	  LineType		  "Connection"
	  SrcBlock		  "Revolute2"
	  SrcPort		  RConn1
	  Points		  [5, 0; 0, 35]
	  DstBlock		  "Body2"
	  DstPort		  LConn1
	}
	Line {
	  LineType		  "Connection"
	  SrcBlock		  "Joint Sensor2"
	  SrcPort		  LConn1
	  Points		  [-5, 0; 0, -75]
	  DstBlock		  "Revolute2"
	  DstPort		  RConn2
	}
	Line {
	  SrcBlock		  "Joint Sensor2"
	  SrcPort		  1
	  Points		  [15, 0; 0, -10; 70, 0; 0, 10]
	  DstBlock		  "pendulum2 angle"
	  DstPort		  1
	}
	Line {
	  SrcBlock		  "Joint Sensor2"
	  SrcPort		  2
	  Points		  [10, 0; 0, 25; 50, 0; 0, 10; 10, 0; 0, 5]
	  DstBlock		  "Pendulum2 velocity1"
	  DstPort		  1
	}
	Line {
	  LineType		  "Connection"
	  SrcBlock		  "Joint Initial Condition1"
	  SrcPort		  RConn1
	  Points		  [5, 0; 0, -10; -15, 0; 0, -35]
	  DstBlock		  "Revolute2"
	  DstPort		  LConn2
	}
	Line {
	  LineType		  "Connection"
	  SrcBlock		  "Joint Actuator"
	  SrcPort		  RConn1
	  DstBlock		  "Revolute2"
	  DstPort		  LConn3
	}
	Line {
	  SrcBlock		  "Random\nNumber"
	  SrcPort		  1
	  DstBlock		  "Gain"
	  DstPort		  1
	}
	Line {
	  SrcBlock		  "Gain"
	  SrcPort		  1
	  Points		  [25, 0; 0, 5]
	  DstBlock		  "Joint Actuator"
	  DstPort		  1
	}
	Line {
	  SrcBlock		  "Random\nNumber1"
	  SrcPort		  1
	  DstBlock		  "Gain2"
	  DstPort		  1
	}
	Line {
	  SrcBlock		  "Gain2"
	  SrcPort		  1
	  Points		  [25, 0; 0, 5]
	  DstBlock		  "Joint Actuator2"
	  DstPort		  1
	}
	Line {
	  LineType		  "Connection"
	  SrcBlock		  "Joint Actuator2"
	  SrcPort		  RConn1
	  Points		  [5, 0; 0, -80; -50, 0; 0, -25]
	  DstBlock		  "Revolute1"
	  DstPort		  LConn3
	}
      }
    }
    Block {
      BlockType		      Gain
      Name		      "Gain"
      Position		      [215, 305, 245, 335]
      Orientation	      "left"
      Gain		      ".5369"
      ParameterDataTypeMode   "Inherit via internal rule"
      OutDataTypeMode	      "Inherit via internal rule"
      SaturateOnIntegerOverflow	off
    }
    Block {
      BlockType		      Gain
      Name		      "Gain3"
      Position		      [315, 445, 345, 475]
      Gain		      "2"
      ParameterDataTypeMode   "Inherit via internal rule"
      OutDataTypeMode	      "Inherit via internal rule"
      SaturateOnIntegerOverflow	off
    }
    Block {
      BlockType		      Gain
      Name		      "LQR"
      Position		      [435, 280, 465, 310]
      Orientation	      "left"
      Gain		      "[4.4721  -74.4026  -99.7716    3.9597  -21.9615"
"  -13.7615]"
      Multiplication	      "Matrix(K*u)"
      ParameterDataTypeMode   "Inherit via internal rule"
      OutDataTypeMode	      "Inherit via internal rule"
      SaturateOnIntegerOverflow	off
    }
    Block {
      BlockType		      Mux
      Name		      "Mux"
      Ports		      [6, 1]
      Position		      [415, 77, 445, 228]
      ShowName		      off
      Inputs		      "6"
      DisplayOption	      "bar"
    }
    Block {
      BlockType		      RandomNumber
      Name		      "Random\nNumber"
      Position		      [230, 445, 260, 475]
      Mean		      "1"
      SampleTime	      "0"
    }
    Block {
      BlockType		      ToWorkspace
      Name		      "To Workspace"
      Position		      [580, 95, 640, 125]
      VariableName	      "c"
      MaxDataPoints	      "inf"
      SampleTime	      "-1"
      SaveFormat	      "Array"
    }
    Block {
      BlockType		      ToWorkspace
      Name		      "To Workspace1"
      Position		      [600, 320, 660, 350]
      VariableName	      "t"
      MaxDataPoints	      "inf"
      SampleTime	      "-1"
      SaveFormat	      "Array"
    }
    Block {
      BlockType		      Outport
      Name		      "Out1"
      Position		      [555, 148, 585, 162]
      IconDisplay	      "Port number"
      BusOutputAsStruct	      off
    }
    Line {
      SrcBlock		      "Add"
      SrcPort		      1
      Points		      [-60, 0; 0, -200]
      DstBlock		      "Furuta Pendulum SYstem"
      DstPort		      1
    }
    Line {
      SrcBlock		      "Furuta Pendulum SYstem"
      SrcPort		      1
      DstBlock		      "Mux"
      DstPort		      1
    }
    Line {
      SrcBlock		      "Furuta Pendulum SYstem"
      SrcPort		      2
      DstBlock		      "Mux"
      DstPort		      2
    }
    Line {
      SrcBlock		      "Furuta Pendulum SYstem"
      SrcPort		      3
      DstBlock		      "Mux"
      DstPort		      3
    }
    Line {
      SrcBlock		      "Furuta Pendulum SYstem"
      SrcPort		      4
      Points		      [25, 0]
      Branch {
	DstBlock		"Mux"
	DstPort			4
      }
      Branch {
	Points			[0, 155]
	DstBlock		"Gain"
	DstPort			1
      }
    }
    Line {
      SrcBlock		      "Furuta Pendulum SYstem"
      SrcPort		      5
      DstBlock		      "Mux"
      DstPort		      5
    }
    Line {
      SrcBlock		      "Furuta Pendulum SYstem"
      SrcPort		      6
      DstBlock		      "Mux"
      DstPort		      6
    }
    Line {
      SrcBlock		      "Mux"
      SrcPort		      1
      Points		      [25, 0]
      Branch {
	Points			[30, 0]
	Branch {
	  DstBlock		  "Out1"
	  DstPort		  1
	}
	Branch {
	  Points		  [0, 140]
	  DstBlock		  "LQR"
	  DstPort		  1
	}
      }
      Branch {
	Points			[0, -45]
	DstBlock		"To Workspace"
	DstPort			1
      }
    }
    Line {
      SrcBlock		      "Gain"
      SrcPort		      1
      Points		      [-5, 0]
      DstBlock		      "Add"
      DstPort		      2
    }
    Line {
      SrcBlock		      "LQR"
      SrcPort		      1
      Points		      [-225, 0]
      DstBlock		      "Add"
      DstPort		      1
    }
    Line {
      SrcBlock		      "Clock"
      SrcPort		      1
      DstBlock		      "To Workspace1"
      DstPort		      1
    }
    Line {
      SrcBlock		      "Random\nNumber"
      SrcPort		      1
      DstBlock		      "Gain3"
      DstPort		      1
    }
    Line {
      SrcBlock		      "Gain3"
      SrcPort		      1
      Points		      [20, 0; 0, -60]
      DstBlock		      "Add"
      DstPort		      3
    }
  }
}
MatData {
  NumRecords		  1
  DataRecord {
    Tag			    DataTag0
    Data		    "  %)30     .    6     8    (    !          %    "
"\"     $    D     0         0    )    &QE;6UE8R]&=7)U=&$@4&5N9'5L=6T@4UES=&5M"
"+T=R;W5N9      "
  }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -