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

📄 trans_test.mdl

📁 这是关于matlab stateflow的源码例子
💻 MDL
📖 第 1 页 / 共 2 页
字号:
	  SrcBlock		  "Constant"
	  SrcPort		  1
	  DstBlock		  "Output"
	  DstPort		  1
	}
      }
    }
    Block {
      BlockType		      Mux
      Name		      "Mux"
      Ports		      [2, 1, 0, 0, 0]
      Position		      [140, 26, 145, 64]
      ShowName		      off
      Inputs		      "2"
      DisplayOption	      "bar"
    }
    Block {
      BlockType		      SubSystem
      Name		      "Y"
      Ports		      [0, 1, 0, 0, 0]
      Position		      [25, 76, 75, 104]
      OpenFcn		      "set_param(gcbh,'action','1');"
      FontName		      "Arial"
      FontSize		      12
      FontWeight	      "bold"
      ShowPortLabels	      on
      MaskType		      "Manual Switch"
      MaskDescription	      "Output toggles between two inputs by double-cli"
"cking on the block.\n"
      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;\n"
      MaskDisplay	      "plot(x,y)\n\n"
      MaskSelfModifiable      on
      MaskIconFrame	      on
      MaskIconOpaque	      on
      MaskIconRotate	      "none"
      MaskIconUnits	      "autoscale"
      MaskValueString	      "1|0"
      System {
	Name			"Y"
	Location		[492, 443, 732, 566]
	Open			off
	ModelBrowserVisibility	off
	ModelBrowserWidth	200
	ScreenColor		"white"
	PaperOrientation	"landscape"
	PaperPositionMode	"auto"
	PaperType		"usletter"
	PaperUnits		"inches"
	ZoomFactor		"100"
	AutoZoom		on
	Block {
	  BlockType		  Constant
	  Name			  "Constant"
	  Position		  [45, 50, 65, 70]
	  Value			  "1"
	}
	Block {
	  BlockType		  Outport
	  Name			  "Output"
	  Position		  [140, 53, 170, 67]
	  Port			  "1"
	  OutputWhenDisabled	  "held"
	  InitialOutput		  "0"
	}
	Line {
	  SrcBlock		  "Constant"
	  SrcPort		  1
	  DstBlock		  "Output"
	  DstPort		  1
	}
      }
    }
    Line {
      SrcBlock		      "E"
      SrcPort		      1
      DstBlock		      "Mux"
      DstPort		      1
    }
    Line {
      SrcBlock		      "Y"
      SrcPort		      1
      Points		      [45, 0]
      DstBlock		      "Mux"
      DstPort		      2
    }
    Line {
      SrcBlock		      "Mux"
      SrcPort		      1
      Points		      [100, 0]
      DstBlock		      "Chart"
      DstPort		      trigger
    }
    Line {
      SrcBlock		      "Event E2"
      SrcPort		      1
      Points		      [100, 0]
      DstBlock		      "Chart"
      DstPort		      1
    }
    Line {
      SrcBlock		      "Chart"
      SrcPort		      1
      DstBlock		      "Display"
      DstPort		      1
    }
  }
}

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

