| Using Simulink | |
サンプルのモデルファイル
このモデルファイルは、第7章で記載したマスキングを説明するサンプルシステムについて記述しています。モデルとサブシステムは、つぎのとおりです。

モデルファイル mask_example.mdl はつぎのようになります。
Model {
Name "slopeintercept"
Version 3.00
SimParamPage "Solver"
SampleTimeColors off
InvariantConstants off
WideVectorLines off
ShowLineWidths off
ShowPortDataTypes off
StartTime "0.0"
StopTime "10.0"
SolverMode "Auto"
Solver "ode45"
RelTol "1e-3"
AbsTol "auto"
Refine "1"
MaxStep "auto"
InitialStep "auto"
FixedStep "auto"
MaxOrder 5
OutputOption "RefineOutputTimes"
OutputTimes "[]"
LoadExternalInput off
ExternalInput "[t, u]"
SaveTime on
TimeSaveName "tout"
SaveState off
StateSaveName "xout"
SaveOutput on
OutputSaveName "yout"
LoadInitialState off
InitialState "xInitial"
SaveFinalState off
FinalStateName "xFinal"
SaveFormat "Matrix"
LimitMaxRows off
MaxRows "1000"
Decimation "1"
AlgebraicLoopMsg "warning"
MinStepSizeMsg "warning"
UnconnectedInputMsg "warning"
UnconnectedOutputMsg "warning"
UnconnectedLineMsg "warning"
InheritedTsInSrcMsg "warning"
IntegerOverflowMsg "none"
UnnecessaryDatatypeConvMsg "none"
Int32ToFloatConvMsg "warning"
SignalLabelMismatchMsg "none"
ConsistencyChecking "off"
ZeroCross on
SimulationMode "normal"
BlockDataTips on
BlockParametersDataTip on
BlockAttributesDataTip off
BlockPortWidthsDataTip off
BlockDescriptionStringDataTipoff
BlockMaskParametersDataTip off
ToolBar on
StatusBar on
BrowserShowLibraryLinks off
BrowserLookUnderMasks off
OptimizeBlockIOStorage on
BufferReuse on
BooleanDataType off
RTWSystemTargetFile "grt.tlc"
RTWInlineParameters off
RTWRetainRTWFile off
RTWTemplateMakefile "grt_default_tmf"
RTWMakeCommand "make_rtw"
RTWGenerateCodeOnly off
ExtModeMexFile "ext_comm"
ExtModeBatchMode off
ExtModeTrigType "manual"
ExtModeTrigMode "oneshot"
ExtModeTrigPort "1"
ExtModeTrigElement "any"
ExtModeTrigDuration 1000
ExtModeTrigHoldOff 0
ExtModeTrigDelay 0
ExtModeTrigDirection "rising"
ExtModeTrigLevel 0
ExtModeArchiveMode "off"
ExtModeAutoIncOneShot off
ExtModeIncDirWhenArm off
ExtModeAddSuffixToVar off
ExtModeWriteAllDataToWs off
ExtModeArmWhenConnect off
Created "Tue Jul 28 15:18:08 1998"
Creator "JoeSchmo"
UpdateHistory "UpdateHistoryNever"
ModifiedByFormat "%<Auto>"
LastModifiedBy "MoeSchmo"
ModifiedDateFormat "%<Auto>"
LastModifiedDate "Fri Oct 30 15:17:59 1998"
ModelVersionFormat "1.%<AutoIncrement:4>"
ConfigurationManager "none"
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 "slopeintercept"
Location [629, 86, 984, 341]
Open on
ModelBrowserVisibility off
ModelBrowserWidth 200
ScreenColor "automatic"
PaperOrientation "landscape"
PaperPositionMode "auto"
PaperType "usletter"
PaperUnits "inches"
ZoomFactor "100"
AutoZoom on
ReportName "simulink-default.rpt"
Block {
BlockType Scope
Name "Scope"
Ports [1, 0, 0, 0, 0]
Position [205, 79, 235, 111]
Floating off
Location [188, 365, 512, 604]
Open off
NumInputPorts "1"
TickLabels "OneTimeTick"
ZoomMode "on"
List {
ListTypeAxesTitles
axes1 "%<SignalLabel>"
}
Grid "on"
TimeRange "auto"
YMin "-5"
YMax "5"
SaveToWorkspace off
SaveName "ScopeData"
DataFormat "StructureWithTime"
LimitMaxRows on
MaxRows "5000"
Decimation "1"
SampleInput off
SampleTime "0"
}
Block {
BlockType Sin
Name "Sine Wave"
Position [35, 80, 65, 110]
Amplitude "1"
Frequency "1"
Phase "0"
SampleTime "0"
}
Block {
BlockType ToWorkspace
Name "To Workspace"
Position [200, 150, 260, 180]
VariableName "simout"
Buffer "inf"
Decimation "1"
SampleTime "-1"
SaveFormat "Structure"
}
Block {
BlockType SubSystem
Name "mx + b"
Ports [1, 1, 0, 0, 0]
Position [105, 80, 135, 110]
ShowPortLabels on
MaskType "SampleMaskedBlock"
MaskDescription "Models the equation for a line, y =
mx + b.\nTh"
"e slope and intercept are mask block parameters."
MaskHelp "Enter the slope (m) and intercept (b) in the
bl"
"ock dialog parameter fields.\nThe block generates y for a given
input x."
MaskPromptString "Slope:|Intercept:"
MaskStyleString "edit,edit"
MaskTunableValueString "on,on"
MaskCallbackString "|"
MaskEnableString "on,on"
MaskVisibilityString "on,on"
MaskVariables "m=@1;b=@2;"
MaskDisplay "plot([0 1],[0 m] + (m<0))"
MaskIconFrame on
MaskIconOpaque on
MaskIconRotate "none"
MaskIconUnits "normalized"
MaskValueString " 4|2"
System {
Name "mx + b"
Location[175, 110, 504, 342]
Open off
ModelBrowserVisibilityoff
ModelBrowserWidth200
ScreenColor"white"
PaperOrientation"landscape"
PaperPositionMode"auto"
PaperType"usletter"
PaperUnits"inches"
ZoomFactor"100"
AutoZoomon
Block {
BlockType Inport
Name "x"
Position [15, 68, 45, 82]
Port "1"
PortWidth "-1"
SampleTime "-1"
DataType "auto"
SignalType "auto"
Interpolate on
}
Block {
BlockType Constant
Name "Intercept"
Position [145, 130, 175, 160]
Orientation "up"
Value "b"
}
Block {
BlockType Gain
Name "Slope"
Position [80, 60, 110, 90]
Gain "m"
SaturateOnIntegerOverflow on
}
Block {
BlockType Sum
Name "Sum"
Ports [2, 1, 0, 0, 0]
Position [145, 60, 175, 90]
NamePlacement "alternate"
IconShape "round"
Inputs "|++"
SaturateOnIntegerOverflow on
}
Block {
BlockType Outport
Name "y"
Position [225, 68, 255, 82]
Port "1"
OutputWhenDisabled "held"
InitialOutput "[]"
}
Line {
SrcBlock "Intercept"
SrcPort 1
DstBlock "Sum"
DstPort 2
}
Line {
SrcBlock "Sum"
SrcPort 1
DstBlock "y"
DstPort 1
}
Line {
SrcBlock "x"
SrcPort 1
DstBlock "Slope"
DstPort 1
}
Line {
SrcBlock "Slope"
SrcPort 1
DstBlock "Sum"
DstPort 1
}
}
}
Line {
SrcBlock "Sine Wave"
SrcPort 1
DstBlock "mx + b"
DstPort 1
}
Line {
SrcBlock "mx + b"
SrcPort 1
Points [25, 0]
Branch {
DstBlock"Scope"
DstPort 1
}
Branch {
Points [0, 70]
DstBlock"To Workspace"
DstPort 1
}
}
Annotation {
Position [135, 27]
Text "Sample Masked Subsystem"
}
}
}
![]() | Systemセクション |