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

📄 hair_dryer.mdl

📁 这是关于matlab stateflow的源码例子
💻 MDL
📖 第 1 页 / 共 2 页
字号:
	  DstPort		  1
	}
	Line {
	  Name			  "G"
	  Labels		  [2, 1]
	  SrcBlock		  "Math\nFunction"
	  SrcPort		  1
	  Points		  [-25, 0; 0, 30]
	  DstBlock		  "Product2"
	  DstPort		  1
	}
	Line {
	  SrcBlock		  "Voltage"
	  SrcPort		  1
	  Points		  [5, 0]
	  Branch {
	    Points		    [0, 105; 155, 0]
	    DstBlock		    "Product2"
	    DstPort		    2
	  }
	  Branch {
	    DstBlock		    "Product1"
	    DstPort		    1
	  }
	}
	Line {
	  SrcBlock		  "heat_level"
	  SrcPort		  1
	  DstBlock		  "Voltage"
	  DstPort		  1
	}
	Line {
	  SrcBlock		  "fan_level"
	  SrcPort		  1
	  DstBlock		  "Fan Size*Speed"
	  DstPort		  1
	}
	Line {
	  SrcBlock		  "Sum3"
	  SrcPort		  1
	  DstBlock		  "temp"
	  DstPort		  1
	}
      }
    }
    Block {
      BlockType		      SubSystem
      Name		      "Hair Dryer"
      Ports		      [2, 1, 0, 1, 0]
      Position		      [160, 111, 275, 184]
      FontName		      "Arial"
      FontSize		      16
      FontWeight	      "bold"
      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			"Hair Dryer"
	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		  Inport
	  Name			  "level"
	  Position		  [20, 101, 40, 119]
	  Port			  "1"
	  PortWidth		  "1"
	  SampleTime		  "-1"
	  DataType		  "auto"
	  SignalType		  "auto"
	  Interpolate		  on
	}
	Block {
	  BlockType		  Inport
	  Name			  "temp"
	  Position		  [20, 136, 40, 154]
	  Port			  "2"
	  PortWidth		  "1"
	  SampleTime		  "-1"
	  DataType		  "auto"
	  SignalType		  "auto"
	  Interpolate		  on
	}
	Block {
	  BlockType		  TriggerPort
	  Name			  " input events "
	  Ports			  [0, 1, 0, 0, 0]
	  Position		  [20, 171, 40, 189]
	  TriggerType		  "either"
	  ShowOutputPort	  on
	  OutputDataType	  "auto"
	}
	Block {
	  BlockType		  Demux
	  Name			  " Demux "
	  Ports			  [1, 1, 0, 0, 0]
	  Position		  [270, 180, 320, 220]
	  Outputs		  "1"
	}
	Block {
	  BlockType		  "S-Function"
	  Name			  " SFunction "
	  Tag			  "Stateflow S-Function hair_dryer 1"
	  Ports			  [3, 2, 0, 0, 0]
	  Position		  [180, 100, 230, 180]
	  FunctionName		  "sf_sfun"
	  PortCounts		  "[3 2]"
	  SFunctionModules	  "''"
	}
	Block {
	  BlockType		  Terminator
	  Name			  " Terminator "
	  Position		  [460, 191, 480, 209]
	}
	Block {
	  BlockType		  Outport
	  Name			  "heat"
	  Position		  [460, 101, 480, 119]
	  Port			  "1"
	  OutputWhenDisabled	  "held"
	  InitialOutput		  "[]"
	}
	Line {
	  SrcBlock		  " SFunction "
	  SrcPort		  1
	  Points		  [0, 80]
	  DstBlock		  " Demux "
	  DstPort		  1
	}
	Line {
	  SrcBlock		  " Demux "
	  SrcPort		  1
	  DstBlock		  " Terminator "
	  DstPort		  1
	}
	Line {
	  SrcBlock		  " SFunction "
	  SrcPort		  2
	  DstBlock		  "heat"
	  DstPort		  1
	}
	Line {
	  SrcBlock		  " input events "
	  SrcPort		  1
	  DstBlock		  " SFunction "
	  DstPort		  3
	}
	Line {
	  SrcBlock		  "level"
	  SrcPort		  1
	  DstBlock		  " SFunction "
	  DstPort		  1
	}
	Line {
	  SrcBlock		  "temp"
	  SrcPort		  1
	  DstBlock		  " SFunction "
	  DstPort		  2
	}
      }
    }
    Block {
      BlockType		      Reference
      Name		      "Heater Level"
      Ports		      [2, 1, 0, 0, 0]
      Position		      [80, 13, 130, 57]
      FontName		      "Arial"
      FontSize		      12
      FontWeight	      "bold"
      SourceBlock	      "simulink3/Nonlinear/Manual Switch"
      SourceType	      "Manual Switch"
      sw		      "1"
      action		      "0"
    }
    Block {
      BlockType		      Mux
      Name		      "Mux"
      Ports		      [2, 1, 0, 0, 0]
      Position		      [167, 70, 263, 75]
      Orientation	      "down"
      BackgroundColor	      "black"
      NamePlacement	      "alternate"
      ShowName		      off
      FontSize		      12
      FontWeight	      "bold"
      Inputs		      "2"
      DisplayOption	      "none"
    }
    Block {
      BlockType		      Scope
      Name		      "Scope"
      Ports		      [1, 0, 0, 0, 0]
      Position		      [45, 225, 75, 255]
      Orientation	      "left"
      FontSize		      12
      FontWeight	      "bold"
      Floating		      off
      Location		      [19, 421, 436, 685]
      Open		      on
      NumInputPorts	      "1"
      TickLabels	      "on"
      ZoomMode		      "on"
      List {
	ListType		AxesTitles
	axes1			"%<SignalLabel>"
      }
      Grid		      "on"
      TimeRange		      "100"
      YMin		      "60"
      YMax		      "210"
      SaveToWorkspace	      off
      SaveName		      "ScopeData"
      DataFormat	      "Matrix"
      LimitMaxRows	      on
      MaxRows		      "5000"
      Decimation	      "1"
      SampleInput	      off
      SampleTime	      "0"
    }
    Line {
      SrcBlock		      "Constant"
      SrcPort		      1
      DstBlock		      "Heater Level"
      DstPort		      1
    }
    Line {
      SrcBlock		      "Constant1"
      SrcPort		      1
      DstBlock		      "Heater Level"
      DstPort		      2
    }
    Line {
      SrcBlock		      "Hair Dryer"
      SrcPort		      1
      Points		      [60, 0; 0, 100]
      DstBlock		      "Fan Heat System"
      DstPort		      2
    }
    Line {
      SrcBlock		      "Constant2"
      SrcPort		      1
      DstBlock		      "Fan Heat System"
      DstPort		      1
    }
    Line {
      SrcBlock		      "Fan Heat System"
      SrcPort		      1
      Points		      [-35, 0]
      Branch {
	DstBlock		"Scope"
	DstPort			1
      }
      Branch {
	Points			[0, -75]
	Branch {
	  DstBlock		  "Hair Dryer"
	  DstPort		  2
	}
	Branch {
	  DstBlock		  "Display"
	  DstPort		  1
	}
      }
    }
    Line {
      SrcBlock		      " 0.5s Timer"
      SrcPort		      1
      DstBlock		      "Mux"
      DstPort		      2
    }
    Line {
      SrcBlock		      "Mux"
      SrcPort		      1
      DstBlock		      "Hair Dryer"
      DstPort		      trigger
    }
    Line {
      SrcBlock		      "Heater Level"
      SrcPort		      1
      Points		      [10, 0]
      Branch {
	Points			[45, 0]
	DstBlock		"Mux"
	DstPort			1
      }
      Branch {
	DstBlock		"Hair Dryer"
	DstPort			1
      }
    }
  }
}

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

Stateflow {

	machine {
		id         		1
		name       		"hair_dryer"
		created    		"16-Sep-1997 14:06:20"
		firstTarget		21
		sfVersion  		20011061
	}

	chart {
		id                     		2
		name                   		"Hair Dryer"
		windowPosition         		[335.25 273 376.5 265.5]
		viewLimits             		[0.2642222868420276 333.264222286842 0 229.5]
		screen                 		[1 1 1024 768 1.333333333333333]
		treeNode               		[0 3 0 0]
		firstTransition        		8
		firstJunction          		7
		visible                		1
		machine                		1
		decomposition          		CLUSTER_CHART
		firstEvent             		15
		firstData              		17
		chartFileNumber        		1
	}

	state {
		id             		3
		labelString    		"overheat\n"
						"en:heat=0"
		position       		[8.626756536829745 7.499999999999986 90 60]
		fontSize       		14
		chart          		2
		treeNode       		[2 0 0 4]
		type           		OR_STATE
		decomposition  		CLUSTER_STATE
	}

	state {
		id             		4
		labelString    		"heater_level"
		position       		[7.790532135087069 108.75 310.7659369394775 111]
		fontSize       		14
		chart          		2
		treeNode       		[2 5 3 0]
		firstTransition		13
		type           		OR_STATE
		decomposition  		CLUSTER_STATE
	}

	state {
		id             		5
		labelString    		"high\n"
						"en: heat=1"
		position       		[203.4437320090831 137.2500000000001 90 60]
		fontSize       		14
		chart          		2
		treeNode       		[4 0 0 6]
		type           		OR_STATE
		decomposition  		CLUSTER_STATE
	}

	state {
		id             		6
		labelString    		"low\n"
						"en:heat=0.5"
		position       		[35.57331325443399 140.2500000000001 90 60]
		fontSize       		14
		chart          		2
		treeNode       		[4 0 5 0]
		type           		OR_STATE
		decomposition  		CLUSTER_STATE
	}

	junction {
		id         		7
		position   		[210.4705564878917 47.99999999999994 7]
		chart      		2
		linkNode   		[2 0 0]
		type       		CONNECTIVE_JUNCTION
	}

	transition {
		id           		8
		labelString  		"[temp<100]"
		labelPosition		[112.8195406734175 22.55193157172064 74.25 18]
		fontSize     		14
		src {
			id          		3
			intersection		[2 1 0 0.5499999999999993 98.62675653682975 40.49999999999994]
		}
		dst {
			id          		7
			intersection		[0 -0.9530968199791333 -0.3026655774046057 -1 203.7988787480378 
								  45.88134095816771]
		}
		midPoint     		[134.2085085926825 40.45360046647736]
		chart        		2
		linkNode     		[2 0 9]
		dataLimits   		[98.62675653682979 203.7988787480378 39.75251519266373 45.88134095816771]
	}

	transition {
		id           		9
		labelString  		"[level>0.5]"
		labelPosition		[242.7204215527448 29.01196744110496 66.75 18]
		fontSize     		14
		src {
			id          		7
			intersection		[0 1 5.546930265622879e-015 -1 217.4705564878917 47.99999999999998]
		}
		dst {
			id          		5
			intersection		[2 1 0 0.5999999999999977 293.4437320090831 173.2499999999999]
		}
		midPoint     		[323.75 105]
		chart        		2
		linkNode     		[2 8 10]
		dataLimits   		[217.4705564878921 325.737912438597 47.033266473129 175.6499999999999]
	}

	transition {
		id           		10
		labelString  		"[level<0.5]"
		labelPosition		[193.5499694699754 76.46657534368136 66.75 18]
		fontSize     		14
		src {
			id          		7
			intersection		[0 -0.738948919852581 0.6737614517384499 -1 205.2979140489237 
								  52.71633016216909]
		}
		dst {
			id          		6
			intersection		[1 0 -1 0.8503072402462648 112.1009648765978 140.2500000000001]
		}
		midPoint     		[185.3324117623051 93.51535711826037]
		chart        		2
		linkNode     		[2 9 11]
		dataLimits   		[109.7009648765978 205.2979140489238 52.71633016216919 140.2500000000001]
	}

	transition {
		id           		11
		labelPosition		[14.33933647668103 80.67995292441539 9.75 18]
		fontSize     		14
		src {
			intersection		[0 0 0 0 10.38099422399424 81.74999999999994]
		}
		dst {
			id          		3
			intersection		[3 0 1 0.7471751368092835 31.38099422399423 67.49999999999999]
		}
		midPoint     		[19.3422829558098 79.90182469093377]
		chart        		2
		linkNode     		[2 10 12]
		dataLimits   		[10.3809942239942 33.78099422399423 67.49999999999999 81.74999999999989]
	}

	transition {
		id           		12
		labelString  		"[temp>200]"
		labelPosition		[65.32017228388206 79.950871785605 74.25 18]
		fontSize     		14
		src {
			id          		4
			intersection		[1 0 -1 0.1983987247498819 69.44609771958162 108.75]
		}
		dst {
			id          		3
			intersection		[3 0 1 0.4916666666666666 54.37675653682975 67.49999999999999]
		}
		midPoint     		[65.23699193582898 97.13765900402476]
		chart        		2
		linkNode     		[2 11 0]
		dataLimits   		[51.97675653682975 69.44609771958164 67.49999999999999 108.75]
	}

	transition {
		id           		13
		labelString  		"s1"
		labelPosition		[154.6092303837924 136.3708618300912 17.25 18]
		fontSize     		14
		src {
			id          		5
			intersection		[4 -1 0 0.6500000000000024 203.4437320090831 158.2499999999999]
		}
		dst {
			id          		6
			intersection		[2 1 0 0.2249999999999981 125.573313254434 153.7499999999999]
		}
		midPoint     		[179.5295668254701 157.2015710203304]
		chart        		2
		linkNode     		[4 0 14]
		dataLimits   		[125.573313254434 203.4437320090831 151.3499999999999 158.2499999999999]
	}

	transition {
		id           		14
		labelString  		"s1"
		labelPosition		[152.7587703184986 166.7701922942935 17.25 18]
		fontSize     		14
		src {
			id          		6
			intersection		[2 1 0 0.7249999999999981 125.573313254434 183.7499999999999]
		}
		dst {
			id          		5
			intersection		[4 -1 0 0.1875000000000024 203.4437320090831 185.9999999999999]
		}
		midPoint     		[149.4700821563793 184.1990857255918]
		chart        		2
		linkNode     		[4 13 0]
		dataLimits   		[125.573313254434 203.4437320090831 183.5999999999999 188.3999999999999]
	}

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

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

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

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

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

	instance {
		id     		20
		name   		"Hair Dryer"
		machine		1
		chart  		2
	}

	target {
		id               		21
		name             		"sfun"
		description      		"Default Simulink S-Function Target."
		codeFlags        		"-sfun-debug-consistency-range-conflict"
		machine          		1
		linkNode         		[1 0 0]
		checksumOld      		[3790112762 977606513 3981980661 948209531]
	}
}

⌨️ 快捷键说明

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