Stateflow {

	machine {
		id         		1
		name       		"trans_test"
		created    		"26-Jan-1999 16:42:58"
		firstTarget		20
		sfVersion  		20011061
	}

	chart {
		id                     		2
		name                   		"Chart"
		windowPosition         		[366 200.25 365.25 342.75]
		viewLimits             		[0 321.75 0 306.75]
		screen                 		[1 1 1024 768 1.333333333333333]
		treeNode               		[0 3 0 0]
		firstTransition        		9
		visible                		1
		machine                		1
		decomposition          		CLUSTER_CHART
		firstEvent             		15
		firstData              		17
		chartFileNumber        		1
	}

	state {
		id             		3
		labelString    		"D"
		position       		[177.2491430138489 8.250000000000028 114.229860825449 240.0000000000002]
		fontSize       		14
		chart          		2
		treeNode       		[2 4 0 6]
		type           		OR_STATE
		decomposition  		CLUSTER_STATE
	}

	state {
		id             		4
		labelString    		"S1\n"
						"cur_st=1"
		position       		[208.2356026326613 27.00000000000014 76.23920197449607 42.75000000000009]
		fontSize       		14
		chart          		2
		treeNode       		[3 0 0 5]
		type           		OR_STATE
		decomposition  		CLUSTER_STATE
	}

	state {
		id             		5
		labelString    		"S2\n"
						"cur_st=2"
		position       		[208.3652303578774 79.87500000000004 76.23920197449607 42.75000000000009]
		fontSize       		14
		chart          		2
		treeNode       		[3 0 4 7]
		type           		OR_STATE
		decomposition  		CLUSTER_STATE
	}

	state {
		id             		6
		labelString    		"Wait"
		position       		[26.50702728643904 104.25 85.25531331413684 43.50000000000003]
		fontSize       		14
		chart          		2
		treeNode       		[2 0 3 0]
		type           		OR_STATE
		decomposition  		CLUSTER_STATE
	}

	state {
		id             		7
		labelString    		"S3\n"
						"cur_st=3"
		position       		[208.3638591800356 133.1250000000001 76.23920197449607 42.75000000000009]
		fontSize       		14
		chart          		2
		treeNode       		[3 0 5 8]
		type           		OR_STATE
		decomposition  		CLUSTER_STATE
	}

	state {
		id             		8
		labelString    		"S4\n"
						"cur_st=4"
		position       		[208.3633449883449 187.1250000000001 76.23920197449607 42.75000000000009]
		fontSize       		14
		chart          		2
		treeNode       		[3 0 7 0]
		type           		OR_STATE
		decomposition  		CLUSTER_STATE
	}

	transition {
		id           		9
		labelString  		"E[Cond]"
		labelPosition		[91.77121375413523 30.62961311754422 53.25 18]
		fontSize     		14
		src {
			id          		6
			intersection		[1 0 -1 0.6802270786323496 84.5 104.25]
		}
		dst {
			id          		4
			intersection		[4 -1 0 0.5087719298245651 208.2356026326613 48.00000000000003]
		}
		midPoint     		[107.2455339040303 67.50264670061978]
		chart        		2
		linkNode     		[2 0 10]
		dataLimits   		[84.49999999999999 208.2356026326613 45.60000000000003 104.2499999999999]
	}

	transition {
		id           		10
		labelPosition		[45.56176543108408 78.01625297937045 6.75 13.5]
		fontSize     		10
		src {
			intersection		[0 -1 0 0 50 74.25000000000003]
		}
		dst {
			id          		6
			intersection		[1 0 -1 0.275560217895128 50 104.25]
		}
		midPoint     		[45.56176543108408 78.01625297937045]
		chart        		2
		linkNode     		[2 9 11]
		dataLimits   		[44.34731861119298 52.4 74.25000000000003 104.25]
	}

	transition {
		id           		11
		labelString  		"E"
		labelPosition		[141.7306053629314 92.16102638873899 11.25 18]
		fontSize     		14
		src {
			id          		6
			intersection		[2 1 0 0.3275862068965515 111.7623406005759 118.5]
		}
		dst {
			id          		5
			intersection		[4 -1 0 0.5350877192982468 208.3652303578774 99.75000000000003]
		}
		midPoint     		[142.5850812150183 113.1070898681453]
		chart        		2
		linkNode     		[2 10 12]
		dataLimits   		[111.7623406005759 208.3652303578774 97.35000000000002 118.5000000000001]
	}

	transition {
		id           		12
		labelString  		"[Cond]"
		labelPosition		[126.022890873425 143.8908938199424 43.5 18]
		fontSize     		14
		src {
			id          		6
			intersection		[2 1 0 0.6206896551724134 111.7623406005759 131.25]
		}
		dst {
			id          		7
			intersection		[4 -1 0 0.5877192982456155 208.3638591800356 150.75]
		}
		midPoint     		[142.6918613878295 136.0944466191714]
		chart        		2
		linkNode     		[2 11 13]
		dataLimits   		[111.7623406005759 208.3638591800356 131.2499999999999 153.15]
	}

	transition {
		id           		13
		labelString  		"/cur_st=0"
		labelPosition		[73.28636107563615 241.2422372159398 60.75 18]
		fontSize     		14
		src {
			id          		3
			intersection		[3 0 1 0.7811355384179786 202.25 248.2500000000002]
		}
		dst {
			id          		6
			intersection		[3 0 1 0.6804542537638696 53.75 147.7500000000001]
		}
		midPoint     		[53.75 240.75]
		chart        		2
		linkNode     		[2 12 14]
		dataLimits   		[47.62412836643069 202.25 147.7500000000001 278.7785503007506]
	}

	transition {
		id           		14
		labelPosition		[146.4075570558952 207.4105164123682 9.75 18]
		fontSize     		14
		src {
			id          		6
			intersection		[3 0 1 0.3197729213676505 84.5 147.7500000000001]
		}
		dst {
			id          		8
			intersection		[4 -1 0 0.4298245614035112 208.3633449883449 211.5]
		}
		midPoint     		[107.1901842481879 187.1700087169702]
		chart        		2
		linkNode     		[2 13 0]
		dataLimits   		[84.49999999999997 208.3633449883449 147.7500000000003 213.9]
	}

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

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

	data {
		id         		17
		name       		"cur_st"
		linkNode   		[2 0 18]
		scope      		OUTPUT_DATA
		machine    		1
		dataType   		"double"
	}

	data {
		id         		18
		name       		"Cond"
		linkNode   		[2 17 0]
		scope      		INPUT_DATA
		machine    		1
		dataType   		"double"
	}

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

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

⌨️ 快捷键说明

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