📄 motor_lc.mdl
字号:
Interpolate on
}
Block {
BlockType DiscreteIntegrator
Name "Discrete-Time\nIntegrator"
Ports [1, 1]
Position [195, 70, 230, 110]
IntegratorMethod "ForwardEuler"
ExternalReset "none"
InitialConditionSource "internal"
InitialCondition "0"
LimitOutput off
UpperSaturationLimit "inf"
LowerSaturationLimit "-inf"
ShowSaturationPort off
ShowStatePort off
SampleTime "Ts"
}
Block {
BlockType Gain
Name "Kd"
Position [95, 124, 160, 156]
Gain "3.2110"
Multiplication "Element-wise(K.*u)"
SaturateOnIntegerOverflow on
}
Block {
BlockType Gain
Name "Ki"
Position [95, 73, 175, 107]
Gain "745.7705"
Multiplication "Element-wise(K.*u)"
SaturateOnIntegerOverflow on
}
Block {
BlockType Gain
Name "Kp"
Position [95, 23, 190, 57]
Gain "16.9382"
Multiplication "Element-wise(K.*u)"
SaturateOnIntegerOverflow on
}
Block {
BlockType Sum
Name "Sum"
Ports [3, 1]
Position [295, 50, 315, 70]
ShowName off
IconShape "round"
Inputs "|+++"
SaturateOnIntegerOverflow on
}
Block {
BlockType Sum
Name "Sum1"
Ports [2, 1]
Position [235, 145, 255, 165]
ShowName off
IconShape "round"
Inputs "|+-"
SaturateOnIntegerOverflow on
}
Block {
BlockType UnitDelay
Name "Unit Delay"
Position [185, 160, 220, 200]
X0 "0"
SampleTime "Ts"
}
Block {
BlockType Outport
Name "Out1"
Position [355, 53, 385, 67]
Port "1"
OutputWhenDisabled "held"
InitialOutput "[]"
}
Line {
SrcBlock "e"
SrcPort 1
Points [10, 0]
Branch {
DstBlock "Kp"
DstPort 1
}
Branch {
Points [0, 50]
Branch {
Points [0, 50]
DstBlock "Kd"
DstPort 1
}
Branch {
DstBlock "Ki"
DstPort 1
}
}
}
Line {
SrcBlock "Sum"
SrcPort 1
DstBlock "Out1"
DstPort 1
}
Line {
SrcBlock "Kd"
SrcPort 1
Points [0, 15]
Branch {
DstBlock "Sum1"
DstPort 1
}
Branch {
Points [0, 25]
DstBlock "Unit Delay"
DstPort 1
}
}
Line {
SrcBlock "Sum1"
SrcPort 1
Points [45, 0]
DstBlock "Sum"
DstPort 3
}
Line {
SrcBlock "Ki"
SrcPort 1
DstBlock "Discrete-Time\nIntegrator"
DstPort 1
}
Line {
SrcBlock "Discrete-Time\nIntegrator"
SrcPort 1
Points [49, 0]
DstBlock "Sum"
DstPort 2
}
Line {
SrcBlock "Kp"
SrcPort 1
Points [89, 0]
DstBlock "Sum"
DstPort 1
}
Line {
SrcBlock "Unit Delay"
SrcPort 1
DstBlock "Sum1"
DstPort 2
}
}
}
Block {
BlockType RandomNumber
Name "Random\nNumber"
Position [20, 110, 50, 140]
Mean "0"
Variance "1"
Seed "0"
SampleTime "0"
VectorParams1D on
}
Block {
BlockType Scope
Name "Scope"
Ports [1]
Position [500, 35, 530, 65]
Floating off
Location [8, 65, 237, 237]
Open on
NumInputPorts "1"
TickLabels "OneTimeTick"
ZoomMode "on"
List {
ListType AxesTitles
axes1 "%<SignalLabel>"
}
Grid "on"
TimeRange "0.8"
YMin "0"
YMax "8"
SaveToWorkspace off
SaveName "ScopeData"
DataFormat "StructureWithTime"
LimitDataPoints on
MaxDataPoints "50000"
Decimation "1"
SampleInput off
SampleTime "0"
}
Block {
BlockType Step
Name "Step"
Position [15, 25, 40, 55]
Time "0"
Before "0"
After "4"
SampleTime "0"
VectorParams1D on
}
Block {
BlockType Sum
Name "Sum"
Ports [2, 1]
Position [150, 30, 170, 50]
ShowName off
IconShape "round"
Inputs "|+-"
SaturateOnIntegerOverflow on
}
Block {
BlockType ToWorkspace
Name "To Workspace\nRPM"
Position [470, 85, 490, 105]
VariableName "y"
MaxDataPoints "inf"
Decimation "1"
SampleTime "-1"
SaveFormat "Array"
}
Block {
BlockType ToWorkspace
Name "To Workspace2"
Position [255, 140, 280, 170]
VariableName "t"
MaxDataPoints "inf"
Decimation "1"
SampleTime "-1"
SaveFormat "Array"
}
Block {
BlockType ZeroOrderHold
Name "Zero-Order\nHold"
Position [190, 136, 225, 174]
SampleTime "Ts"
}
Block {
BlockType Outport
Name "NCD Outport"
Position [415, 150, 470, 210]
DropShadow on
OpenFcn "optblock"
Port "1"
OutputWhenDisabled "held"
InitialOutput "0"
MaskType "NCD Outport"
MaskDisplay "plot([0:10],[-.5 1.5 .6 1.3 .8 1.1 .95 1.02 .99"
" 1 1]);\ndisp('\\n\\n NCD\\n OutPort 1'); "
MaskIconFrame on
MaskIconOpaque on
MaskIconRotate "none"
MaskIconUnits "autoscale"
}
Line {
SrcBlock "Clock"
SrcPort 1
DstBlock "Zero-Order\nHold"
DstPort 1
}
Line {
SrcBlock "Step"
SrcPort 1
DstBlock "Gain1"
DstPort 1
}
Line {
SrcBlock "Sum"
SrcPort 1
DstBlock "PID Subsystem"
DstPort 1
}
Line {
SrcBlock "Gain2"
SrcPort 1
Points [145, 0; 0, -65]
DstBlock "Motor speed\nSubsystem"
DstPort 2
}
Line {
SrcBlock "Motor speed\nSubsystem"
SrcPort 1
Points [5, 0; 0, 10]
Branch {
DstBlock "Mux"
DstPort 2
}
Branch {
Points [0, 45; -75, 0]
Branch {
Points [-145, 0]
DstBlock "Sum"
DstPort 2
}
Branch {
DstBlock "Gain5"
DstPort 1
}
}
}
Line {
SrcBlock "PID Subsystem"
SrcPort 1
Points [15, 0]
DstBlock "Motor speed\nSubsystem"
DstPort 1
}
Line {
SrcBlock "Random\nNumber"
SrcPort 1
DstBlock "Gain2"
DstPort 1
}
Line {
SrcBlock "Zero-Order\nHold"
SrcPort 1
DstBlock "To Workspace2"
DstPort 1
}
Line {
SrcBlock "Gain1"
SrcPort 1
Points [5, 0]
Branch {
DstBlock "Sum"
DstPort 1
}
Branch {
Points [0, -25; 250, 0]
DstBlock "Mux"
DstPort 1
}
}
Line {
SrcBlock "Mux"
SrcPort 1
DstBlock "Gain3"
DstPort 1
}
Line {
SrcBlock "Gain3"
SrcPort 1
Points [0, 0]
Branch {
DstBlock "Scope"
DstPort 1
}
Branch {
Points [0, 20; -30, 0]
DstBlock "To Workspace\nRPM"
DstPort 1
}
}
Line {
SrcBlock "Gain4"
SrcPort 1
DstBlock "NCD Outport"
DstPort 1
}
Line {
SrcBlock "Gain5"
SrcPort 1
Points [0, 30; -75, 0; 0, 25]
DstBlock "Gain4"
DstPort 1
}
Annotation {
Position [123, 224]
Text "Motor_LC.mdl\nPenChen Chou, Aug. 4, 2001\nUse o"
"f NCD blockset to find \n[Kp Ki Kd] values for the Linear Controller"
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -