home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1994 #1 / monster.zip / monster / MATH / VISSIM.ZIP / CARTPOLE.VSM < prev    next >
Text File  |  1993-05-19  |  10KB  |  393 lines

  1. ; VisSim Block Diagram Format (VBDF)
  2. ; Copyright (C) 1989-1993 Visual Solutions
  3. PV=1.200
  4. PS=0
  5. PE=15
  6. PP=0.01
  7. PI=173
  8. PX=0.01
  9. PN=1e-006
  10. Pn=10,6,14,"MS Sans Serif"
  11. Pc=118
  12. PD=640x480
  13. PA=1
  14. Pf=0x0
  15. Ps=1257,0,0,873,0,0
  16. Pd=17
  17. PM=1,1,1,1
  18. N.1="comment"@0x0@239x104
  19. C=" Welcome to the VisSim/Neural-Net (TM) working demo of an inverted pendulum.
  20.  
  21.  READ THESE INSTRUCTIONS FIRST!!!
  22.  
  23. Step 1.  The neural-net is ready to learn. Just select GO under SIMULATE, and it will start learning.
  24.      WARNING!!!
  25. It will take many hours for the neural net to sufficiently learn to control the inverted pendulum.  Our  recommendation is that you stop the neural net at some point.  Select Stop from  the Simulate menu when the Error signal from  the neural-net (lower plot) is always below 10E-2.
  26. Change the neural-net learning method or input parameters by clicking the right mouse button on the neural-net block CP-095.NET.  The two methods to try are Backpropagation, and Backpropagation with Momentum.  
  27.  
  28. Step 2.  Try placing the pole at different initial positions from vertical.  The initial deflection can be between +/- .99 radians of vertical.  Click the right button on the Cart and Pole, and follow the directions for setting the pole's initial condition.  You should train the net on a number of initial conditions (say, 6 total) ranging from -.99 to +.99 radians.
  29.  
  30. Step 3. To try controlling the inverted pendulum with a neural-net that has already been trained, click right button on the neural-net block and replace CP-095.NET with CP.NET under Weight File.  Be sure to turn off \"Learn\" and turn off \"Save at Sim End\".
  31.  
  32. CP.NET will control the inverted pendulum at any initial deflection between -.99 and +.99 radians."
  33. N.2="gain"(0.0625)@378x175<M>
  34. N.3="export"@96x595
  35. n="noNet.dat"
  36. dc=512
  37. dp=15
  38. di=0.008
  39. N.4="import"@24x588
  40. n="noNet.dat"
  41. di=0.008
  42. N.5="Compound"@132x112#4,1<CR>
  43. n="control system"
  44. Ms=1254,0,0,873,0,0
  45. N.6="gain"(6)@210x42<M>
  46. N.7="gain"(1)@156x147<M>
  47. N.8="wireLabel"@12x28<M>
  48. n="Theta"
  49. N.9="comment"@216x0@210x21<M>
  50. C="Pole balancing control"
  51. N.10="summingJunction"(0)@426x182#4,1<M>
  52. N.11="wireLabel"@12x133<M>
  53. n="Theta dot"
  54. N.12="wireLabel"@12x238<M>
  55. n="x"
  56. N.13="wireLabel"@12x350<M>
  57. n="x dot"
  58. N.14="gain"(0.65)@180x364<M>
  59. N.15="gain"(0.5)@150x252<M>
  60. N.16="wireLabel"@528x182<M>
  61. n="Control output"
  62. N.17="gain"(100)@18x357
  63. N.18="Compound"@96x336#1,4<C>
  64. n="Cart and Pole"
  65. Ms=1254,0,0,873,0,0
  66. N.19="Compound"@522x42#1,1<MC>
  67. n="X"
  68. Ms=333,0,0,252,0,0
  69. N.20="integrator"(0,3)@330x203<M>
  70. N.21="Compound"@444x147#1,1<MC>
  71. n="Xdot"
  72. Ms=303,0,0,252,0,0
  73. N.22="integrator"(0,2)@300x203<M>
  74. N.23="Compound"@198x161#3,2<MCR>
  75. n="Acceleration"
  76. Ms=1254,0,0,873,0,0
  77. N.24="cos"@96x49<M>
  78. N.25="Compound"@120x98#0,1<MC>
  79. n="Gravity"
  80. Ms=1254,0,0,873,0,0
  81. N.26="const"(9.8)@408x203<M>
  82. N.27="sin"@66x112<M>
  83. N.28="*"@198x98<M>
  84. N.29="*"@384x308<M>
  85. N.30="const"(2)@504x322<M>
  86. N.31="*"@558x280#3,1<M>
  87. N.32="summingJunction"(0)@468x287<M>
  88. N.33="Compound"@18x175#0,1<MC>
  89. n="MasspoleLength"
  90. Ms=1254,0,0,873,0,0
  91. N.34="const"(0.05)@492x203<M>
  92. N.35="*"@138x161#4,1<M>
  93. N.36="Compound"@72x385#1,1<MC>
  94. n="External force"
  95. Ms=559,0,0,317,0,0
  96. N.37="Compound"@120x273#0,1<MC>
  97. n="force magnitude"
  98. Ms=422,0,0,216,0,0
  99. N.38="const"(10)@420x182<M>
  100. N.39="-X"@426x273<M>
  101. N.40="merge"@528x189<M>
  102. N.41="summingJunction"(0)@204x329<M>
  103. N.42="const"(1.33333)@306x259<M>
  104. N.43="summingJunction"(0)@402x245<M>
  105. N.44="1/X"@486x252<M>
  106. N.45="*"@348x182#3,1<M>
  107. N.46="const"(0.0909091)@264x210<M>
  108. N.47="summingJunction"(0)@552x91<M>
  109. N.48="const"(0.90909)@222x371<M>
  110. N.49="*"@324x336<M>
  111. N.50="gain"(0.454545)@360x77<M>
  112. N.51="wireLabel"@12x329<M>
  113. n="applied force"
  114. N.52="wireLabel"@12x217<M>
  115. n="theta dot"
  116. N.53="wireLabel"@12x49<M>
  117. n="theta"
  118. N.54="wireLabel"@516x343<M>
  119. n="theta acceleration"
  120. N.55="wireLabel"@534x70<M>
  121. n="x acceleration"
  122. N.56="*"@498x77<M>
  123. N.57="Compound"@234x364#1,1<MC>
  124. n="ThetaDot"
  125. Ms=1254,0,0,873,0,0
  126. N.58="integrator"(0,0)@288x203<M>
  127. N.59="Compound"@480x252#1,1<MC>
  128. n="Theta"
  129. Ms=1254,0,0,873,0,0
  130. N.60="wireLabel"@696x182<M>
  131. n="x dot"
  132. N.61="wireLabel"@696x294<M>
  133. n="theta"
  134. N.62="wireLabel"@654x399<M>
  135. n="theta dot"
  136. N.63="wireLabel"@720x63<M>
  137. n="x"
  138. N.64="wireLabel"@12x189<M>
  139. n="applied force"
  140. N.65="neuralNet"@108x196#5,1<R>
  141. n="cp.net"
  142. UP=4,1,0,1,8,0.3,0.7,0.5,1,1,0,0,0
  143. N.66="plot"@312x210@306x147
  144. pt="Neural-net error in learning mode"
  145. px="Time (sec)"
  146. py="Error"
  147. pax=0
  148. pf=H
  149. pf=F
  150. pb=0.1,0.0001
  151. pbx=15,0
  152. pbY=0,0
  153. pbX=0,0
  154. pc=500
  155. pm=10
  156. pf=Y
  157. pb.0=10,1e-016
  158. pb.1=1,0.01
  159. pL.1="err"
  160. pb.2=0,0
  161. pb.3=0,0
  162. N.67="variable"@162x49<M>
  163. n=":cosTheta"
  164. N.68="variable"@252x189<M>
  165. n=":cosTheta"
  166. N.69="variable"@258x308<M>
  167. n=":cosTheta"
  168. N.70="summingJunction"(0)@330x168<M>
  169. N.71="Compound"@186x196#1,1<CR>
  170. n="bias"
  171. Ms=1248,0,0,852,0,0
  172. N.72="Compound"@12x224#1,1<CR>
  173. n="outBias"
  174. Ms=1248,0,0,852,0,0
  175. N.73="stop"@258x210<M>
  176. N.74="Compound"@282x364#1,0<C>
  177. n="stopCnd"
  178. Ms=1248,0,0,852,0,0
  179. N.75=">"@186x203<M>
  180. N.76="abs"@78x203<M>
  181. N.77="const"(1)@108x259<M>
  182. N.78="merge"@6x147<R>
  183. N.79="button"(1)@12x119
  184. N.80="Compound"@186x238#1,1<CR>
  185. n="bias"
  186. Ms=1248,0,0,852,0,0
  187. N.81="Compound"@186x252#1,1<CR>
  188. n="bias"
  189. Ms=1248,0,0,852,0,0
  190. N.82="Compound"@186x224#1,1<CR>
  191. n="bias"
  192. Ms=1248,0,0,852,0,0
  193. N.83="Compound"@186x210#1,1<CR>
  194. n="bias"
  195. Ms=1248,0,0,852,0,0
  196. N.84="const"(8)@276x196<M>
  197. N.85="wireLabel"@288x140<M>
  198. n="values range from -6 to 6"
  199. N.86="wireLabel"@228x98<M>
  200. n="X input"
  201. N.87="wireLabel"@228x105<M>
  202. n="Values range from -5 to 5"
  203. N.88="wireLabel"@288x119<M>
  204. n="Controller Input"
  205. N.89="summingJunction"(0)@270x161<M>
  206. N.90="gain"(0.08333333)@354x168<M>
  207. N.91="const"(6)@228x196<M>
  208. N.92="wireLabel"@216x126<M>
  209. n="X dot range from -15 to 15"
  210. N.93="wireLabel"@198x119<M>
  211. n="Theta Input ranges from -1 to 1"
  212. N.94="summingJunction"(0)@228x168<M>
  213. N.95="gain"(0.025)@312x175<M>
  214. N.96="const"(20)@180x196<M>
  215. N.97="wireLabel"@156x126<M>
  216. n="Theta dot ranges from -15 to 15"
  217. N.98="gain"(16)@156x182<M>
  218. N.99="summingJunction"(0)@246x196<M>
  219. N.100="const"(8)@174x210<M>
  220. N.101="wireLabel"@186x140<M>
  221. n="Map into the range -6 to 6"
  222. N.102="summingJunction"(0)@252x147<M>
  223. N.103="gain"(0.025)@336x154<M>
  224. N.104="const"(20)@204x182<M>
  225. N.105="summingJunction"(0)@240x168<M>
  226. N.106="gain"(0.15)@324x175<M>
  227. N.107="const"(4)@192x196<M>
  228. N.108="integrator"(-0.85,1)@312x203<M>
  229. N.109="wireLabel"@216x56<M>
  230. n="Cart and Pole"
  231. N.110="wirePositioner"@90x182
  232. N.111="wirePositioner"@258x182
  233. N.112="display"(0.61869404189366)@384x252<M>
  234. N.113="meter"(-1,1)@312x0@306x105
  235. n="pole angle in radians"
  236. N.114="meter"(-1,1)@312x105@306x105
  237. n="Cart displacement from origin"
  238. N.115="comment"@252x91@176x97<M>
  239. C="Click the right mouse button on the 1/S block to set the initial condition of the pole.
  240.  
  241. Initial conditions must be between -0.99 and 0 .99."
  242. N.116="comment"@432x273@176x56<M>
  243. C="Click the right mouse button on Theta to set the initial condition of the pole."
  244. N.117="wirePositioner"@240x287<M>
  245. N.118="comment"@54x280@176x50
  246. C="Click the right mouse button on Cart and Pole to set the pole to an initial deflection."
  247. I.2.i1=70.o1
  248. G.5=6,7,8,9,10,11,12,13,14,15,16,
  249. I.5.o1=10.o1
  250. I.5.i1=18.o3
  251. I.5.i2=18.o4
  252. I.5.i3=18.o1
  253. I.5.i4=18.o2
  254. I.6.i1=5.i1
  255. I.7.i1=5.i2
  256. I.10.i1=6.o1
  257. I.10.i2=7.o1
  258. I.10.i3=15.o1
  259. I.10.i4=14.o1
  260. I.14.i1=5.i4
  261. I.15.i1=5.i3
  262. I.17.i1=78.o1
  263. G.18=19,21,23,57,59,60,61,62,63,64,109,116,
  264. I.18.o1=19.o1
  265. I.18.o2=21.o1
  266. I.18.o3=59.o1
  267. I.18.o4=57.o1
  268. I.18.i1=17.o1
  269. G.19=20,
  270. I.19.o1=20.o1
  271. I.19.i1=21.o1
  272. I.20.i1=19.i1
  273. G.21=22,
  274. I.21.o1=22.o1
  275. I.21.i1=23.o1
  276. I.22.i1=21.i1
  277. G.23=24,25,27,28,29,30,31,32,33,35,36,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,67,68,69,117,
  278. I.23.o1=47.o1
  279. I.23.o2=31.o1
  280. I.23.i1=59.o1
  281. I.23.i2=57.o1
  282. I.23.i3=18.i1
  283. I.24.i1=23.i1
  284. G.25=26,
  285. I.25.o1=26.o1
  286. I.27.i1=23.i1
  287. I.28.i1=25.o1
  288. I.28.i2=27.o1
  289. I.29.i1=69.o1
  290. I.29.i2=49.o1
  291. I.31.i1=44.o1
  292. I.31.i2=32.o1
  293. I.31.i3=30.o1
  294. I.32.i1=117.o1
  295. f32.2.i=-
  296. I.32.i2=29.o1
  297. G.33=34,
  298. I.33.o1=34.o1
  299. I.35.i1=27.o1
  300. I.35.i2=33.o1
  301. I.35.i3=23.i2
  302. I.35.i4=23.i2
  303. G.36=37,39,40,
  304. I.36.o1=40.o1
  305. G.37=38,
  306. I.37.o1=38.o1
  307. I.39.i1=37.o1
  308. I.40.i1=36.i1
  309. I.40.i2=37.o1
  310. I.40.i3=39.o1
  311. I.41.i1=35.o1
  312. I.41.i2=23.i3
  313. f43.1.i=-
  314. I.43.i1=45.o1
  315. I.43.i2=42.o1
  316. I.44.i1=43.o1
  317. I.45.i1=68.o1
  318. I.45.i2=68.o1
  319. I.45.i3=46.o1
  320. f47.1.i=-
  321. I.47.i1=56.o1
  322. I.47.i2=49.o1
  323. I.49.i1=41.o1
  324. I.49.i2=48.o1
  325. I.56.i1=50.o1
  326. I.56.i2=31.o1
  327. G.57=58,
  328. I.57.o1=58.o1
  329. I.57.i1=23.o2
  330. I.58.i1=57.i1
  331. G.59=108,115,
  332. I.59.o1=108.o1
  333. I.59.i1=57.o1
  334. I.65.i1=71.o1
  335. I.65.i2=83.o1
  336. I.65.i3=82.o1
  337. I.65.i4=80.o1
  338. I.65.i5=81.o1
  339. I.66.i2=111.o1
  340. I.67.i1=24.o1
  341. I.70.i1=71.i1
  342. I.70.i2=84.o1
  343. G.71=2,70,84,85,88,
  344. I.71.o1=2.o1
  345. I.71.i1=5.o1
  346. G.72=98,99,100,101,
  347. I.72.o1=99.o1
  348. I.72.i1=65.o1
  349. I.73.i1=75.o1
  350. G.74=73,75,76,77,
  351. I.74.i1=18.o3
  352. I.75.i1=76.o1
  353. I.75.i2=77.o1
  354. I.76.i1=74.i1
  355. I.78.i1=79.o1
  356. I.78.i2=5.o1
  357. I.78.i3=72.o1
  358. G.80=93,105,106,107,112,
  359. I.80.o1=106.o1
  360. I.80.i1=18.o3
  361. G.81=94,95,96,97,
  362. I.81.o1=95.o1
  363. I.81.i1=18.o4
  364. G.82=92,102,103,104,
  365. I.82.o1=103.o1
  366. I.82.i1=18.o2
  367. G.83=86,87,89,90,91,
  368. I.83.o1=90.o1
  369. I.83.i1=18.o1
  370. I.89.i1=83.i1
  371. I.89.i2=91.o1
  372. I.90.i1=89.o1
  373. I.94.i1=81.i1
  374. I.94.i2=96.o1
  375. I.95.i1=94.o1
  376. I.98.i1=72.i1
  377. I.99.i1=98.o1
  378. f99.2.i=-
  379. I.99.i2=100.o1
  380. I.102.i1=82.i1
  381. I.102.i2=104.o1
  382. I.103.i1=102.o1
  383. I.105.i1=80.i1
  384. I.105.i2=107.o1
  385. I.106.i1=105.o1
  386. I.108.i1=59.i1
  387. I.110.i1=65.o1
  388. I.111.i1=110.o1
  389. I.112.i1=106.o1
  390. I.113.i1=18.o3
  391. I.114.i1=18.o1
  392. I.117.i1=28.o1
  393.