slcp1.mdl
来自「模糊控制工具箱,很好用的,有相应的说明文件,希望对大家有用!」· MDL 代码 · 共 1,427 行 · 第 1/3 页
MDL
1,427 行
BlockType Gain
Gain "1"
Multiplication "Element-wise(K.*u)"
ParameterDataTypeMode "Same as input"
ParameterDataType "sfix(16)"
ParameterScalingMode "Best Precision: Matrix-wise"
ParameterScaling "2^0"
OutDataTypeMode "Same as input"
OutDataType "sfix(16)"
OutScaling "2^0"
LockScale off
RndMeth "Floor"
SaturateOnIntegerOverflow on
SampleTime "-1"
}
Block {
BlockType If
NumInputs "1"
IfExpression "u1 > 0"
ShowElse on
ZeroCross on
SampleTime "-1"
}
Block {
BlockType Inport
UseBusObject off
BusObject "BusObject"
BusOutputAsStruct off
PortDimensions "-1"
SampleTime "-1"
DataType "auto"
OutDataType "sfix(16)"
OutScaling "2^0"
SignalType "auto"
SamplingMode "auto"
Interpolate on
}
Block {
BlockType Integrator
ExternalReset "none"
InitialConditionSource "internal"
InitialCondition "0"
LimitOutput off
UpperSaturationLimit "inf"
LowerSaturationLimit "-inf"
ShowSaturationPort off
ShowStatePort off
AbsoluteTolerance "auto"
IgnoreLimit off
ZeroCross on
}
Block {
BlockType Math
Operator "exp"
OutputSignalType "auto"
SampleTime "-1"
OutDataTypeMode "Same as first input"
OutDataType "sfix(16)"
OutScaling "2^0"
LockScale off
RndMeth "Floor"
SaturateOnIntegerOverflow on
}
Block {
BlockType Merge
Inputs "2"
InitialOutput "[]"
AllowUnequalInputPortWidths off
InputPortOffsets "[]"
}
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 Reference
}
Block {
BlockType RelationalOperator
Operator ">="
InputSameDT on
LogicOutDataTypeMode "Logical (see Configuration Parameters: Optimiza"
"tion)"
LogicDataType "uint(8)"
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
}
}
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 "slcp1"
Location [363, 127, 894, 577]
Open on
ModelBrowserVisibility off
ModelBrowserWidth 200
ScreenColor "white"
PaperOrientation "landscape"
PaperPositionMode "auto"
PaperType "usletter"
PaperUnits "inches"
ZoomFactor "100"
ReportName "simulink-default.rpt"
Block {
BlockType "S-Function"
Name "Animation"
Ports [1]
Position [410, 34, 465, 66]
FunctionName "animcp1"
}
Block {
BlockType SubSystem
Name "Cart & Pole\nDynamics"
Ports [2, 4]
Position [265, 185, 315, 240]
ShowPortLabels off
TreatAsAtomicUnit off
MinAlgLoopOccurrences off
RTWSystemCode "Auto"
MaskHideContents off
MaskType "Cart & Pole"
MaskDescription "Inverted Pendulum (cart & pole)"
MaskHelp "Inverted Pendulum"
MaskPromptString "Initial Conditions (angle, angular velocity, ca"
"rt position and cart velocity):|Physical Specifications (cart mass and g):"
MaskStyleString "edit,edit"
MaskTunableValueString "on,on"
MaskCallbackString "|"
MaskEnableString "on,on"
MaskVisibilityString "on,on"
MaskToolTipString "on,on"
MaskVarAliasString ","
MaskInitialization "init_cond = @1; spec = @2;mc=spec(1);g=spec(2);"
MaskDisplay "plot(-4,-1,4,6,[0 3 2.8 -0.2 0],[1 5 5.15 1.15 "
"1],[-1 -1 1 1 -1],[1 0 0 1 1],[-3.5 3.5],[0 0])"
MaskIconFrame on
MaskIconOpaque on
MaskIconRotate "none"
MaskIconUnits "autoscale"
MaskValueString "[0, 0, 0, 0]|[1.0, 9.8]"
MaskTabNameString ","
System {
Name "Cart & Pole\nDynamics"
Location [261, 554, 1061, 859]
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 [60, 50, 80, 70]
Port "1"
IconDisplay "Port number"
LatchInput off
HoldInput off
}
Block {
BlockType Inport
Name "in_2"
Position [55, 210, 75, 230]
Port "2"
IconDisplay "Port number"
LatchInput off
HoldInput off
}
Block {
BlockType Fcn
Name "Fcn2"
Position [515, 220, 555, 240]
ShowName off
Expr "(u(1)+u(7)*u(6)*(u(4)*u(4)*u(2)-u(5)*u(3)))"
"/(mc+u(7))"
}
Block {
BlockType Fcn
Name "Fcn3"
Position [425, 85, 465, 105]
ShowName off
Expr "(g*u(2)+u(3)*((-u(1)-u(6)*u(5)*u(4)*u(4)*u("
"2))/(mc+u(6))))/(u(5)*(4/3-(u(6)*u(3)*u(3))/(mc+u(6))))"
}
Block {
BlockType Fcn
Name "Fcn4"
Position [145, 69, 200, 91]
ShowName off
}
Block {
BlockType Fcn
Name "Fcn5"
Position [145, 98, 200, 122]
ShowName off
Expr "cos(u[1])"
}
Block {
BlockType Gain
Name "Gain"
Position [110, 230, 145, 260]
Gain "0.1"
}
Block {
BlockType Gain
Name "Gain1"
Position [155, 205, 190, 235]
Gain "0.5"
}
Block {
BlockType Mux
Name "Mux1"
Ports [4, 1]
Position [280, 54, 315, 111]
ShowName off
}
Block {
BlockType Mux
Name "Mux2"
Ports [3, 1]
Position [465, 208, 495, 252]
ShowName off
Inputs "[4,1,2]"
}
Block {
BlockType Mux
Name "Mux3"
Ports [2, 1]
Position [375, 73, 405, 117]
ShowName off
Inputs "[4,2]"
}
Block {
BlockType Mux
Name "Mux5"
Ports [2, 1]
Position [270, 207, 300, 258]
ShowName off
Inputs "2"
}
Block {
BlockType Integrator
Name "theta"
Ports [1, 1]
Position [570, 85, 590, 105]
InitialCondition "init_cond(1)"
}
Block {
BlockType Integrator
Name "theta dot"
Ports [1, 1]
Position [500, 85, 520, 105]
InitialCondition "init_cond(2)"
}
Block {
BlockType Integrator
Name "x"
Ports [1, 1]
Position [635, 220, 655, 240]
InitialCondition "init_cond(3)"
}
Block {
BlockType Integrator
Name "x dot"
Ports [1, 1]
Position [575, 220, 595, 240]
InitialCondition "init_cond(4)"
}
Block {
BlockType Outport
Name "out_1"
Position [735, 85, 755, 105]
IconDisplay "Port number"
InitialOutput "0"
}
Block {
BlockType Outport
Name "out_2"
Position [740, 125, 760, 145]
Port "2"
IconDisplay "Port number"
InitialOutput "0"
}
Block {
BlockType Outport
Name "out_3"
Position [740, 165, 760, 185]
Port "3"
IconDisplay "Port number"
InitialOutput "0"
}
Block {
BlockType Outport
Name "out_4"
Position [740, 205, 760, 225]
Port "4"
IconDisplay "Port number"
InitialOutput "0"
}
Line {
SrcBlock "theta"
SrcPort 1
Points [0, 0]
Branch {
DstBlock "out_1"
DstPort 1
}
Branch {
Points [-25, 0; 0, -65; -445, 0; 0, 70]
Branch {
Points [0, 10]
DstBlock "Fcn5"
DstPort 1
}
Branch {
DstBlock "Fcn4"
DstPort 1
}
}
}
Line {
SrcBlock "Fcn5"
SrcPort 1
Points [20, 0; 0, -20]
DstBlock "Mux1"
DstPort 3
}
Line {
SrcBlock "Fcn4"
SrcPort 1
Points [10, 0; 0, -5]
DstBlock "Mux1"
DstPort 2
}
Line {
SrcBlock "theta dot"
SrcPort 1
Points [15, 0]
Branch {
DstBlock "theta"
DstPort 1
}
Branch {
Points [0, 40]
Branch {
DstBlock "out_2"
DstPort 1
}
Branch {
Points [-305, 0; 0, -30]
DstBlock "Mux1"
DstPort 4
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?