⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gear_test.mdl

📁 这是关于matlab stateflow的源码例子
💻 MDL
📖 第 1 页 / 共 2 页
字号:
Model {
  Name			  "gear_test"
  Version		  4.00
  SampleTimeColors	  off
  LibraryLinkDisplay	  "none"
  WideLines		  off
  ShowLineDimensions	  off
  ShowPortDataTypes	  off
  ShowStorageClass	  off
  ExecutionOrder	  off
  RecordCoverage	  off
  CovPath		  "/"
  CovSaveName		  "covdata"
  CovMetricSettings	  "dw"
  CovNameIncrementing	  off
  CovHtmlReporting	  on
  BlockNameDataTip	  off
  BlockParametersDataTip  off
  BlockDescriptionStringDataTip	off
  ToolBar		  on
  StatusBar		  on
  BrowserShowLibraryLinks off
  BrowserLookUnderMasks	  off
  Created		  "Thu Mar 20 16:42:42 2003"
  UpdateHistory		  "UpdateHistoryNever"
  ModifiedByFormat	  "%<Auto>"
  LastModifiedBy	  "wyh"
  ModifiedDateFormat	  "%<Auto>"
  LastModifiedDate	  "Thu Mar 20 22:07:56 2003"
  ModelVersionFormat	  "1.%<AutoIncrement:14>"
  ConfigurationManager	  "None"
  SimParamPage		  "Solver"
  StartTime		  "0.0"
  StopTime		  "inf"
  SolverMode		  "Auto"
  Solver		  "ode45"
  RelTol		  "1e-3"
  AbsTol		  "auto"
  Refine		  "1"
  MaxStep		  "auto"
  MinStep		  "auto"
  MaxNumMinSteps	  "-1"
  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		  "Array"
  LimitDataPoints	  on
  MaxDataPoints		  "1000"
  Decimation		  "1"
  AlgebraicLoopMsg	  "warning"
  MinStepSizeMsg	  "warning"
  UnconnectedInputMsg	  "warning"
  UnconnectedOutputMsg	  "warning"
  UnconnectedLineMsg	  "warning"
  InheritedTsInSrcMsg	  "warning"
  SingleTaskRateTransMsg  "none"
  MultiTaskRateTransMsg	  "error"
  IntegerOverflowMsg	  "warning"
  CheckForMatrixSingularity "none"
  UnnecessaryDatatypeConvMsg "none"
  Int32ToFloatConvMsg	  "warning"
  InvalidFcnCallConnMsg	  "error"
  SignalLabelMismatchMsg  "none"
  LinearizationMsg	  "none"
  VectorMatrixConversionMsg "none"
  SfunCompatibilityCheckMsg "none"
  BlockPriorityViolationMsg "warning"
  ArrayBoundsChecking	  "none"
  ConsistencyChecking	  "none"
  ZeroCross		  on
  Profile		  off
  SimulationMode	  "normal"
  RTWSystemTargetFile	  "grt.tlc"
  RTWOptions		  "-aEnforceIntegerDowncast=1 -aExtMode=0 -aFoldNonRol"
"ledExpr=1 -aForceParamTrailComments=0 -aGenerateComments=1 -aIgnoreCustomStor"
"ageClasses=1 -aIncHierarchyInIds=0 -aInlineInvariantSignals=0 -aLocalBlockOut"
"puts=1 -aLogVarNameModifier=\"rt_\" -aRTWVerbose=1 -aRollThreshold=5 -aShowEl"
"iminatedStatements=1"
  RTWInlineParameters	  off
  RTWRetainRTWFile	  off
  RTWTemplateMakefile	  "grt_default_tmf"
  RTWMakeCommand	  "make_rtw"
  RTWGenerateCodeOnly	  off
  TLCProfiler		  off
  TLCDebug		  off
  TLCCoverage		  off
  AccelSystemTargetFile	  "accel.tlc"
  AccelTemplateMakefile	  "accel_default_tmf"
  AccelMakeCommand	  "make_rtw"
  TryForcingSFcnDF	  off
  ExtModeMexFile	  "ext_comm"
  ExtModeBatchMode	  off
  ExtModeTrigType	  "manual"
  ExtModeTrigMode	  "normal"
  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	  on
  ExtModeSkipDownloadWhenConnect off
  ExtModeLogAll		  on
  ExtModeAutoUpdateStatusClock on
  OptimizeBlockIOStorage  on
  BufferReuse		  on
  ParameterPooling	  on
  BlockReductionOpt	  on
  RTWExpressionDepthLimit 5
  BooleanDataType	  off
  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		    "gear_test"
    Location		    [328, 190, 836, 595]
    Open		    on
    ModelBrowserVisibility  off
    ModelBrowserWidth	    200
    ScreenColor		    "automatic"
    PaperOrientation	    "landscape"
    PaperPositionMode	    "auto"
    PaperType		    "A4"
    PaperUnits		    "centimeters"
    ZoomFactor		    "100"
    ReportName		    "simulink-default.rpt"
    Block {
      BlockType		      SubSystem
      Name		      "Chart"
      Ports		      [0, 2, 0, 1]
      Position		      [255, 91, 345, 164]
      ShowPortLabels	      off
      TreatAsAtomicUnit	      on
      RTWSystemCode	      "Auto"
      RTWFcnNameOpts	      "Auto"
      RTWFileNameOpts	      "Auto"
      MaskType		      "Stateflow"
      MaskDescription	      "Stateflow diagram"
      MaskDisplay	      "plot(sf('Private','sfblk','xIcon'),sf('Private'"
",'sfblk','yIcon'));text(0.5,0,sf('Private', 'sfblk', 'tIcon'),'HorizontalAl',"
"'Center','VerticalAl','Bottom');"
      MaskSelfModifiable      on
      MaskIconFrame	      off
      MaskIconOpaque	      off
      MaskIconRotate	      "none"
      MaskIconUnits	      "autoscale"
      System {
	Name			"Chart"
	Location		[257, 457, 812, 717]
	Open			off
	ModelBrowserVisibility	off
	ModelBrowserWidth	200
	ScreenColor		"white"
	PaperOrientation	"landscape"
	PaperPositionMode	"auto"
	PaperType		"A4"
	PaperUnits		"centimeters"
	ZoomFactor		"100"
	Block {
	  BlockType		  TriggerPort
	  Name			  " input events "
	  Ports			  [0, 1]
	  Position		  [20, 101, 40, 119]
	  TriggerType		  "either"
	  ShowOutputPort	  on
	  OutputDataType	  "auto"
	}
	Block {
	  BlockType		  Demux
	  Name			  " Demux "
	  Ports			  [1, 1]
	  Position		  [270, 180, 320, 220]
	  Outputs		  "1"
	  BusSelectionMode	  off
	}
	Block {
	  BlockType		  "S-Function"
	  Name			  " SFunction "
	  Tag			  "Stateflow S-Function gear_test 1"
	  Ports			  [1, 3]
	  Position		  [180, 100, 230, 180]
	  FunctionName		  "sf_sfun"
	  PortCounts		  "[1 3]"
	  SFunctionModules	  "''"
	  Port {
	    PortNumber		    2
	    Name		    "ig"
	    TestPoint		    off
	    LinearAnalysisOutput    off
	    LinearAnalysisInput	    off
	    RTWStorageClass	    "Auto"
	  }
	  Port {
	    PortNumber		    3
	    Name		    "x_c"
	    TestPoint		    off
	    LinearAnalysisOutput    off
	    LinearAnalysisInput	    off
	    RTWStorageClass	    "Auto"
	  }
	}
	Block {
	  BlockType		  Terminator
	  Name			  " Terminator "
	  Position		  [460, 191, 480, 209]
	}
	Block {
	  BlockType		  Outport
	  Name			  "ig"
	  Position		  [460, 101, 480, 119]
	  Port			  "1"
	  OutputWhenDisabled	  "held"
	  InitialOutput		  "[]"
	}
	Block {
	  BlockType		  Outport
	  Name			  "x_c"
	  Position		  [460, 136, 480, 154]
	  Port			  "2"
	  OutputWhenDisabled	  "held"
	  InitialOutput		  "[]"
	}
	Line {
	  SrcBlock		  " Demux "
	  SrcPort		  1
	  DstBlock		  " Terminator "
	  DstPort		  1
	}
	Line {
	  SrcBlock		  " SFunction "
	  SrcPort		  1
	  Points		  [0, 85]
	  DstBlock		  " Demux "
	  DstPort		  1
	}
	Line {
	  SrcBlock		  " input events "
	  SrcPort		  1
	  DstBlock		  " SFunction "
	  DstPort		  1
	}
	Line {
	  Name			  "ig"
	  Labels		  [0, 0]
	  SrcBlock		  " SFunction "
	  SrcPort		  2
	  DstBlock		  "ig"
	  DstPort		  1
	}
	Line {
	  Name			  "x_c"
	  Labels		  [0, 0]
	  SrcBlock		  " SFunction "
	  SrcPort		  3
	  DstBlock		  "x_c"
	  DstPort		  1
	}
      }
    }
    Block {
      BlockType		      Display
      Name		      "Display"
      Ports		      [1]
      Position		      [375, 105, 465, 135]
      Format		      "short"
      Decimation	      "1"
      Floating		      off
      SampleTime	      "-1"
    }
    Block {
      BlockType		      Mux
      Name		      "Mux"
      Ports		      [3, 1]
      Position		      [145, 96, 150, 134]
      ShowName		      off
      Inputs		      "3"
      DisplayOption	      "bar"
    }
    Block {
      BlockType		      Constant
      Name		      "downshift"
      Position		      [40, 100, 70, 130]
      OpenFcn		      "v=get_param(gcb,'value');if v=='1',set_param(gc"
"b,'value','0'),else,set_param(gcb,'value','1'),end;"
      Value		      "0"
      VectorParams1D	      on
    }
    Block {
      BlockType		      Constant
      Name		      "reverse"
      Position		      [40, 160, 70, 190]
      OpenFcn		      "v=get_param(gcb,'value');if v=='1',set_param(gc"
"b,'value','0'),else,set_param(gcb,'value','1'),end;"
      Value		      "0"
      VectorParams1D	      on
    }
    Block {
      BlockType		      Constant
      Name		      "upshift"
      Position		      [45, 35, 75, 65]
      OpenFcn		      "v=get_param(gcb,'value');if v=='1',set_param(gc"
"b,'value','0'),else,set_param(gcb,'value','1'),end;"
      Value		      "1"
      VectorParams1D	      on
    }
    Line {
      SrcBlock		      "Mux"
      SrcPort		      1
      Points		      [45, 0; 0, -65; 100, 0]
      DstBlock		      "Chart"
      DstPort		      trigger
    }
    Line {
      SrcBlock		      "upshift"
      SrcPort		      1
      Points		      [0, 50; 20, 0; 0, 5]
      DstBlock		      "Mux"
      DstPort		      1
    }
    Line {
      SrcBlock		      "downshift"
      SrcPort		      1
      DstBlock		      "Mux"
      DstPort		      2
    }
    Line {
      SrcBlock		      "reverse"
      SrcPort		      1
      Points		      [25, 0; 0, -50]
      DstBlock		      "Mux"
      DstPort		      3
    }
    Line {
      SrcBlock		      "Chart"
      SrcPort		      1
      Points		      [0, 10]
      DstBlock		      "Display"
      DstPort		      1
    }
  }
}

