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

📄 carpole1122.mdl

📁 先进PID控制的光盘源程序
💻 MDL
📖 第 1 页 / 共 3 页
字号:
      ActionType	      "unset"
    }
    Block {
      BlockType		      Constant
    }
    Block {
      BlockType		      DataTypeConversion
      OutDataTypeMode	      "Inherit via back propagation"
      OutDataType	      "sfix(16)"
      OutScaling	      "2^0"
      LockScale		      off
      ConvertRealWorld	      "Real World Value (RWV)"
      RndMeth		      "Zero"
      SaturateOnIntegerOverflow	on
      SampleTime	      "-1"
    }
    Block {
      BlockType		      Demux
      Outputs		      "4"
      DisplayOption	      "none"
      BusSelectionMode	      off
    }
    Block {
      BlockType		      Fcn
      Expr		      "sin(u[1])"
      SampleTime	      "-1"
    }
    Block {
      BlockType		      If
      NumInputs		      "1"
      IfExpression	      "u1 > 0"
      ShowElse		      on
      ZeroCross		      on
      SampleTime	      "-1"
    }
    Block {
      BlockType		      Inport
      Port		      "1"
      UseBusObject	      off
      BusObject		      "BusObject"
      BusOutputAsStruct	      off
      PortDimensions	      "-1"
      SampleTime	      "-1"
      DataType		      "auto"
      OutDataType	      "sfix(16)"
      OutScaling	      "2^0"
      SignalType	      "auto"
      SamplingMode	      "auto"
      LatchByDelayingOutsideSignal off
      LatchByCopyingInsideSignal off
      Interpolate	      on
    }
    Block {
      BlockType		      Integrator
      ExternalReset	      "none"
      InitialConditionSource  "internal"
      InitialCondition	      "0"
      LimitOutput	      off
      UpperSaturationLimit    "inf"
      LowerSaturationLimit    "-inf"
      ShowSaturationPort      off
      ShowStatePort	      off
      AbsoluteTolerance	      "auto"
      IgnoreLimit	      off
      ZeroCross		      on
    }
    Block {
      BlockType		      Math
      Operator		      "exp"
      OutputSignalType	      "auto"
      SampleTime	      "-1"
      OutDataTypeMode	      "Same as first input"
      OutDataType	      "sfix(16)"
      OutScaling	      "2^0"
      LockScale		      off
      RndMeth		      "Floor"
      SaturateOnIntegerOverflow	on
    }
    Block {
      BlockType		      Merge
      Inputs		      "2"
      InitialOutput	      "[]"
      AllowUnequalInputPortWidths off
      InputPortOffsets	      "[]"
    }
    Block {
      BlockType		      Mux
      Inputs		      "4"
      DisplayOption	      "none"
      UseBusObject	      off
      BusObject		      "BusObject"
      NonVirtualBus	      off
    }
    Block {
      BlockType		      Outport
      Port		      "1"
      UseBusObject	      off
      BusObject		      "BusObject"
      BusOutputAsStruct	      off
      PortDimensions	      "-1"
      SampleTime	      "-1"
      DataType		      "auto"
      OutDataType	      "sfix(16)"
      OutScaling	      "2^0"
      SignalType	      "auto"
      SamplingMode	      "auto"
      OutputWhenDisabled      "held"
      InitialOutput	      "[]"
    }
    Block {
      BlockType		      Product
      Inputs		      "2"
      Multiplication	      "Element-wise(.*)"
      InputSameDT	      on
      OutDataTypeMode	      "Same as first input"
      OutDataType	      "sfix(16)"
      OutScaling	      "2^0"
      LockScale		      off
      RndMeth		      "Zero"
      SaturateOnIntegerOverflow	on
      SampleTime	      "-1"
    }
    Block {
      BlockType		      RelationalOperator
      Operator		      ">="
      InputSameDT	      on
      LogicOutDataTypeMode    "Logical (see Configuration Parameters: Optimiza"
"tion)"
      LogicDataType	      "uint(8)"
      ZeroCross		      on
      SampleTime	      "-1"
    }
    Block {
      BlockType		      Scope
      ModelBased	      off
      TickLabels	      "OneTimeTick"
      ZoomMode		      "on"
      Grid		      "on"
      TimeRange		      "auto"
      YMin		      "-5"
      YMax		      "5"
      SaveToWorkspace	      off
      SaveName		      "ScopeData"
      LimitDataPoints	      on
      MaxDataPoints	      "5000"
      Decimation	      "1"
      SampleInput	      off
      SampleTime	      "-1"
    }
    Block {
      BlockType		      "S-Function"
      FunctionName	      "system"
      SFunctionModules	      "''"
      PortCounts	      "[]"
    }
    Block {
      BlockType		      SignalGenerator
      WaveForm		      "sine"
      TimeSource	      "Use simulation time"
      Amplitude		      "1"
      Frequency		      "1"
      Units		      "Hertz"
      VectorParams1D	      on
    }
    Block {
      BlockType		      SubSystem
      ShowPortLabels	      on
      Permissions	      "ReadWrite"
      PermitHierarchicalResolution "All"
      TreatAsAtomicUnit	      off
      SystemSampleTime	      "-1"
      RTWFcnNameOpts	      "Auto"
      RTWFileNameOpts	      "Auto"
      RTWMemSecFuncInitTerm   "Inherit from model"
      RTWMemSecFuncExecute    "Inherit from model"
      RTWMemSecDataConstants  "Inherit from model"
      RTWMemSecDataInternal   "Inherit from model"
      RTWMemSecDataParameters "Inherit from model"
      SimViewingDevice	      off
      DataTypeOverride	      "UseLocalSettings"
      MinMaxOverflowLogging   "UseLocalSettings"
    }
    Block {
      BlockType		      Sum
      IconShape		      "rectangular"
      Inputs		      "++"
      InputSameDT	      on
      OutDataTypeMode	      "Same as first input"
      OutDataType	      "sfix(16)"
      OutScaling	      "2^0"
      LockScale		      off
      RndMeth		      "Floor"
      SaturateOnIntegerOverflow	on
      SampleTime	      "-1"
    }
    Block {
      BlockType		      Switch
      Criteria		      "u2 >= Threshold"
      Threshold		      "0"
      InputSameDT	      on
      OutDataTypeMode	      "Inherit via internal rule"
      RndMeth		      "Floor"
      SaturateOnIntegerOverflow	on
      ZeroCross		      on
      SampleTime	      "-1"
    }
  }
  AnnotationDefaults {
    HorizontalAlignment	    "center"
    VerticalAlignment	    "middle"
    ForegroundColor	    "black"
    BackgroundColor	    "white"
    DropShadow		    off
    FontName		    "Arial"
    FontSize		    10
    FontWeight		    "normal"
    FontAngle		    "normal"
  }
  LineDefaults {
    FontName		    "Arial"
    FontSize		    9
    FontWeight		    "normal"
    FontAngle		    "normal"
  }
  System {
    Name		    "carpole1122"
    Location		    [2, 79, 1278, 974]
    Open		    on
    ModelBrowserVisibility  off
    ModelBrowserWidth	    200
    ScreenColor		    "white"
    PaperOrientation	    "landscape"
    PaperPositionMode	    "auto"
    PaperType		    "A4"
    PaperUnits		    "centimeters"
    TiledPaperMargins	    [0.500000, 0.500000, 0.500000, 0.500000]
    TiledPageScale	    1
    ShowPageBoundaries	    off
    ZoomFactor		    "100"
    ReportName		    "simulink-default.rpt"
    Block {
      BlockType		      "S-Function"
      Name		      "Animation"
      Ports		      [1]
      Position		      [490, 74, 545, 106]
      FunctionName	      "animcp"
    }
    Block {
      BlockType		      SubSystem
      Name		      "Cart & Pole\nDynamics"
      Ports		      [1, 4]
      Position		      [345, 190, 395, 245]
      ShowPortLabels	      off
      MinAlgLoopOccurrences   off
      RTWSystemCode	      "Auto"
      FunctionWithSeparateData off
      MaskHideContents	      off
      MaskType		      "Cart & Pole"
      MaskDescription	      "Inverted Pendulum (cart & pole)"
      MaskHelp		      "Inverted Pendulum"
      MaskPromptString	      "Initial Conditions (angle, angular velocity, ca"
"rt position and cart velocity):|Physical Specifications (pole length, pole ma"
"ss, cart mass and g):"
      MaskStyleString	      "edit,edit"
      MaskTunableValueString  "on,on"
      MaskCallbackString      "|"
      MaskEnableString	      "on,on"
      MaskVisibilityString    "on,on"
      MaskToolTipString	      "on,on"
      MaskVarAliasString      ","
      MaskInitialization      "init_cond = @1; specs = @2;l=specs(1)/2;m=specs"
"(2);mc=specs(3);g=specs(4);"
      MaskDisplay	      "plot(-4,-1,4,6,[0 3 2.8 -0.2 0],[1 5 5.15 1.15 "
"1],[-1 -1 1 1 -1],[1 0 0 1 1],[-3.5 3.5],[0 0])"
      MaskIconFrame	      on
      MaskIconOpaque	      on
      MaskIconRotate	      "none"
      MaskIconUnits	      "autoscale"
      MaskValueString	      "[0.2, 0, 0.5, 0]|[1.0, 0.1, 1.0, 9.8]"
      MaskTabNameString	      ","
      System {
	Name			"Cart & Pole\nDynamics"
	Location		[134, 510, 934, 815]
	Open			off
	ModelBrowserVisibility	off
	ModelBrowserWidth	200
	ScreenColor		"white"
	PaperOrientation	"landscape"
	PaperPositionMode	"auto"
	PaperType		"A4"
	PaperUnits		"centimeters"
	TiledPaperMargins	[0.500000, 0.500000, 0.500000, 0.500000]
	TiledPageScale		1
	ShowPageBoundaries	off
	ZoomFactor		"100"
	Block {
	  BlockType		  Inport
	  Name			  "in_1"
	  Position		  [205, 60, 225, 80]
	  IconDisplay		  "Port number"
	}
	Block {
	  BlockType		  Fcn
	  Name			  "Fcn1"
	  Position		  [350, 85, 390, 105]
	  ShowName		  off
	  Expr			  "(g*u(2)+u(3)*((-u(1)-m*l*u(4)*u(4)*u(2))/(m"
"c+m)))/(l*(4/3-(m*u(3)*u(3))/(mc+m)))"
	}
	Block {
	  BlockType		  Fcn
	  Name			  "Fcn2"
	  Position		  [450, 220, 490, 240]
	  ShowName		  off
	  Expr			  "(u(1)+m*l*(u(4)*u(4)*u(2)-u(5)*u(3)))/(mc+m"
")"
	}
	Block {
	  BlockType		  Fcn
	  Name			  "Fcn4"
	  Position		  [145, 89, 200, 111]
	  ShowName		  off
	}
	Block {
	  BlockType		  Fcn
	  Name			  "Fcn5"
	  Position		  [145, 118, 200, 142]
	  ShowName		  off
	  Expr			  "cos(u[1])"
	}
	Block {
	  BlockType		  Mux
	  Name			  "Mux1"
	  Ports			  [4, 1]
	  Position		  [280, 65, 315, 120]
	  ShowName		  off
	}
	Block {
	  BlockType		  Mux
	  Name			  "Mux2"
	  Ports			  [2, 1]
	  Position		  [400, 208, 430, 252]
	  ShowName		  off
	  Inputs		  "[4,1]"
	}
	Block {
	  BlockType		  Integrator
	  Name			  "theta"
	  Ports			  [1, 1]
	  Position		  [505, 85, 525, 105]
	  InitialCondition	  "init_cond(1)"
	  IgnoreLimit		  off
	}
	Block {
	  BlockType		  Integrator
	  Name			  "theta dot"
	  Ports			  [1, 1]
	  Position		  [435, 85, 455, 105]
	  InitialCondition	  "init_cond(2)"
	  IgnoreLimit		  off
	}
	Block {
	  BlockType		  Integrator
	  Name			  "x"
	  Ports			  [1, 1]
	  Position		  [570, 220, 590, 240]
	  InitialCondition	  "init_cond(3)"
	  IgnoreLimit		  off
	}
	Block {
	  BlockType		  Integrator
	  Name			  "x dot"
	  Ports			  [1, 1]
	  Position		  [510, 220, 530, 240]
	  InitialCondition	  "init_cond(4)"
	  IgnoreLimit		  off
	}
	Block {
	  BlockType		  Outport
	  Name			  "out_1"
	  Position		  [670, 85, 690, 105]
	  IconDisplay		  "Port number"
	  BusOutputAsStruct	  off
	  InitialOutput		  "0"
	}
	Block {
	  BlockType		  Outport
	  Name			  "out_2"
	  Position		  [675, 125, 695, 145]
	  Port			  "2"
	  IconDisplay		  "Port number"
	  BusOutputAsStruct	  off
	  InitialOutput		  "0"
	}
	Block {
	  BlockType		  Outport
	  Name			  "out_3"
	  Position		  [675, 165, 695, 185]
	  Port			  "3"
	  IconDisplay		  "Port number"
	  BusOutputAsStruct	  off
	  InitialOutput		  "0"
	}
	Block {
	  BlockType		  Outport
	  Name			  "out_4"
	  Position		  [675, 205, 695, 225]
	  Port			  "4"
	  IconDisplay		  "Port number"
	  BusOutputAsStruct	  off
	  InitialOutput		  "0"
	}
	Line {
	  SrcBlock		  "in_1"
	  SrcPort		  1
	  DstBlock		  "Mux1"
	  DstPort		  1
	}
	Line {
	  SrcBlock		  "x"
	  SrcPort		  1
	  Points		  [25, 0; 0, -55]
	  DstBlock		  "out_3"
	  DstPort		  1
	}
	Line {
	  SrcBlock		  "x dot"
	  SrcPort		  1
	  Points		  [0, 0]
	  Branch {
	    Points		    [15, 0; 0, -15]
	    DstBlock		    "out_4"
	    DstPort		    1
	  }
	  Branch {
	    DstBlock		    "x"
	    DstPort		    1
	  }
	}
	Line {
	  SrcBlock		  "Mux1"
	  SrcPort		  1
	  Points		  [0, 0]
	  Branch {
	    DstBlock		    "Fcn1"
	    DstPort		    1
	  }
	  Branch {
	    Points		    [10, 0; 0, 125]
	    DstBlock		    "Mux2"
	    DstPort		    1
	  }
	}
	Line {
	  SrcBlock		  "Mux2"
	  SrcPort		  1
	  DstBlock		  "Fcn2"
	  DstPort		  1
	}
	Line {
	  SrcBlock		  "Fcn2"
	  SrcPort		  1
	  DstBlock		  "x dot"
	  DstPort		  1
	}
	Line {
	  SrcBlock		  "Fcn1"
	  SrcPort		  1

⌨️ 快捷键说明

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