📄 d_pid_disc.mdl
字号:
SaturateOnIntegerOverflow off
Port {
PortNumber 1
Name "torque_k"
RTWStorageClass "Auto"
DataLoggingNameMode "SignalName"
}
}
Block {
BlockType Gain
Name "Spring \ndamping"
Position [305, 70, 335, 100]
Gain "0.0001"
ParameterDataTypeMode "Inherit via internal rule"
OutDataTypeMode "Inherit via internal rule"
SaturateOnIntegerOverflow off
Port {
PortNumber 1
Name "torque_b"
RTWStorageClass "Auto"
DataLoggingNameMode "SignalName"
}
}
Block {
BlockType Gain
Name "Spring \ndamping3"
Position [175, 233, 255, 267]
Orientation "left"
Gain "12e-6"
ParameterDataTypeMode "Inherit via internal rule"
OutDataTypeMode "Inherit via internal rule"
SaturateOnIntegerOverflow off
}
Block {
BlockType Sum
Name "Sum2"
Ports [2, 1]
Position [265, 75, 285, 95]
ShowName off
IconShape "round"
Inputs "+-"
InputSameDT off
OutDataTypeMode "Inherit via internal rule"
SaturateOnIntegerOverflow off
}
Block {
BlockType Sum
Name "Sum4"
Ports [2, 1]
Position [355, 140, 375, 160]
ShowName off
IconShape "round"
Inputs "+-"
InputSameDT off
OutDataTypeMode "Inherit via internal rule"
SaturateOnIntegerOverflow off
}
Block {
BlockType Sum
Name "Sum5"
Ports [2, 1]
Position [490, 105, 510, 125]
ShowName off
IconShape "round"
InputSameDT off
OutDataTypeMode "Inherit via internal rule"
SaturateOnIntegerOverflow off
}
Block {
BlockType Sum
Name "Sum6"
Ports [2, 1]
Position [70, 170, 90, 190]
ShowName off
IconShape "round"
Inputs "|+-"
InputSameDT off
OutDataTypeMode "Inherit via internal rule"
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
}
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 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 TransferFcn
Name "Transfer Fcn"
Position [125, 72, 205, 108]
Numerator "[1000*2*pi]"
Denominator "[1 1000*2*pi]"
}
Block {
BlockType ZeroOrderHold
Name "Zero-Order\nHold"
Position [240, 75, 275, 105]
SampleTime "Ts"
}
Block {
BlockType Scope
Name "states_X"
Ports [1]
Position [780, 59, 810, 91]
Floating off
Location [910, 77, 1234, 316]
Open off
NumInputPorts "1"
List {
ListType AxesTitles
axes1 "%<SignalLabel>"
}
YMin "-75"
YMax "250"
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
DstBlock "Sum1"
DstPort 1
}
Line {
Name "Vin"
Labels [0, 0]
SrcBlock "Constant1"
SrcPort 1
Points [35, 0]
DstBlock "Sum1"
DstPort 2
}
Line {
SrcBlock "Mechanics"
SrcPort 1
DstBlock "states_X"
DstPort 1
}
Line {
SrcBlock "Amplifier"
SrcPort 1
DstBlock "Mechanics"
DstPort 1
}
Line {
SrcBlock "Sum1"
SrcPort 1
DstBlock "Transfer Fcn"
DstPort 1
}
Line {
SrcBlock "Transfer Fcn"
SrcPort 1
DstBlock "Zero-Order\nHold"
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, 65]
DstBlock "10bit"
DstPort 1
}
}
Line {
SrcBlock "10bit"
SrcPort 1
Points [-65, 0; 0, -80]
DstBlock "Discrete PID1"
DstPort 2
}
Line {
SrcBlock "Discrete PID1"
SrcPort 1
Points [35, 0]
Branch {
DstBlock "Amplifier"
DstPort 1
}
Branch {
Points [0, -70]
DstBlock "Control_signal"
DstPort 1
}
}
Line {
SrcBlock "Zero-Order\nHold"
SrcPort 1
DstBlock "Discrete PID1"
DstPort 1
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -