📄 simu_modlib.mdl
字号:
DstPort 2
}
Line {
SrcBlock "Switch"
SrcPort 1
DstBlock "Integrator"
DstPort 1
}
Line {
SrcBlock "Inport"
SrcPort 1
Points [15, 0]
Branch {
Points [0, 150]
Branch {
Points [0, 165]
DstBlock "Relational\noperator3"
DstPort 1
}
Branch {
DstBlock "Relational\noperator2"
DstPort 1
}
}
Branch {
DstBlock "Switch"
DstPort 1
}
}
Line {
SrcBlock "Saturation"
SrcPort 1
DstBlock "Outport"
DstPort 1
}
}
}
Block {
BlockType Logic
Name "Logical\nOperator"
Ports [2, 1, 0, 0, 0]
Position [110, 198, 140, 222]
Operator AND
Inputs "2"
}
Block {
BlockType Lookup
Name "Look-Up\nTable"
Position [185, 138, 215, 162]
InputValues "[-4:5]"
OutputValues " rand(1,10)-0.5"
}
Block {
BlockType MATLABFcn
Name "MATLAB Fcn"
Position [170, 258, 230, 292]
MATLABFcn "sin"
OutputWidth "-1"
}
Block {
BlockType Memory
Name "Memory"
Position [25, 325, 65, 355]
X0 "0"
InheritSampleTime off
}
Block {
BlockType Product
Name "Product"
Ports [2, 1, 0, 0, 0]
Position [30, 138, 60, 162]
Inputs "2"
}
Block {
BlockType S-Function
Name "Quantizer"
Ports [1, 1, 0, 0, 0]
Position [30, 82, 60, 108]
FunctionName "quantize"
Parameters "q"
MaskType "Quantizer"
MaskDescription "Discretizes input at given interval."
MaskHelp "Quantizes input in given intervals. "
MaskPromptString "Quantization interval:"
MaskStyleString "edit"
MaskInitialization "q = @1;"
MaskDisplay "plot([-4,4],[0,0],[0,0],[-4,4],[-3,-2,-2,-1,"
"-1,0,0,1,1,2,2,3,3,4]-0.5,[-3,-3,-2,-2,-1,-1"
",0,0,1,1,2,2,3,3])"
MaskIconFrame on
MaskIconOpaque on
MaskIconRotate none
MaskIconUnits autoscale
MaskValueString "0.5"
}
Block {
BlockType RateLimiter
Name "Rate Limiter"
Position [260, 82, 290, 108]
RisingSlewLimit "1.0"
FallingSlewLimit "-1.0"
}
Block {
BlockType RelationalOperator
Name "Relational\nOperator"
Position [30, 198, 60, 222]
Operator >=
}
Block {
BlockType Relay
Name "Relay"
Position [110, 33, 140, 57]
OnSwitchValue "eps"
OffSwitchValue "eps"
OnOutputValue "1"
OffOutputValue "0"
}
Block {
BlockType ResetIntegrator
Name "Reset\nIntegrator"
Position [260, 260, 290, 290]
InitialCondition "15"
}
Block {
BlockType S-Function
Name "S-Function"
Ports [1, 1, 0, 0, 0]
Position [100, 265, 150, 285]
FunctionName "system"
}
Block {
BlockType Saturate
Name "Saturation"
Position [260, 33, 290, 57]
UpperLimit "0.5"
LowerLimit "-0.5"
}
Block {
BlockType SubSystem
Name "Sign"
Ports [1, 1, 0, 0, 0]
Position [30, 32, 60, 58]
ShowPortLabels off
MaskType "Sign"
MaskDescription "y = sign(x)"
MaskHelp "Sign Function:\\n\\t\\t\\ty = 1 if x "
"> 0\\n\\t\\t\\ty = 0 if x = 0\\n\\t\\t\\ty "
"= -1 if x < 0"
MaskDisplay "plot(-50,-50,50,50,[-50,50],[0,0],[0,0],[-50"
",50],[-40,0],[-30,-30],[0,40],[30,30])"
MaskIconFrame on
MaskIconOpaque on
MaskIconRotate none
MaskIconUnits autoscale
System {
Name "Sign"
Location [159, 417, 467, 586]
Open off
ScreenColor white
Block {
BlockType Inport
Name "in_1"
Position [35, 30, 55, 50]
Port "1"
PortWidth "-1"
SampleTime "-1"
}
Block {
BlockType Constant
Name "Constant"
Position [65, 105, 85, 125]
Value "0"
}
Block {
BlockType RelationalOperator
Name "Relational\nOperator"
Position [140, 32, 170, 63]
Operator >
}
Block {
BlockType RelationalOperator
Name "Relational\nOperator1"
Position [140, 92, 170, 123]
Operator <
}
Block {
BlockType Sum
Name "Sum"
Ports [2, 1, 0, 0, 0]
Position [215, 64, 235, 91]
Inputs "+-"
}
Block {
BlockType Outport
Name "out_1"
Position [265, 70, 285, 90]
Port "1"
OutputWhenDisabled held
InitialOutput "0"
}
Line {
SrcBlock "Sum"
SrcPort 1
DstBlock "out_1"
DstPort 1
}
Line {
SrcBlock "Relational\nOperator"
SrcPort 1
Points [10, 0; 0, 20]
DstBlock "Sum"
DstPort 1
}
Line {
SrcBlock "Relational\nOperator1"
SrcPort 1
Points [10, 0; 0, -25]
DstBlock "Sum"
DstPort 2
}
Line {
SrcBlock "Constant"
SrcPort 1
Points [20, 0]
Branch {
Points [0, -60]
DstBlock "Relational\nOperator"
DstPort 2
}
Branch {
DstBlock "Relational\nOperator1"
DstPort 2
}
}
Line {
SrcBlock "in_1"
SrcPort 1
Points [35, 0]
Branch {
Points [0, 60]
DstBlock "Relational\nOperator1"
DstPort 1
}
Branch {
DstBlock "Relational\nOperator"
DstPort 1
}
}
}
}
Block {
BlockType Switch
Name "Switch"
Position [260, 199, 290, 231]
Threshold "0"
}
Block {
BlockType TransportDelay
Name "Transport\nDelay"
Position [105, 325, 145, 355]
DelayTime "1"
InitialInput "0"
BufferSize "1024"
}
Block {
BlockType VariableTransportDelay
Name "Variable\nTransport Delay"
Position [180, 327, 220, 358]
MaximumDelay "10"
InitialInput "0"
MaximumPoints "1024"
}
Annotation {
Position [162, 8]
VerticalAlignment top
Text "Nonlinear Library"
}
}
}
Block {
BlockType Gain
Name "Gain"
Position [115, 17, 140, 43]
FontName "Times New Roman"
FontSize 8
Gain "1"
}
Block {
BlockType Integrator
Name "Integrator"
Ports [1, 1, 0, 0, 0]
Position [70, 15, 90, 35]
FontName "Times New Roman"
FontSize 8
ExternalReset none
InitialConditionSource internal
InitialCondition "0"
LimitOutput off
UpperSaturationLimit "inf"
LowerSaturationLimit "-inf"
ShowSaturationPort off
ShowStatePort off
AbsoluteTolerance "auto"
}
Block {
BlockType SubSystem
Name "Nonlinear"
Ports [0, 0, 0, 0, 0]
Position [20, 165, 55, 216]
FontName "Times New Roman"
FontSize 8
ShowPortLabels off
System {
Name "Nonlinear"
Location [104, 131, 548, 390]
Open off
ScreenColor white
Block {
BlockType SubSystem
Name "2-D Look-Up\nTable"
Ports [2, 1, 0, 0, 0]
Position [270, 78, 300, 102]
ShowPortLabels off
MaskType "2-D Table Lookup"
MaskDescription "Two Dimensional Table Lookup\nThe first "
"input corresponds to X Index and the "
"second input corresponds to the Y Index"
MaskHelp "This block returns a linearly interpolated "
"intersection from the table using the "
"X index (which corresponds to the rows "
"of the table) and the Y index (which "
"corresponds to the columns of the table). "
"Extrapolation is used."
MaskPromptString "X Index|Y Index|Table"
MaskStyleString "edit,edit,edit"
MaskInitialization "xindex=@1; yindex=@2; table=@3; sftab2chk(xi"
"ndex,yindex,table);"
MaskDisplay "plot(-10,-10,110,110,[90,50,10],[90,40,30],["
"90,50,10],[50,26,20],[90,50,10],[22,13,10])"
MaskIconFrame on
MaskIconOpaque on
MaskIconRotate none
MaskIconUnits autoscale
MaskValueString "sort(rand(10,1))*2-1|sort(rand(10,1))*2-1|ma"
"gic(10)-50"
System {
Name "2-D Look-Up\nTable"
Location [316, 263, 598, 417]
Open off
ScreenColor white
Block {
BlockType Inport
Name "x0"
Position [20, 25, 40, 45]
Port "1"
PortWidth "-1"
SampleTime "-1"
}
Block {
BlockType Inport
Name "y0"
Position [20, 80, 40, 100]
Port "2"
PortWidth "-1"
SampleTime "-1"
}
Block {
BlockType Mux
Name "Mux"
Ports [2, 1, 0, 0, 0]
Position [90, 46, 120, 79]
Inputs "2"
}
Block {
BlockType S-Function
Name "S-function"
Ports [1, 1, 0, 0, 0]
Position [140, 52, 190, 78]
FunctionName "sftable2"
Parameters "xindex, yindex, table"
}
Block {
BlockType Outport
Name "table out"
Position [215, 55, 235, 75]
Port "1"
OutputWhenDisabled held
InitialOutput "0"
}
Line {
SrcBlock "Mux"
SrcPort 1
DstBlock "S-function"
DstPort 1
}
Line {
SrcBlock "x0"
SrcPort 1
Points [20, 0; 0, 20]
DstBlock "Mux"
DstPort 1
}
Line {
SrcBlock "S-function"
SrcPort 1
DstBlock "table out"
DstPort 1
}
Line {
SrcBlock "y0"
SrcPort 1
Points [20, 0; 0, -20]
DstBlock "Mux"
DstPort 2
}
}
}
Block {
BlockType Abs
Name "Abs"
Position [145, 88, 175, 112]
}
Block {
BlockType Backlash
Name "Backlash"
Position [145, 33, 175, 57]
BacklashWidth "1"
InitialOutput "0"
}
Block {
BlockType CombinatorialLogic
Name "Combinatorial\nLogic"
Position [100, 148, 130, 172]
TruthTable "[0 0;0 1;0 1;1 0;0 1;1 0;1 0;1 1]"
}
Block {
BlockType Lookup
Name "Coulombic\nFriction"
Position [390, 32, 420, 58]
InputValues "[-1,0,0,1]"
OutputValues "[-gain-ini -ini ini gain+ini]"
MaskType "Coulombic Friction"
MaskDescription "Coulombic Friction\ny = sign(x) * (Gain "
"* abs(x) + Offset)"
MaskHelp "This block has a discontinuity\\nat zero "
"and a linear gain afterward.\\ny= sign(x)*(G"
"ain*abs(x)+Offset)"
MaskPromptString "Offset discontinuity at zero:|Gain:"
MaskStyleString "edit,edit"
MaskInitialization "ini=@1;gain=@2;x=max(ini,gain+ini);"
MaskDisplay "plot([-1 0 0 1],[-gain-ini, -ini, ini, "
"gain+ini],[-1 1],[0 0],[0 0],[-x,x])"
MaskIconFrame on
MaskIconOpaque on
MaskIconRotate none
MaskIconUnits autoscale
MaskValueString "1|1"
}
Block {
BlockType DeadZone
Name "Dead Zone"
Position [325, 32, 355, 58]
LowerValue "-0.5"
UpperValue "0.5"
}
Block {
BlockType Fcn
Name "Fcn"
Position [385, 95, 425, 115]
Expr "sin(u[1])"
}
Block {
BlockType SubSystem
Name "Limited\nIntegrator"
Ports [1, 1, 0, 0, 0]
Position [270, 215, 310, 245]
ShowPortLabels off
MaskType "Limited Integrator."
MaskDescription "Limited Integrator"
MaskHelp "Implements a limited integrator with "
"\\nan expression of the form:\\n\\nif(x<=lb "
"and u<0) or (x>=ub and u>0)\\n xdot=0\\nel"
"se\\n xdot=u"
MaskPromptString "Lower bound:|Upper bound:|Initial condition:"
MaskStyleString "edit,edit,edit"
MaskInitialization "lower_limit=@1;upper_limit=@2;X0=@3;"
MaskDisplay "plot(-1,-0.2,3.5,1.2,[0.05,1,2,2.9],[0,0,1,1"
"]);disp(' 1/s ')"
MaskIconFrame on
MaskIconOpaque on
MaskIconRotate none
MaskIconUnits autoscale
MaskValueString "-.5|.5|0"
System {
Name "Limited\nIntegrator"
Location [452, 229, 1117, 789]
Open off
ScreenColor white
Block {
BlockType Inport
Name "Inport"
Position [25, 85, 45, 105]
Port "1"
PortWidth "-1"
SampleTime "-1"
}
Block {
BlockType Constant
Name "Constant"
Position [325, 179, 395, 201]
ShowName off
Value "upper_limit"
}
Block {
BlockType Constant
Name "Constant1"
Position [325, 345, 390, 365]
ShowName off
Value "lower_limit"
}
Block {
BlockType Constant
Name "Constant2"
Position [20, 135, 40, 155]
Value "0"
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -