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

📄 h_pid_disc.mdl

📁 该项源码是关于电机速度环控制,对学习电机控制的人很有帮助.
💻 MDL
📖 第 1 页 / 共 4 页
字号:
      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		      Quantizer
      QuantizationInterval    "0.5"
      LinearizeAsGain	      on
      SampleTime	      "-1"
    }
    Block {
      BlockType		      Saturate
      UpperLimit	      "0.5"
      LowerLimit	      "-0.5"
      LinearizeAsGain	      on
      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		      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		      TransferFcn
      Numerator		      "[1]"
      Denominator	      "[1 2 1]"
      AbsoluteTolerance	      "auto"
      Realization	      "auto"
    }
    Block {
      BlockType		      Trigonometry
      Operator		      "sin"
      OutputSignalType	      "auto"
      SampleTime	      "-1"
    }
    Block {
      BlockType		      UnitDelay
      X0		      "0"
      SampleTime	      "1"
      StateMustResolveToSignalObject off
      RTWStateStorageClass    "Auto"
    }
    Block {
      BlockType		      ZeroOrderHold
      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		    "h_pid_disc"
    Location		    [79, 269, 929, 522]
    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		      SubSystem
      Name		      "Amplifier"
      Ports		      [1, 1]
      Position		      [420, 74, 470, 136]
      MinAlgLoopOccurrences   off
      RTWSystemCode	      "Auto"
      FunctionWithSeparateData off
      MaskHideContents	      off
      System {
	Name			"Amplifier"
	Location		[837, 274, 1210, 453]
	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			  "control"
	  Position		  [25, 33, 55, 47]
	  IconDisplay		  "Port number"
	}
	Block {
	  BlockType		  Saturate
	  Name			  "Saturation2"
	  Position		  [205, 25, 230, 55]
	  UpperLimit		  "12"
	  LowerLimit		  "-12"
	}
	Block {
	  BlockType		  TransferFcn
	  Name			  "Transfer Fcn"
	  Position		  [90, 22, 170, 58]
	  Numerator		  "[5000*2*pi]"
	  Denominator		  "[1 5000*2*pi]"
	}
	Block {
	  BlockType		  Outport
	  Name			  "u"
	  Position		  [265, 33, 295, 47]
	  IconDisplay		  "Port number"
	  BusOutputAsStruct	  off
	}
	Line {
	  SrcBlock		  "control"
	  SrcPort		  1
	  DstBlock		  "Transfer Fcn"
	  DstPort		  1
	}
	Line {
	  SrcBlock		  "Saturation2"
	  SrcPort		  1
	  DstBlock		  "u"
	  DstPort		  1
	}
	Line {
	  SrcBlock		  "Transfer Fcn"
	  SrcPort		  1
	  DstBlock		  "Saturation2"
	  DstPort		  1
	}
      }
    }
    Block {
      BlockType		      Constant
      Name		      "Constant1"
      Position		      [30, 125, 60, 155]
      Value		      "48"
      VectorParams1D	      on
      SamplingMode	      "Sample based"
      OutDataTypeMode	      "Inherit from 'Constant value'"
      OutDataType	      "sfix(16)"
      ConRadixGroup	      "Use specified scaling"
      OutScaling	      "2^0"
      SampleTime	      "Ts"
      FramePeriod	      "inf"
      Port {
	PortNumber		1
	Name			"Vin"
	RTWStorageClass		"Auto"
	DataLoggingNameMode	"SignalName"
      }
    }
    Block {
      BlockType		      SubSystem
      Name		      "Control Unit"
      Ports		      [2, 1]
      Position		      [275, 49, 370, 156]
      BackgroundColor	      "lightBlue"
      DropShadow	      on
      MinAlgLoopOccurrences   off
      RTWSystemCode	      "Auto"
      FunctionWithSeparateData off
      MaskHideContents	      off
      MaskDisplay	      "disp('Fixed Point\\nProcessor')"
      MaskIconFrame	      on
      MaskIconOpaque	      on
      MaskIconRotate	      "none"
      MaskIconUnits	      "autoscale"
      System {
	Name			"Control Unit"
	Location		[482, 121, 951, 256]
	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			  "Uref"
	  Position		  [15, 38, 45, 52]
	  IconDisplay		  "Port number"
	}
	Block {
	  BlockType		  Inport
	  Name			  "y"
	  Position		  [15, 88, 45, 102]
	  Port			  "2"
	  IconDisplay		  "Port number"
	}
	Block {
	  BlockType		  SubSystem
	  Name			  "10bit"
	  Ports			  [1, 1]
	  Position		  [90, 78, 125, 112]
	  MinAlgLoopOccurrences	  off
	  RTWSystemCode		  "Auto"
	  FunctionWithSeparateData off
	  MaskHideContents	  off
	  MaskDisplay		  "disp('A/D')"
	  MaskIconFrame		  on
	  MaskIconOpaque	  on
	  MaskIconRotate	  "none"
	  MaskIconUnits		  "autoscale"
	  System {
	    Name		    "10bit"
	    Location		    [240, 478, 693, 636]
	    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		      "In1"
	      Position		      [415, 33, 445, 47]
	      Orientation	      "left"
	      IconDisplay	      "Port number"
	    }
	    Block {
	      BlockType		      Gain
	      Name		      "Gain"
	      Position		      [245, 24, 290, 56]
	      Orientation	      "left"
	      Gain		      "200"
	      ParameterDataTypeMode   "Inherit via internal rule"
	      OutDataTypeMode	      "Inherit via internal rule"
	      SaturateOnIntegerOverflow	off
	    }
	    Block {
	      BlockType		      Quantizer
	      Name		      "Quantizer"
	      Position		      [180, 25, 210, 55]
	      Orientation	      "left"
	      QuantizationInterval    "1"
	      SampleTime	      "Ts"
	    }
	    Block {
	      BlockType		      Saturate
	      Name		      "Saturation1"
	      Position		      [105, 25, 135, 55]
	      Orientation	      "left"
	      UpperLimit	      "512"
	      LowerLimit	      "-512"
	      SampleTime	      "Ts"
	    }
	    Block {
	      BlockType		      ZeroOrderHold
	      Name		      "Zero-Order\nHold"
	      Position		      [345, 25, 380, 55]
	      Orientation	      "left"
	      SampleTime	      "Ts"
	    }
	    Block {
	      BlockType		      Outport
	      Name		      "Out1"
	      Position		      [25, 33, 55, 47]
	      Orientation	      "left"
	      IconDisplay	      "Port number"
	      BusOutputAsStruct	      off
	      DataType		      "Specify via dialog"
	    }
	    Line {
	      SrcBlock		      "Gain"
	      SrcPort		      1
	      Points		      [0, 0]
	      DstBlock		      "Quantizer"
	      DstPort		      1
	    }
	    Line {
	      SrcBlock		      "Saturation1"
	      SrcPort		      1
	      DstBlock		      "Out1"
	      DstPort		      1
	    }
	    Line {
	      SrcBlock		      "In1"
	      SrcPort		      1
	      DstBlock		      "Zero-Order\nHold"
	      DstPort		      1
	    }
	    Line {
	      SrcBlock		      "Quantizer"
	      SrcPort		      1
	      Points		      [0, 0]
	      DstBlock		      "Saturation1"
	      DstPort		      1
	    }
	    Line {
	      SrcBlock		      "Zero-Order\nHold"
	      SrcPort		      1
	      DstBlock		      "Gain"
	      DstPort		      1
	    }
	  }
	}
	Block {
	  BlockType		  SubSystem
	  Name			  "A/D"
	  Ports			  [1, 1]
	  Position		  [90, 29, 120, 61]
	  MinAlgLoopOccurrences	  off
	  RTWSystemCode		  "Auto"
	  FunctionWithSeparateData off
	  MaskHideContents	  off
	  MaskDisplay		  "disp('A/D')\n"
	  MaskIconFrame		  on
	  MaskIconOpaque	  on
	  MaskIconRotate	  "none"
	  MaskIconUnits		  "autoscale"
	  System {
	    Name		    "A/D"
	    Location		    [492, 122, 710, 239]
	    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		      "In1"
	      Position		      [25, 33, 55, 47]
	      IconDisplay	      "Port number"
	    }
	    Block {
	      BlockType		      ZeroOrderHold
	      Name		      "Zero-Order\nHold"
	      Position		      [85, 25, 120, 55]
	      SampleTime	      "Ts"
	    }
	    Block {
	      BlockType		      Outport
	      Name		      "Out1"
	      Position		      [150, 33, 180, 47]
	      IconDisplay	      "Port number"
	      BusOutputAsStruct	      off
	    }
	    Line {
	      SrcBlock		      "In1"
	      SrcPort		      1
	      DstBlock		      "Zero-Order\nHold"
	      DstPort		      1
	    }
	    Line {
	      SrcBlock		      "Zero-Order\nHold"
	      SrcPort		      1
	      Points		      [0, 0]
	      DstBlock		      "Out1"
	      DstPort		      1
	    }
	  }
	}
	Block {
	  BlockType		  SubSystem
	  Name			  "Discrete PID"
	  Ports			  [2, 1]
	  Position		  [220, 30, 260, 90]
	  MinAlgLoopOccurrences	  off
	  RTWSystemCode		  "Auto"
	  FunctionWithSeparateData off
	  MaskHideContents	  off
	  MaskPromptString	  "Proportional Gain (K)|Part of Commanded sig"
"nal used for P Gain (b)|Integral Gain (Ti)|Derivative Gain (Td)|Derivative Di"
"visor (N)|Anti-Windup Gain (Tt)|Output Upper Limit (Umax)|Output Lower Limit "
"(Umin)|Sample Time (Ts)"
	  MaskStyleString	  "edit,edit,edit,edit,edit,edit,edit,edit,edi"
"t"
	  MaskTunableValueString  "on,on,on,on,on,on,on,on,on"
	  MaskCallbackString	  "||||||||"
	  MaskEnableString	  "on,on,on,on,on,on,on,on,on"
	  MaskVisibilityString	  "on,on,on,on,on,on,on,on,on"
	  MaskToolTipString	  "on,on,on,on,on,on,on,on,on"
	  MaskVarAliasString	  ",,,,,,,,"
	  MaskVariables		  "K=@1;b=@2;Ti=@3;Td=@4;N=@5;Tt=@6;Umax=@7;Um"
"in=@8;Ts=@9;"
	  MaskDisplay		  "disp('DISC\\nPID_2')"
	  MaskIconFrame		  on
	  MaskIconOpaque	  on
	  MaskIconRotate	  "none"
	  MaskIconUnits		  "autoscale"
	  MaskValueString	  "0.1|0.7|0.01|1e-5|4|0.005|12|-12|Ts"
	  MaskTabNameString	  ",,,,,,,,"
	  System {
	    Name		    "Discrete PID"
	    Location		    [420, 523, 1226, 958]
	    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"
	    Block {
	      BlockType		      Inport
	      Name		      "uc"
	      Position		      [25, 123, 55, 137]
	      IconDisplay	      "Port number"
	    }
	    Block {
	      BlockType		      Inport
	      Name		      "y"
	      Position		      [25, 183, 55, 197]
	      Port		      "2"
	      IconDisplay	      "Port number"
	      Port {
		PortNumber		1
		Name			"y(k)"
		RTWStorageClass		"Auto"
		DataLoggingNameMode	"SignalName"
	      }
	    }
	    Block {
	      BlockType		      Gain
	      Name		      "Anti-Windup Feedback"
	      Position		      [510, 24, 560, 56]
	      Orientation	      "left"
	      Gain		      "1/Tt"
	      ParameterDataTypeMode   "Inherit via internal rule"
	      OutDataTypeMode	      "Inherit via internal rule"
	      SaturateOnIntegerOverflow	off
	      SampleTime	      "Ts"
	    }
	    Block {
	      BlockType		      DiscreteIntegrator
	      Name		      "Discrete-Time\nIntegrator1"
	      Ports		      [1, 1]
	      Position		      [310, 49, 345, 81]
	      IntegratorMethod	      "Integration: Forward Euler"
	      gainval		      "K"
	      ExternalReset	      "none"
	      InitialConditionSource  "internal"
	      SampleTime	      "Ts"
	      IgnoreLimit	      off
	      ICPrevOutput	      "DiscIntNeverNeededParam"
	      ICPrevScaledInput	      "DiscIntNeverNeededParam"
	      Port {
		PortNumber		1
		Name			"I(k)"
		RTWStorageClass		"Auto"
		DataLoggingNameMode	"SignalName"
	      }
	    }
	    Block {
	      BlockType		      Gain
	      Name		      "Kd"
	      Position		      [270, 278, 390, 332]
	      Gain		      "K*Td*N/(Td+N*Ts)"

⌨️ 快捷键说明

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