📄 c_pid_cont.mdl
字号:
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
}
Block {
BlockType Outport
Name "tacho"
Position [550, 48, 580, 62]
Port "2"
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 {
Points [85, 0]
Branch {
Labels [2, 0]
Points [0, 230]
DstBlock "Mux"
DstPort 1
}
Branch {
DstBlock "DC-Tacho"
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]
Branch {
Points [0, 240]
DstBlock "Mux"
DstPort 2
}
Branch {
DstBlock "DC-Tacho"
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
}
Line {
SrcBlock "DC-Tacho"
SrcPort 1
DstBlock "tacho"
DstPort 1
}
}
}
Block {
BlockType Reference
Name "PID\napproximate \noutput\nderivative"
Ports [2, 1]
Position [320, 79, 360, 126]
SourceBlock "dc_motor_lib/Controllers/PID\napproximate \nout"
"put\nderivative"
SourceType "PID Controller with approximate output derivati"
"ve"
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.3"
Ti_inv "1/0.03"
Td "0.000005"
N "3"
}
Block {
BlockType DiscretePulseGenerator
Name "Pulse\nGenerator1"
Ports [0, 1]
Position [15, 73, 60, 107]
PulseType "Time based"
Amplitude "96"
Period "10"
PulseWidth "50"
}
Block {
BlockType Sum
Name "Sum1"
Ports [2, 1]
Position [90, 80, 110, 100]
ShowName off
IconShape "round"
Inputs "|+-"
InputSameDT off
OutDataTypeMode "Inherit via internal rule"
SaturateOnIntegerOverflow off
}
Block {
BlockType Sum
Name "Sum2"
Ports [2, 1]
Position [235, 80, 255, 100]
ShowName off
IconShape "round"
Inputs "|+-"
InputSameDT off
OutDataTypeMode "Inherit via internal rule"
SaturateOnIntegerOverflow off
}
Block {
BlockType Gain
Name "Tacho_voltage_to_speed"
Position [365, 195, 420, 225]
Orientation "left"
Gain "200"
ParameterDataTypeMode "Inherit via internal rule"
OutDataTypeMode "Inherit via internal rule"
SaturateOnIntegerOverflow off
}
Block {
BlockType TransferFcn
Name "Transfer Fcn"
Position [125, 72, 205, 108]
Numerator "[2000*2*pi]"
Denominator "[1 2000*2*pi]"
}
Block {
BlockType Scope
Name "error"
Ports [1]
Position [285, 19, 315, 51]
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 [780, 59, 810, 91]
Floating off
Location [699, 524, 1023, 763]
Open off
NumInputPorts "1"
List {
ListType AxesTitles
axes1 "%<SignalLabel>"
}
YMin "0"
YMax "100"
SaveName "ScopeData2"
DataFormat "StructureWithTime"
LimitDataPoints off
SampleTime "0"
}
Block {
BlockType Scope
Name "states_X1"
Ports [1]
Position [785, 119, 815, 151]
Floating off
Location [699, 524, 1023, 763]
Open off
NumInputPorts "1"
List {
ListType AxesTitles
axes1 "%<SignalLabel>"
}
YMin "0"
YMax "100"
DataFormat "StructureWithTime"
LimitDataPoints off
SampleTime "0"
}
Line {
SrcBlock "Pulse\nGenerator1"
SrcPort 1
Points [10, 0]
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; 5, 0]
Branch {
Points [0, -55]
DstBlock "error"
DstPort 1
}
Branch {
DstBlock "PID\napproximate \noutput\nderivative"
DstPort 1
}
}
Line {
SrcBlock "PID\napproximate \noutput\nderivative"
SrcPort 1
Points [0, 0; 10, 0]
Branch {
Points [0, -70]
DstBlock "Control_signal"
DstPort 1
}
Branch {
Labels [0, 0]
DstBlock "Amplifier"
DstPort 1
}
}
Line {
SrcBlock "Mechanics"
SrcPort 1
DstBlock "states_X"
DstPort 1
}
Line {
SrcBlock "Amplifier"
SrcPort 1
DstBlock "Mechanics"
DstPort 1
}
Line {
SrcBlock "Sum1"
SrcPort 1
Points [0, 0]
DstBlock "Transfer Fcn"
DstPort 1
}
Line {
SrcBlock "Transfer Fcn"
SrcPort 1
DstBlock "Sum2"
DstPort 1
}
Line {
Name "dth_m_tacho"
Labels [0, 0]
SrcBlock "Mechanics"
SrcPort 2
Points [50, 0]
Branch {
DstBlock "states_X1"
DstPort 1
}
Branch {
Labels [2, 0]
Points [0, 75]
DstBlock "Tacho_voltage_to_speed"
DstPort 1
}
}
Line {
SrcBlock "Tacho_voltage_to_speed"
SrcPort 1
Points [-115, 0; 0, -95]
Branch {
DstBlock "Sum2"
DstPort 2
}
Branch {
DstBlock "PID\napproximate \noutput\nderivative"
DstPort 2
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -