📄 sltankrule.mdl
字号:
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 TransferFcn
Numerator "[1]"
Denominator "[1 2 1]"
AbsoluteTolerance "auto"
Realization "auto"
}
Block {
BlockType ZeroOrderHold
SampleTime "1"
}
}
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 "sltankrule"
Location [106, 74, 856, 424]
Open on
ModelBrowserVisibility off
ModelBrowserWidth 200
ScreenColor "white"
PaperOrientation "landscape"
PaperPositionMode "auto"
PaperType "usletter"
PaperUnits "inches"
ZoomFactor "100"
ReportName "simulink-default.rpt"
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 Controller \nwith Ruleviewer"
Ports [1, 1]
Position [260, 130, 320, 180]
SourceBlock "fuzblock/Fuzzy Logic \nController \nwith Rulevi"
"ewer"
SourceType "FIS"
ShowPortLabels on
fismatrix "tank"
Ts "2"
}
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 SubSystem
Name "PID \nController"
Ports [1, 1]
Position [250, 34, 290, 66]
ShowPortLabels off
TreatAsAtomicUnit off
MinAlgLoopOccurrences off
RTWSystemCode "Auto"
MaskHideContents off
MaskType "PID Controller"
MaskDescription "Enter expressions for proportional, integral, a"
"nd derivative terms.\nP+I/s+Ds"
MaskHelp "This block implements a PID controller where pa"
"rameters are entered for the Proportional, Integral and Derivative terms. Unm"
"ask this block to see how it works. The derivative term is implemented using "
"a true derivative block."
MaskPromptString "Proportional:|Integral|Derivative:"
MaskStyleString "edit,edit,edit"
MaskTunableValueString "on,on,on"
MaskCallbackString "||"
MaskEnableString "on,on,on"
MaskVisibilityString "on,on,on"
MaskToolTipString "on,on,on"
MaskVarAliasString ",,"
MaskInitialization "P=@1; I=@2; D=@3;"
MaskDisplay "disp('PID')"
MaskIconFrame on
MaskIconOpaque on
MaskIconRotate "none"
MaskIconUnits "autoscale"
MaskValueString "2|0|1"
MaskTabNameString ",,"
System {
Name "PID \nController"
Location [8, 55, 370, 299]
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 [25, 65, 45, 85]
Port "1"
IconDisplay "Port number"
LatchInput off
HoldInput off
}
Block {
BlockType Gain
Name "D"
Position [95, 129, 115, 151]
Gain "D"
}
Block {
BlockType Derivative
Name "Derivative"
Position [150, 128, 190, 152]
}
Block {
BlockType TransferFcn
Name "Integral"
Position [110, 57, 145, 93]
Numerator "[I]"
Denominator "[1 0]"
}
Block {
BlockType Gain
Name "Proportional"
Position [120, 13, 140, 37]
Gain "P"
}
Block {
BlockType Sum
Name "Sum"
Ports [3, 1]
Position [245, 57, 265, 93]
Inputs "+++"
}
Block {
BlockType Outport
Name "Out_1"
Position [290, 65, 310, 85]
IconDisplay "Port number"
InitialOutput "0"
}
Line {
SrcBlock "Proportional"
SrcPort 1
Points [65, 0; 0, 40]
DstBlock "Sum"
DstPort 1
}
Line {
SrcBlock "Integral"
SrcPort 1
DstBlock "Sum"
DstPort 2
}
Line {
SrcBlock "Derivative"
SrcPort 1
Points [20, 0; 0, -55]
DstBlock "Sum"
DstPort 3
}
Line {
SrcBlock "In_1"
SrcPort 1
Points [15, 0]
Branch {
Points [15, 0]
Branch {
DstBlock "Integral"
DstPort 1
}
Branch {
Points [0, -50]
DstBlock "Proportional"
DstPort 1
}
}
Branch {
Points [0, 65]
DstBlock "D"
DstPort 1
}
}
Line {
SrcBlock "Sum"
SrcPort 1
DstBlock "Out_1"
DstPort 1
}
Line {
SrcBlock "D"
SrcPort 1
DstBlock "Derivative"
DstPort 1
}
}
}
Block {
BlockType "S-Function"
Name "S-Function"
Ports [1]
Position [630, 61, 685, 109]
FunctionName "animtank"
Parameters "1"
}
Block {
BlockType Scope
Name "Scope1"
Ports [1]
Position [650, 140, 680, 170]
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 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"
MaskHideContents off
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
HoldInput off
}
Block {
BlockType Inport
Name "source flow"
Position [20, 110, 40, 130]
Port "2"
IconDisplay "Port number"
LatchInput off
HoldInput off
}
Block {
BlockType SubSystem
Name "Limited Integrator"
Ports [1, 1]
Position [80, 9, 130, 51]
ShowPortLabels off
TreatAsAtomicUnit off
MinAlgLoopOccurrences off
RTWSystemCode "Auto"
MaskHideContents 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"
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
HoldInput 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
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -