📄 fuzzypid.mdl
字号:
SaturateOnIntegerOverflow on
SampleTime "-1"
}
Block {
BlockType Inport
Port "1"
UseBusObject off
BusObject "BusObject"
BusOutputAsStruct off
PortDimensions "-1"
SampleTime "-1"
DataType "auto"
OutDataType "sfix(16)"
OutScaling "2^0"
SignalType "auto"
SamplingMode "auto"
LatchByDelayingOutsideSignal off
LatchByCopyingInsideSignal off
Interpolate on
}
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 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 Step
Time "1"
Before "0"
After "1"
SampleTime "-1"
VectorParams1D on
ZeroCross on
}
Block {
BlockType SubSystem
ShowPortLabels "FromPortIcon"
Permissions "ReadWrite"
PermitHierarchicalResolution "All"
TreatAsAtomicUnit off
SystemSampleTime "-1"
RTWFcnNameOpts "Auto"
RTWFileNameOpts "Auto"
RTWMemSecFuncInitTerm "Inherit from model"
RTWMemSecFuncExecute "Inherit from model"
RTWMemSecDataConstants "Inherit from model"
RTWMemSecDataInternal "Inherit from model"
RTWMemSecDataParameters "Inherit from model"
SimViewingDevice off
DataTypeOverride "UseLocalSettings"
MinMaxOverflowLogging "UseLocalSettings"
}
Block {
BlockType Sum
IconShape "rectangular"
Inputs "++"
CollapseMode "All dimensions"
CollapseDim "1"
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 ToWorkspace
VariableName "simulink_output"
MaxDataPoints "1000"
Decimation "1"
SampleTime "0"
FixptAsFi off
}
Block {
BlockType TransferFcn
Numerator "[1]"
Denominator "[1 2 1]"
AbsoluteTolerance "auto"
ContinuousStateAttributes "''"
Realization "auto"
}
Block {
BlockType TransportDelay
DelayTime "1"
InitialOutput "0"
BufferSize "1024"
FixedBuffer off
TransDelayFeedthrough off
PadeOrder "0"
}
}
AnnotationDefaults {
HorizontalAlignment "center"
VerticalAlignment "middle"
ForegroundColor "black"
BackgroundColor "white"
DropShadow off
FontName "Helvetica"
FontSize 10
FontWeight "normal"
FontAngle "normal"
UseDisplayTextAsClickCallback off
}
LineDefaults {
FontName "Helvetica"
FontSize 9
FontWeight "normal"
FontAngle "normal"
}
System {
Name "fuzzypid"
Location [-2, 48, 1262, 792]
Open on
ModelBrowserVisibility off
ModelBrowserWidth 200
ScreenColor "white"
PaperOrientation "landscape"
PaperPositionMode "auto"
PaperType "A4"
PaperUnits "centimeters"
TiledPaperMargins [0.500000, 0.500000, 0.500000, 0.500000]
TiledPageScale 1
ShowPageBoundaries off
ZoomFactor "100"
ReportName "simulink-default.rpt"
Block {
BlockType Abs
Name "Abs"
Position [160, 130, 190, 160]
}
Block {
BlockType Clock
Name "Clock"
Position [215, 250, 235, 270]
DisplayTime on
Decimation "1000"
}
Block {
BlockType Derivative
Name "Derivative"
Position [190, 75, 220, 105]
}
Block {
BlockType Reference
Name "Discrete\nPID Controller"
Ports [1, 1]
Position [155, 177, 200, 223]
DialogController "POWERSYS.PowerSysDialog"
SourceBlock "powerlib_extras/Discrete \nControl Blocks/Discr"
"ete\nPID Controller"
SourceType "Discrete PID Controller"
ShowPortLabels "FromPortIcon"
SystemSampleTime "-1"
FunctionWithSeparateData off
RTWMemSecFuncInitTerm "Inherit from model"
RTWMemSecFuncExecute "Inherit from model"
RTWMemSecDataConstants "Inherit from model"
RTWMemSecDataInternal "Inherit from model"
RTWMemSecDataParameters "Inherit from model"
Kp "10"
Ki "1"
Kd "0.01"
TcD "0.5e-3"
Par_Limits "[1e6 -1e6]"
Init "0"
Ts "1"
}
Block {
BlockType SubSystem
Name "Fuzzy Logic \nController"
Ports [1, 1]
Position [280, 15, 315, 65]
AncestorBlock "fuzblock/Fuzzy Logic \nController"
FontName "Arial"
MinAlgLoopOccurrences off
RTWSystemCode "Auto"
FunctionWithSeparateData off
MaskHideContents off
MaskType "FIS"
MaskDescription "FIS"
MaskHelp "web(['file:///' docroot '/toolbox/fuzzy/fuzzylo"
"giccontroller.html']);"
MaskPromptString "FIS File or Structure:"
MaskStyleString "edit"
MaskTunableValueString "on"
MaskEnableString "on"
MaskVisibilityString "on"
MaskToolTipString "on"
MaskVariables "fis=@1;"
MaskInitialization "fis = fuzblockmask(gcb,fis);"
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])"
MaskSelfModifiable on
MaskIconFrame on
MaskIconOpaque on
MaskIconRotate "none"
MaskIconUnits "autoscale"
MaskValueString "frule1"
System {
Name "Fuzzy Logic \nController"
Location [251, 557, 620, 673]
Open off
ModelBrowserVisibility off
ModelBrowserWidth 200
ScreenColor "white"
PaperOrientation "landscape"
PaperPositionMode "auto"
PaperType "A4"
PaperUnits "centimeters"
TiledPaperMargins [0.500000, 0.500000, 0.500000, 0.500000]
TiledPageScale 1
ShowPageBoundaries off
ZoomFactor "100"
Block {
BlockType Inport
Name "In1"
Position [25, 43, 55, 57]
IconDisplay "Port number"
}
Block {
BlockType "S-Function"
Name "FIS S-function"
Ports [1, 1]
Position [135, 24, 205, 76]
FunctionName "sffis"
Parameters "fis"
SFunctionModules "sfsup"
}
Block {
BlockType Outport
Name "Out1"
Position [305, 43, 335, 57]
IconDisplay "Port number"
BusOutputAsStruct off
}
Line {
SrcBlock "In1"
SrcPort 1
DstBlock "FIS S-function"
DstPort 1
}
Line {
SrcBlock "FIS S-function"
SrcPort 1
DstBlock "Out1"
DstPort 1
}
}
}
Block {
BlockType Gain
Name "Gain"
Position [335, 25, 365, 55]
Gain "14"
}
Block {
BlockType Gain
Name "Gain1"
Position [130, 15, 160, 45]
Gain "0.3"
}
Block {
BlockType Gain
Name "Gain2"
Position [135, 75, 165, 105]
Gain "1.2"
}
Block {
BlockType Mux
Name "Mux"
Ports [2, 1]
Position [255, 21, 260, 59]
ShowName off
Inputs "2"
DisplayOption "bar"
}
Block {
BlockType Scope
Name "Scope"
Ports [1]
Position [475, 129, 505, 161]
Floating off
Location [5, 46, 1285, 768]
Open off
NumInputPorts "1"
List {
ListType AxesTitles
axes1 "%<SignalLabel>"
}
YMin "0.6"
YMax "1.3"
SaveName "ScopeData1"
DataFormat "StructureWithTime"
SampleTime "0"
}
Block {
BlockType Step
Name "Step"
Position [20, 130, 50, 160]
SampleTime "0"
}
Block {
BlockType Sum
Name "Sum"
Ports [2, 1]
Position [75, 117, 95, 173]
ShowName off
Inputs "|+-"
CollapseMode "All dimensions"
InputSameDT off
OutDataTypeMode "Inherit via internal rule"
}
Block {
BlockType Switch
Name "Switch"
Position [260, 130, 290, 160]
Threshold "1.2"
}
Block {
BlockType ToWorkspace
Name "To Workspace"
Position [290, 245, 350, 275]
VariableName "tt"
MaxDataPoints "inf"
SampleTime "-1"
SaveFormat "Array"
}
Block {
BlockType ToWorkspace
Name "To Workspace1"
Position [480, 220, 540, 250]
VariableName "yy"
MaxDataPoints "inf"
SampleTime "-1"
SaveFormat "Array"
}
Block {
BlockType TransferFcn
Name "Transfer Fcn"
Position [385, 127, 445, 163]
Denominator "[2 35 1]"
}
Block {
BlockType TransportDelay
Name "Transport\nDelay"
Position [325, 130, 355, 160]
DelayTime "0.5"
}
Line {
SrcBlock "Sum"
SrcPort 1
Points [0, 0]
Branch {
DstBlock "Abs"
DstPort 1
}
Branch {
Points [0, -55]
Branch {
Points [0, -60]
DstBlock "Gain1"
DstPort 1
}
Branch {
DstBlock "Gain2"
DstPort 1
}
}
Branch {
Points [0, 55]
DstBlock "Discrete\nPID Controller"
DstPort 1
}
}
Line {
SrcBlock "Abs"
SrcPort 1
DstBlock "Switch"
DstPort 2
}
Line {
SrcBlock "Gain2"
SrcPort 1
DstBlock "Derivative"
DstPort 1
}
Line {
SrcBlock "Gain1"
SrcPort 1
DstBlock "Mux"
DstPort 1
}
Line {
SrcBlock "Derivative"
SrcPort 1
Points [10, 0; 0, -40]
DstBlock "Mux"
DstPort 2
}
Line {
SrcBlock "Transport\nDelay"
SrcPort 1
DstBlock "Transfer Fcn"
DstPort 1
}
Line {
SrcBlock "Transfer Fcn"
SrcPort 1
Points [5, 0]
Branch {
DstBlock "Scope"
DstPort 1
}
Branch {
Points [0, 90]
Branch {
Points [-410, 0; 0, -70]
DstBlock "Sum"
DstPort 2
}
Branch {
DstBlock "To Workspace1"
DstPort 1
}
}
}
Line {
SrcBlock "Mux"
SrcPort 1
DstBlock "Fuzzy Logic \nController"
DstPort 1
}
Line {
SrcBlock "Fuzzy Logic \nController"
SrcPort 1
DstBlock "Gain"
DstPort 1
}
Line {
SrcBlock "Discrete\nPID Controller"
SrcPort 1
Points [40, 0]
DstBlock "Switch"
DstPort 3
}
Line {
SrcBlock "Clock"
SrcPort 1
DstBlock "To Workspace"
DstPort 1
}
Line {
SrcBlock "Step"
SrcPort 1
DstBlock "Sum"
DstPort 1
}
Line {
SrcBlock "Gain"
SrcPort 1
Points [25, 0; 0, 70; -150, 0]
DstBlock "Switch"
DstPort 1
}
Line {
SrcBlock "Switch"
SrcPort 1
DstBlock "Transport\nDelay"
DstPort 1
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -