📄 sltank2.mdl
字号:
SrcBlock "Switch"
SrcPort 1
DstBlock "out_1"
DstPort 1
}
Line {
SrcBlock "in_1"
SrcPort 1
DstBlock "Switch"
DstPort 1
}
Line {
SrcBlock "const"
SrcPort 1
DstBlock "Switch"
DstPort 2
}
}
}
Block {
BlockType SubSystem
Name "Water\nTank"
Ports [1, 1]
Position [470, 115, 515, 165]
ShowPortLabels off
TreatAsAtomicUnit off
RTWSystemCode "Auto"
RTWFcnNameOpts "Auto"
RTWFileNameOpts "Auto"
System {
Name "Water\nTank"
Location [650, 142, 962, 397]
Open off
ModelBrowserVisibility off
ModelBrowserWidth 200
ScreenColor "white"
PaperOrientation "landscape"
PaperPositionMode "auto"
PaperType "usletter"
PaperUnits "inches"
ZoomFactor "100"
AutoZoom on
Block {
BlockType Inport
Name "in_1"
Position [35, 45, 55, 65]
Port "1"
Interpolate on
}
Block {
BlockType SubSystem
Name "Subsystem"
Ports [2, 1]
Position [100, 68, 150, 112]
ShowPortLabels off
TreatAsAtomicUnit off
RTWSystemCode "Auto"
RTWFcnNameOpts "Auto"
RTWFileNameOpts "Auto"
MaskType "Valve"
MaskDescription "Valve"
MaskPromptString "Initial position [0=closed 1=open]:"
MaskStyleString "edit"
MaskTunableValueString "on"
MaskEnableString "on"
MaskVisibilityString "on"
MaskToolTipString "on"
MaskInitialization "InitialPosition = @1;"
MaskDisplay "disp('VALVE')"
MaskIconFrame on
MaskIconOpaque on
MaskIconRotate "none"
MaskIconUnits "autoscale"
MaskValueString "0"
System {
Name "Subsystem"
Location [408, 498, 736, 676]
Open off
ModelBrowserVisibility off
ModelBrowserWidth 200
ScreenColor "white"
PaperOrientation "landscape"
PaperPositionMode "auto"
PaperType "usletter"
PaperUnits "inches"
ZoomFactor "100"
AutoZoom on
Block {
BlockType Inport
Name "control"
Position [20, 20, 40, 40]
Port "1"
Interpolate on
}
Block {
BlockType Inport
Name "source flow"
Position [20, 110, 40, 130]
Port "2"
Interpolate on
}
Block {
BlockType Integrator
Name "Limited Integrator"
Ports [1, 1]
Position [80, 9, 130, 51]
ExternalReset "none"
InitialConditionSource "internal"
InitialCondition "InitialPosition"
LimitOutput on
UpperSaturationLimit "1"
LowerSaturationLimit "0"
ShowSaturationPort off
ShowStatePort off
AbsoluteTolerance "auto"
}
Block {
BlockType Product
Name "Product"
Ports [2, 1]
Position [180, 76, 215, 134]
Inputs "2"
Multiplication "Element-wise(.*)"
SaturateOnIntegerOverflow on
}
Block {
BlockType Outport
Name "out flow"
Position [250, 95, 270, 115]
Port "1"
OutputWhenDisabled "held"
InitialOutput "[]"
}
Line {
SrcBlock "source flow"
SrcPort 1
DstBlock "Product"
DstPort 2
}
Line {
SrcBlock "Product"
SrcPort 1
DstBlock "out flow"
DstPort 1
}
Line {
SrcBlock "control"
SrcPort 1
DstBlock "Limited Integrator"
DstPort 1
}
Line {
SrcBlock "Limited Integrator"
SrcPort 1
Points [25, 0; 0, 60]
DstBlock "Product"
DstPort 1
}
}
}
Block {
BlockType Terminator
Name "Terminator"
Position [265, 110, 285, 130]
}
Block {
BlockType Terminator
Name "Terminator1"
Position [265, 165, 285, 185]
}
Block {
BlockType SubSystem
Name "tank 2"
Ports [1, 3]
Position [175, 61, 235, 119]
ShowPortLabels off
TreatAsAtomicUnit off
RTWSystemCode "Auto"
RTWFcnNameOpts "Auto"
RTWFileNameOpts "Auto"
MaskType "Water tank"
MaskDescription "Cylindrical water tank with overflow signal"
MaskPromptString "Height of tank (m):|Bottom area (m^2):|Out "
"pipe crossection (m^2):|Overflow sensor distance from top (m):|Initial level "
"height (m):"
MaskStyleString "edit,edit,edit,edit,edit"
MaskTunableValueString "on,on,on,on,on"
MaskCallbackString "||||"
MaskEnableString "on,on,on,on,on"
MaskVisibilityString "on,on,on,on,on"
MaskToolTipString "on,on,on,on,on"
MaskInitialization "ht=@1;area=@2;outletArea=@3;overflowLimit=@"
"4;initialHt=@5;"
MaskDisplay "disp('WATER\\nTANK')"
MaskIconFrame on
MaskIconOpaque on
MaskIconRotate "none"
MaskIconUnits "autoscale"
MaskValueString "2|1|0.05|0|0.5"
System {
Name "tank 2"
Location [113, 464, 659, 772]
Open off
ModelBrowserVisibility off
ModelBrowserWidth 200
ScreenColor "white"
PaperOrientation "landscape"
PaperPositionMode "auto"
PaperType "usletter"
PaperUnits "inches"
ZoomFactor "100"
AutoZoom on
Block {
BlockType Inport
Name "flow\nin"
Position [25, 175, 45, 195]
Port "1"
Interpolate on
}
Block {
BlockType Gain
Name "1/area"
Position [220, 167, 270, 223]
Gain "1/area"
Multiplication "Element-wise(K.*u)"
SaturateOnIntegerOverflow on
}
Block {
BlockType Relay
Name "Overflow sensor"
Position [385, 18, 425, 62]
OnSwitchValue "ht - overflowLimit"
OffSwitchValue "ht - overflowLimit"
OnOutputValue "1"
OffOutputValue "0"
}
Block {
BlockType Gain
Name "outletArea"
Position [410, 167, 460, 223]
Gain "outletArea"
Multiplication "Element-wise(K.*u)"
SaturateOnIntegerOverflow on
}
Block {
BlockType Fcn
Name "sqrt(2gh)"
Position [300, 171, 390, 219]
Expr "sqrt(2*9.8*u)"
}
Block {
BlockType Sum
Name "sum"
Ports [2, 1]
Position [105, 175, 125, 210]
IconShape "rectangular"
Inputs "+-"
SaturateOnIntegerOverflow on
}
Block {
BlockType Integrator
Name "tank\nvolume"
Ports [1, 1]
Position [150, 174, 200, 216]
ExternalReset "none"
InitialConditionSource "internal"
InitialCondition "initialHt * area"
LimitOutput on
UpperSaturationLimit "ht * area"
LowerSaturationLimit "0"
ShowSaturationPort off
ShowStatePort off
AbsoluteTolerance "auto"
}
Block {
BlockType Outport
Name "water\nlevel"
Position [495, 100, 515, 120]
Port "1"
OutputWhenDisabled "held"
InitialOutput "[]"
}
Block {
BlockType Outport
Name "flow\nout"
Position [495, 185, 515, 205]
Port "2"
OutputWhenDisabled "held"
InitialOutput "[]"
}
Block {
BlockType Outport
Name "overflow\nflag"
Position [495, 30, 515, 50]
Port "3"
OutputWhenDisabled "held"
InitialOutput "[]"
}
Line {
SrcBlock "1/area"
SrcPort 1
Points [0, 0]
Branch {
Points [10, 0; 0, -85]
Branch {
DstBlock "water\nlevel"
DstPort 1
}
Branch {
Points [0, -70]
DstBlock "Overflow sensor"
DstPort 1
}
}
Branch {
DstBlock "sqrt(2gh)"
DstPort 1
}
}
Line {
SrcBlock "outletArea"
SrcPort 1
Points [10, 0]
Branch {
Points [0, 65; -390, 0; 0, -60]
DstBlock "sum"
DstPort 2
}
Branch {
DstBlock "flow\nout"
DstPort 1
}
}
Line {
SrcBlock "sqrt(2gh)"
SrcPort 1
DstBlock "outletArea"
DstPort 1
}
Line {
SrcBlock "tank\nvolume"
SrcPort 1
DstBlock "1/area"
DstPort 1
}
Line {
SrcBlock "Overflow sensor"
SrcPort 1
DstBlock "overflow\nflag"
DstPort 1
}
Line {
SrcBlock "flow\nin"
SrcPort 1
DstBlock "sum"
DstPort 1
}
Line {
SrcBlock "sum"
SrcPort 1
DstBlock "tank\nvolume"
DstPort 1
}
}
}
Block {
BlockType Constant
Name "tank max\ninflow"
Position [20, 109, 65, 141]
Value "0.5"
VectorParams1D on
}
Block {
BlockType Outport
Name "out_1"
Position [265, 60, 285, 80]
Port "1"
OutputWhenDisabled "held"
InitialOutput "[]"
}
Line {
SrcBlock "Subsystem"
SrcPort 1
DstBlock "tank 2"
DstPort 1
}
Line {
SrcBlock "tank max\ninflow"
SrcPort 1
Points [5, 0; 0, -25]
DstBlock "Subsystem"
DstPort 2
}
Line {
SrcBlock "tank 2"
SrcPort 1
DstBlock "out_1"
DstPort 1
}
Line {
SrcBlock "in_1"
SrcPort 1
Points [15, 0; 0, 25]
DstBlock "Subsystem"
DstPort 1
}
Line {
SrcBlock "tank 2"
SrcPort 2
Points [10, 0]
DstBlock "Terminator"
DstPort 1
}
Line {
SrcBlock "tank 2"
SrcPort 3
Points [0, 65]
DstBlock "Terminator1"
DstPort 1
}
}
}
Block {
BlockType Sum
Name "level\nerror1"
Ports [2, 1]
Position [175, 43, 195, 87]
IconShape "rectangular"
Inputs "+-"
SaturateOnIntegerOverflow on
}
Block {
BlockType Sum
Name "level\nerror2"
Ports [2, 1]
Position [175, 183, 195, 227]
IconShape "rectangular"
Inputs "+-"
SaturateOnIntegerOverflow on
}
Line {
SrcBlock "Water\nTank"
SrcPort 1
Points [15, 0; 0, 145; -410, 0; 0, -70]
Branch {
Points [0, -80]
Branch {
DstBlock "Derivative"
DstPort 1
}
Branch {
Points [0, -60]
DstBlock "level\nerror1"
DstPort 2
}
}
Branch {
DstBlock "Animation"
DstPort 2
}
Branch {
DstBlock "level\nerror2"
DstPort 2
}
}
Line {
SrcBlock "level\nerror2"
SrcPort 1
DstBlock "PID \nController"
DstPort 1
}
Line {
SrcBlock "Derivative"
SrcPort 1
Points [15, 0; 0, -55]
DstBlock "Mux1"
DstPort 2
}
Line {
SrcBlock "Set Point"
SrcPort 1
Points [20, 0]
Branch {
Points [0, 140]
Branch {
DstBlock "level\nerror2"
DstPort 1
}
Branch {
DstBlock "Animation"
DstPort 1
}
}
Branch {
DstBlock "level\nerror1"
DstPort 1
}
}
Line {
SrcBlock "PID \nController"
SrcPort 1
Points [15, 0; 0, -55]
DstBlock "Switch"
DstPort 2
}
Line {
SrcBlock "Fuzzy Logic\nController"
SrcPort 1
Points [5, 0; 0, 50]
DstBlock "Switch"
DstPort 1
}
Line {
SrcBlock "Switch"
SrcPort 1
DstBlock "Water\nTank"
DstPort 1
}
Line {
SrcBlock "level\nerror1"
SrcPort 1
DstBlock "Mux1"
DstPort 1
}
Line {
SrcBlock "Mux1"
SrcPort 1
DstBlock "Fuzzy Logic\nController"
DstPort 1
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -