📄 sltbu.mdl
字号:
# $Revision: 1.7 $
Model {
Name "sltbu"
Version 2.20
SimParamPage Solver
SampleTimeColors off
InvariantConstants off
WideVectorLines on
ShowLineWidths off
StartTime "0.0"
StopTime "999999"
Solver ode3
RelTol "1e-3"
AbsTol "1e-6"
Refine "1"
MaxStep "0.1"
InitialStep "auto"
FixedStep "0.1"
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_vc.tmf"
RTWMakeCommand "make_rtw"
RTWGenerateCodeOnly off
ExtModeMexFile "ext_comm"
ExtModeBatchMode off
PreLoadFcn "inittbu;"
CloseFcn "[winName] = get_param(0, 'CurrentSystem'); AnimFigT"
"itle = [winName, ': Truck Backer-Upper Animation']; AnimFigH = findobj(0,'Nam"
"e',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 "sltbu"
Location [136, 183, 826, 638]
Open on
ToolBar on
StatusBar on
ScreenColor white
PaperOrientation landscape
PaperPositionMode auto
PaperType usletter
PaperUnits inches
Block {
BlockType "S-Function"
Name " Animation &\nHuman Controller"
Ports [1, 1, 0, 0, 0]
Position [520, 95, 585, 125]
FunctionName "animtbu"
PortCounts "[]"
SFunctionModules "''"
}
Block {
BlockType Constant
Name "Constant"
Position [75, 390, 95, 410]
Orientation up
Value "1"
MaskIconFrame on
MaskIconOpaque on
MaskIconRotate none
MaskIconUnits autoscale
}
Block {
BlockType MATLABFcn
Name "Controller 1"
Position [320, 260, 375, 290]
Orientation left
MATLABFcn "ctrltbu1"
OutputWidth "1"
MaskIconFrame on
MaskIconOpaque on
MaskIconRotate none
MaskIconUnits autoscale
}
Block {
BlockType MATLABFcn
Name "Controller 2"
Position [320, 310, 375, 340]
Orientation left
MATLABFcn "ctrltbu2"
OutputWidth "1"
MaskIconFrame on
MaskIconOpaque on
MaskIconRotate none
MaskIconUnits autoscale
}
Block {
BlockType Fcn
Name "Distance"
Position [335, 210, 370, 240]
Orientation left
Expr "sqrt(u[1]^2+u[2]^2)"
MaskIconFrame on
MaskIconOpaque on
MaskIconRotate none
MaskIconUnits autoscale
}
Block {
BlockType SubSystem
Name "Double click\non this for demo.5"
Ports [0, 0, 0, 0, 0]
Position [500, 377, 641, 410]
DropShadow on
ShowName off
OpenFcn "inittbu"
ShowPortLabels off
MaskDisplay "disp('Variable Initialization')"
MaskIconFrame on
MaskIconOpaque on
MaskIconRotate none
MaskIconUnits autoscale
System {
Name "Double click\non this for demo.5"
Location [-10, 380, 117, 533]
Open off
ToolBar off
StatusBar off
ScreenColor white
PaperOrientation landscape
PaperPositionMode auto
PaperType usletter
PaperUnits inches
}
}
Block {
BlockType "S-Function"
Name "Fuzzy Logic Controller"
Ports [1, 1, 0, 0, 0]
Position [145, 264, 200, 316]
Orientation left
FunctionName "sffis"
Parameters "fismatrix"
PortCounts "[]"
SFunctionModules "sfsup"
MaskType "FIS"
MaskDescription "FIS"
MaskHelp "Fuzzy Inference System"
MaskPromptString "FIS Matrix:"
MaskStyleString "edit"
MaskTunableValueString "on"
MaskInitialization "fismatrix = @1;"
MaskDisplay "plot(0, -0.3, 6, -0.3, 0, 1.2, 6, 1.2, [0 6], ["
"0 0], [1 2 3],[0 1 0],[2 3 4],[0 1 0],[3 4 5],[0 1 0])"
MaskIconFrame on
MaskIconOpaque on
MaskIconRotate none
MaskIconUnits autoscale
MaskValueString "fismat"
}
Block {
BlockType Stop
Name "Stop\nsimulation"
Position [595, 19, 630, 51]
}
Block {
BlockType Switch
Name "Switch"
Position [69, 190, 101, 215]
Orientation up
Threshold "0"
MaskIconFrame on
MaskIconOpaque on
MaskIconRotate none
MaskIconUnits autoscale
}
Block {
BlockType SubSystem
Name "Truck\nKinematics"
Ports [1, 1, 0, 0, 0]
Position [290, 131, 340, 179]
ShowPortLabels off
MaskType "Truck Dynamics"
MaskDescription "Truck Dynamics"
MaskHelp "Truck dynamics"
MaskPromptString "Initial Conditions (x, y, phi):|Backup Speed:|t"
"ruck Length:"
MaskStyleString "edit,edit,edit"
MaskTunableValueString "on,on,on"
MaskInitialization "init_cond = @1; backup_speed = @2; truck_l = @3"
";"
MaskDisplay "plot(-3, -3, 3, 3,[-1 1 1 -1 -1],[-2 -2 2 2 -2]"
",[-1.1 -1.1],[-2 -1],[1.1 1.1],[-2 -1],[1.35 0.85],[1.93 1.07],[-0.85 -1.35],"
"[1.93 1.07])"
MaskIconFrame on
MaskIconOpaque on
MaskIconRotate none
MaskIconUnits autoscale
MaskValueString "TbuInitCond|backup_speed|truck_l"
System {
Name "Truck\nKinematics"
Location [338, 438, 876, 621]
Open off
ToolBar off
StatusBar off
ScreenColor white
PaperOrientation landscape
PaperPositionMode auto
PaperType usletter
PaperUnits inches
Block {
BlockType Inport
Name "in"
Position [20, 33, 40, 57]
Port "1"
PortWidth "-1"
SampleTime "-1"
}
Block {
BlockType Gain
Name "Gain1"
Position [310, 24, 340, 66]
Gain "-backup_speed"
}
Block {
BlockType Gain
Name "Gain2"
Position [310, 80, 340, 120]
Gain "-backup_speed"
}
Block {
BlockType Gain
Name "Gain3"
Position [140, 19, 175, 71]
Gain "-backup_speed/truck_l"
}
Block {
BlockType Mux
Name "Mux1"
Ports [3, 1, 0, 0, 0]
Position [440, 110, 465, 160]
Inputs "3"
}
Block {
BlockType Fcn
Name "cos"
Position [245, 29, 295, 61]
Expr "cos(u[1])"
}
Block {
BlockType Integrator
Name "phi"
Ports [1, 1, 0, 0, 0]
Position [190, 33, 210, 57]
ExternalReset none
InitialConditionSource internal
InitialCondition "init_cond(3)"
LimitOutput off
UpperSaturationLimit "inf"
LowerSaturationLimit "-inf"
ShowSaturationPort off
ShowStatePort off
AbsoluteTolerance "auto"
}
Block {
BlockType Fcn
Name "sin"
Position [245, 84, 295, 116]
Expr "sin(u[1])"
}
Block {
BlockType Fcn
Name "tan"
Position [75, 30, 115, 60]
Expr "tan(u[1])"
}
Block {
BlockType Integrator
Name "x"
Ports [1, 1, 0, 0, 0]
Position [360, 33, 380, 57]
ExternalReset none
InitialConditionSource internal
InitialCondition "init_cond(1)"
LimitOutput off
UpperSaturationLimit "inf"
LowerSaturationLimit "-inf"
ShowSaturationPort off
ShowStatePort off
AbsoluteTolerance "auto"
}
Block {
BlockType Integrator
Name "y"
Ports [1, 1, 0, 0, 0]
Position [360, 88, 380, 112]
ExternalReset none
InitialConditionSource internal
InitialCondition "init_cond(2)"
LimitOutput off
UpperSaturationLimit "inf"
LowerSaturationLimit "-inf"
ShowSaturationPort off
ShowStatePort off
AbsoluteTolerance "auto"
}
Block {
BlockType Outport
Name "out"
Position [495, 123, 515, 147]
Port "1"
OutputWhenDisabled held
InitialOutput "0"
}
Line {
SrcBlock "in"
SrcPort 1
DstBlock "tan"
DstPort 1
}
Line {
SrcBlock "phi"
SrcPort 1
Points [0, 0]
Branch {
DstBlock "cos"
DstPort 1
}
Branch {
Points [5, 0; 0, 55]
DstBlock "sin"
DstPort 1
}
Branch {
Points [5, 0; 0, 105]
DstBlock "Mux1"
DstPort 3
}
}
Line {
SrcBlock "cos"
SrcPort 1
DstBlock "Gain1"
DstPort 1
}
Line {
SrcBlock "Gain1"
SrcPort 1
DstBlock "x"
DstPort 1
}
Line {
SrcBlock "sin"
SrcPort 1
DstBlock "Gain2"
DstPort 1
}
Line {
SrcBlock "Gain2"
SrcPort 1
DstBlock "y"
DstPort 1
}
Line {
SrcBlock "tan"
SrcPort 1
DstBlock "Gain3"
DstPort 1
}
Line {
SrcBlock "Gain3"
SrcPort 1
DstBlock "phi"
DstPort 1
}
Line {
SrcBlock "Mux1"
SrcPort 1
DstBlock "out"
DstPort 1
}
Line {
SrcBlock "x"
SrcPort 1
Points [30, 0; 0, 75]
DstBlock "Mux1"
DstPort 1
}
Line {
SrcBlock "y"
SrcPort 1
Points [20, 0; 0, 35]
DstBlock "Mux1"
DstPort 2
}
}
}
Block {
BlockType Mux
Name "states &\ntheta"
Ports [2, 1, 0, 0, 0]
Position [450, 90, 480, 130]
Inputs "[3 1]"
}
Block {
BlockType Mux
Name "states &\ntheta1"
Ports [3, 1, 0, 0, 0]
Position [230, 270, 260, 310]
Orientation left
ShowName off
Inputs "3"
MaskIconFrame on
MaskIconOpaque on
MaskIconRotate none
MaskIconUnits autoscale
}
Block {
BlockType Fcn
Name "y<=0"
Position [520, 25, 560, 45]
Expr "u[2]<0"
}
Line {
SrcBlock "y<=0"
SrcPort 1
DstBlock "Stop\nsimulation"
DstPort 1
}
Line {
SrcBlock "Switch"
SrcPort 1
Points [0, 0]
Branch {
Points [0, -30]
DstBlock "Truck\nKinematics"
DstPort 1
}
Branch {
Points [0, -65]
DstBlock "states &\ntheta"
DstPort 2
}
}
Line {
SrcBlock "Truck\nKinematics"
SrcPort 1
Points [0, 0]
Branch {
Points [50, 0; 0, -55]
DstBlock "states &\ntheta"
DstPort 1
}
Branch {
Points [50, 0; 0, 70]
Branch {
DstBlock "Distance"
DstPort 1
}
Branch {
Points [0, 50]
Branch {
DstBlock "Controller 1"
DstPort 1
}
Branch {
Points [0, 50]
DstBlock "Controller 2"
DstPort 1
}
}
}
}
Line {
SrcBlock "Constant"
SrcPort 1
DstBlock "Switch"
DstPort 2
}
Line {
SrcBlock "states &\ntheta"
SrcPort 1
Points [10, 0]
Branch {
DstBlock " Animation &\nHuman Controller"
DstPort 1
}
Branch {
Points [0, -75]
DstBlock "y<=0"
DstPort 1
}
}
Line {
SrcBlock "Fuzzy Logic Controller"
SrcPort 1
Points [-65, 0]
DstBlock "Switch"
DstPort 1
}
Line {
SrcBlock " Animation &\nHuman Controller"
SrcPort 1
Points [10, 0; 0, 255; -505, 0]
DstBlock "Switch"
DstPort 3
}
Line {
SrcBlock "states &\ntheta1"
SrcPort 1
DstBlock "Fuzzy Logic Controller"
DstPort 1
}
Line {
SrcBlock "Distance"
SrcPort 1
Points [-40, 0; 0, 50]
DstBlock "states &\ntheta1"
DstPort 1
}
Line {
SrcBlock "Controller 1"
SrcPort 1
Points [-15, 0; 0, 15]
DstBlock "states &\ntheta1"
DstPort 2
}
Line {
SrcBlock "Controller 2"
SrcPort 1
Points [-15, 0; 0, -20]
DstBlock "states &\ntheta1"
DstPort 3
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -