📄 quadrotorsim.mdl
字号:
SrcBlock "Dynamics"
SrcPort 1
Points [30, 0]
Branch {
Points [0, 45]
DstBlock "Goto"
DstPort 1
}
Branch {
DstBlock "x"
DstPort 1
}
}
Annotation {
Name "Quadrotor Model"
Position [283, 20]
ForegroundColor "blue"
FontName "Arial"
FontSize 12
FontWeight "bold"
}
}
}
Block {
BlockType Sum
Name "Sum"
Ports [2, 1]
Position [235, 275, 255, 295]
ShowName off
IconShape "round"
Inputs "|++"
InputSameDT off
OutDataTypeMode "Inherit via internal rule"
OutDataType "sfix(16)"
OutScaling "2^0"
OutDataTypeStr "Inherit: Inherit via internal rule"
SaturateOnIntegerOverflow off
}
Block {
BlockType Display
Name "Tracking Error"
Ports [1]
Position [795, 100, 885, 130]
Decimation "1"
Lockdown off
}
Block {
BlockType SubSystem
Name "plotting\nroutines"
Ports [0, 2]
Position [660, 87, 760, 203]
ForegroundColor "red"
MinAlgLoopOccurrences off
PropExecContextOutsideSubsystem off
RTWSystemCode "Auto"
FunctionWithSeparateData off
Opaque off
RequestExecContextInheritance off
MaskHideContents off
System {
Name "plotting\nroutines"
Location [833, 167, 1522, 770]
Open off
ModelBrowserVisibility off
ModelBrowserWidth 200
ScreenColor "white"
PaperOrientation "landscape"
PaperPositionMode "auto"
PaperType "usletter"
PaperUnits "inches"
TiledPaperMargins [0.500000, 0.500000, 0.500000, 0.500000]
TiledPageScale 1
ShowPageBoundaries off
ZoomFactor "100"
Block {
BlockType From
Name "Controls"
Position [120, 461, 160, 489]
CloseFcn "tagdialog Close"
GotoTag "u"
TagVisibility "global"
}
Block {
BlockType Demux
Name "Demux"
Ports [1, 2]
Position [510, 381, 515, 459]
BackgroundColor "black"
ShowName off
Outputs "2"
DisplayOption "bar"
}
Block {
BlockType From
Name "Desired State"
Position [120, 406, 160, 434]
CloseFcn "tagdialog Close"
GotoTag "xd"
TagVisibility "global"
}
Block {
BlockType From
Name "Estimated State"
Position [120, 351, 160, 379]
CloseFcn "tagdialog Close"
GotoTag "xhat"
TagVisibility "global"
}
Block {
BlockType From
Name "From"
Position [145, 201, 215, 229]
ShowName off
CloseFcn "tagdialog Close"
GotoTag "target"
TagVisibility "global"
}
Block {
BlockType From
Name "From1"
Position [120, 516, 190, 544]
ShowName off
CloseFcn "tagdialog Close"
GotoTag "target"
TagVisibility "global"
}
Block {
BlockType Mux
Name "Mux"
Ports [2, 1]
Position [260, 70, 265, 265]
ShowName off
Inputs "2"
DisplayOption "bar"
}
Block {
BlockType Mux
Name "Mux1"
Ports [5, 1]
Position [260, 286, 265, 554]
ShowName off
Inputs "5"
DisplayOption "bar"
}
Block {
BlockType "S-Function"
Name "S-Function1"
Ports [1, 1]
Position [360, 405, 480, 435]
ShowName off
FunctionName "plotQuadStateVariables"
Parameters "C"
EnableBusSupport off
}
Block {
BlockType From
Name "State"
Position [45, 106, 85, 134]
CloseFcn "tagdialog Close"
GotoTag "x"
TagVisibility "global"
}
Block {
BlockType ZeroOrderHold
Name "Zero-Order\nHold1"
Position [300, 401, 335, 439]
ShowName off
SampleTime "C.Ts"
}
Block {
BlockType SubSystem
Name "plot quadrotor"
Ports [1]
Position [310, 131, 380, 209]
MinAlgLoopOccurrences off
PropExecContextOutsideSubsystem off
RTWSystemCode "Auto"
FunctionWithSeparateData off
Opaque off
RequestExecContextInheritance off
MaskHideContents off
MaskDisplay "image(imread('tv.jpg'))"
MaskIconFrame on
MaskIconOpaque on
MaskIconRotate "none"
MaskIconUnits "autoscale"
System {
Name "plot quadrotor"
Location [858, 574, 1247, 876]
Open off
ModelBrowserVisibility off
ModelBrowserWidth 200
ScreenColor "white"
PaperOrientation "landscape"
PaperPositionMode "auto"
PaperType "usletter"
PaperUnits "inches"
TiledPaperMargins [0.500000, 0.500000, 0.500000, 0.500000]
TiledPageScale 1
ShowPageBoundaries off
ZoomFactor "100"
Block {
BlockType Inport
Name "x"
Position [75, 78, 105, 92]
IconDisplay "Port number"
}
Block {
BlockType Clock
Name "Clock"
Position [75, 120, 95, 140]
Decimation "10"
}
Block {
BlockType Mux
Name "Mux"
Ports [2, 1]
Position [155, 61, 160, 154]
ShowName off
Inputs "2"
DisplayOption "bar"
}
Block {
BlockType MATLABFcn
Name "plotQuadrotor"
Ports [1]
Position [240, 95, 300, 125]
MATLABFcn "plotQuadrotor(u)"
OutputDimensions "0"
SampleTime "0.1"
}
Line {
SrcBlock "Clock"
SrcPort 1
DstBlock "Mux"
DstPort 2
}
Line {
SrcBlock "x"
SrcPort 1
DstBlock "Mux"
DstPort 1
}
Line {
SrcBlock "Mux"
SrcPort 1
DstBlock "plotQuadrotor"
DstPort 1
}
}
}
Block {
BlockType Outport
Name "error_tracking"
Position [555, 393, 585, 407]
IconDisplay "Port number"
OutDataType "sfix(16)"
OutScaling "2^0"
}
Block {
BlockType Outport
Name "error_estimation"
Position [560, 433, 590, 447]
Port "2"
IconDisplay "Port number"
OutDataType "sfix(16)"
OutScaling "2^0"
}
Line {
SrcBlock "State"
SrcPort 1
Points [0, 0]
Branch {
Points [0, 190]
DstBlock "Mux1"
DstPort 1
}
Branch {
DstBlock "Mux"
DstPort 1
}
}
Line {
SrcBlock "Mux"
SrcPort 1
DstBlock "plot quadrotor"
DstPort 1
}
Line {
SrcBlock "Desired State"
SrcPort 1
DstBlock "Mux1"
DstPort 3
}
Line {
SrcBlock "Controls"
SrcPort 1
DstBlock "Mux1"
DstPort 4
}
Line {
SrcBlock "Mux1"
SrcPort 1
DstBlock "Zero-Order\nHold1"
DstPort 1
}
Line {
SrcBlock "Estimated State"
SrcPort 1
DstBlock "Mux1"
DstPort 2
}
Line {
SrcBlock "From"
SrcPort 1
DstBlock "Mux"
DstPort 2
}
Line {
SrcBlock "From1"
SrcPort 1
DstBlock "Mux1"
DstPort 5
}
Line {
SrcBlock "S-Function1"
SrcPort 1
DstBlock "Demux"
DstPort 1
}
Line {
SrcBlock "Demux"
SrcPort 1
DstBlock "error_tracking"
DstPort 1
}
Line {
SrcBlock "Demux"
SrcPort 2
DstBlock "error_estimation"
DstPort 1
}
Line {
SrcBlock "Zero-Order\nHold1"
SrcPort 1
DstBlock "S-Function1"
DstPort 1
}
Annotation {
Name "UAV Visualization"
Position [228, 35]
ForegroundColor "blue"
FontName "Arial"
FontSize 12
FontWeight "bold"
}
}
}
Block {
BlockType SignalGenerator
Name "psi_command"
Ports [0, 1]
Position [30, 372, 70, 388]
WaveForm "square"
Amplitude "pi/8"
Frequency ".1"
}
Block {
BlockType SignalGenerator
Name "px_command"
Ports [0, 1]
Position [30, 57, 65, 73]
WaveForm "square"
Frequency ".09"
}
Block {
BlockType SignalGenerator
Name "py_command"
Ports [0, 1]
Position [30, 162, 70, 178]
WaveForm "square"
Frequency ".05"
}
Block {
BlockType SignalGenerator
Name "pz_command"
Ports [0, 1]
Position [30, 267, 70, 283]
WaveForm "square"
Amplitude "-.1"
Frequency ".05"
}
Line {
SrcBlock "Quadrotor"
SrcPort 1
Points [15, 0; 0, 55; -265, 0; 0, -40]
DstBlock "Autopilot"
DstPort 2
}
Line {
SrcBlock "Autopilot"
SrcPort 1
DstBlock "Quadrotor"
DstPort 1
}
Line {
SrcBlock "plotting\nroutines"
SrcPort 1
DstBlock "Tracking Error"
DstPort 1
}
Line {
SrcBlock "plotting\nroutines"
SrcPort 2
DstBlock "Estimation Error"
DstPort 1
}
Line {
SrcBlock "Mux1"
SrcPort 1
Points [25, 0]
Branch {
DstBlock "Autopilot"
DstPort 1
}
Branch {
Labels [1, 0]
Points [0, -70]
DstBlock "Goto"
DstPort 1
}
}
Line {
SrcBlock "Manual Switch"
SrcPort 1
DstBlock "Mux1"
DstPort 1
}
Line {
SrcBlock "px_command"
SrcPort 1
DstBlock "Manual Switch"
DstPort 1
}
Line {
SrcBlock "Manual Switch1"
SrcPort 1
DstBlock "Mux1"
DstPort 2
}
Line {
SrcBlock "py_command"
SrcPort 1
DstBlock "Manual Switch1"
DstPort 1
}
Line {
SrcBlock "pz_command"
SrcPort 1
DstBlock "Manual Switch2"
DstPort 1
}
Line {
SrcBlock "Manual Switch3"
SrcPort 1
DstBlock "Mux1"
DstPort 4
}
Line {
SrcBlock "psi_command"
SrcPort 1
DstBlock "Manual Switch3"
DstPort 1
}
Line {
SrcBlock "Constant"
SrcPort 1
Points [25, 0; 0, -50]
Branch {
DstBlock "Manual Switch3"
DstPort 2
}
Branch {
Points [0, -105]
Branch {
DstBlock "Manual Switch2"
DstPort 2
}
Branch {
Points [0, -105]
Branch {
DstBlock "Manual Switch1"
DstPort 2
}
Branch {
Points [0, -105]
DstBlock "Manual Switch"
DstPort 2
}
}
}
}
Line {
SrcBlock "Sum"
SrcPort 1
DstBlock "Mux1"
DstPort 3
}
Line {
SrcBlock "Manual Switch2"
SrcPort 1
DstBlock "Sum"
DstPort 1
}
Line {
SrcBlock "Constant1"
SrcPort 1
DstBlock "Sum"
DstPort 2
}
Annotation {
Name "Quadrotor Simulation\nBYU"
Position [478, 95]
ForegroundColor "blue"
FontName "Arial"
FontSize 12
FontWeight "bold"
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -