📄 a_pid_cont.mdl
字号:
SaturateOnIntegerOverflow off
}
Block {
BlockType Outport
Name "c_torque"
Position [45, 118, 75, 132]
IconDisplay "Port number"
BusOutputAsStruct off
}
Block {
BlockType Outport
Name "dth_l"
Position [295, 243, 325, 257]
Port "2"
IconDisplay "Port number"
BusOutputAsStruct off
}
Block {
BlockType Outport
Name "th_l"
Position [480, 173, 510, 187]
Port "3"
IconDisplay "Port number"
BusOutputAsStruct off
}
Line {
Name "dth_l"
Labels [0, 0]
SrcBlock "Integrator3"
SrcPort 1
Points [0, 0; 30, 0]
Branch {
DstBlock "Integrator4"
DstPort 1
}
Branch {
Points [0, -70]
DstBlock "Sum2"
DstPort 2
}
Branch {
Points [0, 70]
Branch {
DstBlock "Spring \ndamping3"
DstPort 1
}
Branch {
DstBlock "dth_l"
DstPort 1
}
}
}
Line {
Name "th_l"
Labels [0, 0]
SrcBlock "Integrator4"
SrcPort 1
Points [0, 0; 30, 0]
Branch {
Points [0, -5]
DstBlock "Sum4"
DstPort 2
}
Branch {
DstBlock "th_l"
DstPort 1
}
}
Line {
Name "ddth_l"
Labels [0, 0]
SrcBlock "Rotor inertia1"
SrcPort 1
DstBlock "Integrator3"
DstPort 1
}
Line {
SrcBlock "Sum2"
SrcPort 1
DstBlock "Spring \ndamping"
DstPort 1
}
Line {
SrcBlock "Sum4"
SrcPort 1
DstBlock "Spring \nconstant"
DstPort 1
}
Line {
Name "torque_b"
Labels [0, 0]
SrcBlock "Spring \ndamping"
SrcPort 1
Points [160, 0]
DstBlock "Sum5"
DstPort 1
}
Line {
Name "torque_k"
Labels [0, 0]
SrcBlock "Spring \nconstant"
SrcPort 1
Points [50, 0]
DstBlock "Sum5"
DstPort 2
}
Line {
SrcBlock "Sum5"
SrcPort 1
Points [10, 0; 0, 195; -495, 0; 0, -130]
Branch {
DstBlock "Sum6"
DstPort 1
}
Branch {
DstBlock "c_torque"
DstPort 1
}
}
Line {
SrcBlock "Sum6"
SrcPort 1
DstBlock "Rotor inertia1"
DstPort 1
}
Line {
SrcBlock "Spring \ndamping3"
SrcPort 1
Points [-90, 0]
DstBlock "Sum6"
DstPort 2
}
Line {
SrcBlock "dth_m"
SrcPort 1
Points [0, 15]
DstBlock "Sum2"
DstPort 1
}
Line {
SrcBlock "th_m"
SrcPort 1
DstBlock "Sum4"
DstPort 1
}
}
}
Block {
BlockType Mux
Name "Mux"
Ports [4, 1]
Position [405, 252, 410, 408]
ShowName off
DisplayOption "bar"
Port {
PortNumber 1
PropagatedSignals "dth_m, th_m, dth_l, th_l"
ShowPropagatedSignals "on"
RTWStorageClass "Auto"
DataLoggingNameMode "SignalName"
}
}
Block {
BlockType Reference
Name "dc_motor1"
Ports [2, 2]
Position [80, 27, 205, 83]
BackgroundColor "lightBlue"
DropShadow on
SourceBlock "dc_motor_lib/dc_motor"
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 "2.06"
Lm "0.000238"
Kb "1/((406*2*pi)/60)"
Kt "0.0235"
Jm "1.07e-6"
bm "12e-7"
Port {
PortNumber 1
Name "dth_m"
PropagatedSignals "dth_m"
RTWStorageClass "Auto"
DataLoggingNameMode "SignalName"
}
Port {
PortNumber 2
Name "th_m"
PropagatedSignals "th_m"
RTWStorageClass "Auto"
DataLoggingNameMode "SignalName"
}
}
Block {
BlockType Outport
Name "states_X"
Position [555, 323, 585, 337]
IconDisplay "Port number"
BusOutputAsStruct off
}
Line {
Name "dth_m"
Labels [0, 0]
SrcBlock "dc_motor1"
SrcPort 1
Points [60, 0]
Branch {
Labels [2, 1]
Points [0, 0; 0, 205]
DstBlock "Load"
DstPort 1
}
Branch {
Labels [3, 0]
Points [85, 0; 0, 230]
DstBlock "Mux"
DstPort 1
}
}
Line {
Name "th_m"
Labels [0, 0]
SrcBlock "dc_motor1"
SrcPort 2
Points [90, 0]
Branch {
Labels [1, 1]
Points [0, 210]
DstBlock "Load"
DstPort 2
}
Branch {
Labels [1, 1]
Points [30, 0; 0, 240]
DstBlock "Mux"
DstPort 2
}
}
Line {
SrcBlock "In1"
SrcPort 1
Points [0, 0]
DstBlock "dc_motor1"
DstPort 1
}
Line {
Labels [0, 0]
SrcBlock "Mux"
SrcPort 1
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 {
Name "th_l"
Labels [-1, 1]
SrcBlock "Load"
SrcPort 3
Points [-50, 0; 0, 105]
DstBlock "Mux"
DstPort 4
}
Line {
SrcBlock "Load"
SrcPort 1
Points [-100, 0; 0, -165]
DstBlock "dc_motor1"
DstPort 2
}
}
}
Block {
BlockType Reference
Name "PID\napproximate\nderivative1"
Ports [1, 1]
Position [220, 92, 260, 128]
SourceBlock "dc_motor_lib/Controllers/PID\napproximate\nderi"
"vative1"
SourceType "PID Controller with approximate derivative"
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"
K "0.1"
Ti_inv "1/0.03"
Td "0.0001"
N "3"
}
Block {
BlockType DiscretePulseGenerator
Name "Pulse\nGenerator1"
Ports [0, 1]
Position [15, 93, 60, 127]
PulseType "Time based"
Amplitude "96"
Period "10"
PulseWidth "50"
}
Block {
BlockType Sum
Name "Sum1"
Ports [2, 1]
Position [90, 100, 110, 120]
ShowName off
IconShape "round"
Inputs "|+-"
InputSameDT off
OutDataTypeMode "Inherit via internal rule"
SaturateOnIntegerOverflow off
}
Block {
BlockType Sum
Name "Sum2"
Ports [2, 1]
Position [130, 100, 150, 120]
ShowName off
IconShape "round"
Inputs "|+-"
InputSameDT off
OutDataTypeMode "Inherit via internal rule"
SaturateOnIntegerOverflow off
}
Block {
BlockType Scope
Name "error"
Ports [1]
Position [190, 29, 220, 61]
Floating off
Location [604, 84, 928, 323]
Open off
NumInputPorts "1"
List {
ListType AxesTitles
axes1 "%<SignalLabel>"
}
YMin "-100"
YMax "500"
SaveName "ScopeData5"
DataFormat "StructureWithTime"
LimitDataPoints off
SampleTime "0"
}
Block {
BlockType Scope
Name "states_X"
Ports [1]
Position [535, 79, 565, 111]
Floating off
Location [851, 70, 1175, 309]
Open off
NumInputPorts "1"
List {
ListType AxesTitles
axes1 "%<SignalLabel>"
}
YMin "0"
YMax "100"
SaveName "ScopeData2"
DataFormat "StructureWithTime"
LimitDataPoints off
SampleTime "0"
}
Line {
SrcBlock "Pulse\nGenerator1"
SrcPort 1
DstBlock "Sum1"
DstPort 1
}
Line {
Name "Vin"
Labels [0, 0]
SrcBlock "Constant1"
SrcPort 1
Points [35, 0]
DstBlock "Sum1"
DstPort 2
}
Line {
SrcBlock "Sum2"
SrcPort 1
Points [0, 0; 15, 0]
Branch {
Points [0, -65]
DstBlock "error"
DstPort 1
}
Branch {
DstBlock "PID\napproximate\nderivative1"
DstPort 1
}
}
Line {
SrcBlock "Sum1"
SrcPort 1
DstBlock "Sum2"
DstPort 1
}
Line {
SrcBlock "PID\napproximate\nderivative1"
SrcPort 1
Points [15, 0]
Branch {
DstBlock "Mechanics"
DstPort 1
}
Branch {
Points [0, -70]
DstBlock "Control_signal"
DstPort 1
}
}
Line {
SrcBlock "Mechanics"
SrcPort 1
DstBlock "Demux"
DstPort 1
}
Line {
Name "dth_m"
Labels [0, 0]
SrcBlock "Demux"
SrcPort 1
Points [0, 0; 45, 0]
Branch {
DstBlock "states_X"
DstPort 1
}
Branch {
Labels [2, 0]
Points [0, 115; -355, 0]
DstBlock "Sum2"
DstPort 2
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -