📄 narmamaglev.mdl
字号:
DstBlock "Discrete State-Space4"
DstPort 1
}
Line {
SrcBlock "Discrete State-Space4"
SrcPort 1
Points [10, 0]
Branch {
DstBlock "Matrix\nGain"
DstPort 1
}
Branch {
Points [0, 120]
DstBlock "Matrix\nGain1"
DstPort 1
}
}
Line {
SrcBlock "Zero-Order\nHold"
SrcPort 1
Points [0, 0; 15, 0]
Branch {
DstBlock "Control Signal"
DstPort 1
}
Branch {
Points [0, 250; -1210, 0]
Branch {
Points [-105, 0; 0, -255]
DstBlock "Fcn"
DstPort 1
}
Branch {
Points [0, -195]
DstBlock "Switch"
DstPort 3
}
}
}
Line {
SrcBlock "Fcn"
SrcPort 1
Points [0, 40]
DstBlock "Switch"
DstPort 1
}
Line {
SrcBlock "Constant2"
SrcPort 1
Points [25, 0]
DstBlock "Switch"
DstPort 2
}
Line {
SrcBlock "Unit Delay4"
SrcPort 1
Points [5, 0]
DstBlock "Mux"
DstPort 2
}
Line {
SrcBlock "Switch"
SrcPort 1
Points [0, -30]
DstBlock "Unit Delay4"
DstPort 1
}
Line {
SrcBlock "Saturation1"
SrcPort 1
DstBlock "Zero-Order\nHold"
DstPort 1
}
Line {
SrcBlock "Product"
SrcPort 1
Points [55, 0]
Branch {
Points [0, -65]
DstBlock "Fcn2"
DstPort 1
}
Branch {
Points [0, 70; 95, 0]
DstBlock "Switch2"
DstPort 3
}
}
Line {
SrcBlock "Constant4"
SrcPort 1
DstBlock "Switch2"
DstPort 2
}
Line {
SrcBlock "Switch2"
SrcPort 1
DstBlock "Saturation1"
DstPort 1
}
Line {
SrcBlock "Fcn2"
SrcPort 1
Points [10, 0]
DstBlock "Switch2"
DstPort 1
}
}
}
Block {
BlockType SubSystem
Name "Plant\n(Magnet Levitation)"
Ports [1, 1]
Position [435, 63, 550, 127]
TreatAsAtomicUnit off
MaskInitialization "x1=[-2 -2 2 2 -2 NaN -2 -2 2 2 -2];\ny1=[5 4 4 "
"5 5 NaN 2 0 0 2 2];\nx2=[-2 -2 2 2 -2 NaN -2 2 NaN -2 2 NaN 2 4 NaN "
"2 4];\ny2=[4 3 3 4 4 NaN 1.5 1 NaN 1 .5 NaN 1.5 1.5 NaN .5 .5];\nx1t = -"
".5 ; y1t = 4.4;\nx2t = -.5; y2t = 3.4;\n"
MaskDisplay "plot([-10],[0],[10],[5]);\nplot([x1 NaN x2],[y1"
" NaN y2]);\ntext(x1t,y1t,'N')\ntext(x2t,y2t,'S')"
MaskIconFrame on
MaskIconOpaque on
MaskIconRotate "none"
MaskIconUnits "autoscale"
Port {
PortNumber 1
Name "Position"
TestPoint off
LinearAnalysisOutput off
LinearAnalysisInput off
RTWStorageClass "Auto"
DataLogging off
DataLoggingNameMode "SignalName"
DataLoggingDecimateData off
DataLoggingDecimation "2"
DataLoggingLimitDataPoints off
DataLoggingMaxPoints "5000"
}
System {
Name "Plant\n(Magnet Levitation)"
Location [177, 189, 853, 455]
Open off
ModelBrowserVisibility off
ModelBrowserWidth 200
ScreenColor "white"
PaperOrientation "landscape"
PaperPositionMode "auto"
PaperType "usletter"
PaperUnits "inches"
ZoomFactor "100"
Block {
BlockType Inport
Name "Current"
Position [15, 93, 45, 107]
}
Block {
BlockType Product
Name "Division"
Ports [3, 1]
Position [195, 94, 225, 126]
Inputs "**/"
}
Block {
BlockType Product
Name "Division1"
Ports [2, 1]
Position [340, 52, 370, 83]
Inputs "/*"
}
Block {
BlockType Product
Name "Division2"
Ports [2, 1]
Position [350, 137, 380, 168]
Inputs "/*"
}
Block {
BlockType Gain
Name "Gain"
Position [250, 95, 280, 125]
Gain "15"
}
Block {
BlockType Constant
Name "Gravity"
Position [225, 160, 255, 190]
Value "9.8"
}
Block {
BlockType Integrator
Name "Position"
Ports [1, 1]
Position [540, 100, 570, 130]
InitialCondition ".5"
ZeroCross off
}
Block {
BlockType Signum
Name "Sign"
Position [90, 150, 120, 180]
ZeroCross off
}
Block {
BlockType Fcn
Name "Square Law"
Position [85, 85, 145, 115]
Expr "u^2"
}
Block {
BlockType Sum
Name "Sum"
Ports [3, 1]
Position [405, 93, 430, 137]
ShowName off
Inputs "|+--"
}
Block {
BlockType Integrator
Name "Velocity"
Ports [1, 1]
Position [470, 100, 500, 130]
ZeroCross off
}
Block {
BlockType Gain
Name "Viscous Friction"
Position [440, 175, 470, 205]
Orientation "left"
Gain "12"
}
Block {
BlockType Constant
Name "mass"
Position [235, 35, 265, 65]
Value "3"
}
Block {
BlockType Outport
Name "Output"
Position [620, 108, 650, 122]
}
Line {
SrcBlock "Square Law"
SrcPort 1
DstBlock "Division"
DstPort 1
}
Line {
SrcBlock "Division"
SrcPort 1
DstBlock "Gain"
DstPort 1
}
Line {
SrcBlock "Gravity"
SrcPort 1
Points [35, 0; 0, -55]
DstBlock "Sum"
DstPort 2
}
Line {
SrcBlock "Velocity"
SrcPort 1
Points [5, 0]
Branch {
Points [0, 0]
DstBlock "Position"
DstPort 1
}
Branch {
Points [0, 75]
DstBlock "Viscous Friction"
DstPort 1
}
}
Line {
SrcBlock "Sum"
SrcPort 1
DstBlock "Velocity"
DstPort 1
}
Line {
SrcBlock "Gain"
SrcPort 1
Points [40, 0]
DstBlock "Division1"
DstPort 2
}
Line {
SrcBlock "Division1"
SrcPort 1
Points [15, 0]
DstBlock "Sum"
DstPort 1
}
Line {
SrcBlock "mass"
SrcPort 1
Points [40, 0]
Branch {
Points [15, 0]
DstBlock "Division1"
DstPort 1
}
Branch {
Points [0, 95]
DstBlock "Division2"
DstPort 1
}
}
Line {
SrcBlock "Viscous Friction"
SrcPort 1
Points [-110, 0; 0, -30]
DstBlock "Division2"
DstPort 2
}
Line {
SrcBlock "Division2"
SrcPort 1
Points [5, 0]
DstBlock "Sum"
DstPort 3
}
Line {
SrcBlock "Current"
SrcPort 1
Points [10, 0]
Branch {
DstBlock "Square Law"
DstPort 1
}
Branch {
Points [0, 65]
DstBlock "Sign"
DstPort 1
}
}
Line {
SrcBlock "Position"
SrcPort 1
Points [15, 0]
Branch {
DstBlock "Output"
DstPort 1
}
Branch {
Points [0, 120; -410, 0]
DstBlock "Division"
DstPort 3
}
}
Line {
SrcBlock "Sign"
SrcPort 1
Points [25, 0; 0, -55]
DstBlock "Division"
DstPort 2
}
}
}
Block {
BlockType UniformRandomNumber
Name "Random Reference"
Position [45, 44, 75, 76]
Minimum "0.5"
Maximum "4"
Seed "round(now)"
SampleTime "5"
}
Block {
BlockType SubSystem
Name "X(2Y)\n Graph"
Ports [3]
Position [685, 72, 720, 118]
CopyFcn "sfunxy2([],[],[],'CopyBlock')"
DeleteFcn "sfunxy2([],[],[],'DeleteBlock')"
LoadFcn "sfunxy2([],[],[],'LoadBlock')"
StartFcn "sfunxy2([],[],[],'Start')"
StopFcn "sfunxy2([],[],[],'Stop')"
NameChangeFcn "sfunxy2([],[],[],'NameChange')"
TreatAsAtomicUnit off
MaskType "X(2Y) scope."
MaskDescription "X(2Y) scope using MATLAB graph window. First i"
"nput is used as time base. Enter plotting ranges."
MaskHelp "This block can be used to explore limit cycles."
" Look at the m-file sfunxy.m to see how it works."
MaskPromptString "x-min:|x-max:|y-min:|y-max:|Sample time:"
MaskStyleString "edit,edit,edit,edit,edit"
MaskTunableValueString "on,on,on,on,on"
MaskCallbackString "||||"
MaskEnableString "on,on,on,on,on"
MaskVisibilityString "on,on,on,on,on"
MaskToolTipString "on,on,on,on,on"
MaskVarAliasString ",,,,"
MaskVariables "xmin=@1;xmax=@2;ymin=@3;ymax=@4;st=@5;"
MaskDisplay "plot([.05 .95 .95 .05 .05],[.45 .45 .95 .95 .45"
"], 0.5+cos(0:0.1:2*pi)*0.3,0.7+sin(0:0.1:2*pi)*0.2)"
MaskSelfModifiable on
MaskIconFrame on
MaskIconOpaque on
MaskIconRotate "none"
MaskIconUnits "normalized"
MaskValueString "0|5|-1|1|-1"
System {
Name "X(2Y)\n Graph"
Location [82, 157, 342, 335]
Open off
ModelBrowserVisibility off
ModelBrowserWidth 200
ScreenColor "white"
PaperOrientation "landscape"
PaperPositionMode "auto"
PaperType "usletter"
PaperUnits "inches"
ZoomFactor "100"
Block {
BlockType Inport
Name "x"
Position [25, 27, 55, 43]
}
Block {
BlockType Inport
Name "y1"
Position [25, 67, 55, 83]
Port "2"
}
Block {
BlockType Inport
Name "y2"
Position [25, 107, 55, 123]
Port "3"
}
Block {
BlockType Mux
Name "Mux"
Ports [3, 1]
Position [105, 48, 135, 102]
ShowName off
Inputs "3"
}
Block {
BlockType "S-Function"
Name "sfunxy"
Ports [1]
Position [175, 65, 225, 85]
ShowName off
FunctionName "sfunxy2"
Parameters "[xmin xmax ymin ymax], st"
}
Line {
SrcBlock "y2"
SrcPort 1
Points [15, 0; 0, -20]
DstBlock "Mux"
DstPort 3
}
Line {
SrcBlock "y1"
SrcPort 1
DstBlock "Mux"
DstPort 2
}
Line {
SrcBlock "x"
SrcPort 1
Points [15, 0; 0, 20]
DstBlock "Mux"
DstPort 1
}
Line {
SrcBlock "Mux"
SrcPort 1
DstBlock "sfunxy"
DstPort 1
}
}
}
Line {
SrcBlock "Clock"
SrcPort 1
Points [15, 0; 0, 25]
DstBlock "X(2Y)\n Graph"
DstPort 1
}
Line {
Labels [1, 0]
SrcBlock "Random Reference"
SrcPort 1
Points [50, 0]
Branch {
Points [0, 140; 530, 0; 0, -90]
DstBlock "X(2Y)\n Graph"
DstPort 3
}
Branch {
DstBlock "NARMA-L2 Controller"
DstPort 1
}
}
Line {
Name "Current"
Labels [0, 0]
SrcBlock "NARMA-L2 Controller"
SrcPort 1
DstBlock "Plant\n(Magnet Levitation)"
DstPort 1
}
Line {
Name "Position"
Labels [0, 0]
SrcBlock "Plant\n(Magnet Levitation)"
SrcPort 1
Points [60, 0]
Branch {
Points [0, 80; -445, 0; 0, -50]
DstBlock "NARMA-L2 Controller"
DstPort 2
}
Branch {
DstBlock "X(2Y)\n Graph"
DstPort 2
}
}
Annotation {
Name "NARMA-L2 Control of a Magnet Levitation System"
"\n(Double click on the \"?\" for more info)"
Position [198, 232]
}
Annotation {
Name "To start and stop the simulation, use the \"Sta"
"rt/Stop\"\nselection in the \"Simulation\" pull-down menu"
Position [201, 277]
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -