📄 logicmpc.mdl
字号:
OutputWhenDisabled "held"
InitialOutput "[]"
}
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 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 ToWorkspace
VariableName "simulink_output"
MaxDataPoints "1000"
Decimation "1"
SampleTime "0"
FixptAsFi off
}
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 "arial"
FontSize 10
FontWeight "normal"
FontAngle "normal"
}
LineDefaults {
FontName "arial"
FontSize 9
FontWeight "normal"
FontAngle "normal"
}
System {
Name "logicMPC"
Location [233, 93, 832, 463]
Open on
ModelBrowserVisibility off
ModelBrowserWidth 200
ScreenColor "white"
PaperOrientation "landscape"
PaperPositionMode "auto"
PaperType "A4"
PaperUnits "centimeters"
ZoomFactor "100"
ReportName "simulink-default.rpt"
Block {
BlockType Reference
Name "MPC Controller"
Ports [3, 1]
Position [300, 366, 395, 444]
LinkData {
BlockName "Mux"
DialogParameters {
Inputs "2"
}
}
SourceBlock "mpclib/MPC Controller"
SourceType "MPC"
ShowPortLabels on
mpcobj "MPC2"
n_mv "0"
x0 "[]"
ref_from_ws off
ref_signal_name "[]"
ref_preview on
md_from_ws off
md_signal_name "[]"
md_preview on
from_project off
md_inport on
project_file "MPCtask.mat"
task_name "MPCDesign1"
}
Block {
BlockType SubSystem
Name "NineState"
Ports [2, 1]
Position [300, 102, 395, 173]
TreatAsAtomicUnit off
MinAlgLoopOccurrences off
RTWSystemCode "Auto"
MaskHideContents off
System {
Name "NineState"
Location [330, 313, 779, 514]
Open off
ModelBrowserVisibility off
ModelBrowserWidth 200
ScreenColor "white"
PaperOrientation "landscape"
PaperPositionMode "auto"
PaperType "A4"
PaperUnits "centimeters"
ZoomFactor "100"
Block {
BlockType Inport
Name "ref"
Position [25, 33, 55, 47]
IconDisplay "Port number"
}
Block {
BlockType Inport
Name "feedback"
Position [30, 98, 60, 112]
Port "2"
IconDisplay "Port number"
}
Block {
BlockType Derivative
Name "Derivative"
Position [205, 70, 235, 100]
}
Block {
BlockType Mux
Name "Mux"
Ports [2, 1]
Position [270, 28, 275, 77]
ShowName off
Inputs "2"
DisplayOption "bar"
}
Block {
BlockType "S-Function"
Name "S-Function"
Ports [1, 1]
Position [310, 40, 370, 70]
FunctionName "NineState"
Parameters "0.2,0.2"
}
Block {
BlockType Sum
Name "Sum1"
Ports [2, 1]
Position [115, 30, 135, 50]
ShowName off
IconShape "round"
Inputs "|+-"
InputSameDT off
OutDataTypeMode "Inherit via internal rule"
SaturateOnIntegerOverflow off
}
Block {
BlockType Outport
Name "Out1"
Position [400, 48, 430, 62]
IconDisplay "Port number"
BusOutputAsStruct off
}
Line {
SrcBlock "Sum1"
SrcPort 1
Points [0, 0; 40, 0]
Branch {
Points [0, 45]
DstBlock "Derivative"
DstPort 1
}
Branch {
DstBlock "Mux"
DstPort 1
}
}
Line {
SrcBlock "Mux"
SrcPort 1
DstBlock "S-Function"
DstPort 1
}
Line {
SrcBlock "Derivative"
SrcPort 1
Points [0, -20]
DstBlock "Mux"
DstPort 2
}
Line {
SrcBlock "S-Function"
SrcPort 1
DstBlock "Out1"
DstPort 1
}
Line {
SrcBlock "ref"
SrcPort 1
DstBlock "Sum1"
DstPort 1
}
Line {
SrcBlock "feedback"
SrcPort 1
Points [60, 0]
DstBlock "Sum1"
DstPort 2
}
Annotation {
Name "\n"
Position [287, 164]
UseDisplayTextAsClickCallback off
}
}
}
Block {
BlockType Scope
Name "Scope"
Ports [1]
Position [780, 209, 810, 241]
Floating off
Location [37, 265, 629, 741]
Open on
NumInputPorts "1"
List {
ListType AxesTitles
axes1 "%<SignalLabel>"
}
TimeRange "30"
YMin "0"
YMax "1.4"
DataFormat "StructureWithTime"
SampleTime "0"
}
Block {
BlockType Scope
Name "Scope1"
Ports [1]
Position [505, 94, 535, 126]
Floating off
Location [306, 167, 798, 619]
Open off
NumInputPorts "1"
List {
ListType AxesTitles
axes1 "%<SignalLabel>"
}
TimeRange "30"
YMin "-10"
YMax "10"
SaveName "ScopeData1"
DataFormat "StructureWithTime"
SampleTime "0"
}
Block {
BlockType Step
Name "Step"
Position [100, 110, 130, 140]
Time "0"
SampleTime "0"
}
Block {
BlockType SubSystem
Name "Switch"
Ports [2, 1]
Position [480, 195, 520, 255]
TreatAsAtomicUnit off
MinAlgLoopOccurrences off
RTWSystemCode "Auto"
MaskHideContents off
System {
Name "Switch"
Location [2, 82, 1014, 713]
Open on
ModelBrowserVisibility off
ModelBrowserWidth 200
ScreenColor "white"
PaperOrientation "landscape"
PaperPositionMode "auto"
PaperType "A4"
PaperUnits "centimeters"
ZoomFactor "100"
Block {
BlockType Inport
Name "K(t)"
Position [25, 18, 55, 32]
IconDisplay "Port number"
}
Block {
BlockType Inport
Name "U(t)"
Position [20, 63, 50, 77]
Port "2"
IconDisplay "Port number"
}
Block {
BlockType "S-Function"
Name "ControlSwitch"
Ports [1, 1]
Position [130, 25, 200, 75]
FunctionName "switchUK"
Parameters "20,20,0"
}
Block {
BlockType Mux
Name "Mux"
Ports [2, 1]
Position [80, 31, 85, 69]
ShowName off
Inputs "2"
DisplayOption "bar"
}
Block {
BlockType Outport
Name "Out1"
Position [255, 43, 285, 57]
IconDisplay "Port number"
BusOutputAsStruct off
}
Line {
SrcBlock "Mux"
SrcPort 1
DstBlock "ControlSwitch"
DstPort 1
}
Line {
SrcBlock "K(t)"
SrcPort 1
DstBlock "Mux"
DstPort 1
}
Line {
SrcBlock "ControlSwitch"
SrcPort 1
DstBlock "Out1"
DstPort 1
}
Line {
SrcBlock "U(t)"
SrcPort 1
DstBlock "Mux"
DstPort 2
}
}
}
Block {
BlockType ToWorkspace
Name "To Workspace2"
Position [740, 350, 800, 380]
VariableName "simout"
MaxDataPoints "inf"
SampleTime "-1"
SaveFormat "Structure With Time"
}
Block {
BlockType TransferFcn
Name "Transfer Fcn1"
Position [630, 207, 690, 243]
Numerator "[8]"
Denominator "[2 3 4 ]"
}
Line {
SrcBlock "Step"
SrcPort 1
Points [0, -5; 65, 0]
Branch {
DstBlock "NineState"
DstPort 1
}
Branch {
Points [0, 285]
DstBlock "MPC Controller"
DstPort 2
}
}
Line {
SrcBlock "Transfer Fcn1"
SrcPort 1
Points [15, 0]
Branch {
Points [0, 75; -430, 0]
Branch {
Points [0, -145]
DstBlock "NineState"
DstPort 2
}
Branch {
Points [0, 80]
DstBlock "MPC Controller"
DstPort 1
}
}
Branch {
Points [15, 0]
Branch {
DstBlock "Scope"
DstPort 1
}
Branch {
DstBlock "To Workspace2"
DstPort 1
}
}
}
Line {
SrcBlock "Switch"
SrcPort 1
DstBlock "Transfer Fcn1"
DstPort 1
}
Line {
SrcBlock "NineState"
SrcPort 1
Points [45, 0]
Branch {
Points [0, 70]
DstBlock "Switch"
DstPort 1
}
Branch {
Points [0, -30]
DstBlock "Scope1"
DstPort 1
}
}
Line {
SrcBlock "MPC Controller"
SrcPort 1
Points [45, 0; 0, -165]
DstBlock "Switch"
DstPort 2
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -