📄 sim42.mdl
字号:
SamplingMode "auto"
OutputWhenDisabled "held"
InitialOutput "[]"
}
Block {
BlockType Scope
Floating off
ModelBased off
TickLabels "OneTimeTick"
ZoomMode "on"
Grid "on"
TimeRange "auto"
YMin "-5"
YMax "5"
SaveToWorkspace off
SaveName "ScopeData"
LimitDataPoints on
MaxDataPoints "5000"
Decimation "1"
SampleInput off
SampleTime "0"
}
Block {
BlockType "S-Function"
FunctionName "system"
PortCounts "[]"
SFunctionModules "''"
}
Block {
BlockType Sin
SineType "Time based"
TimeSource "Use simulation time"
Amplitude "1"
Bias "0"
Frequency "1"
Phase "0"
Samples "10"
Offset "0"
SampleTime "-1"
VectorParams1D on
}
Block {
BlockType SubSystem
ShowPortLabels on
Permissions "ReadWrite"
PermitHierarchicalResolution "All"
SystemSampleTime "-1"
RTWFcnNameOpts "Auto"
RTWFileNameOpts "Auto"
SimViewingDevice off
DataTypeOverride "UseLocalSettings"
MinMaxOverflowLogging "UseLocalSettings"
}
Block {
BlockType Sum
IconShape "rectangular"
Inputs "++"
InputSameDT on
OutDataTypeMode "Same as first input"
OutDataType "sfix(16)"
OutScaling "2^0"
LockScale off
RndMeth "Floor"
SaturateOnIntegerOverflow on
SampleTime "-1"
}
}
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 "Sim42"
Location [0, 74, 1012, 743]
Open on
ModelBrowserVisibility off
ModelBrowserWidth 200
ScreenColor "white"
PaperOrientation "landscape"
PaperPositionMode "auto"
PaperType "usletter"
PaperUnits "inches"
ZoomFactor "100"
ReportName "simulink-default.rpt"
Block {
BlockType DataTypeConversion
Name "Data Type Conversion"
Position [210, 181, 265, 209]
BackgroundColor "[0.000000, 1.000000, 0.250980]"
OutDataTypeMode "boolean"
}
Block {
BlockType DiscretePulseGenerator
Name "Discrete Pulse\nGenerator"
Ports [0, 1]
Position [120, 171, 165, 219]
BackgroundColor "[0.501961, 0.000000, 1.000000]"
ShowName off
FontName "Arial"
FontSize 12
SampleTime "5"
}
Block {
BlockType Logic
Name "Logical\nOperator"
Ports [1, 1]
Position [307, 265, 353, 295]
Orientation "down"
BackgroundColor "[0.000000, 1.000000, 0.250980]"
NamePlacement "alternate"
ShowName off
FontName "Arial"
FontSize 12
Operator "NOT"
Inputs "1"
}
Block {
BlockType Merge
Name "Merge"
Ports [2, 1]
Position [495, 209, 585, 276]
BackgroundColor "[0.000000, 1.000000, 0.250980]"
ShowName off
FontName "Arial"
FontSize 12
}
Block {
BlockType SubSystem
Name "Repeating\nSequence"
Ports [0, 1]
Position [155, 348, 210, 392]
BackgroundColor "[0.501961, 0.000000, 1.000000]"
ShowName off
AncestorBlock "simulink/Sources/Repeating\nSequence"
FontName "Arial"
FontSize 12
TreatAsAtomicUnit off
MinAlgLoopOccurrences off
RTWSystemCode "Auto"
MaskType "Repeating table"
MaskDescription "Output a repeating sequence of numbers specifie"
"d in a table of time-value pairs. Values of time should be monotonically incr"
"easing."
MaskHelp "Repeats cycle given in table. Time values shoul"
"d be monotonically increasing."
MaskPromptString "Time values:|Output values:"
MaskStyleString "edit,edit"
MaskTunableValueString "on,on"
MaskCallbackString "|"
MaskEnableString "on,on"
MaskVisibilityString "on,on"
MaskToolTipString "on,on"
MaskVarAliasString ","
MaskVariables "rep_seq_t=@1;rep_seq_y=@2;"
MaskInitialization "if (length(rep_seq_t) ~= length(rep_seq_y)),\n "
" error('Length of time vector and output vector must be the same.')\nend\nper"
"iod = max(rep_seq_t) - min(rep_seq_t);\ns = round(length(rep_seq_t)/50);\nif "
"s > 0\n pts = [1:s:length(rep_seq_t)];\n L = length(pts);\nelse\n L = "
"length(rep_seq_t);\n pts = [1:L];\nend\n\ndisp_seq_t = reshape(rep_seq_t(pts"
"),L,1);\ndisp_seq_y = reshape(rep_seq_y(pts),L,1);\ndisp_period = max(disp_se"
"q_t) - min(disp_seq_t);\n\ndisp_seq_t = repmat(disp_seq_t,1,3) + (ones(L,1)*"
"(disp_period*[0,1,2]));\ndisp_seq_t = [ disp_seq_t(:); disp_seq_t(end) ];\ndi"
"sp_seq_y = repmat(disp_seq_y,1,3);\ndisp_seq_y = [ disp_seq_y(:); disp_seq_y("
"1) ];\n"
MaskDisplay "plot( disp_seq_t, disp_seq_y )"
MaskIconFrame on
MaskIconOpaque on
MaskIconRotate "none"
MaskIconUnits "autoscale"
MaskValueString "[0 1]|[0 2]"
MaskTabNameString ","
System {
Name "Repeating\nSequence"
Location [2, 82, 1014, 721]
Open off
ModelBrowserVisibility off
ModelBrowserWidth 200
ScreenColor "white"
PaperOrientation "landscape"
PaperPositionMode "auto"
PaperType "A4"
PaperUnits "centimeters"
ZoomFactor "100"
Block {
BlockType Clock
Name "Clock"
Position [50, 110, 80, 140]
BackgroundColor "lightBlue"
ShowName off
DisableCoverage on
Decimation "10"
}
Block {
BlockType Fcn
Name "Fcn1"
Position [250, 131, 345, 159]
BackgroundColor "[0.501961, 0.000000, 1.000000]"
DisableCoverage on
Expr "rem(u[1],period)"
}
Block {
BlockType Lookup
Name "Look-Up Table1"
Position [380, 127, 430, 163]
BackgroundColor "magenta"
DisableCoverage on
DialogController "Simulink.DDGSource"
InputValues "rep_seq_t - min(rep_seq_t)"
OutputValues "rep_seq_y"
}
Block {
BlockType SignalConversion
Name "Output"
Position [480, 113, 525, 177]
BackgroundColor "magenta"
ConversionOutput "Contiguous copy"
}
Block {
BlockType Sum
Name "Sum"
Ports [2, 1]
Position [190, 106, 220, 179]
BackgroundColor "green"
ShowName off
DisableCoverage on
Inputs "+-"
}
Block {
BlockType "S-Function"
Name "startTime"
Ports [0, 1]
Position [90, 147, 160, 173]
BackgroundColor "[0.501961, 0.000000, 1.000000]"
DisableCoverage on
FunctionName "sfun_tstart"
}
Block {
BlockType Outport
Name "Out1"
Position [610, 130, 640, 160]
BackgroundColor "lightBlue"
IconDisplay "Port number"
BusOutputAsStruct off
}
Line {
SrcBlock "Output"
SrcPort 1
DstBlock "Out1"
DstPort 1
}
Line {
SrcBlock "Look-Up Table1"
SrcPort 1
DstBlock "Output"
DstPort 1
}
Line {
SrcBlock "startTime"
SrcPort 1
DstBlock "Sum"
DstPort 2
}
Line {
SrcBlock "Clock"
SrcPort 1
DstBlock "Sum"
DstPort 1
}
Line {
SrcBlock "Sum"
SrcPort 1
DstBlock "Fcn1"
DstPort 1
}
Line {
SrcBlock "Fcn1"
SrcPort 1
DstBlock "Look-Up Table1"
DstPort 1
}
}
}
Block {
BlockType Scope
Name "Scope"
Ports [1]
Position [660, 218, 710, 272]
BackgroundColor "[1.000000, 0.501961, 0.752941]"
FontName "Arial"
FontSize 12
Location [15, 229, 906, 528]
Open off
NumInputPorts "1"
TickLabels "on"
List {
ListType AxesTitles
axes1 "%<SignalLabel>"
}
TimeRange "20"
YMin "-1.5"
YMax "2"
DataFormat "Array"
}
Block {
BlockType Sin
Name "Sine Wave"
Ports [0, 1]
Position [155, 77, 210, 123]
BackgroundColor "[0.501961, 0.000000, 1.000000]"
ShowName off
FontName "Arial"
FontSize 12
SineType "Time based"
Frequency "pi"
SampleTime "0"
}
Block {
BlockType SubSystem
Name "Subsystem"
Tag "MergeExample"
Ports [1, 1, 1]
Position [300, 71, 365, 129]
NamePlacement "alternate"
ShowName off
FontName "Arial"
FontSize 12
TreatAsAtomicUnit on
MinAlgLoopOccurrences off
RTWSystemCode "Auto"
System {
Name "Subsystem"
Location [62, 367, 492, 557]
Open off
ModelBrowserVisibility off
ModelBrowserWidth 200
ScreenColor "white"
PaperOrientation "landscape"
PaperPositionMode "auto"
PaperType "usletter"
PaperUnits "inches"
ZoomFactor "100"
Block {
BlockType Inport
Name "U"
Position [70, 103, 100, 117]
Port "1"
IconDisplay "Port number"
LatchInput off
}
Block {
BlockType EnablePort
Name "Enable"
Ports []
Position [115, 25, 161, 60]
BackgroundColor "magenta"
StatesWhenEnabling "reset"
}
Block {
BlockType "S-Function"
Name "S-Function"
Ports []
Position [225, 30, 285, 60]
BackgroundColor "[0.501961, 0.000000, 1.000000]"
FunctionName "mergefcn"
}
Block {
BlockType Outport
Name "Y"
Position [230, 103, 260, 117]
IconDisplay "Port number"
BusOutputAsStruct off
}
Line {
SrcBlock "U"
SrcPort 1
DstBlock "Y"
DstPort 1
}
}
}
Block {
BlockType SubSystem
Name "Subsystem1"
Tag "MergeExample"
Ports [1, 1, 1]
Position [300, 343, 365, 397]
ShowName off
FontName "Arial"
FontSize 12
TreatAsAtomicUnit on
MinAlgLoopOccurrences off
RTWSystemCode "Auto"
System {
Name "Subsystem1"
Location [97, 540, 456, 710]
Open off
ModelBrowserVisibility off
ModelBrowserWidth 200
ScreenColor "white"
PaperOrientation "landscape"
PaperPositionMode "auto"
PaperType "usletter"
PaperUnits "inches"
ZoomFactor "100"
Block {
BlockType Inport
Name "U"
Position [70, 103, 100, 117]
Port "1"
IconDisplay "Port number"
LatchInput off
}
Block {
BlockType EnablePort
Name "Enable"
Ports []
Position [145, 25, 191, 60]
StatesWhenEnabling "reset"
}
Block {
BlockType "S-Function"
Name "S-Function"
Ports []
Position [235, 25, 295, 55]
FunctionName "mergefcn"
}
Block {
BlockType Outport
Name "Y"
Position [230, 103, 260, 117]
IconDisplay "Port number"
BusOutputAsStruct off
}
Line {
SrcBlock "U"
SrcPort 1
DstBlock "Y"
DstPort 1
}
}
}
Line {
SrcBlock "Sine Wave"
SrcPort 1
DstBlock "Subsystem"
DstPort 1
}
Line {
SrcBlock "Subsystem"
SrcPort 1
Points [35, 0; 0, 125]
DstBlock "Merge"
DstPort 1
}
Line {
SrcBlock "Subsystem1"
SrcPort 1
Points [35, 0; 0, -110]
DstBlock "Merge"
DstPort 2
}
Line {
SrcBlock "Logical\nOperator"
SrcPort 1
DstBlock "Subsystem1"
DstPort enable
}
Line {
SrcBlock "Discrete Pulse\nGenerator"
SrcPort 1
DstBlock "Data Type Conversion"
DstPort 1
}
Line {
SrcBlock "Repeating\nSequence"
SrcPort 1
DstBlock "Subsystem1"
DstPort 1
}
Line {
SrcBlock "Merge"
SrcPort 1
DstBlock "Scope"
DstPort 1
}
Line {
SrcBlock "Data Type Conversion"
SrcPort 1
Points [10, 0; 50, 0]
Branch {
DstBlock "Logical\nOperator"
DstPort 1
}
Branch {
DstBlock "Subsystem"
DstPort enable
}
}
Annotation {
Position [555, 323]
}
Annotation {
Position [483, 587]
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -