motorola.mdl
来自「书籍代码:遗传演算法原理与应用_活用MATLAB(Source Code)」· MDL 代码 · 共 1,568 行 · 第 1/3 页
MDL
1,568 行
Block {
BlockType Abs
Name "Abs"
Position [300, 180, 330, 210]
SaturateOnIntegerOverflow on
}
Block {
BlockType Constant
Name "Constant"
Position [170, 205, 200, 235]
Value "L1"
VectorParams1D on
}
Block {
BlockType DiscreteIntegrator
Name "Discrete-Time\nIntegrator"
Ports [1, 1]
Position [205, 77, 245, 113]
BackgroundColor "yellow"
IntegratorMethod "BackwardEuler"
ExternalReset "none"
InitialConditionSource "internal"
InitialCondition "0"
LimitOutput off
UpperSaturationLimit "inf"
LowerSaturationLimit "-inf"
ShowSaturationPort off
ShowStatePort off
SampleTime "Ts"
RTWStateStorageClass "Auto"
}
Block {
BlockType Gain
Name "Gain1"
Position [225, 203, 275, 237]
BackgroundColor "yellow"
Gain "1000"
Multiplication "Element-wise(K.*u)"
SaturateOnIntegerOverflow on
}
Block {
BlockType Gain
Name "Gain4"
Position [135, 78, 185, 112]
BackgroundColor "yellow"
Gain "1"
Multiplication "Element-wise(K.*u)"
SaturateOnIntegerOverflow on
}
Block {
BlockType Gain
Name "Gain7"
Position [75, 133, 125, 167]
BackgroundColor "yellow"
Gain "1"
Multiplication "Element-wise(K.*u)"
SaturateOnIntegerOverflow on
}
Block {
BlockType Gain
Name "Kd4"
Position [315, 129, 365, 171]
Gain "Kd"
Multiplication "Element-wise(K.*u)"
SaturateOnIntegerOverflow on
}
Block {
BlockType Gain
Name "Ki"
Position [265, 78, 310, 112]
Gain "Ki"
Multiplication "Element-wise(K.*u)"
SaturateOnIntegerOverflow on
}
Block {
BlockType Gain
Name "Kp"
Position [230, 16, 275, 54]
Gain "Kp"
Multiplication "Element-wise(K.*u)"
SaturateOnIntegerOverflow on
}
Block {
BlockType Gain
Name "Kp1"
Position [420, 56, 460, 94]
Gain "1"
Multiplication "Element-wise(K.*u)"
SaturateOnIntegerOverflow on
}
Block {
BlockType Product
Name "Product"
Ports [2, 1]
Position [425, 183, 450, 227]
Inputs "2"
Multiplication "Element-wise(.*)"
SaturateOnIntegerOverflow on
}
Block {
BlockType RelationalOperator
Name "Relational\nOperator"
Position [360, 197, 390, 228]
Operator "<="
}
Block {
BlockType Saturate
Name "Saturation"
Position [475, 59, 505, 91]
UpperLimit "10"
LowerLimit "-10"
LinearizeAsGain on
}
Block {
BlockType Saturate
Name "Saturation1, L2"
Position [475, 190, 505, 220]
UpperLimit "L2"
LowerLimit "-L2"
LinearizeAsGain on
}
Block {
BlockType Sum
Name "Sum1"
Ports [3, 1]
Position [360, 55, 400, 95]
IconShape "round"
Inputs "++-"
SaturateOnIntegerOverflow on
}
Block {
BlockType ZeroOrderHold
Name "Zero-Order\nHold"
Position [520, 59, 550, 91]
SampleTime "Ts"
}
Block {
BlockType SubSystem
Name "difference2"
Ports [1, 1]
Position [140, 131, 190, 169]
ShowPortLabels on
TreatAsAtomicUnit off
RTWSystemCode "Auto"
RTWFcnNameOpts "Auto"
RTWFileNameOpts "Auto"
System {
Name "difference2"
Location [216, 152, 472, 256]
Open off
ModelBrowserVisibility off
ModelBrowserWidth 200
ScreenColor "white"
PaperOrientation "landscape"
PaperPositionMode "auto"
PaperType "usletter"
PaperUnits "inches"
ZoomFactor "100"
Block {
BlockType Inport
Name "In1"
Position [20, 33, 50, 47]
Port "1"
LatchInput off
Interpolate on
}
Block {
BlockType DiscreteTransferFcn
Name "Discrete\nTransfer Fcn"
Position [85, 22, 145, 58]
Numerator "[1 -1]"
Denominator "[Ts Ts]"
SampleTime "Ts"
Realization "auto"
RTWStateStorageClass "Auto"
}
Block {
BlockType Outport
Name "Out1"
Position [195, 33, 225, 47]
Port "1"
OutputWhenDisabled "held"
InitialOutput "[]"
}
Line {
SrcBlock "In1"
SrcPort 1
DstBlock "Discrete\nTransfer Fcn"
DstPort 1
}
Line {
SrcBlock "Discrete\nTransfer Fcn"
SrcPort 1
DstBlock "Out1"
DstPort 1
}
}
}
Block {
BlockType Outport
Name "control"
Position [565, 68, 595, 82]
Port "1"
OutputWhenDisabled "held"
InitialOutput "[]"
}
Line {
SrcBlock "Gain4"
SrcPort 1
DstBlock "Discrete-Time\nIntegrator"
DstPort 1
}
Line {
SrcBlock "difference2"
SrcPort 1
DstBlock "2-point ave."
DstPort 1
}
Line {
SrcBlock "2-point ave."
SrcPort 1
Points [15, 0]
Branch {
DstBlock "Kd4"
DstPort 1
}
Branch {
DstBlock "Abs"
DstPort 1
}
}
Line {
SrcBlock "Gain7"
SrcPort 1
DstBlock "difference2"
DstPort 1
}
Line {
SrcBlock "In1"
SrcPort 1
Points [55, 0]
Branch {
Points [0, 10]
DstBlock "Gain4"
DstPort 1
}
Branch {
Points [0, -50]
DstBlock "Kp"
DstPort 1
}
}
Line {
SrcBlock "Saturation"
SrcPort 1
DstBlock "Zero-Order\nHold"
DstPort 1
}
Line {
SrcBlock "Sum1"
SrcPort 1
DstBlock "Kp1"
DstPort 1
}
Line {
SrcBlock "Kp1"
SrcPort 1
DstBlock "Saturation"
DstPort 1
}
Line {
SrcBlock "Zero-Order\nHold"
SrcPort 1
DstBlock "control"
DstPort 1
}
Line {
Labels [0, 0]
SrcBlock "Kd4"
SrcPort 1
Points [10, 0]
DstBlock "Sum1"
DstPort 3
}
Line {
SrcBlock "Kp"
SrcPort 1
Points [100, 0]
DstBlock "Sum1"
DstPort 1
}
Line {
SrcBlock "Discrete-Time\nIntegrator"
SrcPort 1
DstBlock "Ki"
DstPort 1
}
Line {
SrcBlock "p_fbk"
SrcPort 1
DstBlock "Gain7"
DstPort 1
}
Line {
SrcBlock "Abs"
SrcPort 1
Points [10, 0]
DstBlock "Relational\nOperator"
DstPort 1
}
Line {
SrcBlock "Constant"
SrcPort 1
DstBlock "Gain1"
DstPort 1
}
Line {
SrcBlock "Relational\nOperator"
SrcPort 1
DstBlock "Product"
DstPort 2
}
Line {
SrcBlock "Ki"
SrcPort 1
Points [50, 0; 0, 35; 45, 0]
DstBlock "Product"
DstPort 1
}
Line {
SrcBlock "Saturation1, L2"
SrcPort 1
Points [5, 0; 0, -90; -170, 0]
DstBlock "Sum1"
DstPort 2
}
Line {
SrcBlock "Product"
SrcPort 1
DstBlock "Saturation1, L2"
DstPort 1
}
Line {
SrcBlock "Gain1"
SrcPort 1
Points [20, 0; 0, 10; 45, 0]
DstBlock "Relational\nOperator"
DstPort 2
}
}
}
Block {
BlockType SubSystem
Name "Double click\non this for demo.5"
Ports []
Position [145, 339, 316, 370]
BackgroundColor "green"
ShowName off
OpenFcn "moto_data1"
ShowPortLabels on
TreatAsAtomicUnit off
RTWSystemCode "Auto"
RTWFcnNameOpts "Auto"
RTWFileNameOpts "Auto"
MaskDisplay "disp('Load initial data before simulation\\nDou"
"ble clicks on this ICON')"
MaskIconFrame on
MaskIconOpaque on
MaskIconRotate "none"
MaskIconUnits "autoscale"
System {
Name "Double click\non this for demo.5"
Location [44, 351, 171, 504]
Open off
ModelBrowserVisibility off
ModelBrowserWidth 200
ScreenColor "white"
PaperOrientation "landscape"
PaperPositionMode "auto"
PaperType "A4"
PaperUnits "centimeters"
ZoomFactor "100"
}
}
Block {
BlockType Gain
Name "Kd1"
Position [175, 212, 205, 238]
Gain "1"
Multiplication "Element-wise(K.*u)"
SaturateOnIntegerOverflow on
}
Block {
BlockType Gain
Name "Kd2"
Position [155, 237, 210, 263]
Gain "1"
Multiplication "Element-wise(K.*u)"
SaturateOnIntegerOverflow on
}
Block {
BlockType Gain
Name "Kd3"
Position [275, 22, 315, 48]
Gain "1"
Multiplication "Element-wise(K.*u)"
SaturateOnIntegerOverflow on
}
Block {
BlockType Gain
Name "Kd4"
Position [155, 297, 210, 323]
Gain "2"
Multiplication "Element-wise(K.*u)"
SaturateOnIntegerOverflow on
}
Block {
BlockType Gain
Name "Kd5"
Position [300, 212, 330, 238]
Gain "1"
Multiplication "Element-wise(K.*u)"
SaturateOnIntegerOverflow on
}
Block {
BlockType Gain
Name "Kd6"
Position [255, 242, 325, 278]
Gain "1"
Multiplication "Element-wise(K.*u)"
SaturateOnIntegerOverflow on
}
Block {
BlockType MATLABFcn
Name "MATLAB Fcn"
Position [425, 120, 485, 150]
MATLABFcn "round"
OutputDimensions "-1"
OutputSignalType "auto"
Output1D on
}
Block {
BlockType SubSystem
Name "Motor Subsystem"
Ports [1, 2]
Position [290, 125, 350, 165]
ShowPortLabels on
TreatAsAtomicUnit off
RTWSystemCode "Auto"
RTWFcnNameOpts "Auto"
RTWFileNameOpts "Auto"
System {
Name "Motor Subsystem"
Location [93, 171, 609, 309]
Open off
ModelBrowserVisibility off
ModelBrowserWidth 200
ScreenColor "automatic"
PaperOrientation "landscape"
PaperPositionMode "auto"
PaperType "A4"
PaperUnits "centimeters"
ZoomFactor "100"
Block {
BlockType Inport
Name "In1"
Position [25, 38, 55, 52]
Port "1"
LatchInput off
Interpolate on
}
Block {
BlockType Integrator
Name "Integrator"
Ports [1, 1]
Position [305, 31, 330, 59]
ExternalReset "none"
InitialConditionSource "internal"
InitialCondition "0"
LimitOutput off
UpperSaturationLimit "inf"
LowerSaturationLimit "-inf"
ShowSaturationPort off
ShowStatePort off
AbsoluteTolerance "auto"
}
Block {
BlockType Gain
Name "Kd1"
Position [155, 32, 210, 58]
Gain "K1"
Multiplication "Element-wise(K.*u)"
SaturateOnIntegerOverflow on
}
Block {
BlockType Gain
Name "Kd4"
Position [350, 32, 405, 58]
Gain "K2"
Multiplication "Element-wise(K.*u)"
SaturateOnIntegerOverflow on
}
Block {
BlockType TransferFcn
Name "Transfer Fcn\nof Motor plant"
Position [230, 28, 290, 62]
Numerator "[K]"
Denominator "[1 a1 a2]"
AbsoluteTolerance "auto"
Realization "auto"
}
Block {
BlockType TransportDelay
Name "Transport\nDelay"
Position [85, 30, 115, 60]
DelayTime "Tc"
InitialInput "0"
BufferSize "1024"
PadeOrder "0"
}
Block {
BlockType Outport
Name "Out1"
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?