📄 slcp.mdl
字号:
# $Revision: 1.7 $
Model {
Name "slcp"
Version 2.20
SimParamPage Solver
SampleTimeColors off
InvariantConstants off
WideVectorLines on
ShowLineWidths off
StartTime "0.0"
StopTime "1000"
Solver ode5
RelTol "1e-3"
AbsTol "1e-6"
Refine "1"
MaxStep "0.1"
InitialStep "auto"
FixedStep ".01"
MaxOrder 5
OutputOption RefineOutputTimes
OutputTimes "[]"
LoadExternalInput off
ExternalInput "[t, u]"
SaveTime off
TimeSaveName "tout"
SaveState off
StateSaveName "xout"
SaveOutput off
OutputSaveName "yout"
LoadInitialState off
InitialState "xInitial"
SaveFinalState off
FinalStateName "xFinal"
LimitMaxRows off
MaxRows "1000"
Decimation "1"
AlgebraicLoopMsg warning
MinStepSizeMsg warning
UnconnectedInputMsg warning
UnconnectedOutputMsg warning
UnconnectedLineMsg warning
ConsistencyChecking off
ZeroCross on
SimulationMode normal
RTWSystemTargetFile "grt.tlc"
RTWInlineParameters off
RTWPlaceOutputsASAP off
RTWRetainRTWFile off
RTWTemplateMakefile "grt_unix.tmf"
RTWMakeCommand "make_rtw"
RTWGenerateCodeOnly off
ExtModeMexFile "ext_comm"
ExtModeBatchMode off
PreLoadFcn "initcp"
CloseFcn "AnimFigTitle = [winName, ': Cart & Pole Animation']"
"; AnimFigH = findobj(0,'Name',AnimFigTitle); close(AnimFigH)"
BlockDefaults {
Orientation right
ForegroundColor black
BackgroundColor white
DropShadow off
NamePlacement normal
FontName "Helvetica"
FontSize 10
FontWeight normal
FontAngle normal
ShowName on
}
AnnotationDefaults {
HorizontalAlignment center
VerticalAlignment middle
ForegroundColor black
BackgroundColor white
DropShadow off
FontName "Helvetica"
FontSize 10
FontWeight normal
FontAngle normal
}
LineDefaults {
FontName "Helvetica"
FontSize 9
FontWeight normal
FontAngle normal
}
System {
Name "slcp"
Location [318, 59, 823, 412]
Open on
ToolBar on
StatusBar on
ScreenColor white
PaperOrientation landscape
PaperPositionMode auto
PaperType usletter
PaperUnits inches
Block {
BlockType "S-Function"
Name "Animation"
Ports [1, 0, 0, 0, 0]
Position [380, 34, 435, 66]
FunctionName "animcp"
PortCounts "[]"
SFunctionModules "''"
}
Block {
BlockType SubSystem
Name "Cart & Pole\nDynamics"
Ports [1, 4, 0, 0, 0]
Position [235, 150, 285, 205]
ShowPortLabels off
MaskType "Cart & Pole"
MaskDescription "Inverted Pendulum (cart & pole)"
MaskHelp "Inverted Pendulum"
MaskPromptString "Initial Conditions (angle, angular velocity, ca"
"rt position and cart velocity):|Physical Specifications (pole length, pole ma"
"ss, cart mass and g):"
MaskStyleString "edit,edit"
MaskTunableValueString "on,on"
MaskInitialization "init_cond = @1; specs = @2;l=specs(1)/2;m=specs"
"(2);mc=specs(3);g=specs(4);"
MaskDisplay "plot(-4,-1,4,6,[0 3 2.8 -0.2 0],[1 5 5.15 1.15 "
"1],[-1 -1 1 1 -1],[1 0 0 1 1],[-3.5 3.5],[0 0])"
MaskIconFrame on
MaskIconOpaque on
MaskIconRotate none
MaskIconUnits autoscale
MaskValueString "[0, 0, 0, 0]|[1.0, 0.1, 1.0, 9.8]"
System {
Name "Cart & Pole\nDynamics"
Location [134, 510, 934, 815]
Open off
ToolBar off
StatusBar off
ScreenColor white
PaperOrientation landscape
PaperPositionMode auto
PaperType usletter
PaperUnits inches
Block {
BlockType Inport
Name "in_1"
Position [205, 60, 225, 80]
Port "1"
PortWidth "-1"
SampleTime "-1"
}
Block {
BlockType Fcn
Name "Fcn1"
Position [350, 85, 390, 105]
ShowName off
Expr "(g*u(2)+u(3)*((-u(1)-m*l*u(4)*u(4)*u(2))/(m"
"c+m)))/(l*(4/3-(m*u(3)*u(3))/(mc+m)))"
}
Block {
BlockType Fcn
Name "Fcn2"
Position [450, 220, 490, 240]
ShowName off
Expr "(u(1)+m*l*(u(4)*u(4)*u(2)-u(5)*u(3)))/(mc+m"
")"
}
Block {
BlockType Fcn
Name "Fcn4"
Position [145, 89, 200, 111]
ShowName off
Expr "sin(u[1])"
}
Block {
BlockType Fcn
Name "Fcn5"
Position [145, 118, 200, 142]
ShowName off
Expr "cos(u[1])"
}
Block {
BlockType Mux
Name "Mux1"
Ports [4, 1, 0, 0, 0]
Position [280, 65, 315, 120]
ShowName off
Inputs "4"
}
Block {
BlockType Mux
Name "Mux2"
Ports [2, 1, 0, 0, 0]
Position [400, 208, 430, 252]
ShowName off
Inputs "[4,1]"
}
Block {
BlockType Integrator
Name "theta"
Ports [1, 1, 0, 0, 0]
Position [505, 85, 525, 105]
ExternalReset none
InitialConditionSource internal
InitialCondition "init_cond(1)"
LimitOutput off
UpperSaturationLimit "inf"
LowerSaturationLimit "-inf"
ShowSaturationPort off
ShowStatePort off
AbsoluteTolerance "auto"
}
Block {
BlockType Integrator
Name "theta dot"
Ports [1, 1, 0, 0, 0]
Position [435, 85, 455, 105]
ExternalReset none
InitialConditionSource internal
InitialCondition "init_cond(2)"
LimitOutput off
UpperSaturationLimit "inf"
LowerSaturationLimit "-inf"
ShowSaturationPort off
ShowStatePort off
AbsoluteTolerance "auto"
}
Block {
BlockType Integrator
Name "x"
Ports [1, 1, 0, 0, 0]
Position [570, 220, 590, 240]
ExternalReset none
InitialConditionSource internal
InitialCondition "init_cond(3)"
LimitOutput off
UpperSaturationLimit "inf"
LowerSaturationLimit "-inf"
ShowSaturationPort off
ShowStatePort off
AbsoluteTolerance "auto"
}
Block {
BlockType Integrator
Name "x dot"
Ports [1, 1, 0, 0, 0]
Position [510, 220, 530, 240]
ExternalReset none
InitialConditionSource internal
InitialCondition "init_cond(4)"
LimitOutput off
UpperSaturationLimit "inf"
LowerSaturationLimit "-inf"
ShowSaturationPort off
ShowStatePort off
AbsoluteTolerance "auto"
}
Block {
BlockType Outport
Name "out_1"
Position [670, 85, 690, 105]
Port "1"
OutputWhenDisabled held
InitialOutput "0"
}
Block {
BlockType Outport
Name "out_2"
Position [675, 125, 695, 145]
Port "2"
OutputWhenDisabled held
InitialOutput "0"
}
Block {
BlockType Outport
Name "out_3"
Position [675, 165, 695, 185]
Port "3"
OutputWhenDisabled held
InitialOutput "0"
}
Block {
BlockType Outport
Name "out_4"
Position [675, 205, 695, 225]
Port "4"
OutputWhenDisabled held
InitialOutput "0"
}
Line {
SrcBlock "in_1"
SrcPort 1
DstBlock "Mux1"
DstPort 1
}
Line {
SrcBlock "x"
SrcPort 1
Points [25, 0; 0, -55]
DstBlock "out_3"
DstPort 1
}
Line {
SrcBlock "x dot"
SrcPort 1
Points [0, 0]
Branch {
Points [15, 0; 0, -15]
DstBlock "out_4"
DstPort 1
}
Branch {
DstBlock "x"
DstPort 1
}
}
Line {
SrcBlock "Mux1"
SrcPort 1
Points [0, 0]
Branch {
DstBlock "Fcn1"
DstPort 1
}
Branch {
Points [10, 0; 0, 125]
DstBlock "Mux2"
DstPort 1
}
}
Line {
SrcBlock "Mux2"
SrcPort 1
DstBlock "Fcn2"
DstPort 1
}
Line {
SrcBlock "Fcn2"
SrcPort 1
DstBlock "x dot"
DstPort 1
}
Line {
SrcBlock "Fcn1"
SrcPort 1
Points [20, 0]
Branch {
Points [0, 30; -45, 0; 0, 115]
DstBlock "Mux2"
DstPort 2
}
Branch {
DstBlock "theta dot"
DstPort 1
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -