; 24-Mar-2008 NEHolt; added support for Aluminum conductors ; 20-Mar-2008 NEHolt; created for blog (defun c:pf3 ( / wire_props wiresize x conduit hit PF amps len Zeff vd kW wire_metal default_msg offset Reactance AC_resistance) ; Calculate 3-phase voltage drop and wire losses (setq wire_props (list ; format ; (list wiresize XL(pvc) XL(al) XL(steel) ; ACR_cu(pvc) ACR_cu(al) ACR_cu(steel) ; ACR_al(pvc) ACR_al(al) ACR_al(steel)) ; where XL and ACR are in ohms per Kilometer (list "8" 0.171 0.171 0.213 2.56 2.56 2.56 4.3 4.3 4.3) (list "6" 0.167 0.167 0.21 1.61 1.61 1.61 2.66 2.66 2.66) (list "4" 0.157 0.157 0.197 1.02 1.02 1.02 1.67 1.67 1.67) (list "3" 0.154 0.154 0.194 0.82 0.82 0.82 1.31 1.31 1.31) (list "2" 0.148 0.148 0.187 0.62 0.66 0.66 1.05 1.05 1.05) (list "1" 0.151 0.151 0.187 0.49 0.52 0.52 0.82 0.85 0.82) (list "1-0" 0.144 0.144 0.18 0.39 0.43 0.39 0.66 0.69 0.66) (list "2-0" 0.141 0.141 0.177 0.33 0.33 0.33 0.52 0.52 0.52) (list "3-0" 0.138 0.138 0.171 0.253 0.269 0.259 0.43 0.43 0.43) (list "4-0" 0.135 0.135 0.167 0.203 0.22 0.207 0.33 0.36 0.33) (list "250" 0.135 0.135 0.171 0.171 0.187 0.177 0.279 0.295 0.282) (list "350" 0.131 0.131 0.164 0.125 0.141 0.128 0.2 0.217 0.207) (list "500" 0.128 0.128 0.157 0.089 0.105 0.095 0.141 0.157 0.148) (list "750" 0.125 0.125 0.157 0.062 0.079 0.069 0.095 0.112 0.102) (list "1000" 0.121 0.121 0.151 0.049 0.062 0.059 0.075 0.089 0.082) ) ) (while (/= (setq wiresize (getstring "\nWire size [? for list] =")) "") ; User enters wire size at command prompt, ends ; up in variable "wiresize" (setq hit nil) ; Look through wire reactance/resistance table ; and find the matching record. (foreach x wire_props (if (= wiresize "?") (progn (princ (car x))(princ " ") ; display only ) ) (if (= wiresize (car x)) (setq hit x) ; remember that found the wire size ) ) (if hit (progn (setq default_msg "") (if wire_metal (setq default_msg (strcat "<" (itoa wire_metal) ">"))) (setq x (getint (strcat "Wire type 1=copper, 2=aluminum " default_msg ":"))) (if (AND x (OR (= x 1)(= x 2))) (progn (setq wire_metal x) (cond ((= wire_metal 1)(setq offset 0)) ((= wire_metal 2)(setq offset 3)) ) ) ) ) ) (if (AND wire_metal hit) (progn ; found wire size record, okay to continue (setq default_msg "") (if conduit (setq default_msg (strcat "<" (itoa conduit) ">"))) (setq x (getint (strcat "Select 1=PVC, 2=Alum conduit, 3=Steel conduit " default_msg ":"))) (if (AND x (OR (= x 1)(= x 2)(= x 3))) (progn (setq conduit x) ) ) (cond ; Pull selected wire size's reactance and ; AC resistance values out of the wire size ; record based upon the conduit type. ((= conduit 1) ; PVC conduit (setq Reactance (cadr hit)) (setq AC_resistance (nth (+ 4 offset) hit)) ) ((= conduit 2) ; Aluminum conduit (setq Reactance (caddr hit)) (setq AC_resistance (nth (+ 5 offset) hit)) ) ((= conduit 3) ; Steel conduit (setq Reactance (nth 3 hit)) (setq AC_resistance (nth (+ 6 offset) hit)) ) (T (setq wiresize nil) ; invalid entry ; Flag to exit now (setq hit nil) ) ) ) ) (if hit (progn ; prompt for additional information (if (not PF)(setq PF 0.85)) (setq x (getreal (strcat "Power factor :"))) (if x (setq PF x)) (if (> PF 1.0)(setq PF 1.0)) (if (< PF 0.0)(setq hit nil)) ; invalid entry ) ) (if hit (progn ; prompt for load current (if amps (setq x (getreal (strcat "Amp current <" (rtos amps 2 1) ">:"))) ; ELSE (setq x (getreal "Amp current:")) ) (if x (setq amps x)) (if len (setq x (getreal (strcat "Wire length (feet) <" (rtos len 2 1) ">:"))) ; ELSE (setq x (getreal "Wire length (feet):")) ) (if x (setq len x)) ; Now calculate voltage drop. ; First calculate effective impedance ; Ze=ACR * PF + SQRT (1 - PF^2) * Reactance (setq Zeff (+ (* AC_resistance PF) (* (sqrt (- 1.0 (expt PF 2.0))) Reactance))) ; Then apply amps and length to get the ; total voltage drop. ; VD = Zeff * amps * length in Kilometers (setq vd (* Zeff amps 1.732 (* len 0.0003048))) (princ "\nvoltage drop=") (princ (rtos vd 2 2)) ; limit to 2 decimals ; Calculate kW heating losses in the wire ; at full load. (setq kW (* (* vd 1.732 amps) 0.001)) (princ ", loss=") (princ (rtos kW 2 1)) ; limit to 1 decimal (princ " kW") ) ) ) (princ) )