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

📄 security.mdl

📁 这是关于matlab stateflow的源码例子
💻 MDL
📖 第 1 页 / 共 3 页
字号:
	  Port			  "1"
	  OutputWhenDisabled	  "reset"
	  InitialOutput		  "0"
	}
	Line {
	  SrcBlock		  "Constant"
	  SrcPort		  1
	  DstBlock		  "Unit Delay"
	  DstPort		  1
	}
	Line {
	  SrcBlock		  "Unit Delay"
	  SrcPort		  1
	  DstBlock		  "Memory"
	  DstPort		  1
	}
	Line {
	  SrcBlock		  "Memory"
	  SrcPort		  1
	  DstBlock		  "Trigger"
	  DstPort		  1
	}
	Annotation {
	  Position		  [225, 149]
	  Text			  "Enter the required delay period as the\nsam"
"ple time of the Unit Delay block "
	  FontName		  "Arial"
	  FontSize		  14
	  FontWeight		  "bold"
	}
      }
    }
    Block {
      BlockType		      SubSystem
      Name		      "Security System"
      Ports		      [0, 2, 0, 1, 0]
      Position		      [240, 262, 415, 338]
      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			"Security System"
	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			  " input events "
	  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, 220, 320, 260]
	  Outputs		  "1"
	}
	Block {
	  BlockType		  "S-Function"
	  Name			  " SFunction "
	  Tag			  "Stateflow S-Function security 1"
	  Ports			  [1, 3, 0, 0, 0]
	  Position		  [180, 100, 230, 220]
	  FunctionName		  "sf_sfun"
	  PortCounts		  "[1 3]"
	  SFunctionModules	  "''"
	}
	Block {
	  BlockType		  Terminator
	  Name			  " Terminator "
	  Position		  [460, 231, 480, 249]
	}
	Block {
	  BlockType		  Outport
	  Name			  "reset_timer"
	  Position		  [460, 101, 480, 119]
	  Port			  "1"
	  OutputWhenDisabled	  "held"
	  InitialOutput		  "[]"
	}
	Block {
	  BlockType		  Outport
	  Name			  "call_police"
	  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, 120]
	  DstBlock		  " Demux "
	  DstPort		  1
	}
	Line {
	  SrcBlock		  " input events "
	  SrcPort		  1
	  DstBlock		  " SFunction "
	  DstPort		  1
	}
	Line {
	  SrcBlock		  " SFunction "
	  SrcPort		  2
	  DstBlock		  "reset_timer"
	  DstPort		  1
	}
	Line {
	  SrcBlock		  " SFunction "
	  SrcPort		  3
	  DstBlock		  "call_police"
	  DstPort		  1
	}
      }
    }
    Block {
      BlockType		      SubSystem
      Name		      "Window\nSensor"
      Ports		      [0, 1, 0, 0, 0]
      Position		      [30, 146, 80, 174]
      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			"Window\nSensor"
	Location		[820, 226, 990, 308]
	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
	}
      }
    }
    Block {
      BlockType		      SubSystem
      Name		      "Window Mode"
      Ports		      [0, 1, 0, 0, 0]
      Position		      [95, 186, 145, 214]
      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	      "1|0"
      System {
	Name			"Window Mode"
	Location		[820, 226, 990, 308]
	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			  "1"
	}
	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		      "Mux1"
      SrcPort		      1
      DstBlock		      "Security System"
      DstPort		      trigger
    }
    Line {
      SrcBlock		      "Security System"
      SrcPort		      2
      DstBlock		      "Global_Alert"
      DstPort		      1
    }
    Line {
      SrcBlock		      "Door Mode"
      SrcPort		      1
      Points		      [20, 0]
      DstBlock		      "Mux"
      DstPort		      2
    }
    Line {
      SrcBlock		      "Window\nSensor"
      SrcPort		      1
      Points		      [90, 0]
      DstBlock		      "Mux"
      DstPort		      3
    }
    Line {
      SrcBlock		      "Window Mode"
      SrcPort		      1
      Points		      [25, 0]
      DstBlock		      "Mux"
      DstPort		      4
    }
    Line {
      SrcBlock		      "Alarm is:"
      SrcPort		      1
      DstBlock		      "Mux"
      DstPort		      5
    }
    Line {
      SrcBlock		      "Door\nSensor"
      SrcPort		      1
      Points		      [90, 0]
      DstBlock		      "Mux"
      DstPort		      1
    }
    Line {
      SrcBlock		      "Mux"
      SrcPort		      1
      Points		      [110, 0]
      DstBlock		      "Mux1"
      DstPort		      1
    }
    Line {
      SrcBlock		      "Reset"
      SrcPort		      1
      DstBlock		      "Mux"
      DstPort		      6
    }
    Line {
      SrcBlock		      "Reset Pending Timer"
      SrcPort		      1
      Points		      [-45, 0]
      DstBlock		      "Mux1"
      DstPort		      2
    }
    Line {
      SrcBlock		      "Security System"
      SrcPort		      1
      Points		      [15, 0]
      Branch {
	DstBlock		"Local_Warning"
	DstPort			1
      }
      Branch {
	DstBlock		"Reset Pending Timer"
	DstPort			enable
      }
    }
    Annotation {
      Position		      [79, 32]
      Text		      "Double Click these\nblocks to create events"
      FontName		      "Arial"
      FontSize		      12
      FontWeight	      "bold"
    }
    Annotation {
      Position		      [382, 49]
      Text		      "Demo of Stateflow\nHome security System"
      FontName		      "Arial"
      FontSize		      20
      FontWeight	      "bold"
    }
  }
}

# Finite State Machines
# -- File save dated 28-May-1999 09:04:38
#
#    Stateflow Version 2.0 (R11) dated Jan 21 1999, 19:12:04
#
#

Stateflow {

	machine {
		id         		1
		name       		"security"
		created    		"24-Feb-1999 15:07:10"
		firstTarget		41
		debug {
			animation            		[1 0.4]
		}
		sfVersion  		20011061
	}

	chart {
		id                     		2
		name                   		"Security System"
		windowPosition         		[18.75 43.5 353.25 499.5]
		viewLimits             		[0 339.212537669591 6.434362997583719 514.0211627065601]
		zoomFactor             		1.095117151475677
		screen                 		[1 1 1024 768 1.333333333333333]
		treeNode               		[0 3 0 0]
		visible                		1
		machine                		1
		decomposition          		SET_CHART
		firstEvent             		30
		firstData              		38
		chartFileNumber        		1
		executeAtInitialization		1
		disableImplicitCasting 		1
	}

	state {
		id             		3
		labelString    		"Door"
		position       		[7.588779020575231 19.42545360554605 318.2499999999998 134.4009345302233]
		fontSize       		12
		arrowSize      		9
		chart          		2
		treeNode       		[2 4 0 6]
		firstTransition		15
		type           		AND_STATE
		decomposition  		CLUSTER_STATE
	}

	state {
		id             		4
		labelString    		"Active"
		position       		[24.18359758389242 53.7045416682233 185.2661813346446 59.11281420103611]
		fontSize       		12
		arrowSize      		9
		chart          		2
		treeNode       		[3 0 0 5]
		firstTransition		17
		type           		OR_STATE
		decomposition  		CLUSTER_STATE
	}

	state {
		id             		5
		labelString    		"Disabled"
		position       		[238.5369590864321 59.55507103115637 72.13792297147495 46.89271051938247]
		fontSize       		12
		arrowSize      		9
		chart          		2
		treeNode       		[3 0 4 0]
		type           		OR_STATE
		decomposition  		CLUSTER_STATE
	}

	state {
		id             		6
		labelString    		"Win"
		position       		[4.797432822240467 163.52358502063 318.2499999999998 134.4009345302233]
		fontSize       		12
		arrowSize      		9
		chart          		2
		treeNode       		[2 7 3 9]
		firstTransition		19
		type           		AND_STATE
		decomposition  		CLUSTER_STATE
	}

	state {
		id             		7
		labelString    		"Active"
		position       		[28.60088706526088 197.8026730833073 183.060705476659 59.1128142010361]
		fontSize       		12
		arrowSize      		9
		chart          		2
		treeNode       		[6 0 0 8]
		firstTransition		21
		type           		OR_STATE
		decomposition  		CLUSTER_STATE
	}

	state {
		id             		8
		labelString    		"Disabled"
		position       		[235.7456128880973 203.6532024462404 72.13792297147495 46.89271051938247]
		fontSize       		12
		arrowSize      		9
		chart          		2
		treeNode       		[6 0 7 0]
		type           		OR_STATE
		decomposition  		CLUSTER_STATE
	}

	state {
		id             		9
		labelString    		"Alarm"

⌨️ 快捷键说明

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