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

📄 predball.mdl

📁 神经网络预测控制程序的源代码
💻 MDL
📖 第 1 页 / 共 3 页
字号:
	      DstBlock		      "Discrete State-Space1"
	      DstPort		      1
	    }
	    Line {
	      SrcBlock		      "Fcn"
	      SrcPort		      1
	      Points		      [0, 40]
	      DstBlock		      "Switch"
	      DstPort		      1
	    }
	    Line {
	      SrcBlock		      "Discrete State-Space1"
	      SrcPort		      1
	      DstBlock		      "Matrix\nGain"
	      DstPort		      1
	    }
	    Line {
	      SrcBlock		      "tansig"
	      SrcPort		      1
	      Points		      [5, 0]
	      Branch {
		Points			[0, -70]
		DstBlock		"yhat1"
		DstPort			1
	      }
	      Branch {
		DstBlock		"Matrix\nGain2"
		DstPort			1
	      }
	    }
	    Line {
	      SrcBlock		      "Matrix\nGain"
	      SrcPort		      1
	      DstBlock		      "netsum"
	      DstPort		      2
	    }
	    Line {
	      SrcBlock		      "Matrix\nGain1"
	      SrcPort		      1
	      Points		      [10, 0]
	      DstBlock		      "netsum"
	      DstPort		      1
	    }
	    Line {
	      SrcBlock		      "Constant"
	      SrcPort		      1
	      Points		      [15, 0]
	      DstBlock		      "netsum"
	      DstPort		      3
	    }
	    Line {
	      SrcBlock		      "netsum"
	      SrcPort		      1
	      DstBlock		      "tansig"
	      DstPort		      1
	    }
	    Line {
	      SrcBlock		      "Matrix\nGain2"
	      SrcPort		      1
	      DstBlock		      "netsum1"
	      DstPort		      1
	    }
	    Line {
	      SrcBlock		      "Constant1"
	      SrcPort		      1
	      Points		      [10, 0; 0, -55]
	      DstBlock		      "netsum1"
	      DstPort		      2
	    }
	    Line {
	      SrcBlock		      "netsum1"
	      SrcPort		      1
	      DstBlock		      "purelin"
	      DstPort		      1
	    }
	  }
	}
	Block {
	  BlockType		  "S-Function"
	  Name			  "S-Function"
	  Ports			  [1, 1]
	  Position		  [145, 210, 205, 240]
	  Orientation		  "down"
	  NamePlacement		  "alternate"
	  FunctionName		  "predopt"
	  Parameters		  "N2,Ts,Nu,maxiter,csrchfun,rho,alpha,S1,IW,L"
"W1_2,LW2_1,B1,B2,Ni,Nj,min_i,max_i,minp,maxp,mint,maxt,Normalize"
	}
	Block {
	  BlockType		  Outport
	  Name			  "Control Signal"
	  Position		  [105, 300, 135, 315]
	  Orientation		  "down"
	  NamePlacement		  "alternate"
	}
	Line {
	  SrcBlock		  "Plant output"
	  SrcPort		  1
	  Points		  [0, -15]
	  Branch {
	    Points		    [-155, 0; 0, -275; 135, 0]
	    DstBlock		    "Mux"
	    DstPort		    2
	  }
	  Branch {
	    Points		    [0, -30]
	    DstBlock		    "NN model"
	    DstPort		    2
	  }
	}
	Line {
	  SrcBlock		  "Reference"
	  SrcPort		  1
	  DstBlock		  "Mux"
	  DstPort		  1
	}
	Line {
	  SrcBlock		  "NN model"
	  SrcPort		  1
	  Points		  [15, 0; 0, -255; -110, 0]
	  DstBlock		  "Mux"
	  DstPort		  3
	}
	Line {
	  SrcBlock		  "NN model"
	  SrcPort		  2
	  Points		  [40, 0; 0, -185]
	  DstBlock		  "Mux"
	  DstPort		  4
	}
	Line {
	  SrcBlock		  "S-Function"
	  SrcPort		  1
	  Points		  [0, 40]
	  Branch {
	    DstBlock		    "Control Signal"
	    DstPort		    1
	  }
	  Branch {
	    DstBlock		    "NN model"
	    DstPort		    1
	  }
	}
	Line {
	  Labels		  [0, 0]
	  SrcBlock		  "Mux"
	  SrcPort		  1
	  DstBlock		  "S-Function"
	  DstPort		  1
	}
      }
    }
    Block {
      BlockType		      SubSystem
      Name		      "Plant\n(Magnet Levitation)"
      Ports		      [1, 1]
      Position		      [545, 88, 660, 152]
      TreatAsAtomicUnit	      off
      MaskInitialization      "x1=[-2 -2 2 2 -2 NaN -2 -2 2 2 -2];\ny1=[5 4 4 "
"5 5 NaN 2 0 0 2 2];\nx2=[-2 -2 2 2 -2 NaN -2   2  NaN -2 2 NaN 2    4    NaN "
"2  4];\ny2=[4  3  3 4  4 NaN 1.5 1  NaN 1 .5 NaN 1.5 1.5 NaN .5 .5];\nx1t = -"
".5 ; y1t = 4.4;\nx2t = -.5; y2t = 3.4;\n"
      MaskDisplay	      "plot([-10],[0],[10],[5]);\nplot([x1 NaN x2],[y1"
" NaN y2]);\ntext(x1t,y1t,'N')\ntext(x2t,y2t,'S')"
      MaskIconFrame	      on
      MaskIconOpaque	      on
      MaskIconRotate	      "none"
      MaskIconUnits	      "autoscale"
      Port {
	PortNumber		1
	Name			"Position"
	TestPoint		off
	LinearAnalysisOutput	off
	LinearAnalysisInput	off
	RTWStorageClass		"Auto"
	DataLogging		off
	DataLoggingNameMode	"SignalName"
	DataLoggingDecimateData	off
	DataLoggingDecimation	"2"
	DataLoggingLimitDataPoints off
	DataLoggingMaxPoints	"5000"
      }
      System {
	Name			"Plant\n(Magnet Levitation)"
	Location		[233, 425, 909, 691]
	Open			off
	ModelBrowserVisibility	off
	ModelBrowserWidth	200
	ScreenColor		"white"
	PaperOrientation	"landscape"
	PaperPositionMode	"auto"
	PaperType		"usletter"
	PaperUnits		"inches"
	ZoomFactor		"100"
	Block {
	  BlockType		  Inport
	  Name			  "Current"
	  Position		  [30, 93, 60, 107]
	}
	Block {
	  BlockType		  Product
	  Name			  "Division"
	  Ports			  [2, 1]
	  Position		  [195, 92, 225, 123]
	  Inputs		  "*/"
	}
	Block {
	  BlockType		  Product
	  Name			  "Division1"
	  Ports			  [2, 1]
	  Position		  [340, 52, 370, 83]
	  Inputs		  "/*"
	}
	Block {
	  BlockType		  Product
	  Name			  "Division2"
	  Ports			  [2, 1]
	  Position		  [350, 137, 380, 168]
	  Inputs		  "/*"
	}
	Block {
	  BlockType		  Gain
	  Name			  "Gain"
	  Position		  [250, 95, 280, 125]
	  Gain			  "15"
	}
	Block {
	  BlockType		  Constant
	  Name			  "Gravity"
	  Position		  [225, 160, 255, 190]
	  Value			  "9.8"
	}
	Block {
	  BlockType		  Integrator
	  Name			  "Position"
	  Ports			  [1, 1]
	  Position		  [540, 100, 570, 130]
	  InitialCondition	  ".5"
	}
	Block {
	  BlockType		  Fcn
	  Name			  "Square Law"
	  Position		  [105, 85, 165, 115]
	  Expr			  "u^2"
	}
	Block {
	  BlockType		  Sum
	  Name			  "Sum"
	  Ports			  [3, 1]
	  Position		  [405, 93, 430, 137]
	  ShowName		  off
	  Inputs		  "|+--"
	}
	Block {
	  BlockType		  Integrator
	  Name			  "Velocity"
	  Ports			  [1, 1]
	  Position		  [470, 100, 500, 130]
	}
	Block {
	  BlockType		  Gain
	  Name			  "Viscous Friction"
	  Position		  [440, 175, 470, 205]
	  Orientation		  "left"
	  Gain			  "12"
	}
	Block {
	  BlockType		  Constant
	  Name			  "mass"
	  Position		  [235, 35, 265, 65]
	  Value			  "3"
	}
	Block {
	  BlockType		  Outport
	  Name			  "Output"
	  Position		  [620, 108, 650, 122]
	}
	Line {
	  SrcBlock		  "Position"
	  SrcPort		  1
	  Points		  [10, 0]
	  Branch {
	    DstBlock		    "Output"
	    DstPort		    1
	  }
	  Branch {
	    Points		    [0, 120; -405, 0]
	    DstBlock		    "Division"
	    DstPort		    2
	  }
	}
	Line {
	  SrcBlock		  "Current"
	  SrcPort		  1
	  DstBlock		  "Square Law"
	  DstPort		  1
	}
	Line {
	  SrcBlock		  "Division2"
	  SrcPort		  1
	  Points		  [5, 0]
	  DstBlock		  "Sum"
	  DstPort		  3
	}
	Line {
	  SrcBlock		  "Viscous Friction"
	  SrcPort		  1
	  Points		  [-110, 0; 0, -30]
	  DstBlock		  "Division2"
	  DstPort		  2
	}
	Line {
	  SrcBlock		  "mass"
	  SrcPort		  1
	  Points		  [40, 0]
	  Branch {
	    Points		    [0, 95]
	    DstBlock		    "Division2"
	    DstPort		    1
	  }
	  Branch {
	    Points		    [15, 0]
	    DstBlock		    "Division1"
	    DstPort		    1
	  }
	}
	Line {
	  SrcBlock		  "Division1"
	  SrcPort		  1
	  Points		  [15, 0]
	  DstBlock		  "Sum"
	  DstPort		  1
	}
	Line {
	  SrcBlock		  "Gain"
	  SrcPort		  1
	  Points		  [40, 0]
	  DstBlock		  "Division1"
	  DstPort		  2
	}
	Line {
	  SrcBlock		  "Sum"
	  SrcPort		  1
	  DstBlock		  "Velocity"
	  DstPort		  1
	}
	Line {
	  SrcBlock		  "Velocity"
	  SrcPort		  1
	  Points		  [5, 0]
	  Branch {
	    Points		    [0, 75]
	    DstBlock		    "Viscous Friction"
	    DstPort		    1
	  }
	  Branch {
	    Points		    [0, 0]
	    DstBlock		    "Position"
	    DstPort		    1
	  }
	}
	Line {
	  SrcBlock		  "Gravity"
	  SrcPort		  1
	  Points		  [35, 0; 0, -55]
	  DstBlock		  "Sum"
	  DstPort		  2
	}
	Line {
	  SrcBlock		  "Division"
	  SrcPort		  1
	  DstBlock		  "Gain"
	  DstPort		  1
	}
	Line {
	  SrcBlock		  "Square Law"
	  SrcPort		  1
	  DstBlock		  "Division"
	  DstPort		  1
	}
      }
    }
    Block {
      BlockType		      UniformRandomNumber
      Name		      "Random Reference"
      Position		      [60, 69, 90, 101]
      Minimum		      "0.5"
      Maximum		      "3"
      Seed		      "round(now)"
      SampleTime	      "5"
    }
    Block {
      BlockType		      SubSystem
      Name		      "XY Graph"
      Ports		      [3]
      Position		      [800, 97, 835, 143]
      CopyFcn		      "sfunxy2([],[],[],'CopyBlock')"
      DeleteFcn		      "sfunxy2([],[],[],'DeleteBlock')"
      LoadFcn		      "sfunxy2([],[],[],'LoadBlock')"
      StartFcn		      "sfunxy2([],[],[],'Start')"
      StopFcn		      "sfunxy2([],[],[],'Stop')"
      NameChangeFcn	      "sfunxy2([],[],[],'NameChange')"
      TreatAsAtomicUnit	      off
      MaskType		      "XY scope."
      MaskDescription	      "XY scope using MATLAB graph window.  First inpu"
"t is used as time base.  Enter plotting ranges."
      MaskHelp		      "This block can be used to explore limit cycles."
" Look at the m-file sfunxy.m to see how it works."
      MaskPromptString	      "x-min:|x-max:|y-min:|y-max:|Sample time:"
      MaskStyleString	      "edit,edit,edit,edit,edit"
      MaskTunableValueString  "on,on,on,on,on"
      MaskCallbackString      "||||"
      MaskEnableString	      "on,on,on,on,on"
      MaskVisibilityString    "on,on,on,on,on"
      MaskToolTipString	      "on,on,on,on,on"
      MaskVarAliasString      ",,,,"
      MaskVariables	      "xmin=@1;xmax=@2;ymin=@3;ymax=@4;st=@5;"
      MaskDisplay	      "plot([.05 .95 .95 .05 .05],[.45 .45 .95 .95 .45"
"], 0.5+cos(0:0.1:2*pi)*0.3,0.7+sin(0:0.1:2*pi)*0.2)"
      MaskSelfModifiable      on
      MaskIconFrame	      on
      MaskIconOpaque	      on
      MaskIconRotate	      "none"
      MaskIconUnits	      "normalized"
      MaskValueString	      "0|5|0|2|-1"
      System {
	Name			"XY Graph"
	Location		[82, 157, 342, 335]
	Open			off
	ModelBrowserVisibility	off
	ModelBrowserWidth	200
	ScreenColor		"white"
	PaperOrientation	"landscape"
	PaperPositionMode	"auto"
	PaperType		"usletter"
	PaperUnits		"inches"
	ZoomFactor		"100"
	Block {
	  BlockType		  Inport
	  Name			  "x"
	  Position		  [25, 27, 55, 43]
	}
	Block {
	  BlockType		  Inport
	  Name			  "y1"
	  Position		  [25, 67, 55, 83]
	  Port			  "2"
	}
	Block {
	  BlockType		  Inport
	  Name			  "y2"
	  Position		  [25, 107, 55, 123]
	  Port			  "3"
	}
	Block {
	  BlockType		  Mux
	  Name			  "Mux"
	  Ports			  [3, 1]
	  Position		  [105, 48, 135, 102]
	  ShowName		  off
	  Inputs		  "3"
	}
	Block {
	  BlockType		  "S-Function"
	  Name			  "sfunxy"
	  Ports			  [1]
	  Position		  [175, 65, 225, 85]
	  ShowName		  off
	  FunctionName		  "sfunxy2"
	  Parameters		  "[xmin xmax ymin ymax], st"
	}
	Line {
	  SrcBlock		  "Mux"
	  SrcPort		  1
	  DstBlock		  "sfunxy"
	  DstPort		  1
	}
	Line {
	  SrcBlock		  "x"
	  SrcPort		  1
	  Points		  [15, 0; 0, 20]
	  DstBlock		  "Mux"
	  DstPort		  1
	}
	Line {
	  SrcBlock		  "y1"
	  SrcPort		  1
	  DstBlock		  "Mux"
	  DstPort		  2
	}
	Line {
	  SrcBlock		  "y2"
	  SrcPort		  1
	  Points		  [15, 0; 0, -20]
	  DstBlock		  "Mux"
	  DstPort		  3
	}
      }
    }
    Line {
      SrcBlock		      "Random Reference"
      SrcPort		      1
      Points		      [125, 0]
      Branch {
	Points			[0, 260; 545, 0; 0, -210]
	DstBlock		"XY Graph"
	DstPort			3
      }
      Branch {
	DstBlock		"NN Predictive Controller"
	DstPort			1
      }
    }
    Line {
      Name		      "Position"
      Labels		      [0, 0]
      SrcBlock		      "Plant\n(Magnet Levitation)"
      SrcPort		      1
      Points		      [40, 0]
      Branch {
	DstBlock		"XY Graph"
	DstPort			2
      }
      Branch {
	Points			[0, 180; -415, 0]
	DstBlock		"NN Predictive Controller"
	DstPort			2
      }
    }
    Line {
      SrcBlock		      "Clock"
      SrcPort		      1
      Points		      [40, 0]
      DstBlock		      "XY Graph"
      DstPort		      1
    }
    Line {
      Name		      "Current"
      Labels		      [0, 0]
      SrcBlock		      "NN Predictive Controller"
      SrcPort		      1
      DstBlock		      "Plant\n(Magnet Levitation)"
      DstPort		      1
    }
  }
}

⌨️ 快捷键说明

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