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

📄 sf_workspace.mdl

📁 这是关于matlab stateflow的源码例子
💻 MDL
字号:
Model {
  Name			  "sf_workspace"
  Version		  3.00
  SimParamPage		  "Solver"
  SampleTimeColors	  off
  InvariantConstants	  off
  WideVectorLines	  off
  ShowLineWidths	  off
  ShowPortDataTypes	  off
  StartTime		  "0.0"
  StopTime		  "inf"
  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	  "warning"
  UnnecessaryDatatypeConvMsg "none"
  Int32ToFloatConvMsg	  "warning"
  SignalLabelMismatchMsg  "none"
  ConsistencyChecking	  "off"
  ZeroCross		  on
  SimulationMode	  "normal"
  BlockDataTips		  on
  BlockParametersDataTip  on
  BlockAttributesDataTip  off
  BlockPortWidthsDataTip  off
  BlockDescriptionStringDataTip	off
  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
  PreLoadFcn		  "x=0;"
  Created		  "Wed Feb 24 08:36:15 1999"
  UpdateHistory		  "UpdateHistoryNever"
  ModifiedByFormat	  "%<Auto>"
  LastModifiedBy	  "pgoddard"
  ModifiedDateFormat	  "%<Auto>"
  LastModifiedDate	  "Wed Mar 10 09:09:20 1999"
  ModelVersionFormat	  "1.%<AutoIncrement:5>"
  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		    "sf_workspace"
    Location		    [79, 74, 413, 227]
    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		      SubSystem
      Name		      "Chart"
      Ports		      [0, 0, 0, 1, 0]
      Position		      [225, 69, 309, 130]
      ShowPortLabels	      on
      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		"usletter"
	PaperUnits		"inches"
	ZoomFactor		"100"
	AutoZoom		on
	Block {
	  BlockType		  TriggerPort
	  Name			  "E1"
	  Ports			  [0, 1, 0, 0, 0]
	  Position		  [20, 101, 40, 119]
	  TriggerType		  "either"
	  ShowOutputPort	  on
	  OutputDataType	  "auto"
	}
	Block {
	  BlockType		  Demux
	  Name			  " Demux "
	  Ports			  [1, 1, 0, 0, 0]
	  Position		  [270, 100, 320, 140]
	  Outputs		  "1"
	}
	Block {
	  BlockType		  "S-Function"
	  Name			  " SFunction "
	  Tag			  "Stateflow S-Function sf_workspace 1"
	  Ports			  [1, 1, 0, 0, 0]
	  Position		  [180, 100, 230, 140]
	  FunctionName		  "sf_sfun"
	  Parameters		  "x"
	  PortCounts		  "[1 1]"
	  SFunctionModules	  "''"
	}
	Block {
	  BlockType		  Terminator
	  Name			  " Terminator "
	  Position		  [460, 111, 480, 129]
	}
	Line {
	  SrcBlock		  " Demux "
	  SrcPort		  1
	  DstBlock		  " Terminator "
	  DstPort		  1
	}
	Line {
	  SrcBlock		  " SFunction "
	  SrcPort		  1
	  DstBlock		  " Demux "
	  DstPort		  1
	}
	Line {
	  SrcBlock		  "E1"
	  SrcPort		  1
	  DstBlock		  " SFunction "
	  DstPort		  1
	}
      }
    }
    Block {
      BlockType		      SubSystem
      Name		      "E1"
      Ports		      [0, 1, 0, 0, 0]
      Position		      [35, 13, 90, 47]
      OpenFcn		      "set_param(gcbh,'action','1');"
      ShowPortLabels	      on
      MaskType		      "Manual Switch"
      MaskDescription	      "Output toggles between two inputs by double-cli"
"cking on the block."
      MaskHelp		      "This block implements a manual switch."
      MaskPromptString	      "Current setting:|Action:"
      MaskStyleString	      "edit,edit"
      MaskTunableValueString  "on,on"
      MaskCallbackString      "|"
      MaskEnableString	      "on,on"
      MaskVisibilityString    "on,on"
      MaskVariables	      "sw=@1;action=@2;"
      MaskInitialization      "[x,y]=manevent;"
      MaskDisplay	      "plot(x,y);"
      MaskIconFrame	      on
      MaskIconOpaque	      on
      MaskIconRotate	      "none"
      MaskIconUnits	      "autoscale"
      MaskValueString	      "0|0"
      System {
	Name			"E1"
	Location		[814, 232, 984, 314]
	Open			off
	ModelBrowserVisibility	off
	ModelBrowserWidth	200
	ScreenColor		"automatic"
	PaperOrientation	"landscape"
	PaperPositionMode	"auto"
	PaperType		"usletter"
	PaperUnits		"inches"
	ZoomFactor		"100"
	AutoZoom		on
	Block {
	  BlockType		  Constant
	  Name			  "Constant"
	  Position		  [25, 25, 55, 55]
	  Value			  "0"
	}
	Block {
	  BlockType		  Outport
	  Name			  "Output"
	  Position		  [115, 33, 145, 47]
	  Port			  "1"
	  OutputWhenDisabled	  "held"
	  InitialOutput		  "[]"
	}
	Line {
	  SrcBlock		  "Constant"
	  SrcPort		  1
	  DstBlock		  "Output"
	  DstPort		  1
	}
      }
    }
    Line {
      SrcBlock		      "E1"
      SrcPort		      1
      Points		      [170, 0]
      DstBlock		      "Chart"
      DstPort		      trigger
    }
    Annotation {
      Position		      [111, 93]
      Text		      "Change workspace variable x\nto see how Statefl"
"ow interacts with\nworkspace data"
      FontName		      "Arial"
      FontSize		      12
      FontWeight	      "bold"
    }
  }
}

# Finite State Machines
# -- File save dated 10-Mar-1999 09:09:20
#
#    Stateflow Version 2.0 (R11) dated Jan 21 1999, 19:12:04
#
#

Stateflow {

	machine {
		id         		1
		name       		"sf_workspace"
		created    		"24-Feb-1999 08:36:16"
		firstTarget		18
		sfVersion  		20011061
	}

	chart {
		id                     		2
		name                   		"Chart"
		windowPosition         		[55.5 135 443.25 215.25]
		viewLimits             		[6.23612871040163 392.8061461711152 0.3299867043991185 173.6700132956009]
		zoomFactor             		0.96702943704994
		screen                 		[1 1 1024 768 1.333333333333333]
		treeNode               		[0 3 0 0]
		visible                		1
		machine                		1
		decomposition          		SET_CHART
		firstEvent             		15
		firstData              		16
		chartFileNumber        		1
	}

	state {
		id             		3
		labelString    		"Workspace"
		position       		[15.90037914691945 12.75 170.1322878069798 147.75]
		fontSize       		16
		arrowSize      		12
		chart          		2
		treeNode       		[2 5 0 4]
		firstTransition		9
		type           		AND_STATE
		decomposition  		CLUSTER_STATE
	}

	state {
		id             		4
		labelString    		"ML_string"
		position       		[213.0096079276175 13.5 170.1322878069798 147.75]
		fontSize       		16
		arrowSize      		12
		chart          		2
		treeNode       		[2 6 3 0]
		firstTransition		10
		type           		AND_STATE
		decomposition  		CLUSTER_STATE
	}

	state {
		id             		5
		labelString    		"A"
		position       		[37.78609651012499 61.5 58.49882378285226 39]
		fontSize       		16
		arrowSize      		12
		chart          		2
		treeNode       		[3 0 0 7]
		type           		OR_STATE
		decomposition  		CLUSTER_STATE
	}

	state {
		id             		6
		labelString    		"A"
		position       		[234.8953252908231 62.25 58.49882378285226 39]
		fontSize       		16
		arrowSize      		12
		chart          		2
		treeNode       		[4 0 0 8]
		type           		OR_STATE
		decomposition  		CLUSTER_STATE
	}

	state {
		id             		7
		labelString    		"B"
		position       		[113.38558595433 108.75 58.49882378285226 39]
		fontSize       		16
		arrowSize      		12
		chart          		2
		treeNode       		[3 0 5 0]
		type           		OR_STATE
		decomposition  		CLUSTER_STATE
	}

	state {
		id             		8
		labelString    		"B"
		position       		[310.4948147350281 109.5 58.49882378285226 39]
		fontSize       		16
		arrowSize      		12
		chart          		2
		treeNode       		[4 0 6 0]
		type           		OR_STATE
		decomposition  		CLUSTER_STATE
	}

	transition {
		id           		9
		labelPosition		[49.66874238719243 46.48943116832104 10.92005699041564 20.30761817804874]
		fontSize     		16
		arrowSize    		12
		src {
			intersection		[0 0 0 0 41.45005170185262 45]
		}
		dst {
			id          		5
			intersection		[1 0 -1 0.4958959172170399 66.79542438604049 61.5]
		}
		midPoint     		[52.26563277987542 46.30933985159915]
		chart        		2
		linkNode     		[3 0 11]
		dataLimits   		[41.45005170185257 70.39542438604049 45.00000000000008 61.5]
	}

	transition {
		id           		10
		labelPosition		[245.0026233025382 47.27436196023895 10.92005699041564 20.30761817804874]
		fontSize     		16
		arrowSize    		12
		src {
			intersection		[0 0 0 0 238.5592804825507 45.75]
		}
		dst {
			id          		6
			intersection		[1 0 -1 0.4958959172170399 263.9046531667386 62.25]
		}
		midPoint     		[249.3748615605734 47.05933985159915]
		chart        		2
		linkNode     		[4 0 12]
		dataLimits   		[238.5592804825508 267.5046531667387 45.74999999999996 62.25]
	}

	transition {
		id           		11
		labelString  		"[x>0.5]"
		labelPosition		[122.3766497060173 59.75761540216502 50.96026595527297 20.30761817804874]
		fontSize     		16
		arrowSize    		12
		src {
			id          		5
			intersection		[2 1 0 0.4615384615384608 96.28492029297725 79.49999999999997]
		}
		dst {
			id          		7
			intersection		[1 0 -1 0.4856480283632344 141.7954243860405 108.75]
		}
		midPoint     		[116.9762114253018 81.15565614867218]
		chart        		2
		linkNode     		[3 9 13]
		dataLimits   		[96.28492029297726 145.3954243860405 79.49999999999996 108.75]
	}

	transition {
		id           		12
		labelString  		"[ml.x>0.5]"
		labelPosition		[301.7363481118767 59.75761540216506 71.34437233738215 20.30761817804874]
		fontSize     		16
		arrowSize    		12
		src {
			id          		6
			intersection		[2 1 0 0.4615384615384608 293.3941490736753 80.24999999999997]
		}
		dst {
			id          		8
			intersection		[1 0 -1 0.4856480283632344 338.9046531667385 109.5]
		}
		midPoint     		[314.0854402059999 81.90565614867218]
		chart        		2
		linkNode     		[4 10 14]
		dataLimits   		[293.3941490736752 342.5046531667385 80.25000000000009 109.5]
	}

	transition {
		id           		13
		labelString  		"[x<-0.5]"
		labelPosition		[29.18819164688838 127.3774382465975 56.78429635016131 20.30761817804874]
		fontSize     		16
		arrowSize    		12
		src {
			id          		7
			intersection		[4 -1 0 0.5000000000000008 113.38558595433 128.25]
		}
		dst {
			id          		5
			intersection		[3 0 1 0.529745623979891 65.29542438604049 100.5]
		}
		midPoint     		[91.76464623300004 127.1247769343211]
		chart        		2
		linkNode     		[3 11 0]
		dataLimits   		[61.69542438604049 113.3855859543299 100.5 128.2500000000001]
	}

	transition {
		id           		14
		labelString  		"[ml.x<-0.5]"
		labelPosition		[220.7539994883361 128.8774382465975 77.16840273227049 20.30761817804874]
		fontSize     		16
		arrowSize    		12
		src {
			id          		8
			intersection		[4 -1 0 0.5000000000000008 310.4948147350281 129]
		}
		dst {
			id          		6
			intersection		[3 0 1 0.529745623979891 262.4046531667386 101.25]
		}
		midPoint     		[288.8738750136981 127.8747769343211]
		chart        		2
		linkNode     		[4 12 0]
		dataLimits   		[258.8046531667386 310.4948147350281 101.25 129.0000000000001]
	}

	event {
		id         		15
		name       		"E1"
		linkNode   		[2 0 0]
		scope      		INPUT_EVENT
		trigger    		EITHER_EDGE_EVENT
		machine    		1
	}

	data {
		id         		16
		name       		"x"
		linkNode   		[2 0 0]
		scope      		WORKSPACE_DATA
		machine    		1
		dataType   		"double"
	}

	instance {
		id     		17
		name   		"Chart"
		machine		1
		chart  		2
	}

	target {
		id               		18
		name             		"sfun"
		description      		"Default Simulink S-Function Target."
		machine          		1
		linkNode         		[1 0 0]
	}
}

⌨️ 快捷键说明

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