# Finite State Machines
# -- File save dated 20-Mar-2003 22:07:56
#
#    Stateflow Version 4.1 (R12.1) dated May 21 2001, 01:15:03
#
#

Stateflow {

	machine {
		id                   		1
		name                 		"gear_test"
		created              		"20-Mar-2003 16:52:50"
		isLibrary            		0
		firstTarget          		38
		sfVersion            		41012101
	}

	chart {
		id                       		2
		name                     		"Chart"
		windowPosition           		[18.75 18 768 502.5]
		viewLimits               		[-10.958 518.308 -10.958 329.833]
		zoomFactor               		0.731
		screen                   		[1 1 1024 768 1.333333333333333]
		treeNode                 		[0 3 0 0]
		firstTransition          		16
		viewObj                  		6
		machine                  		1
		subviewS {
			x1        		102.732
			zoomFactor		0.22
		}
		decomposition            		CLUSTER_CHART
		firstEvent               		32
		firstData                		35
		chartFileNumber          		1
	}

	state {
		id             		3
		labelString    		"forward"
		position       		[72.61 10.853 151.962 50.342]
		fontSize       		4
		arrowSize      		4
		chart          		2
		treeNode       		[2 7 0 6]
		firstTransition		20
		visible        		0
		subviewer      		2
		type           		OR_STATE
		decomposition  		CLUSTER_STATE
	}

	state {
		id             		4
		labelString    		"first"
		position       		[86.699 23.899 18.779 12.179]
		fontSize       		6
		arrowSize      		4
		chart          		2
		treeNode       		[3 0 7 5]
		visible        		0
		subviewer      		2
		type           		OR_STATE
		decomposition  		CLUSTER_STATE
	}

	state {
		id             		5
		labelString    		"second"
		position       		[134.874 24.396 21.468 11.521]
		fontSize       		6
		arrowSize      		4
		chart          		2
		treeNode       		[3 0 4 8]
		visible        		0
		subviewer      		2
		type           		OR_STATE
		decomposition  		CLUSTER_STATE
	}

	state {
		id             		6
		labelString    		"reverse"
		position       		[202.704 78.459 35.803 12.713]
		fontSize       		4.383
		arrowSize      		4
		chart          		2
		treeNode       		[2 10 3 0]
		firstTransition		29
		superState     		SUBCHART
		subviewer      		2
		subviewS {
			x1        		-15
			y1        		-15
			pos       		[0 0 502.803 224.963]
			fontSize  		4
		}
		type           		OR_STATE
		decomposition  		CLUSTER_STATE
	}

	state {
		id             		7
		labelString    		"third"
		position       		[178.94 23.185 19.06 11.634]
		fontSize       		6
		arrowSize      		4
		chart          		2
		treeNode       		[3 0 0 4]
		visible        		0
		subviewer      		2
		type           		OR_STATE
		decomposition  		CLUSTER_STATE
	}

	state {
		id             		8
		labelString    		"fourth"
		position       		[174.017 49.589 18.345 6.848]
		fontSize       		4
		arrowSize      		4
		chart          		2
		treeNode       		[3 0 5 9]
		visible        		0
		subviewer      		2
		type           		OR_STATE
		decomposition  		CLUSTER_STATE
	}

	state {
		id             		9
		labelString    		"fifth"
		position       		[125.006 50.496 16.722 6.271]
		fontSize       		4
		arrowSize      		4
		chart          		2
		treeNode       		[3 0 8 0]
		visible        		0
		subviewer      		2
		type           		OR_STATE
		decomposition  		CLUSTER_STATE
	}

	state {
		id             		10
		labelString    		"disengage\n"
						"/x_c=0;"

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -