📄 cruiselib.mdl
字号:
DstBlock "Zero-Order\nHold"
DstPort 1
}
Line {
Name "x(n-1)"
FontName "Helvetica"
Labels [0, 0]
SrcBlock "Unit Delay1"
SrcPort 1
Points [-20, 0; 0, 50]
DstBlock "Sum1"
DstPort 1
}
Line {
Name "x(n)"
FontName "Helvetica"
Labels [0, 0]
SrcBlock "Sum1"
SrcPort 1
Points [0, -15; 0, 0]
Branch {
Points [0, -35]
DstBlock "Unit Delay1"
DstPort 1
}
Branch {
Points [205, 0]
DstBlock "Gain2"
DstPort 1
}
}
Line {
SrcBlock "Gain2"
SrcPort 1
Points [30, 0]
DstBlock "Sum2"
DstPort 1
}
Line {
SrcBlock "Gain1"
SrcPort 1
Points [30, 0]
DstBlock "Sum2"
DstPort 2
}
Line {
Name "x(n)"
FontName "Helvetica"
Labels [0, 0]
SrcBlock "Sum2"
SrcPort 1
Points [0, -5]
DstBlock "force"
DstPort 1
}
}
}
Block {
BlockType SubSystem
Name "PID cruise control"
Ports [1, 1]
Position [25, 55, 125, 105]
AncestorBlock "simclasslib/discrete cruise controller"
FontName "Helvetica"
ShowPortLabels on
TreatAsAtomicUnit off
RTWSystemCode "Auto"
RTWFcnNameOpts "Auto"
RTWFileNameOpts "Auto"
MaskType "Discrete PID cruise control"
MaskDescription "This is a discrete PID controller with sampling"
" time 20 msec.\nPlease enter gains."
MaskHelp "This block is a discrete PID controller with sa"
"mpling time\n20 msec. It is implemented as: \n<br> Input: u(n)\n<br> Integral"
": x(n)=x(n-1)+u(n)\n<br> Derivative: d(n)=u(n)-u(n-1)\n<br> Output: y(n)=Pu(n"
")+Ix(n)+Dd(n)\n"
MaskPromptString "Proportional|Integral|Derivative"
MaskStyleString "edit,edit,edit"
MaskTunableValueString "on,on,on"
MaskCallbackString "||"
MaskEnableString "on,on,on"
MaskVisibilityString "on,on,on"
MaskVariables "P=@1;I=@2;D=@3;"
MaskInitialization "line1=['P=',num2str(P)];\nline2=['I=',num2str(I"
")];\nline3=['D=',num2str(D)];\nicon=strvcat(line1,line2,line3);"
MaskDisplay "disp(icon)"
MaskIconFrame on
MaskIconOpaque on
MaskIconRotate "none"
MaskIconUnits "autoscale"
MaskValueString "20|0.1|2"
System {
Name "PID cruise control"
Location [410, 297, 908, 580]
Open off
ModelBrowserVisibility off
ModelBrowserWidth 200
ScreenColor "automatic"
PaperOrientation "landscape"
PaperPositionMode "auto"
PaperType "usletter"
PaperUnits "inches"
ZoomFactor "100"
AutoZoom on
Block {
BlockType Inport
Name "error"
Position [15, 143, 45, 157]
FontName "Helvetica"
Port "1"
Interpolate on
}
Block {
BlockType Gain
Name "Gain"
Position [340, 135, 370, 165]
FontName "Helvetica"
Gain "D"
Multiplication "Element-wise(K.*u)"
SaturateOnIntegerOverflow on
}
Block {
BlockType Gain
Name "Gain1"
Position [340, 190, 370, 220]
FontName "Helvetica"
Gain "P"
Multiplication "Element-wise(K.*u)"
SaturateOnIntegerOverflow on
}
Block {
BlockType Gain
Name "Gain2"
Position [345, 60, 375, 90]
FontName "Helvetica"
Gain "I"
Multiplication "Element-wise(K.*u)"
SaturateOnIntegerOverflow on
}
Block {
BlockType Sum
Name "Sum"
Ports [2, 1]
Position [185, 140, 205, 160]
ShowName off
FontName "Helvetica"
IconShape "round"
Inputs "|+-"
SaturateOnIntegerOverflow on
Port {
PortNumber 1
Name "d(n)"
TestPoint off
LinearAnalysisOutput off
LinearAnalysisInput off
RTWStorageClass "Auto"
}
}
Block {
BlockType Sum
Name "Sum1"
Ports [2, 1]
Position [100, 85, 120, 105]
ShowName off
FontName "Helvetica"
IconShape "round"
Inputs "|++"
SaturateOnIntegerOverflow on
Port {
PortNumber 1
Name "x(n)"
TestPoint off
LinearAnalysisOutput off
LinearAnalysisInput off
RTWStorageClass "Auto"
}
}
Block {
BlockType Sum
Name "Sum2"
Ports [3, 1]
Position [400, 140, 420, 160]
ShowName off
FontName "Helvetica"
IconShape "round"
Inputs "+++"
SaturateOnIntegerOverflow on
Port {
PortNumber 1
Name "x(n)"
TestPoint off
LinearAnalysisOutput off
LinearAnalysisInput off
RTWStorageClass "Auto"
}
}
Block {
BlockType UnitDelay
Name "Unit Delay"
Position [135, 190, 170, 230]
FontName "Helvetica"
X0 "0"
SampleTime ".02"
}
Block {
BlockType UnitDelay
Name "Unit Delay1"
Position [55, 25, 90, 65]
Orientation "left"
FontName "Helvetica"
X0 "0"
SampleTime ".02"
Port {
PortNumber 1
Name "x(n-1)"
TestPoint off
LinearAnalysisOutput off
LinearAnalysisInput off
RTWStorageClass "Auto"
}
}
Block {
BlockType ZeroOrderHold
Name "Zero-Order\nHold"
Position [65, 131, 95, 169]
FontName "Helvetica"
SampleTime ".02"
}
Block {
BlockType Outport
Name "force"
Position [445, 143, 475, 157]
FontName "Helvetica"
Port "1"
OutputWhenDisabled "held"
InitialOutput "[]"
}
Line {
SrcBlock "Zero-Order\nHold"
SrcPort 1
Points [0, 0]
Branch {
Points [5, 0]
Branch {
Labels [1, 0]
DstBlock "Sum"
DstPort 1
}
Branch {
Points [0, 60]
Branch {
Points [0, 0]
DstBlock "Unit Delay"
DstPort 1
}
Branch {
Points [0, 45; 220, 0]
DstBlock "Gain1"
DstPort 1
}
}
}
Branch {
Points [0, -30]
DstBlock "Sum1"
DstPort 2
}
}
Line {
SrcBlock "Unit Delay"
SrcPort 1
Points [20, 0]
DstBlock "Sum"
DstPort 2
}
Line {
SrcBlock "error"
SrcPort 1
DstBlock "Zero-Order\nHold"
DstPort 1
}
Line {
Name "x(n-1)"
FontName "Helvetica"
Labels [0, 0]
SrcBlock "Unit Delay1"
SrcPort 1
Points [-20, 0; 0, 50]
DstBlock "Sum1"
DstPort 1
}
Line {
Name "x(n)"
FontName "Helvetica"
Labels [0, 0]
SrcBlock "Sum1"
SrcPort 1
Points [0, -15; 0, 0]
Branch {
Points [0, -35]
DstBlock "Unit Delay1"
DstPort 1
}
Branch {
Points [205, 0]
DstBlock "Gain2"
DstPort 1
}
}
Line {
Name "d(n)"
FontName "Helvetica"
Labels [0, 0]
SrcBlock "Sum"
SrcPort 1
DstBlock "Gain"
DstPort 1
}
Line {
SrcBlock "Gain2"
SrcPort 1
Points [30, 0]
DstBlock "Sum2"
DstPort 1
}
Line {
SrcBlock "Gain"
SrcPort 1
DstBlock "Sum2"
DstPort 2
}
Line {
SrcBlock "Gain1"
SrcPort 1
Points [35, 0]
DstBlock "Sum2"
DstPort 3
}
Line {
Name "x(n)"
FontName "Helvetica"
Labels [0, 0]
SrcBlock "Sum2"
SrcPort 1
DstBlock "force"
DstPort 1
}
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -