📄 sltankrule.mdl
字号:
SaveToWorkspace off
SaveName "ScopeData"
DataFormat "Array"
LimitDataPoints on
MaxDataPoints "5000"
Decimation "1"
SampleInput off
SampleTime "0"
MaskIconFrame on
MaskIconOpaque on
MaskIconRotate "none"
MaskIconUnits "autoscale"
}
Block {
BlockType Scope
Name "Scope4"
Ports [1]
Position [575, 125, 605, 155]
Floating off
Location [78, 177, 304, 320]
Open off
NumInputPorts "1"
TickLabels "on"
ZoomMode "on"
List {
ListType AxesTitles
axes1 "%<SignalLabel>"
}
Grid "on"
TimeRange "200.000000"
YMin "-2.000000"
YMax "2.000000"
SaveToWorkspace off
SaveName "ScopeData"
DataFormat "Array"
LimitDataPoints on
MaxDataPoints "5000"
Decimation "1"
SampleInput off
SampleTime "0"
}
Block {
BlockType SignalGenerator
Name "Signal\nGenerator"
Position [20, 158, 65, 192]
WaveForm "square"
Amplitude "0.500000"
Frequency "0.100000"
Units "rad/sec"
VectorParams1D on
}
Block {
BlockType SubSystem
Name "Subsystem"
Ports [2, 1]
Position [405, 88, 455, 132]
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"
Block {
BlockType Inport
Name "control"
Position [20, 20, 40, 40]
Port "1"
LatchInput off
Interpolate on
}
Block {
BlockType Inport
Name "source flow"
Position [20, 110, 40, 130]
Port "2"
LatchInput off
Interpolate on
}
Block {
BlockType SubSystem
Name "Limited Integrator"
Ports [1, 1]
Position [80, 9, 130, 51]
ShowPortLabels off
TreatAsAtomicUnit off
RTWSystemCode "Auto"
RTWFcnNameOpts "Auto"
RTWFileNameOpts "Auto"
MaskType "Limited integrator."
MaskDescription "Limited integrator"
MaskHelp "Implements a limited integrator with \\nan "
"expression of the form:\\n\\nif(x<=lb and u<0) or (x>=ub and u>0)\\n\\txdot=0"
"\\nelse\\n\\txdot=u."
MaskPromptString "Lower bound:|Upper bound:|Initial condition"
MaskStyleString "edit,edit,edit"
MaskTunableValueString "on,on,on"
MaskCallbackString "||"
MaskEnableString "on,on,on"
MaskVisibilityString "on,on,on"
MaskToolTipString "on,on,on"
MaskInitialization "lb = @1; ub = @2; xi = @3;"
MaskDisplay "plot(-1,-0.2,3.5,1.2,[0.05,1,2,2.9],[0,0,1,"
"1]);disp(' 1/s ')"
MaskIconFrame on
MaskIconOpaque on
MaskIconRotate "none"
MaskIconUnits "autoscale"
MaskValueString "0|1|InitialPosition"
MaskVariableAliases ",,"
System {
Name "Limited Integrator"
Location [0, 0, 791, 233]
Open off
ModelBrowserVisibility off
ModelBrowserWidth 200
ScreenColor "white"
PaperOrientation "landscape"
PaperPositionMode "auto"
PaperType "usletter"
PaperUnits "inches"
ZoomFactor "100"
Block {
BlockType Inport
Name "In_1"
Position [20, 130, 40, 150]
Port "1"
LatchInput off
Interpolate on
}
Block {
BlockType Fcn
Name "Fcn"
Position [150, 116, 520, 154]
Expr "u[2]*((((u[1]>lb)+(u[2]>=0))>0) * (((u["
"1]<ub)+(u[2]<=0))>0))"
}
Block {
BlockType Integrator
Name "Integrator"
Ports [1, 1]
Position [540, 126, 585, 144]
ExternalReset "none"
InitialConditionSource "internal"
InitialCondition "xi"
LimitOutput off
UpperSaturationLimit "inf"
LowerSaturationLimit "-inf"
ShowSaturationPort off
ShowStatePort off
AbsoluteTolerance "auto"
}
Block {
BlockType Mux
Name "Mux"
Ports [2, 1]
Position [85, 116, 115, 149]
Inputs "2"
DisplayOption "none"
}
Block {
BlockType Saturate
Name "Saturation"
Position [630, 121, 675, 149]
UpperLimit "ub"
LowerLimit "lb"
LinearizeAsGain on
}
Block {
BlockType Outport
Name "Out_1"
Position [720, 125, 740, 145]
Port "1"
OutputWhenDisabled "held"
InitialOutput "0"
}
Line {
SrcBlock "Integrator"
SrcPort 1
Points [10, 0]
Branch {
DstBlock "Saturation"
DstPort 1
}
Branch {
Points [0, -100; -545, 0; 0, 90]
DstBlock "Mux"
DstPort 1
}
}
Line {
SrcBlock "Fcn"
SrcPort 1
DstBlock "Integrator"
DstPort 1
}
Line {
SrcBlock "Mux"
SrcPort 1
DstBlock "Fcn"
DstPort 1
}
Line {
SrcBlock "In_1"
SrcPort 1
DstBlock "Mux"
DstPort 2
}
Line {
SrcBlock "Saturation"
SrcPort 1
DstBlock "Out_1"
DstPort 1
}
}
}
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 "0"
}
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 Sum
Name "Sum1"
Ports [2, 1]
Position [100, 110, 120, 150]
IconShape "rectangular"
Inputs "+-"
SaturateOnIntegerOverflow on
}
Block {
BlockType Switch
Name "Switch"
Position [360, 72, 380, 128]
Threshold "0"
}
Block {
BlockType Saturate
Name "change"
Position [255, 269, 290, 301]
Orientation "left"
UpperLimit "0.1"
LowerLimit "-0.1"
LinearizeAsGain on
MaskIconFrame on
MaskIconOpaque on
MaskIconRotate "none"
MaskIconUnits "autoscale"
}
Block {
BlockType Scope
Name "change\nscope"
Ports [1]
Position [260, 210, 290, 240]
Floating off
Location [715, 630, 977, 764]
Open off
NumInputPorts "1"
TickLabels "on"
ZoomMode "on"
List {
ListType AxesTitles
axes1 "%<SignalLabel>"
}
Grid "on"
TimeRange "20.000000"
YMin "-0.100000"
YMax "0.100000"
SaveToWorkspace off
SaveName "ScopeData"
DataFormat "Array"
LimitDataPoints on
MaxDataPoints "5000"
Decimation "1"
SampleInput off
SampleTime "0"
}
Block {
BlockType Constant
Name "const"
Position [310, 86, 335, 114]
Value "-1"
VectorParams1D on
}
Block {
BlockType Sum
Name "error"
Ports [2, 1]
Position [155, 125, 175, 145]
IconShape "rectangular"
Inputs "+-"
SaturateOnIntegerOverflow on
}
Block {
BlockType SubSystem
Name "tank 2"
Ports [1, 3]
Position [470, 81, 530, 139]
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 heig"
"ht (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;in"
"itialHt=@5;"
MaskDisplay "disp('WATER\\nTANK')"
MaskIconFrame on
MaskIconOpaque on
MaskIconRotate "none"
MaskIconUnits "autoscale"
MaskValueString "2|1|0.05|0|0.5"
MaskVariableAliases ",,,,"
System {
Name "tank 2"
Location [416, 401, 962, 709]
Open off
ModelBrowserVisibility off
ModelBrowserWidth 200
ScreenColor "white"
PaperOrientation "landscape"
PaperPositionMode "auto"
PaperType "usletter"
PaperUnits "inches"
ZoomFactor "100"
Block {
BlockType Inport
Name "flow\nin"
Position [25, 175, 45, 195]
Port "1"
LatchInput off
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
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -