b_ss_controller.mdl
来自「这是一个电机PID控制的程序」· MDL 代码 · 共 1,849 行 · 第 1/4 页
MDL
1,849 行
Branch {
DstBlock "th_l"
DstPort 1
}
Branch {
DstBlock "Sum4"
DstPort 2
}
}
Line {
Name "dth_l"
Labels [0, 0]
SrcBlock "Integrator3"
SrcPort 1
Points [0, 0; 30, 0]
Branch {
Points [0, 70]
Branch {
DstBlock "dth_l"
DstPort 1
}
Branch {
DstBlock "Load\ndamping"
DstPort 1
}
}
Branch {
DstBlock "Sum2"
DstPort 2
}
Branch {
DstBlock "Integrator4"
DstPort 1
}
}
}
}
Block {
BlockType Mux
Name "Mux"
Ports [4, 1]
Position [390, 327, 395, 483]
ShowName off
DisplayOption "bar"
Port {
PortNumber 1
PropagatedSignals "dth_m, th_m, dth_l, th_l"
ShowPropagatedSignals "on"
RTWStorageClass "Auto"
DataLoggingNameMode "SignalName"
}
}
Block {
BlockType Terminator
Name "Terminator"
Position [300, 55, 320, 75]
ShowName off
}
Block {
BlockType Terminator
Name "Terminator1"
Position [325, 70, 345, 90]
ShowName off
}
Block {
BlockType Terminator
Name "Terminator2"
Position [235, 115, 255, 135]
ShowName off
}
Block {
BlockType Reference
Name "dc_motor_detailed3"
Ports [2, 7]
Position [80, 30, 205, 130]
BackgroundColor "lightBlue"
DropShadow on
SourceBlock "dc_motor_lib/dc_motor_detailed"
SourceType ""
ShowPortLabels on
SystemSampleTime "-1"
FunctionWithSeparateData off
RTWMemSecFuncInitTerm "Inherit from model"
RTWMemSecFuncExecute "Inherit from model"
RTWMemSecDataConstants "Inherit from model"
RTWMemSecDataInternal "Inherit from model"
RTWMemSecDataParameters "Inherit from model"
Rm "Rm"
Lm "Lm"
Kb "Kb"
Kt "Kt"
Jm "Jm"
bm "bm"
Ktemp "14"
ttemp "910"
amb_temp "22"
Port {
PortNumber 1
Name "current"
PropagatedSignals "Current"
RTWStorageClass "Auto"
DataLoggingNameMode "SignalName"
}
Port {
PortNumber 5
Name "dth_m"
PropagatedSignals "dth_m"
RTWStorageClass "Auto"
DataLoggingNameMode "SignalName"
}
Port {
PortNumber 6
Name "th_m"
PropagatedSignals "th_m"
RTWStorageClass "Auto"
DataLoggingNameMode "SignalName"
}
}
Block {
BlockType Outport
Name "states_X"
Position [560, 398, 590, 412]
IconDisplay "Port number"
BusOutputAsStruct off
}
Block {
BlockType Outport
Name "encoder"
Position [525, 238, 555, 252]
Port "2"
IconDisplay "Port number"
BusOutputAsStruct off
}
Block {
BlockType Outport
Name "Current"
Position [490, 28, 520, 42]
Port "3"
IconDisplay "Port number"
BusOutputAsStruct off
}
Block {
BlockType Outport
Name "back_emf"
Position [490, 63, 520, 77]
Port "4"
IconDisplay "Port number"
BusOutputAsStruct off
}
Line {
Name "dth_m"
SrcBlock "dc_motor_detailed3"
SrcPort 5
Points [65, 0]
Branch {
Labels [1, 1]
Points [0, 225]
DstBlock "Load"
DstPort 1
}
Branch {
Labels [3, 0]
Points [65, 0; 0, 250]
DstBlock "Mux"
DstPort 1
}
}
Line {
Name "th_m"
SrcBlock "dc_motor_detailed3"
SrcPort 6
Points [105, 0; 0, 135]
Branch {
Points [0, 110]
Branch {
Labels [1, 1]
DstBlock "Load"
DstPort 2
}
Branch {
Labels [2, 1]
Points [0, 30]
DstBlock "Mux"
DstPort 2
}
}
Branch {
DstBlock "encoder"
DstPort 1
}
}
Line {
Labels [0, 0]
SrcBlock "Mux"
SrcPort 1
Points [0, 0]
DstBlock "states_X"
DstPort 1
}
Line {
Name "dth_l"
Labels [-1, 1]
SrcBlock "Load"
SrcPort 2
Points [-25, 0; 0, 90]
DstBlock "Mux"
DstPort 3
}
Line {
SrcBlock "Load"
SrcPort 1
Points [-100, 0; 0, -205]
DstBlock "dc_motor_detailed3"
DstPort 2
}
Line {
SrcBlock "dc_motor_detailed3"
SrcPort 3
DstBlock "Terminator"
DstPort 1
}
Line {
SrcBlock "dc_motor_detailed3"
SrcPort 4
DstBlock "Terminator1"
DstPort 1
}
Line {
SrcBlock "dc_motor_detailed3"
SrcPort 7
DstBlock "Terminator2"
DstPort 1
}
Line {
SrcBlock "Vin"
SrcPort 1
DstBlock "dc_motor_detailed3"
DstPort 1
}
Line {
Name "current"
Labels [-1, 0]
SrcBlock "dc_motor_detailed3"
SrcPort 1
DstBlock "Current"
DstPort 1
}
Line {
SrcBlock "dc_motor_detailed3"
SrcPort 2
Points [145, 0; 0, 20]
DstBlock "back_emf"
DstPort 1
}
Line {
Name "th_l"
Labels [-1, 1]
SrcBlock "Load"
SrcPort 3
Points [-5, 0; 0, 105]
DstBlock "Mux"
DstPort 4
}
}
}
Block {
BlockType Scope
Name "Scope1"
Ports [1]
Position [680, 184, 710, 216]
Floating off
Location [388, 741, 712, 980]
Open off
NumInputPorts "1"
List {
ListType AxesTitles
axes1 "%<SignalLabel>"
}
YMin "-150"
YMax "175"
DataFormat "StructureWithTime"
LimitDataPoints off
SampleTime "0"
}
Block {
BlockType Scope
Name "Scope10"
Ports [1]
Position [465, 19, 495, 51]
Floating off
Location [35, 579, 359, 818]
Open off
NumInputPorts "1"
List {
ListType AxesTitles
axes1 "%<SignalLabel>"
}
YMin "-20"
YMax "12.5"
SaveName "ScopeData9"
DataFormat "StructureWithTime"
LimitDataPoints off
SampleTime "0"
}
Block {
BlockType Scope
Name "Scope2"
Ports [1]
Position [680, 84, 710, 116]
Floating off
Location [388, 741, 712, 980]
Open off
NumInputPorts "1"
List {
ListType AxesTitles
axes1 "%<SignalLabel>"
}
YMax "15"
SaveName "ScopeData1"
DataFormat "StructureWithTime"
LimitDataPoints off
SampleTime "0"
}
Block {
BlockType Scope
Name "Scope8"
Ports [1]
Position [725, 154, 755, 186]
Floating off
Location [330, 284, 654, 523]
Open off
NumInputPorts "1"
List {
ListType AxesTitles
axes1 "%<SignalLabel>"
}
YMin "6.5e-011"
YMax "7.05e-011"
SaveName "ScopeData7"
DataFormat "StructureWithTime"
LimitDataPoints off
SampleTime "0"
}
Block {
BlockType Step
Name "Step"
Position [30, 15, 60, 45]
SampleTime "Ts"
}
Block {
BlockType ZeroOrderHold
Name "Zero-Order\nHold"
Position [80, 86, 100, 104]
ShowName off
SampleTime "Ts"
}
Block {
BlockType ZeroOrderHold
Name "Zero-Order\nHold1"
Position [80, 115, 100, 135]
ShowName off
SampleTime "Ts"
}
Line {
SrcBlock "Mechanics"
SrcPort 4
Points [10, 0; 0, 45; -255, 0; 0, -50]
DstBlock "Amplifier"
DstPort 3
}
Line {
SrcBlock "Mechanics"
SrcPort 3
Points [20, 0; 0, 85; -280, 0; 0, -95]
DstBlock "Amplifier"
DstPort 2
}
Line {
SrcBlock "Amplifier"
SrcPort 1
Points [0, 0; 15, 0]
Branch {
DstBlock "Mechanics"
DstPort 1
}
Branch {
Points [0, -90]
DstBlock "Scope10"
DstPort 1
}
}
Line {
SrcBlock "Controller"
SrcPort 1
DstBlock "Amplifier"
DstPort 1
}
Line {
SrcBlock "Demux"
SrcPort 4
DstBlock "Scope1"
DstPort 1
}
Line {
SrcBlock "Mechanics"
SrcPort 1
Points [55, 0; 0, 15]
Branch {
Points [0, 85]
Branch {
DstBlock "Demux"
DstPort 1
}
Branch {
Labels [0, 0]
Points [0, 60; -570, 0; 0, -150]
DstBlock "Zero-Order\nHold"
DstPort 1
}
}
Branch {
DstBlock "Scope2"
DstPort 1
}
}
Line {
SrcBlock "Demux"
SrcPort 1
DstBlock "Scope8"
DstPort 1
}
Line {
SrcBlock "Mechanics"
SrcPort 2
Points [35, 0; 0, 120; -535, 0; 0, -105]
DstBlock "Zero-Order\nHold1"
DstPort 1
}
Line {
SrcBlock "Zero-Order\nHold"
SrcPort 1
DstBlock "Controller"
DstPort 2
}
Line {
SrcBlock "Zero-Order\nHold1"
SrcPort 1
DstBlock "Controller"
DstPort 3
}
Line {
SrcBlock "Step"
SrcPort 1
Points [40, 0; 0, 35]
DstBlock "Controller"
DstPort 1
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?