0 Members and 1 Guest are viewing this topic.
(defun duct_calc (/) ;;; volume pressure velocity;;; diam rey_no fric_fac width;;; depth square friction area_sqft;;; ) (setq diam (getreal "\nEnter duct diameter:") width (getreal "\nEnter duct width:") depth (getreal "\nEnter duct depth:") volume (getreal "\nEnter total CFM'S:") velocity (getreal "\nEnter Velocity in FPM:") ) (cond ((and diam volume) (setq area_sqft (/ (* 0.7854 (expt diam 2.0)) 144.0) width (* diam 0.914774703) depth (* diam 0.914774703) velocity (/ volume area_sqft) pressure (expt (/ velocity 4005.00) 2) ) (find_fric) ) ((and diam velocity) (setq area_sqft (/ (* 0.7854 (expt diam 2.0)) 144.0) width (* diam 0.914774703) depth (* diam 0.914774703) volume (* area_sqft velocity) pressure (expt (/ velocity 4005.00) 2) ) (find_fric) ) ((and width depth volume) (setq area_sqft (* (/ (* width depth) 144.0) 0.914774703) square (sqrt (* area_sqft 144.0)) diam (* 1.3 (exp (/ (log (/ (expt (* square square) 5.0) (expt (+ square square) 2.0) ) ) 8.0 ) ) ) velocity (/ volume area_sqft) pressure (expt (/ velocity 4005.00) 2) ) (find_fric) ) ((and width depth velocity) (setq area_sqft (* (/ (* width depth) 144.0) 0.914774703) square (sqrt (* area_sqft 144.0)) diam (* 1.3 (exp (/ (log (/ (expt (* square square) 5.0) (expt (+ square square) 2.0) ) ) 8.0 ) ) ) volume (* area_sqft velocity) pressure (expt (/ velocity 4005.00) 2) ) (find_fric) ) ((and volume velocity) (setq area_sqft (/ (/ volume velocity) 0.914774703) square (sqrt (* area_sqft 144.0)) diam (* 1.3 (exp (/ (log (/ (expt (* square square) 5.0) (expt (+ square square) 2.0) ) ) 8.0 ) ) ) width (* diam 0.914774703) depth (* diam 0.914774703) pressure (expt (/ velocity 4005.00) 2) ) (find_fric) ) (t (cond ((if volume t ) (prompt "\nYou must enter diameter or Width x Depth or FPM..." ) ) ((if velocity t ) (prompt "\nYou must enter a diameter or Width x Depth or CFM..." ) ) (t (prompt "\nYou must indicate CFMs or FPM..") ) ) ) ) )(defun find_fric () (setq rey_no (* 0.075 diam velocity (/ 1.0 0.0432)) ;<=need coefficient for viscosity of standard air in pounds/ft hr fric_fac (/ 64.0 rey_no) ;<=only good if reynolds is less than 2000 friction (* fric_fac (/ 1200 diam) pressure) ) ;<==Darcy/Weisbach )
;;; Duct calc returns the friction value(defun duct_calc (/);;; volume pressure velocity ;;; diam rey_no fric_fac width ;;; depth square friction area_sqft ;;; );;; -=<*>=- -=<*>=- -=<*>=- -=<*>=- -=<*>=- -=<*>=- -=<*>=- -=<*>=-;;; Local Functions ;;; -=<*>=- -=<*>=- -=<*>=- -=<*>=- -=<*>=- -=<*>=- -=<*>=- -=<*>=-;;; ;; given the area in square feet returns the diameter (defun area2dia (sf_area / square) (setq square (sqrt (* sf_area 144.0))) (* 1.3 (exp (/ (log (/ (expt (* square square) 5.0) (expt (+ square square) 2.0) ) ) 8.0 ) ) ) ) ; end defun ;; given diameter returns the side dimension (defun dia2sq (dia) (* dia 0.914774703) ) ;; given the diameter returns the area in sq ft (defun dia2area (dia) (/ (* 0.7854 (expt dia 2.0)) 144.0) ) ;; given the sides returns the area in sq ft (defun rec2area (w d) ; retangle to area (* (/ (* w d) 144.0) 0.914774703) ) ;; given the diameter returns the area in sq ft (defun veloc2press (vel) (expt (/ vel 4005.00) 2) ) ;; calc friction (defun find_fric () (setq rey_no (* 0.075 diam velocity (/ 1.0 0.0432)) ;<=need coefficient for viscosity of standard air in pounds/ft hr fric_fac (/ 64.0 rey_no) ;<=only good if reynolds is less than 2000 friction (* fric_fac (/ 1200 diam) pressure) ) ;<==Darcy/Weisbach );;; -=<*>=- -=<*>=- -=<*>=- -=<*>=- -=<*>=- -=<*>=- -=<*>=- -=<*>=-;;;================================================================;;; Start of Routine ;;;================================================================;;; -=<*>=- -=<*>=- -=<*>=- -=<*>=- -=<*>=- -=<*>=- -=<*>=- -=<*>=- (prompt "\nEnter known values. Press Enter if not known. ") (setq diam (getreal "\nEnter duct diameter: ")) (if (null diam) ; skip if diameter entered (setq width (getreal "\nEnter duct width: ") depth (getreal "\nEnter duct depth: ") ) ) (setq volume (getreal "\nEnter total CFM'S: ") velocity (getreal "\nEnter Velocity in FPM: ") ) ;;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- ;; Process user input ;;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- (cond ;;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- ((and diam volume) (setq area_sqft (dia2area diam) width (dia2sq diam) depth width velocity (/ volume area_sqft) pressure (veloc2press velocity) ) (find_fric) ) ;;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- ((and diam velocity) (setq area_sqft (dia2area diam) width (dia2sq diam) depth width volume (* area_sqft velocity) pressure (veloc2press velocity) ) (find_fric) ) ;;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- ((and width depth volume) (setq area_sqft (rec2area width depth) diam (area2dia area_sqft) velocity (/ volume area_sqft) pressure (veloc2press velocity) ) (find_fric) ) ;;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- ((and width depth velocity) (setq area_sqft (rec2area width depth) diam (area2dia area_sqft) volume (* area_sqft velocity) pressure (veloc2press velocity) ) (find_fric) ) ;;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- ((and volume velocity) (setq area_sqft (/ (/ volume velocity) 0.914774703) diam (area2dia area_sqft) width (dia2sq diam) depth width pressure (veloc2press velocity) ) (find_fric) ) ;;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- (t (alert "\nInsufficient data retry inputs...")) ) ; end cond stmt) ; end defun
(t (cond ((if volume t ) (prompt "\nYou must enter diameter or Width x Depth or FPM..." ) ) ((if velocity t ) (prompt "\nYou must enter a diameter or Width x Depth or CFM..." ) ) (t (prompt "\nYou must indicate CFMs or FPM..") ) ) )
(t (cond ((or volume velocity) (prompt "\nYou must enter diameter or Width x Depth or FPM..." ) ) (t (prompt "\nYou must indicate CFMs or FPM..") ) ) )
(defun c:test (/ friction) (while (null (setq friction (duct_calc)))) (print friction) (princ))
(defun duct_calc (/);;; volume pressure velocity;;; diam rey_no fric_fac width;;; depth square friction area_sqft;;; );;; -=<*>=- -=<*>=- -=<*>=- -=<*>=- -=<*>=- -=<*>=- -=<*>=- -=<*>=-;;; Local Functions ;;; -=<*>=- -=<*>=- -=<*>=- -=<*>=- -=<*>=- -=<*>=- -=<*>=- -=<*>=-;;; ;; given the area in square feet returns the diameter (defun area2dia (sf_area / square) (setq square (sqrt (* sf_area 144.0))) (* 1.3 (exp (/ (log (/ (expt (* square square) 5.0) (expt (+ square square) 2.0) ) ) 8.0 ) ) ) ) ; end defun ;; given diameter returns the side dimension (defun dia2sq (dia) (* dia 0.914774703) ) ;; given the diameter returns the area in sq ft (defun dia2area (dia) (/ (* 0.7854 (expt dia 2.0)) 144.0) ) ;; given the sides returns the area in sq ft (defun rec2area (w d) ; retangle to area (* (/ (* w d) 144.0) 0.914774703) ) ;; given the diameter returns the area in sq ft (defun veloc2press (vel) (expt (/ vel 4005.00) 2) ) ;; calc friction (defun find_fric () (setq rey_no (* 0.075 diam velocity (/ 1.0 0.0432)) ;<=need coefficient for viscosity of standard air in pounds/ft hr fric_fac (/ 64.0 rey_no) ;<=only good if reynolds is less than 2000 friction (* fric_fac (/ 1200 diam) pressure) ) ;<==Darcy/Weisbach );;; -=<*>=- -=<*>=- -=<*>=- -=<*>=- -=<*>=- -=<*>=- -=<*>=- -=<*>=-;;;================================================================;;; Start of Routine ;;;================================================================;;; -=<*>=- -=<*>=- -=<*>=- -=<*>=- -=<*>=- -=<*>=- -=<*>=- -=<*>=- (prompt "\nEnter known values. Press Enter if not known. ") (setq diam (getreal "\nEnter duct diameter: ")) (if (null diam) ; skip if diameter entered (setq width (getreal "\nEnter duct width: ") depth (getreal "\nEnter duct depth: ") ) ) (setq volume (getreal "\nEnter total CFM'S: ") velocity (getreal "\nEnter Velocity in FPM: ") ) ;;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- ;; Process character pressed ;;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- (cond ;;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- ((and diam volume) (setq area_sqft (dia2area diam) width (dia2sq diam) depth width velocity (/ volume area_sqft) pressure (veloc2press velocity) ) (find_fric) ) ;;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- ((and diam velocity) (setq area_sqft (dia2area diam) width (dia2sq diam) depth width volume (* area_sqft velocity) pressure (veloc2press velocity) ) (find_fric) ) ;;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- ((and width depth volume) (setq area_sqft (rec2area width depth) diam (area2dia area_sqft) velocity (/ volume area_sqft) pressure (veloc2press velocity) ) (find_fric) ) ;;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- ((and width depth velocity) (setq area_sqft (rec2area width depth) diam (area2dia area_sqft) volume (* area_sqft velocity) pressure (veloc2press velocity) ) (find_fric) ) ;;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- ((and volume velocity) (setq area_sqft (/ (/ volume velocity) 0.914774703) diam (area2dia area_sqft) width (dia2sq diam) depth width pressure (veloc2press velocity) ) (find_fric) ) ;;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- (t (cond ((or volume velocity) (prompt "\nYou must enter diameter or Width x Depth..." ) ) (t (prompt "\nYou must indicate CFMs or FPM..") ) ) ) ) ; end cond stmt (textscr) (mapcar 'print (list diam volume width depth velocity friction) ) (princ) )
;;; Duct calc returns the friction value(defun duct_calc (/ friction volume pressure velocity diam rey_no fric_fac width depth area_sqft );;; -=<*>=- -=<*>=- -=<*>=- -=<*>=- -=<*>=- -=<*>=- -=<*>=- -=<*>=-;;; Local Functions ;;; -=<*>=- -=<*>=- -=<*>=- -=<*>=- -=<*>=- -=<*>=- -=<*>=- -=<*>=-;;; ;; given the area in square feet returns the diameter (defun area2dia (sf_area / square) (setq square (sqrt (* sf_area 144.0))) (* 1.3 (exp (/ (log (/ (expt (* square square) 5.0) (expt (+ square square) 2.0) ) ) 8.0 ) ) ) ) ; end defun ;; given diameter returns the side dimension (defun dia2sq (dia) (* dia 0.914774703) ) ;; given the diameter returns the area in sq ft (defun dia2area (dia) (/ (* 0.7854 (expt dia 2.0)) 144.0) ) ;; given the sides returns the area in sq ft (defun rec2area (w d) ; retangle to area (* (/ (* w d) 144.0) 0.914774703) ) ;; given the diameter returns the area in sq ft (defun veloc2press (vel) (expt (/ vel 4005.00) 2) ) ;; calc friction (defun find_fric () (setq rey_no (* 0.075 diam velocity (/ 1.0 0.0432)) ;<=need coefficient for viscosity of standard air in pounds/ft hr fric_fac (/ 64.0 rey_no) ;<=only good if reynolds is less than 2000 friction (* fric_fac (/ 1200 diam) pressure) ) ;<==Darcy/Weisbach );;; -=<*>=- -=<*>=- -=<*>=- -=<*>=- -=<*>=- -=<*>=- -=<*>=- -=<*>=-;;;================================================================;;; Start of Routine ;;;================================================================;;; -=<*>=- -=<*>=- -=<*>=- -=<*>=- -=<*>=- -=<*>=- -=<*>=- -=<*>=- ;;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- ;; Get User Input ;;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- (prompt "\nEnter known values. Press Enter if not known. ") (setq diam (getreal "\nEnter duct diameter: ")) (if (null diam) ; skip if diameter entered (setq width (getreal "\nEnter duct width: ") depth (getreal "\nEnter duct depth: ") ) ) (setq volume (getreal "\nEnter total CFM'S: ")) (if (null (and (or diam (and width depth)) volume)) (setq velocity (getreal "\nEnter Velocity in FPM: ")) ) ;;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- ;; Process User Input ;;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- (cond ;;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- ((and diam volume) (setq area_sqft (dia2area diam) width (dia2sq diam) depth width velocity (/ volume area_sqft) pressure (veloc2press velocity) ) (find_fric) ) ;;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- ((and diam velocity) (setq area_sqft (dia2area diam) width (dia2sq diam) depth width volume (* area_sqft velocity) pressure (veloc2press velocity) ) (find_fric) ) ;;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- ((and width depth volume) (setq area_sqft (rec2area width depth) diam (area2dia area_sqft) velocity (/ volume area_sqft) pressure (veloc2press velocity) ) (find_fric) ) ;;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- ((and width depth velocity) (setq area_sqft (rec2area width depth) diam (area2dia area_sqft) volume (* area_sqft velocity) pressure (veloc2press velocity) ) (find_fric) ) ;;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- ((and volume velocity) (setq area_sqft (/ (/ volume velocity) 0.914774703) diam (area2dia area_sqft) width (dia2sq diam) depth width pressure (veloc2press velocity) ) (find_fric) ) ;;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- (t (cond ((or volume velocity) (prompt "\nYou must enter diameter or Width x Depth or FPM..." ) ) (t (prompt "\nYou must indicate CFMs or FPM..") ) ) ) ) ; end cond stmt (textscr) (mapcar '(lambda (x) (prompt (strcat "\n" (car x) (rtos (cdr x) 2)))) (list (cons "Diameter " diam) (cons "Width " width) (cons "Depth " depth) (cons "Volume " volume) (cons "Velocity " velocity) (cons "Friction " friction) ) ) (princ)) ; end defun(defun c:test (/ friction) (while (null (setq friction (duct_calc)))) (print friction) (princ))
And you've only been doing this for 3 months
Note: Friction losses have been calculated based on the Darcy equation.The friction factor was determined by using a simplified formula byAltshule/Tsal (see ASHRAE, 1997 Fundamentals, Chapter 32). The absoluteroughness factor of 0.0003 ft for the medium smooth roughness categorygalvanized steel ductwork is used in the calculation.