📄 sltank.mdl
字号:
# $Revision: 1.10 $
Model {
Name "sltank"
Version 2.20
SimParamPage Solver
SampleTimeColors off
InvariantConstants off
WideVectorLines off
ShowLineWidths off
StartTime "0"
StopTime "10000"
Solver ode45
RelTol "1e-3"
AbsTol "1e-6"
Refine "1"
MaxStep "0.2"
InitialStep "auto"
FixedStep "auto"
MaxOrder 5
OutputOption RefineOutputTimes
OutputTimes "[]"
LoadExternalInput off
ExternalInput "[t, u]"
SaveTime off
TimeSaveName "tout"
SaveState off
StateSaveName "xout"
SaveOutput off
OutputSaveName "yout"
LoadInitialState off
InitialState "xInitial"
SaveFinalState off
FinalStateName "xFinal"
LimitMaxRows off
MaxRows "1000"
Decimation "1"
AlgebraicLoopMsg warning
MinStepSizeMsg warning
UnconnectedInputMsg warning
UnconnectedOutputMsg warning
UnconnectedLineMsg warning
ConsistencyChecking off
ZeroCross on
SimulationMode normal
RTWSystemTargetFile "grt.tlc"
RTWInlineParameters off
RTWPlaceOutputsASAP off
RTWRetainRTWFile off
RTWTemplateMakefile "grt_unix.tmf"
RTWMakeCommand "make_rtw"
RTWGenerateCodeOnly off
ExtModeMexFile "ext_comm"
ExtModeBatchMode off
PreLoadFcn "tank=readfis('tank');"
CloseFcn "AnimFigH = findobj(0,'Name', 'Tank Demo'); close(An"
"imFigH)"
BlockDefaults {
Orientation right
ForegroundColor black
BackgroundColor white
DropShadow off
NamePlacement normal
FontName "Helvetica"
FontSize 10
FontWeight normal
FontAngle normal
ShowName on
}
AnnotationDefaults {
HorizontalAlignment center
VerticalAlignment middle
ForegroundColor black
BackgroundColor white
DropShadow off
FontName "Helvetica"
FontSize 10
FontWeight normal
FontAngle normal
}
LineDefaults {
FontName "Helvetica"
FontSize 9
FontWeight normal
FontAngle normal
}
System {
Name "sltank"
Location [92, 139, 858, 489]
Open on
ToolBar on
StatusBar on
ScreenColor white
PaperOrientation landscape
PaperPositionMode auto
PaperType usletter
PaperUnits inches
Block {
BlockType Scope
Name "Comparison"
Ports [1, 0, 0, 0, 0]
Position [650, 140, 680, 170]
Floating off
Location [72, 107, 298, 471]
Open off
Grid on
TickLabels on
ZoomMode on
TimeRange "100"
YMin "0"
YMax "2"
SaveToWorkspace off
SaveName "ScopeData"
LimitMaxRows on
MaxRows "5000"
Decimation "1"
SampleInput off
SampleTime "0"
}
Block {
BlockType Constant
Name "Constant"
Position [30, 81, 55, 109]
Value "1"
}
Block {
BlockType Derivative
Name "Derivative"
Position [320, 269, 370, 301]
Orientation left
MaskIconFrame on
MaskIconOpaque on
MaskIconRotate none
MaskIconUnits autoscale
}
Block {
BlockType "S-Function"
Name "Fuzzy Logic Controller"
Ports [1, 1, 0, 0, 0]
Position [255, 129, 310, 181]
FunctionName "sffis"
Parameters "fismatrix"
PortCounts "[]"
SFunctionModules "sfsup"
MaskType "FIS"
MaskDescription "FIS"
MaskHelp "Fuzzy Inference System"
MaskPromptString "FIS Matrix:"
MaskStyleString "edit"
MaskTunableValueString "on"
MaskInitialization "fismatrix = @1;"
MaskDisplay "plot(0, -0.3, 6, -0.3, 0, 1.2, 6, 1.2, [0 6], ["
"0 0], [1 2 3],[0 1 0],[2 3 4],[0 1 0],[3 4 5],[0 1 0])"
MaskIconFrame on
MaskIconOpaque on
MaskIconRotate none
MaskIconUnits autoscale
MaskValueString "tank"
}
Block {
BlockType Mux
Name "Mux1"
Ports [2, 1, 0, 0, 0]
Position [205, 126, 235, 159]
Inputs "2"
}
Block {
BlockType Mux
Name "Mux2"
Ports [2, 1, 0, 0, 0]
Position [575, 66, 605, 99]
Inputs "2"
}
Block {
BlockType Reference
Name "PID Controller"
Ports [1, 1, 0, 0, 0]
Position [260, 35, 290, 65]
SourceBlock "simulink_extras/Additional\nLinear/PID Controll"
"er\n(with Approximate\nDerivative)"
SourceType "PID(2) Controller"
P "2"
I "0"
D "1"
N "100"
}
Block {
BlockType "S-Function"
Name "S-Function"
Ports [1, 0, 0, 0, 0]
Position [630, 61, 685, 109]
FunctionName "animtank"
Parameters "1"
PortCounts "[]"
SFunctionModules "''"
}
Block {
BlockType Scope
Name "Scope2"
Ports [1, 0, 0, 0, 0]
Position [490, 160, 520, 190]
Orientation left
Floating off
Location [207, 553, 469, 687]
Open off
Grid on
TickLabels on
ZoomMode on
TimeRange "20.000000"
YMin "-2.000000"
YMax "2.000000"
SaveToWorkspace off
SaveName "ScopeData"
LimitMaxRows on
MaxRows "5000"
Decimation "1"
SampleInput off
SampleTime "0"
MaskIconFrame on
MaskIconOpaque on
MaskIconRotate none
MaskIconUnits autoscale
}
Block {
BlockType Scope
Name "Scope4"
Ports [1, 0, 0, 0, 0]
Position [575, 125, 605, 155]
Floating off
Location [78, 177, 304, 320]
Open off
Grid on
TickLabels on
ZoomMode on
TimeRange "200.000000"
YMin "-2.000000"
YMax "2.000000"
SaveToWorkspace off
SaveName "ScopeData"
LimitMaxRows on
MaxRows "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"
}
Block {
BlockType SubSystem
Name "Subsystem"
Ports [2, 1, 0, 0, 0]
Position [405, 88, 455, 132]
ShowPortLabels off
MaskType "Valve"
MaskDescription "Valve"
MaskPromptString "Initial position [0=closed 1=open]:"
MaskStyleString "edit"
MaskTunableValueString "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
ToolBar off
StatusBar off
ScreenColor white
PaperOrientation landscape
PaperPositionMode auto
PaperType usletter
PaperUnits inches
Block {
BlockType Inport
Name "control"
Position [20, 20, 40, 40]
Port "1"
PortWidth "-1"
SampleTime "-1"
}
Block {
BlockType Inport
Name "source flow"
Position [20, 110, 40, 130]
Port "2"
PortWidth "-1"
SampleTime "-1"
}
Block {
BlockType SubSystem
Name "Limited Integrator"
Ports [1, 1, 0, 0, 0]
Position [80, 9, 130, 51]
ShowPortLabels off
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"
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"
System {
Name "Limited Integrator"
Location [0, 0, 791, 233]
Open off
ToolBar off
StatusBar off
ScreenColor white
PaperOrientation landscape
PaperPositionMode auto
PaperType usletter
PaperUnits inches
Block {
BlockType Inport
Name "In_1"
Position [20, 130, 40, 150]
Port "1"
PortWidth "-1"
SampleTime "-1"
}
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, 0, 0, 0]
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, 0, 0, 0]
Position [85, 116, 115, 149]
Inputs "2"
}
Block {
BlockType Saturate
Name "Saturation"
Position [630, 121, 675, 149]
UpperLimit "ub"
LowerLimit "lb"
}
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, 0, 0, 0]
Position [180, 76, 215, 134]
Inputs "2"
}
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, 0, 0, 0]
Position [100, 110, 120, 150]
Inputs "+-"
}
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"
MaskIconFrame on
MaskIconOpaque on
MaskIconRotate none
MaskIconUnits autoscale
}
Block {
BlockType Scope
Name "change\nscope"
Ports [1, 0, 0, 0, 0]
Position [260, 210, 290, 240]
Floating off
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -