📄 lqr.mdl
字号:
Orientation "left"
ShowName off
}
Block {
BlockType Abs
Name " 2"
Position [235, 285, 265, 315]
ShowName off
}
Block {
BlockType Constant
Name "Constant"
Position [235, 125, 265, 155]
Value "0"
}
Block {
BlockType Constant
Name "Constant1"
Position [235, 235, 265, 265]
Value "10"
}
Block {
BlockType Constant
Name "Constant2"
Position [530, 180, 560, 210]
Value "pi"
}
Block {
BlockType Gain
Name "Gain"
Position [240, 175, 270, 205]
Gain "1.5"
}
Block {
BlockType SubSystem
Name "Pendulum"
Ports [2, 2]
Position [425, 165, 475, 245]
DropShadow on
TreatAsAtomicUnit off
System {
Name "Pendulum"
Location [218, 249, 782, 475]
Open off
ModelBrowserVisibility off
ModelBrowserWidth 200
ScreenColor "white"
PaperOrientation "landscape"
PaperPositionMode "auto"
PaperType "A4"
PaperUnits "centimeters"
ZoomFactor "100"
Block {
BlockType Inport
Name "Vel"
Position [65, 88, 95, 102]
}
Block {
BlockType Inport
Name "Acc"
Position [65, 148, 95, 162]
Port "2"
}
Block {
BlockType Gain
Name "AccCof"
Position [135, 140, 165, 170]
Gain "0.0002 * 0.0002/ (0.46 / 37500.0)"
}
Block {
BlockType Gain
Name "Angle Encoder"
Position [460, 150, 490, 180]
Gain "-(pi * 2.0 / 2400)"
}
Block {
BlockType Reference
Name "Get Cart's Position"
Ports [0, 1]
Position [330, 54, 420, 86]
Priority "1"
SourceBlock "googolbox/GT-400-SV Block Library/Get C"
"urrent Axis' Position"
SourceType "GetPos"
axis "1"
}
Block {
BlockType Reference
Name "Get Pend's Angle"
Ports [0, 1]
Position [335, 149, 425, 181]
Priority "1"
SourceBlock "googolbox/GT-400-SV Block Library/Get C"
"urrent Axis' Position"
SourceType "GetPos"
axis "2"
}
Block {
BlockType Gain
Name "Pos Encoder"
Position [460, 55, 490, 85]
Gain "0.46 / 37500.0"
}
Block {
BlockType Reference
Name "Set Cart's Acc And Vel"
Ports [2]
Position [200, 103, 290, 147]
Priority "1"
SourceBlock "googolbox/GT-400-SV Block Library/Set C"
"urrent Axis' Acc and Vel"
SourceType "SetAccVel"
axis "1"
vel "2"
pos "25000"
}
Block {
BlockType Gain
Name "VelCof"
Position [135, 80, 165, 110]
Gain "0.0002 / (0.46 / 37500.0)"
}
Block {
BlockType Outport
Name "Pos"
Position [530, 63, 560, 77]
}
Block {
BlockType Outport
Name "Angle"
Position [530, 158, 560, 172]
Port "2"
}
Line {
SrcBlock "AccCof"
SrcPort 1
Points [0, -20]
DstBlock "Set Cart's Acc And Vel"
DstPort 2
}
Line {
SrcBlock "VelCof"
SrcPort 1
Points [0, 20]
DstBlock "Set Cart's Acc And Vel"
DstPort 1
}
Line {
SrcBlock "Angle Encoder"
SrcPort 1
DstBlock "Angle"
DstPort 1
}
Line {
SrcBlock "Pos Encoder"
SrcPort 1
DstBlock "Pos"
DstPort 1
}
Line {
SrcBlock "Get Pend's Angle"
SrcPort 1
DstBlock "Angle Encoder"
DstPort 1
}
Line {
SrcBlock "Acc"
SrcPort 1
DstBlock "AccCof"
DstPort 1
}
Line {
SrcBlock "Vel"
SrcPort 1
DstBlock "VelCof"
DstPort 1
}
Line {
SrcBlock "Get Cart's Position"
SrcPort 1
DstBlock "Pos Encoder"
DstPort 1
}
}
}
Block {
BlockType Saturate
Name "Saturation"
Position [170, 285, 200, 315]
UpperLimit "15"
LowerLimit "-15"
}
Block {
BlockType Signum
Name "Sign"
Position [180, 175, 210, 205]
}
Block {
BlockType Sum
Name "Sum"
Ports [2, 1]
Position [600, 196, 615, 234]
ShowName off
Inputs "+-"
InputSameDT off
OutDataTypeMode "Inherit via internal rule"
}
Block {
BlockType Switch
Name "Switch1"
Position [325, 124, 340, 206]
Threshold "20*pi/180"
InputSameDT off
}
Block {
BlockType Switch
Name "Switch2"
Position [325, 234, 340, 316]
Threshold "20*pi/180"
InputSameDT off
}
Block {
BlockType Outport
Name "Pos"
Position [525, 148, 555, 162]
}
Block {
BlockType Outport
Name "Angle"
Position [575, 248, 605, 262]
Port "2"
}
Line {
SrcBlock "Constant1"
SrcPort 1
DstBlock "Switch2"
DstPort 1
}
Line {
SrcBlock " 2"
SrcPort 1
DstBlock "Switch2"
DstPort 3
}
Line {
SrcBlock "Constant"
SrcPort 1
DstBlock "Switch1"
DstPort 1
}
Line {
SrcBlock "Gain"
SrcPort 1
DstBlock "Switch1"
DstPort 3
}
Line {
SrcBlock "Sum"
SrcPort 1
Points [10, 0; 0, -110]
DstBlock " -pi~pi"
DstPort 1
}
Line {
SrcBlock "Constant2"
SrcPort 1
Points [20, 0]
DstBlock "Sum"
DstPort 1
}
Line {
SrcBlock "Switch1"
SrcPort 1
Points [20, 0; 0, 20]
DstBlock "Pendulum"
DstPort 1
}
Line {
SrcBlock "Switch2"
SrcPort 1
Points [30, 0; 0, -50]
DstBlock "Pendulum"
DstPort 2
}
Line {
SrcBlock " -pi~pi"
SrcPort 1
DstBlock " 1"
DstPort 1
}
Line {
SrcBlock " 1"
SrcPort 1
Points [-75, 0; 0, 60]
Branch {
DstBlock "Switch1"
DstPort 2
}
Branch {
Points [0, 110]
DstBlock "Switch2"
DstPort 2
}
}
Line {
SrcBlock "Saturation"
SrcPort 1
DstBlock " 2"
DstPort 1
}
Line {
SrcBlock "Pendulum"
SrcPort 1
Points [30, 0]
DstBlock "Pos"
DstPort 1
}
Line {
SrcBlock "Pendulum"
SrcPort 2
Points [65, 0]
Branch {
DstBlock "Sum"
DstPort 2
}
Branch {
Points [0, 30]
DstBlock "Angle"
DstPort 1
}
}
Line {
SrcBlock "Sign"
SrcPort 1
DstBlock "Gain"
DstPort 1
}
Line {
SrcBlock "Acc"
SrcPort 1
Points [0, 0; 25, 0]
Branch {
Points [0, -35]
DstBlock "Sign"
DstPort 1
}
Branch {
Points [0, 75]
DstBlock "Saturation"
DstPort 1
}
}
}
}
Block {
BlockType Scope
Name "Scope1"
Ports [2]
Position [950, 31, 980, 64]
Location [6, 54, 806, 576]
Open off
NumInputPorts "2"
TickLabels "on"
ZoomMode "yonly"
List {
ListType AxesTitles
axes1 "%<SignalLabel>"
axes2 "%<SignalLabel>"
}
TimeRange "10"
YMin "0.013~3.146"
YMax "0.024~3.16"
DataFormat "StructureWithTime"
}
Block {
BlockType Sum
Name "Sum"
Ports [2, 1]
Position [325, 316, 340, 434]
ShowName off
Inputs "+-"
InputSameDT off
OutDataTypeMode "Inherit via internal rule"
}
Block {
BlockType Sum
Name "Sum1"
Ports [2, 1]
Position [325, 175, 340, 290]
ShowName off
Inputs "+-"
InputSameDT off
OutDataTypeMode "Inherit via internal rule"
}
Block {
BlockType Constant
Name "Teta=pi"
Position [135, 334, 170, 356]
Value "pi"
}
Line {
SrcBlock "Mux"
SrcPort 1
DstBlock "LQR Controller"
DstPort 1
}
Line {
Labels [2, 0]
SrcBlock "Mux1"
SrcPort 1
Points [0, 160; -795, 0]
DstBlock "Demux"
DstPort 1
}
Line {
SrcBlock "Sum"
SrcPort 1
Points [15, 0]
Branch {
Points [0, -20]
DstBlock " -pi~pi"
DstPort 1
}
Branch {
Points [0, 50]
DstBlock "Derivative"
DstPort 1
}
}
Line {
SrcBlock "Derivative1"
SrcPort 1
DstBlock "Mux"
DstPort 2
}
Line {
Labels [1, 0]
SrcBlock "Demux"
SrcPort 2
DstBlock "Sum"
DstPort 2
}
Line {
SrcBlock "Derivative"
SrcPort 1
DstBlock "Mux"
DstPort 4
}
Line {
SrcBlock "Demux"
SrcPort 1
DstBlock "Sum1"
DstPort 2
}
Line {
SrcBlock "Sum1"
SrcPort 1
Points [15, 0]
Branch {
Points [0, -20]
DstBlock "Mux"
DstPort 1
}
Branch {
Points [0, 50]
DstBlock "Derivative1"
DstPort 1
}
}
Line {
SrcBlock "Position"
SrcPort 1
DstBlock "Sum1"
DstPort 1
}
Line {
SrcBlock "LQR Controller"
SrcPort 1
Points [0, 5]
DstBlock "Real Control"
DstPort 1
}
Line {
Name "Angle"
Labels [0, 0]
SrcBlock "Real Control"
SrcPort 2
Points [0, 20; 75, 0]
Branch {
Points [0, -320]
DstBlock "Scope1"
DstPort 2
}
Branch {
DstBlock "Mux1"
DstPort 2
}
}
Line {
SrcBlock "Teta=pi"
SrcPort 1
DstBlock "Sum"
DstPort 1
}
Line {
SrcBlock " -pi~pi"
SrcPort 1
DstBlock "Mux"
DstPort 3
}
Line {
Name "Pos"
Labels [2, 1]
SrcBlock "Real Control"
SrcPort 1
Points [0, 10; 40, 0]
Branch {
Points [0, -260]
DstBlock "Scope1"
DstPort 1
}
Branch {
DstBlock "Mux1"
DstPort 1
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -