Guest User

Untitled

a guest
Nov 21st, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 13.98 KB | None | 0 0
  1. ;;THE FOLLOWING COMMANDS, 'SUPPLY', 'SYSTEM', AND 'PT' ARE COMMANDS TO DRAW THE HYDRAULIC GRAPH
  2. ;;--------------------
  3.  
  4. ;;;supply and system programs for the supply curve graph 2/19/99
  5. (setq qsc (getvar "userr1"))
  6. (setq pc (getvar "users1"))
  7. (defun c:supply (/ lc pt3 pt1 pt2 q2 q1 q sp ps)
  8. (graphscr)
  9. (setvar "cmdecho" 0)
  10. (setvar "plinewid" 0.2)
  11. (initget 5)
  12. (setq ps (getreal "\nEnter Static Pressure: "));static pressure
  13. (initget 5)
  14. (setq sp (getreal "\Enter Residual Pressure: "))
  15. (initget 5)
  16. (setq q (getreal "\nEnter Q: ")) ;flow
  17. (initget 5)
  18. (setvar "userr1" (getreal "\nEnter Q Scale Factor: "));flow scale
  19. (setq qsc (getvar "userr1"))
  20. (setq q1(/ q qsc));scaled flow
  21.  
  22. (setq q2(expt q1 1.85));number to graphed
  23.  
  24. (initget 7 "A B C D")
  25. (setvar "users1"(getkword(strcat "\nWhat Presure Scale?? (A. 10,20,30... B. 20,40,60... C. 25,50,75... D. 50,100,150...): ")));update 11/30/05
  26. (setq pc (getvar "users1"))
  27. (cond ;open cond1
  28. ( (= Pc "A")
  29. (text1)
  30. )
  31. ( (= Pc "B")
  32. (text2)
  33. )
  34. ( (= Pc "C")
  35. (text3)
  36. )
  37. ( (= Pc "D")
  38. (text4)
  39. )
  40.  
  41. );close cond 2
  42. );close defun
  43.  
  44. (defun text1();sets the text for the first cond funct
  45. (setq lc(getvar "clayer"))
  46. (setvar "clayer" "Flowcurves")
  47. (command "text" "-1.6191,5.6173,0" "0.65" "0" 10)
  48. (command "text" "-1.6191,11.1173,0" "0.65" "0" 20)
  49. (command "text" "-1.6191,16.6173,0" "0.65" "0" 30)
  50. (command "text" "-1.6191,22.1173,0" "0.65" "0" 40)
  51. (command "text" "-1.6191,27.6173,0" "0.65" "0" 50)
  52. (command "text" "-1.6191,33.1173,0" "0.65" "0" 60)
  53. (command "text" "-1.6191,38.6173,0" "0.65" "0" 70)
  54. (command "text" "-1.6191,44.1173,0" "0.65" "0" 80)
  55. (command "text" "-1.6191,49.6173,0" "0.65" "0" 90)
  56. (SETQ PT1 (LIST Q2 (* sP 0.55)))
  57. (setq pt2(list 0 (* ps 0.55)))
  58. (command "donut" "0" "0.6" pt1 "")
  59. (command "donut" "0" "0.6" pt2 "")
  60.  
  61. (command "pline" pt1 pt2 "")
  62. (setq pt3(car pt1))
  63. (if (< 70.9046 pt3);open if 1
  64. (tr)
  65. (command "extend" "70.7946,54" "" pt1 "")
  66. );close if 1
  67.  
  68. (setvar "clayer" "0")
  69. (iff)
  70. (princ));close defun text1
  71.  
  72. (defun text2();sets the text for the second cond funct
  73. (setq lc(getvar "clayer"))
  74. (setvar "clayer" "Flowcurves")
  75. (command "text" "-1.6191,5.6173,0" "0.65" "0" 20)
  76. (command "text" "-1.6191,11.1173,0" "0.65" "0" 40)
  77. (command "text" "-1.6191,16.6173,0" "0.65" "0" 60)
  78. (command "text" "-1.6191,22.1173,0" "0.65" "0" 80)
  79. (command "text" "-1.6191,27.6173,0" "0.65" "0" 100)
  80. (command "text" "-1.6191,33.1173,0" "0.65" "0" 120)
  81. (command "text" "-1.6191,38.6173,0" "0.65" "0" 140)
  82. (command "text" "-1.6191,44.1173,0" "0.65" "0" 160)
  83. (command "text" "-1.6191,49.6173,0" "0.65" "0" 180)
  84. (SETQ PT1 (LIST Q2 (* SP 0.275)))
  85. (setq pt2(list 0 (* ps 0.275)))
  86. (command "donut" "0" "0.5" pt1 "")
  87. (command "donut" "0" "0.5" pt2 "")
  88.  
  89. (command "pline" pt1 pt2 "")
  90. (setq pt3(car pt1))
  91. (if (< 70.9046 pt3);open if 1
  92. (tr)
  93. (command "extend" "70.7946,54" "" pt1 "")
  94. );close if 1
  95. (setvar "clayer" lc)
  96. (iff)
  97. (princ));close defun text2
  98.  
  99.  
  100. (defun text3();sets the text for the third cond funct
  101. (setq lc(getvar "clayer"))
  102. (setvar "clayer" "Flowcurves")
  103. (command "text" "-1.6191,5.6173,0" "0.65" "0" 25);update 11/30/05
  104. (command "text" "-1.6191,11.1173,0" "0.65" "0" 50)
  105. (command "text" "-1.6191,16.6173,0" "0.65" "0" 75)
  106. (command "text" "-1.6191,22.1173,0" "0.65" "0" 100)
  107. (command "text" "-1.6191,27.6173,0" "0.65" "0" 125)
  108. (command "text" "-1.6191,33.1173,0" "0.65" "0" 150)
  109. (command "text" "-1.6191,38.6173,0" "0.65" "0" 175)
  110. (command "text" "-1.6191,44.1173,0" "0.65" "0" 200)
  111. (command "text" "-1.6191,49.6173,0" "0.65" "0" 225)
  112. (SETQ PT1 (LIST Q2 (* SP 0.22)));update 11/30/05
  113. (setq pt2(list 0 (* ps 0.22)))
  114. (command "donut" "0" "0.5" pt1 "")
  115. (command "donut" "0" "0.5" pt2 "")
  116.  
  117. (command "pline" pt1 pt2 "")
  118. (setq pt3(car pt1))
  119. (if (< 70.9046 pt3);open if 1
  120. (tr)
  121. (command "extend" "70.7946,54" "" pt1 "")
  122. );close if 1
  123. (setvar "clayer" lc)
  124. (iff)
  125. (princ));close defun text3
  126.  
  127.  
  128. (defun text4();sets the text for the third cond funct
  129. (setq lc(getvar "clayer"))
  130. (setvar "clayer" "Flowcurves")
  131. (command "text" "-1.6191,5.6173,0" "0.65" "0" 50);update 11/30/05
  132. (command "text" "-1.6191,11.1173,0" "0.65" "0" 100)
  133. (command "text" "-1.6191,16.6173,0" "0.65" "0" 150)
  134. (command "text" "-1.6191,22.1173,0" "0.65" "0" 200)
  135. (command "text" "-1.6191,27.6173,0" "0.65" "0" 250)
  136. (command "text" "-1.6191,33.1173,0" "0.65" "0" 300)
  137. (command "text" "-1.6191,38.6173,0" "0.65" "0" 350)
  138. (command "text" "-1.6191,44.1173,0" "0.65" "0" 400)
  139. (command "text" "-1.6191,49.6173,0" "0.65" "0" 450)
  140. (SETQ PT1 (LIST Q2 (* SP 0.11)));update 11/30/05
  141. (setq pt2(list 0 (* ps 0.11)))
  142. (command "donut" "0" "0.5" pt1 "")
  143. (command "donut" "0" "0.5" pt2 "")
  144.  
  145. (command "pline" pt1 pt2 "")
  146. (setq pt3(car pt1))
  147. (if (< 70.9046 pt3);open if 1
  148. (tr)
  149. (command "extend" "70.7946,54" "" pt1 "")
  150. );close if 1
  151. (setvar "clayer" lc)
  152. (iff)
  153. (princ));close defun text4
  154. -----------------------------------------------------------
  155. (defun tr()
  156.  
  157. (command "trim" "70.9046,54" "" "f" "70.80,57.0479" "70.80,0" "" "")
  158. )
  159.  
  160. ;the tr sub routine trims the flow curve if it falls outside the graph
  161. -----------------------------------------------------------
  162. (defun iff ();the iff routine asks the user if the entered data
  163. (initget 7 "Yes No") ;was correct, if the user answers no, everything
  164. (if (= "NO" ;in the graph routine is undone, then re-run
  165. (strcase(getkword "\nIs Did you enter the correct data?(Y/N): ")))
  166. (progn
  167. (command "undo" 13)
  168. (c:supply)
  169. );close progn
  170. );close if
  171. (princ)
  172. );close defun
  173. ----------------------------------------------------------------------
  174. (defun c:system (/ lc tp1 tp2 pt1 pt2 ihose2 ihose1 spkrdem3 spkrdem2 phose2 phose ihose spkrdem)
  175. (graphscr)
  176. (setvar "cmdecho" 0)
  177. (setvar "plinewid" 0.2)
  178. (initget 5)
  179. (setq spkrdem(getreal "\nEnter GPM Demand (Including Hose) @ Base of Riser: "))
  180. (initget 5)
  181. (setq phose(getreal "\nEnter Pressure @ Base of Riser: "))
  182. (initget 5)
  183. (setq ihose(getreal "\nEnter GPM Demand(Including Hose) @ City Connection: "))
  184. (initget 5)
  185. (setq phose2(getreal "\nEnter Pressure @ City Connection: "))
  186. (setq spkrdem2(/ spkrdem qsc))
  187. (setq spkrdem3(expt spkrdem2 1.85))
  188. (setq ihose1(/ ihose qsc))
  189. (setq ihose2(expt ihose1 1.85))
  190. (setq pc (getvar "users1"))
  191.  
  192. (cond ;open cond1
  193. ( (= Pc "A")
  194. (tt1)
  195. )
  196. ( (= Pc "B")
  197. (tt2)
  198. )
  199. ( (= Pc "C")
  200. (tt3)
  201. )
  202. ( (= Pc "D")
  203. (tt4)
  204. )
  205.  
  206. );close cond 1
  207. );close defun
  208.  
  209.  
  210. (defun tt1();sets the text for the first cond funct
  211. (setq lc(getvar "clayer"))
  212. (setvar "clayer" "Flowcurves")
  213. (SETQ PT1 (LIST spkrdem3 (* Phose 0.55)))
  214. (setq pt2(list ihose2 (* phose2 0.55)))
  215. (command "donut" "0" "0.6" pt1 "")
  216. (command "donut" "0" "0.6" pt2 "")
  217. (setq tp1(list(+ 0.2286 spkrdem3)(- (* phose 0.55)1.2)))
  218. (setq tp2(list(+ 0.2286 ihose2)(- (* phose2 0.55)1.2)))
  219. (command "text" tp1 "0.85" "0" 1)
  220. (command "text" tp2 "0.85" "0" 2)
  221. (command "pline" pt2 pt1 "0,0" "")
  222. (if (< 70.9046 pt3);open if 1
  223. (tr)
  224. );close if 1
  225. (setvar "clayer" lc)
  226. (iff2)
  227. (princ));close defun text1
  228.  
  229. (defun tt2();sets the text for the second cond funct
  230. (setq lc(getvar "clayer"))
  231. (setvar "clayer" "Flowcurves")
  232. (SETQ PT1 (LIST spkrdem3 (* Phose 0.275)))
  233. (setq pt2(list ihose2 (* phose2 0.275)))
  234. (command "donut" "0" "0.6" pt1 "")
  235. (command "donut" "0" "0.6" pt2 "")
  236. (setq tp1(list(+ 0.2286 spkrdem3)(- (* phose 0.275)1.2)))
  237. (setq tp2(list(+ 0.2286 ihose2)(- (* phose2 0.275)1.2)))
  238. (command "text" tp1 "0.85" "0" 1)
  239. (command "text" tp2 "0.85" "0" 2)
  240. (command "pline" pt2 pt1 "0,0" "")
  241. (setq pt3(car pt1))
  242. (if (< 70.9046 pt3);open if 1
  243. (tr)
  244. );close if 1
  245. (setvar "clayer" lc)
  246. (iff2)
  247. (princ));close defun text2
  248.  
  249.  
  250. (defun tt3();sets the text for the third cond funct
  251. (setq lc(getvar "clayer"))
  252. (setvar "clayer" "Flowcurves")
  253. (SETQ PT1 (LIST spkrdem3 (* Phose 0.22)));update 11/30/05
  254. (setq pt2(list ihose2 (* phose2 0.22)))
  255. (command "donut" "0" "0.6" pt1 "")
  256. (command "donut" "0" "0.6" pt2 "")
  257. (setq tp1(list(+ 0.2286 spkrdem3)(- (* phose 0.22)1.2)))
  258. (setq tp2(list(+ 0.2286 ihose2)(- (* phose2 0.22)1.2)))
  259. (command "text" tp1 "0.85" "0" 1)
  260. (command "text" tp2 "0.85" "0" 2)
  261. (command "pline" pt2 pt1 "0,0" "")
  262. (setq pt3(car pt1))
  263. (if (< 70.9046 pt3);open if 1
  264. (tr)
  265. );close if 1
  266. (setvar "clayer" lc)
  267. (iff2)
  268. (princ));close defun text3
  269.  
  270.  
  271. (defun tt4();sets the text for the third cond funct
  272. (setq lc(getvar "clayer"))
  273. (setvar "clayer" "Flowcurves")
  274. (setq pt1(list ihose2 (* phose2 0.11)));update 11/30/05
  275. (setq pt2(list ihose2 (* phose2 0.11)))
  276. (command "donut" "0" "0.6" pt1 "")
  277. (command "donut" "0" "0.6" pt2 "")
  278. (setq tp1(list(+ 0.2286 spkrdem3)(- (* phose 0.11)1.2)))
  279. (setq tp2(list(+ 0.2286 ihose2)(- (* phose2 0.11)1.2)))
  280. (command "text" tp1 "0.85" "0" 1)
  281. (command "text" tp2 "0.85" "0" 2)
  282. (command "pline" pt2 pt1 "0,0" "")
  283. (setq pt3(car pt1))
  284. (if (< 70.9046 pt3);open if 1
  285. (tr)
  286. );close if 1
  287. (setvar "clayer" lc)
  288. (iff2)
  289. (princ));close defun text4
  290. -----------------------------------------------------------
  291. (defun tr()
  292.  
  293. (command "trim" "70.9046,54.0479" "" "f" "70.80,57.0479" "70.80,0" "" "")
  294. )
  295.  
  296. ;the tr sub routine trims the flow curve if it falls outside the graph
  297. -----------------------------------------------------------
  298. (defun iff2 ();the iff routine asks the user if the entered data
  299. (initget 7 "Yes No") ;was correct, if the user answers no, everything
  300. (if (= "NO" ;in the graph routine is undone, then re-run
  301. (strcase(getkword "\nIs Did you enter the correct data?(Y/N): ")))
  302. (progn
  303. (command "undo" 5)
  304. (c:SYSTEM)
  305. );close progn
  306. );close if
  307. (princ)
  308. );close defun
  309.  
  310. (defun c:pt ()
  311. (graphscr)
  312. (setvar "cmdecho" 0)
  313. (initget 5)
  314. (setq sp (getreal "\nEnter Pressure: "));static pressure
  315. (setq q (getreal "\nEnter Q: ")) ;flow
  316. (initget 5)
  317. (setq q1(/ q qsc));scaled flow
  318.  
  319. (setq q2(expt q1 1.85));number to graphed
  320.  
  321. (setq pc (getvar "users1"))
  322.  
  323. (cond ;open cond1
  324. ( (= Pc "A")
  325. (text11)
  326. )
  327. ( (= Pc "B")
  328. (text22)
  329. )
  330. ( (= Pc "C")
  331. (text33)
  332. )
  333. ( (= Pc "D")
  334. (text44)
  335. )
  336.  
  337. );close cond 1
  338. );close defun
  339.  
  340. (defun text11();sets the text for the first cond funct
  341.  
  342. (SETQ PT1 (LIST Q2 (* sP 0.55)))
  343. (command "donut" "0" "0.6" pt1 "")
  344. (setvar "clayer" "0")
  345. (princ));close defun text1
  346.  
  347. (defun text22();sets the text for the second cond funct
  348.  
  349. (SETQ PT1 (LIST Q2 (* SP 0.275)))
  350. (command "donut" "0" "0.5" pt1 "")
  351. (princ));close defun text2
  352.  
  353.  
  354. (defun text33();sets the text for the third cond funct
  355.  
  356. (SETQ PT1 (LIST Q2 (* SP 0.22)));update 11/30/05
  357. (command "donut" "0" "0.5" pt1 "")
  358. (princ));close defun text3
  359.  
  360.  
  361. (defun text44();sets the text for the third cond funct
  362.  
  363. (SETQ PT1 (LIST Q2 (* SP 0.11)));update 11/30/05
  364. (command "donut" "0" "0.5" pt1 "")
  365. (princ));close defun text4
  366.  
  367.  
  368. ;;PUMP ROUTINE CREATED 10-14-03
  369. ;;-------------------
  370. (defun c:pump ()
  371. (graphscr)
  372. (initget 5)
  373. (setq pumpq (getreal "\nEnter Pump Rated Capacity: "))
  374. (setq churn (getreal "\nEnter combined pressure at Churn: "))
  375. (setq rtd (getreal "\nEnter combined pressure at Rated Capacity: "))
  376. (setq rtd150 (getreal "\nEnter combined pressure at 150% of Rated Capacity: "))
  377. (initget 5)
  378. (SETQ PUMPQ150(* PUMPQ 1.5))
  379. (setq pumpqm(/ pumpq qsc));scaled flow
  380. (setq pumpq150m(/ pumpq150 qsc));scaled flow
  381.  
  382. (setq pumpqm1(expt pumpqm 1.85));number to graphed
  383. (setq pumpq150m1(expt pumpq150m 1.85));number to graphed
  384.  
  385.  
  386.  
  387. (setq pc (getvar "users1"))
  388.  
  389. (cond ;open cond1
  390. ( (= Pc "A")
  391. (text111)
  392. )
  393. ( (= Pc "B")
  394. (text222)
  395. )
  396. ( (= Pc "C")
  397. (text333)
  398. )
  399. ( (= Pc "D")
  400. (text444)
  401. )
  402.  
  403. );close cond 1
  404. );close defun
  405.  
  406. (defun text111();sets the text for the first cond funct
  407.  
  408. (SETQ PUMP1 (LIST (* PUMPQ 0)(* CHURN 0.55)))
  409. (command "donut" "0" "0.6" pump1 "")
  410. (SETQ pump2 (LIST pumpqm1 (* rtd 0.55)))
  411. (command "donut" "0" "0.6" pump2 "")
  412. (setvar "clayer" "0")
  413. (SETQ pump3 (LIST pumpq150m1 (* rtd150 0.55)))
  414. (command "donut" "0" "0.6" pump3 "")
  415. (setvar "clayer" "0")
  416. (command "pline" PUMP1 pUMP2 PUMP3 "")
  417. (princ));close defun text11
  418.  
  419. (defun text222();sets the text for the second cond funct
  420.  
  421. (SETQ PUMP1 (LIST (* PUMPQ 0)(* CHURN 0.275)))
  422. (command "donut" "0" "0.6" pump1 "")
  423. (SETQ pump2 (LIST pumpqm1 (* rtd 0.275)))
  424. (command "donut" "0" "0.6" pump2 "")
  425. (setvar "clayer" "0")
  426. (SETQ pump3 (LIST pumpq150m1 (* rtd150 0.275)))
  427. (command "donut" "0" "0.6" pump3 "")
  428. (setvar "clayer" "0")
  429. (command "pline" PUMP1 pUMP2 PUMP3 "")
  430. (princ));close defun text22
  431.  
  432. (defun text333();sets the text for the third cond funct
  433.  
  434. (SETQ PUMP1 (LIST (* PUMPQ 0)(* CHURN 0.22)));update 11/30/05
  435. (command "donut" "0" "0.6" pump1 "")
  436. (SETQ pump2 (LIST pumpqm1 (* rtd 0.22)))
  437. (command "donut" "0" "0.6" pump2 "")
  438. (setvar "clayer" "0")
  439. (SETQ pump3 (LIST pumpq150m1 (* rtd150 0.22)))
  440. (command "donut" "0" "0.6" pump3 "")
  441. (setvar "clayer" "0")
  442. (command "pline" PUMP1 pUMP2 PUMP3 "")
  443. (princ));close defun text33
  444.  
  445.  
  446. (defun text444();sets the text for the third cond funct
  447.  
  448. (SETQ PUMP1 (LIST (* PUMPQ 0)(* CHURN 0.11)));update 11/30/05
  449. (command "donut" "0" "0.6" pump1 "")
  450. (SETQ pump2 (LIST pumpqm1 (* rtd 0.11)))
  451. (command "donut" "0" "0.6" pump2 "")
  452. (setvar "clayer" "0")
  453. (SETQ pump3 (LIST pumpq150m1 (* rtd150 0.11)))
  454. (command "donut" "0" "0.6" pump3 "")
  455. (setvar "clayer" "0")
  456. (command "pline" PUMP1 pUMP2 PUMP3 "")
  457. (princ));close defun text44
  458. ;;----- EOF
  459.  
  460. (defun c:bl ()
  461. (SETVAR "Clayer" "branchlines")
  462. (COMMAND "line")
  463. (PRINC))
  464.  
  465. (defun c:mn ()
  466. (SETVAR "Clayer" "mains")
  467. (COMMAND "line")
  468. (PRINC))
  469.  
  470. (defun c:sw ()
  471. (SETVAR "Clayer" "site plan1")
  472. (COMMAND "line")
  473. (PRINC))
Add Comment
Please, Sign In to add comment