Created
November 19, 2017 23:58
-
-
Save jecolasurdo/3fe8b1b3bf8545ac1315eec0f10ccdf4 to your computer and use it in GitHub Desktop.
Hydraulic Calculation Programs for Water Pumps
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;THE FOLLOWING COMMANDS, 'SUPPLY', 'SYSTEM', AND 'PT' ARE COMMANDS TO DRAW THE HYDRAULIC GRAPH | |
;;-------------------- | |
;;;supply and system programs for the supply curve graph 2/19/99 | |
(setq qsc (getvar "userr1")) | |
(setq pc (getvar "users1")) | |
(defun c:supply (/ lc pt3 pt1 pt2 q2 q1 q sp ps) | |
(graphscr) | |
(setvar "cmdecho" 0) | |
(setvar "plinewid" 0.2) | |
(initget 5) | |
(setq ps (getreal "\nEnter Static Pressure: "));static pressure | |
(initget 5) | |
(setq sp (getreal "\Enter Residual Pressure: ")) | |
(initget 5) | |
(setq q (getreal "\nEnter Q: ")) ;flow | |
(initget 5) | |
(setvar "userr1" (getreal "\nEnter Q Scale Factor: "));flow scale | |
(setq qsc (getvar "userr1")) | |
(setq q1(/ q qsc));scaled flow | |
(setq q2(expt q1 1.85));number to graphed | |
(initget 7 "A B C D") | |
(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 | |
(setq pc (getvar "users1")) | |
(cond ;open cond1 | |
( (= Pc "A") | |
(text1) | |
) | |
( (= Pc "B") | |
(text2) | |
) | |
( (= Pc "C") | |
(text3) | |
) | |
( (= Pc "D") | |
(text4) | |
) | |
);close cond 2 | |
);close defun | |
(defun text1();sets the text for the first cond funct | |
(setq lc(getvar "clayer")) | |
(setvar "clayer" "Flowcurves") | |
(command "text" "-1.6191,5.6173,0" "0.65" "0" 10) | |
(command "text" "-1.6191,11.1173,0" "0.65" "0" 20) | |
(command "text" "-1.6191,16.6173,0" "0.65" "0" 30) | |
(command "text" "-1.6191,22.1173,0" "0.65" "0" 40) | |
(command "text" "-1.6191,27.6173,0" "0.65" "0" 50) | |
(command "text" "-1.6191,33.1173,0" "0.65" "0" 60) | |
(command "text" "-1.6191,38.6173,0" "0.65" "0" 70) | |
(command "text" "-1.6191,44.1173,0" "0.65" "0" 80) | |
(command "text" "-1.6191,49.6173,0" "0.65" "0" 90) | |
(SETQ PT1 (LIST Q2 (* sP 0.55))) | |
(setq pt2(list 0 (* ps 0.55))) | |
(command "donut" "0" "0.6" pt1 "") | |
(command "donut" "0" "0.6" pt2 "") | |
(command "pline" pt1 pt2 "") | |
(setq pt3(car pt1)) | |
(if (< 70.9046 pt3);open if 1 | |
(tr) | |
(command "extend" "70.7946,54" "" pt1 "") | |
);close if 1 | |
(setvar "clayer" "0") | |
(iff) | |
(princ));close defun text1 | |
(defun text2();sets the text for the second cond funct | |
(setq lc(getvar "clayer")) | |
(setvar "clayer" "Flowcurves") | |
(command "text" "-1.6191,5.6173,0" "0.65" "0" 20) | |
(command "text" "-1.6191,11.1173,0" "0.65" "0" 40) | |
(command "text" "-1.6191,16.6173,0" "0.65" "0" 60) | |
(command "text" "-1.6191,22.1173,0" "0.65" "0" 80) | |
(command "text" "-1.6191,27.6173,0" "0.65" "0" 100) | |
(command "text" "-1.6191,33.1173,0" "0.65" "0" 120) | |
(command "text" "-1.6191,38.6173,0" "0.65" "0" 140) | |
(command "text" "-1.6191,44.1173,0" "0.65" "0" 160) | |
(command "text" "-1.6191,49.6173,0" "0.65" "0" 180) | |
(SETQ PT1 (LIST Q2 (* SP 0.275))) | |
(setq pt2(list 0 (* ps 0.275))) | |
(command "donut" "0" "0.5" pt1 "") | |
(command "donut" "0" "0.5" pt2 "") | |
(command "pline" pt1 pt2 "") | |
(setq pt3(car pt1)) | |
(if (< 70.9046 pt3);open if 1 | |
(tr) | |
(command "extend" "70.7946,54" "" pt1 "") | |
);close if 1 | |
(setvar "clayer" lc) | |
(iff) | |
(princ));close defun text2 | |
(defun text3();sets the text for the third cond funct | |
(setq lc(getvar "clayer")) | |
(setvar "clayer" "Flowcurves") | |
(command "text" "-1.6191,5.6173,0" "0.65" "0" 25);update 11/30/05 | |
(command "text" "-1.6191,11.1173,0" "0.65" "0" 50) | |
(command "text" "-1.6191,16.6173,0" "0.65" "0" 75) | |
(command "text" "-1.6191,22.1173,0" "0.65" "0" 100) | |
(command "text" "-1.6191,27.6173,0" "0.65" "0" 125) | |
(command "text" "-1.6191,33.1173,0" "0.65" "0" 150) | |
(command "text" "-1.6191,38.6173,0" "0.65" "0" 175) | |
(command "text" "-1.6191,44.1173,0" "0.65" "0" 200) | |
(command "text" "-1.6191,49.6173,0" "0.65" "0" 225) | |
(SETQ PT1 (LIST Q2 (* SP 0.22)));update 11/30/05 | |
(setq pt2(list 0 (* ps 0.22))) | |
(command "donut" "0" "0.5" pt1 "") | |
(command "donut" "0" "0.5" pt2 "") | |
(command "pline" pt1 pt2 "") | |
(setq pt3(car pt1)) | |
(if (< 70.9046 pt3);open if 1 | |
(tr) | |
(command "extend" "70.7946,54" "" pt1 "") | |
);close if 1 | |
(setvar "clayer" lc) | |
(iff) | |
(princ));close defun text3 | |
(defun text4();sets the text for the third cond funct | |
(setq lc(getvar "clayer")) | |
(setvar "clayer" "Flowcurves") | |
(command "text" "-1.6191,5.6173,0" "0.65" "0" 50);update 11/30/05 | |
(command "text" "-1.6191,11.1173,0" "0.65" "0" 100) | |
(command "text" "-1.6191,16.6173,0" "0.65" "0" 150) | |
(command "text" "-1.6191,22.1173,0" "0.65" "0" 200) | |
(command "text" "-1.6191,27.6173,0" "0.65" "0" 250) | |
(command "text" "-1.6191,33.1173,0" "0.65" "0" 300) | |
(command "text" "-1.6191,38.6173,0" "0.65" "0" 350) | |
(command "text" "-1.6191,44.1173,0" "0.65" "0" 400) | |
(command "text" "-1.6191,49.6173,0" "0.65" "0" 450) | |
(SETQ PT1 (LIST Q2 (* SP 0.11)));update 11/30/05 | |
(setq pt2(list 0 (* ps 0.11))) | |
(command "donut" "0" "0.5" pt1 "") | |
(command "donut" "0" "0.5" pt2 "") | |
(command "pline" pt1 pt2 "") | |
(setq pt3(car pt1)) | |
(if (< 70.9046 pt3);open if 1 | |
(tr) | |
(command "extend" "70.7946,54" "" pt1 "") | |
);close if 1 | |
(setvar "clayer" lc) | |
(iff) | |
(princ));close defun text4 | |
----------------------------------------------------------- | |
(defun tr() | |
(command "trim" "70.9046,54" "" "f" "70.80,57.0479" "70.80,0" "" "") | |
) | |
;the tr sub routine trims the flow curve if it falls outside the graph | |
----------------------------------------------------------- | |
(defun iff ();the iff routine asks the user if the entered data | |
(initget 7 "Yes No") ;was correct, if the user answers no, everything | |
(if (= "NO" ;in the graph routine is undone, then re-run | |
(strcase(getkword "\nIs Did you enter the correct data?(Y/N): "))) | |
(progn | |
(command "undo" 13) | |
(c:supply) | |
);close progn | |
);close if | |
(princ) | |
);close defun | |
---------------------------------------------------------------------- | |
(defun c:system (/ lc tp1 tp2 pt1 pt2 ihose2 ihose1 spkrdem3 spkrdem2 phose2 phose ihose spkrdem) | |
(graphscr) | |
(setvar "cmdecho" 0) | |
(setvar "plinewid" 0.2) | |
(initget 5) | |
(setq spkrdem(getreal "\nEnter GPM Demand (Including Hose) @ Base of Riser: ")) | |
(initget 5) | |
(setq phose(getreal "\nEnter Pressure @ Base of Riser: ")) | |
(initget 5) | |
(setq ihose(getreal "\nEnter GPM Demand(Including Hose) @ City Connection: ")) | |
(initget 5) | |
(setq phose2(getreal "\nEnter Pressure @ City Connection: ")) | |
(setq spkrdem2(/ spkrdem qsc)) | |
(setq spkrdem3(expt spkrdem2 1.85)) | |
(setq ihose1(/ ihose qsc)) | |
(setq ihose2(expt ihose1 1.85)) | |
(setq pc (getvar "users1")) | |
(cond ;open cond1 | |
( (= Pc "A") | |
(tt1) | |
) | |
( (= Pc "B") | |
(tt2) | |
) | |
( (= Pc "C") | |
(tt3) | |
) | |
( (= Pc "D") | |
(tt4) | |
) | |
);close cond 1 | |
);close defun | |
(defun tt1();sets the text for the first cond funct | |
(setq lc(getvar "clayer")) | |
(setvar "clayer" "Flowcurves") | |
(SETQ PT1 (LIST spkrdem3 (* Phose 0.55))) | |
(setq pt2(list ihose2 (* phose2 0.55))) | |
(command "donut" "0" "0.6" pt1 "") | |
(command "donut" "0" "0.6" pt2 "") | |
(setq tp1(list(+ 0.2286 spkrdem3)(- (* phose 0.55)1.2))) | |
(setq tp2(list(+ 0.2286 ihose2)(- (* phose2 0.55)1.2))) | |
(command "text" tp1 "0.85" "0" 1) | |
(command "text" tp2 "0.85" "0" 2) | |
(command "pline" pt2 pt1 "0,0" "") | |
(if (< 70.9046 pt3);open if 1 | |
(tr) | |
);close if 1 | |
(setvar "clayer" lc) | |
(iff2) | |
(princ));close defun text1 | |
(defun tt2();sets the text for the second cond funct | |
(setq lc(getvar "clayer")) | |
(setvar "clayer" "Flowcurves") | |
(SETQ PT1 (LIST spkrdem3 (* Phose 0.275))) | |
(setq pt2(list ihose2 (* phose2 0.275))) | |
(command "donut" "0" "0.6" pt1 "") | |
(command "donut" "0" "0.6" pt2 "") | |
(setq tp1(list(+ 0.2286 spkrdem3)(- (* phose 0.275)1.2))) | |
(setq tp2(list(+ 0.2286 ihose2)(- (* phose2 0.275)1.2))) | |
(command "text" tp1 "0.85" "0" 1) | |
(command "text" tp2 "0.85" "0" 2) | |
(command "pline" pt2 pt1 "0,0" "") | |
(setq pt3(car pt1)) | |
(if (< 70.9046 pt3);open if 1 | |
(tr) | |
);close if 1 | |
(setvar "clayer" lc) | |
(iff2) | |
(princ));close defun text2 | |
(defun tt3();sets the text for the third cond funct | |
(setq lc(getvar "clayer")) | |
(setvar "clayer" "Flowcurves") | |
(SETQ PT1 (LIST spkrdem3 (* Phose 0.22)));update 11/30/05 | |
(setq pt2(list ihose2 (* phose2 0.22))) | |
(command "donut" "0" "0.6" pt1 "") | |
(command "donut" "0" "0.6" pt2 "") | |
(setq tp1(list(+ 0.2286 spkrdem3)(- (* phose 0.22)1.2))) | |
(setq tp2(list(+ 0.2286 ihose2)(- (* phose2 0.22)1.2))) | |
(command "text" tp1 "0.85" "0" 1) | |
(command "text" tp2 "0.85" "0" 2) | |
(command "pline" pt2 pt1 "0,0" "") | |
(setq pt3(car pt1)) | |
(if (< 70.9046 pt3);open if 1 | |
(tr) | |
);close if 1 | |
(setvar "clayer" lc) | |
(iff2) | |
(princ));close defun text3 | |
(defun tt4();sets the text for the third cond funct | |
(setq lc(getvar "clayer")) | |
(setvar "clayer" "Flowcurves") | |
(setq pt1(list ihose2 (* phose2 0.11)));update 11/30/05 | |
(setq pt2(list ihose2 (* phose2 0.11))) | |
(command "donut" "0" "0.6" pt1 "") | |
(command "donut" "0" "0.6" pt2 "") | |
(setq tp1(list(+ 0.2286 spkrdem3)(- (* phose 0.11)1.2))) | |
(setq tp2(list(+ 0.2286 ihose2)(- (* phose2 0.11)1.2))) | |
(command "text" tp1 "0.85" "0" 1) | |
(command "text" tp2 "0.85" "0" 2) | |
(command "pline" pt2 pt1 "0,0" "") | |
(setq pt3(car pt1)) | |
(if (< 70.9046 pt3);open if 1 | |
(tr) | |
);close if 1 | |
(setvar "clayer" lc) | |
(iff2) | |
(princ));close defun text4 | |
----------------------------------------------------------- | |
(defun tr() | |
(command "trim" "70.9046,54.0479" "" "f" "70.80,57.0479" "70.80,0" "" "") | |
) | |
;the tr sub routine trims the flow curve if it falls outside the graph | |
----------------------------------------------------------- | |
(defun iff2 ();the iff routine asks the user if the entered data | |
(initget 7 "Yes No") ;was correct, if the user answers no, everything | |
(if (= "NO" ;in the graph routine is undone, then re-run | |
(strcase(getkword "\nIs Did you enter the correct data?(Y/N): "))) | |
(progn | |
(command "undo" 5) | |
(c:SYSTEM) | |
);close progn | |
);close if | |
(princ) | |
);close defun | |
(defun c:pt () | |
(graphscr) | |
(setvar "cmdecho" 0) | |
(initget 5) | |
(setq sp (getreal "\nEnter Pressure: "));static pressure | |
(setq q (getreal "\nEnter Q: ")) ;flow | |
(initget 5) | |
(setq q1(/ q qsc));scaled flow | |
(setq q2(expt q1 1.85));number to graphed | |
(setq pc (getvar "users1")) | |
(cond ;open cond1 | |
( (= Pc "A") | |
(text11) | |
) | |
( (= Pc "B") | |
(text22) | |
) | |
( (= Pc "C") | |
(text33) | |
) | |
( (= Pc "D") | |
(text44) | |
) | |
);close cond 1 | |
);close defun | |
(defun text11();sets the text for the first cond funct | |
(SETQ PT1 (LIST Q2 (* sP 0.55))) | |
(command "donut" "0" "0.6" pt1 "") | |
(setvar "clayer" "0") | |
(princ));close defun text1 | |
(defun text22();sets the text for the second cond funct | |
(SETQ PT1 (LIST Q2 (* SP 0.275))) | |
(command "donut" "0" "0.5" pt1 "") | |
(princ));close defun text2 | |
(defun text33();sets the text for the third cond funct | |
(SETQ PT1 (LIST Q2 (* SP 0.22)));update 11/30/05 | |
(command "donut" "0" "0.5" pt1 "") | |
(princ));close defun text3 | |
(defun text44();sets the text for the third cond funct | |
(SETQ PT1 (LIST Q2 (* SP 0.11)));update 11/30/05 | |
(command "donut" "0" "0.5" pt1 "") | |
(princ));close defun text4 | |
;;PUMP ROUTINE CREATED 10-14-03 | |
;;------------------- | |
(defun c:pump () | |
(graphscr) | |
(initget 5) | |
(setq pumpq (getreal "\nEnter Pump Rated Capacity: ")) | |
(setq churn (getreal "\nEnter combined pressure at Churn: ")) | |
(setq rtd (getreal "\nEnter combined pressure at Rated Capacity: ")) | |
(setq rtd150 (getreal "\nEnter combined pressure at 150% of Rated Capacity: ")) | |
(initget 5) | |
(SETQ PUMPQ150(* PUMPQ 1.5)) | |
(setq pumpqm(/ pumpq qsc));scaled flow | |
(setq pumpq150m(/ pumpq150 qsc));scaled flow | |
(setq pumpqm1(expt pumpqm 1.85));number to graphed | |
(setq pumpq150m1(expt pumpq150m 1.85));number to graphed | |
(setq pc (getvar "users1")) | |
(cond ;open cond1 | |
( (= Pc "A") | |
(text111) | |
) | |
( (= Pc "B") | |
(text222) | |
) | |
( (= Pc "C") | |
(text333) | |
) | |
( (= Pc "D") | |
(text444) | |
) | |
);close cond 1 | |
);close defun | |
(defun text111();sets the text for the first cond funct | |
(SETQ PUMP1 (LIST (* PUMPQ 0)(* CHURN 0.55))) | |
(command "donut" "0" "0.6" pump1 "") | |
(SETQ pump2 (LIST pumpqm1 (* rtd 0.55))) | |
(command "donut" "0" "0.6" pump2 "") | |
(setvar "clayer" "0") | |
(SETQ pump3 (LIST pumpq150m1 (* rtd150 0.55))) | |
(command "donut" "0" "0.6" pump3 "") | |
(setvar "clayer" "0") | |
(command "pline" PUMP1 pUMP2 PUMP3 "") | |
(princ));close defun text11 | |
(defun text222();sets the text for the second cond funct | |
(SETQ PUMP1 (LIST (* PUMPQ 0)(* CHURN 0.275))) | |
(command "donut" "0" "0.6" pump1 "") | |
(SETQ pump2 (LIST pumpqm1 (* rtd 0.275))) | |
(command "donut" "0" "0.6" pump2 "") | |
(setvar "clayer" "0") | |
(SETQ pump3 (LIST pumpq150m1 (* rtd150 0.275))) | |
(command "donut" "0" "0.6" pump3 "") | |
(setvar "clayer" "0") | |
(command "pline" PUMP1 pUMP2 PUMP3 "") | |
(princ));close defun text22 | |
(defun text333();sets the text for the third cond funct | |
(SETQ PUMP1 (LIST (* PUMPQ 0)(* CHURN 0.22)));update 11/30/05 | |
(command "donut" "0" "0.6" pump1 "") | |
(SETQ pump2 (LIST pumpqm1 (* rtd 0.22))) | |
(command "donut" "0" "0.6" pump2 "") | |
(setvar "clayer" "0") | |
(SETQ pump3 (LIST pumpq150m1 (* rtd150 0.22))) | |
(command "donut" "0" "0.6" pump3 "") | |
(setvar "clayer" "0") | |
(command "pline" PUMP1 pUMP2 PUMP3 "") | |
(princ));close defun text33 | |
(defun text444();sets the text for the third cond funct | |
(SETQ PUMP1 (LIST (* PUMPQ 0)(* CHURN 0.11)));update 11/30/05 | |
(command "donut" "0" "0.6" pump1 "") | |
(SETQ pump2 (LIST pumpqm1 (* rtd 0.11))) | |
(command "donut" "0" "0.6" pump2 "") | |
(setvar "clayer" "0") | |
(SETQ pump3 (LIST pumpq150m1 (* rtd150 0.11))) | |
(command "donut" "0" "0.6" pump3 "") | |
(setvar "clayer" "0") | |
(command "pline" PUMP1 pUMP2 PUMP3 "") | |
(princ));close defun text44 | |
;;----- EOF | |
(defun c:bl () | |
(SETVAR "Clayer" "branchlines") | |
(COMMAND "line") | |
(PRINC)) | |
(defun c:mn () | |
(SETVAR "Clayer" "mains") | |
(COMMAND "line") | |
(PRINC)) | |
(defun c:sw () | |
(SETVAR "Clayer" "site plan1") | |
(COMMAND "line") | |
(PRINC)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment