📄 sltank.mdl
字号:
RndMeth "Floor"
SaturateOnIntegerOverflow on
}
Block {
BlockType Merge
Inputs "2"
InitialOutput "[]"
AllowUnequalInputPortWidths off
InputPortOffsets "[]"
}
Block {
BlockType MinMax
Function "min"
Inputs "1"
InputSameDT on
OutDataTypeMode "Inherit via internal rule"
OutDataType "sfix(16)"
OutScaling "2^0"
LockScale off
RndMeth "Floor"
SaturateOnIntegerOverflow on
ZeroCross on
SampleTime "-1"
}
Block {
BlockType Mux
Inputs "4"
DisplayOption "none"
UseBusObject off
BusObject "BusObject"
NonVirtualBus off
}
Block {
BlockType Outport
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 Relay
OnSwitchValue "eps"
OffSwitchValue "eps"
OnOutputValue "1"
OffOutputValue "0"
OutputDataTypeScalingMode "All ports same datatype"
OutDataType "sfix(16)"
OutScaling "2^0"
ConRadixGroup "Use specified scaling"
ZeroCross on
SampleTime "-1"
}
Block {
BlockType RelationalOperator
Operator ">="
InputSameDT on
LogicOutDataTypeMode "Logical (see Configuration Parameters: Optimiza"
"tion)"
LogicDataType "uint(8)"
ZeroCross 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 "S-Function"
FunctionName "system"
SFunctionModules "''"
PortCounts "[]"
}
Block {
BlockType SignalGenerator
WaveForm "sine"
TimeSource "Use simulation time"
Amplitude "1"
Frequency "1"
Units "Hertz"
VectorParams1D on
}
Block {
BlockType SubSystem
ShowPortLabels on
Permissions "ReadWrite"
PermitHierarchicalResolution "All"
SystemSampleTime "-1"
RTWFcnNameOpts "Auto"
RTWFileNameOpts "Auto"
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 Switch
Criteria "u2 >= Threshold"
Threshold "0"
InputSameDT on
OutDataTypeMode "Inherit via internal rule"
RndMeth "Floor"
SaturateOnIntegerOverflow on
ZeroCross on
SampleTime "-1"
}
Block {
BlockType Terminator
}
Block {
BlockType TransferFcn
Numerator "[1]"
Denominator "[1 2 1]"
AbsoluteTolerance "auto"
Realization "auto"
}
}
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 [227, 148, 993, 498]
Open on
ModelBrowserVisibility off
ModelBrowserWidth 200
ScreenColor "white"
PaperOrientation "landscape"
PaperPositionMode "auto"
PaperType "usletter"
PaperUnits "inches"
ZoomFactor "100"
ReportName "simulink-default.rpt"
Block {
BlockType Scope
Name "Comparison"
Ports [1]
Position [650, 140, 680, 170]
Floating off
Location [72, 107, 298, 471]
Open off
NumInputPorts "1"
TickLabels "on"
List {
ListType AxesTitles
axes1 "%<SignalLabel>"
}
TimeRange "100"
YMin "0"
YMax "2"
DataFormat "Array"
SampleTime "0"
}
Block {
BlockType Constant
Name "Constant"
Position [30, 81, 55, 109]
}
Block {
BlockType Derivative
Name "Derivative"
Position [320, 269, 370, 301]
Orientation "left"
MaskIconFrame on
MaskIconOpaque on
MaskIconRotate "none"
MaskIconUnits "autoscale"
}
Block {
BlockType Reference
Name "Fuzzy Logic\nController"
Ports [1, 1]
Position [260, 130, 320, 180]
FontName "Arial"
SourceBlock "fuzblock/Fuzzy Logic \nController"
SourceType "FIS"
ShowPortLabels on
fis "tank"
}
Block {
BlockType Mux
Name "Mux1"
Ports [2, 1]
Position [205, 126, 235, 159]
Inputs "2"
}
Block {
BlockType Mux
Name "Mux2"
Ports [2, 1]
Position [575, 66, 605, 99]
Inputs "2"
}
Block {
BlockType Reference
Name "PID Controller"
Ports [1, 1]
Position [260, 35, 290, 65]
SourceBlock "simulink_extras/Additional\nLinear/PID Controll"
"er\n(with Approximate\nDerivative)"
SourceType "PID(2) Controller"
ShowPortLabels on
P "2"
I "0"
D "1"
N "100"
}
Block {
BlockType "S-Function"
Name "S-Function"
Ports [1]
Position [630, 61, 685, 109]
FunctionName "animtank"
Parameters "1"
}
Block {
BlockType Scope
Name "Scope2"
Ports [1]
Position [490, 160, 520, 190]
Orientation "left"
Floating off
Location [207, 553, 469, 687]
Open off
NumInputPorts "1"
TickLabels "on"
List {
ListType AxesTitles
axes1 "%<SignalLabel>"
}
TimeRange "20.000000"
YMin "-2.000000"
YMax "2.000000"
DataFormat "Array"
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"
List {
ListType AxesTitles
axes1 "%<SignalLabel>"
}
TimeRange "200.000000"
YMin "-2.000000"
YMax "2.000000"
DataFormat "Array"
SampleTime "0"
}
Block {
BlockType SignalGenerator
Name "Signal\nGenerator"
Ports [0, 1]
Position [20, 158, 65, 192]
WaveForm "square"
Amplitude "0.500000"
Frequency "0.100000"
Units "rad/sec"
}
Block {
BlockType SubSystem
Name "Subsystem"
Ports [2, 1]
Position [405, 88, 455, 132]
ShowPortLabels off
TreatAsAtomicUnit off
MinAlgLoopOccurrences off
RTWSystemCode "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"
IconDisplay "Port number"
LatchInput off
}
Block {
BlockType Inport
Name "source flow"
Position [20, 110, 40, 130]
Port "2"
IconDisplay "Port number"
LatchInput off
}
Block {
BlockType SubSystem
Name "Limited Integrator"
Ports [1, 1]
Position [80, 9, 130, 51]
ShowPortLabels off
TreatAsAtomicUnit off
MinAlgLoopOccurrences off
RTWSystemCode "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"
MaskVarAliasString ",,"
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"
MaskTabNameString ",,"
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"
IconDisplay "Port number"
LatchInput off
}
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]
InitialCondition "xi"
}
Block {
BlockType Mux
Name "Mux"
Ports [2, 1]
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]
IconDisplay "Port number"
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]
}
Block {
BlockType Outport
Name "out flow"
Position [250, 95, 270, 115]
IconDisplay "Port number"
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
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -