Engineering
Overview
Engineering calculations form the computational backbone of design, analysis, and optimization across mechanical, chemical, civil, electrical, and environmental disciplines. These calculations range from fundamental fluid mechanics and thermodynamics to specialized applications in renewable energy systems and process control. Modern engineering practice demands precise numerical methods to solve complex systems of equations, analyze dimensionless parameters, and predict physical behavior under varying conditions.
Excel has traditionally served as a platform for engineering calculations due to its accessibility and integration with documentation. However, many contemporary engineering problems—particularly those involving iterative solutions, property databases, and industry-standard correlations—benefit significantly from programmatic access to specialized libraries like fluids and pvlib.
Fluids
Fluid mechanics is the study of liquids and gases in motion and at rest. Engineering applications span pipeline design, HVAC systems, chemical processing, aerospace, and environmental engineering.
Atmospheric Modeling
Atmospheric models predict temperature, pressure, and density variations with altitude—critical for aerospace design, weather prediction, and satellite operations.
- US Standard Atmosphere 1976: A simplified model defining standard atmospheric properties up to 1,000 km. The ATMOSPHERE_1976 function implements this widely-used reference.
- NRLMSISE-00: An empirical model that accounts for solar and geomagnetic activity, providing higher fidelity predictions. The ATMOS_NRLMSISE00 function implements this advanced model.
- Air mass calculations: Used in optical astronomy and solar radiation modeling, AIRMASS computes the relative path length through the atmosphere.
Control Valve Sizing and Noise
Control valves regulate fluid flow in process industries. Proper sizing ensures stable control and prevents cavitation, flashing, and excessive noise.
- IEC 60534 standards: The international framework for valve sizing. SIZE_CV_LIQUID and SIZE_CV_GAS calculate flow coefficients (Cv or Kv) for liquid and gas service.
- Noise prediction: Excessive valve noise can damage equipment and violate regulations. CV_NOISE_LIQ_2015 and CV_NOISE_GAS_2011 implement the IEC 60534-8 series for predicting A-weighted sound pressure levels.
- Choked flow factors: FF_CRIT_PRESS_L computes the critical pressure ratio factor for liquid service, essential for accurate sizing under cavitating conditions.
Dimensionless Numbers
Dimensionless numbers are fundamental tools in fluid mechanics, heat transfer, and mass transfer. They enable scaling analysis, regime identification, and correlation development.
- Flow regime characterization: Reynolds number distinguishes laminar from turbulent flow. Froude number (FROUDE) characterizes gravity-driven flows. Dean number (DEAN) identifies secondary flow in curved pipes.
- Interfacial phenomena: Bond number (BOND) compares gravitational to surface tension forces. Capillary number (CAPILLARY) relates viscous to surface tension forces. Weber number governs droplet formation.
- Heat and mass transfer: Eckert number (ECKERT) relates kinetic energy to enthalpy. Fourier numbers (FOURIER_HEAT, FOURIER_MASS) characterize transient diffusion.
- Specialized applications: Archimedes number (ARCHIMEDES) appears in sedimentation and fluidization. Cavitation number (CAVITATION) predicts cavitation onset. Boiling number (BOILING) governs boiling heat transfer.
Friction and Pressure Drop
Friction factors quantify resistance to flow in pipes, channels, and heat exchangers. Accurate prediction is essential for pump and compressor sizing.
- Darcy-Weisbach equation: The fundamental relationship for pressure drop: \Delta P = f \frac{L}{D} \frac{\rho V^2}{2}. Implemented in ONE_PHASE_DP.
- Friction factor correlations: FRICTION_FACTOR automatically selects appropriate correlations. Options include:
- Colebrook equation: The implicit standard (COLEBROOK).
- Clamond’s solution: Exact and highly efficient (CLAMOND).
- Explicit approximations: HAALAND, SWAMEE_JAIN, CHURCHILL, and MOODY.
- Special geometries: FF_CURVED for helical coils and curved pipes, FP_MARTIN and FP_MULEY_MANGLIK for plate heat exchangers.
- Gravitational effects: DP_GRAV computes hydrostatic pressure changes in inclined pipes.
- Fittings and Valves: Minor losses from elbows, tees, and valves are calculated using loss coefficients (K). Functions like BEND_ROUNDED and K_GATE_VALVE implement standard Crane and Miller methods.
- Gas pipeline flow: TRANS_FACTOR converts between friction factor representations for compressible flow analysis.
Compressible Flow
Compressible flow involves gas dynamics where density changes are significant. This is critical for high-speed aerodynamics and gas pipeline design.
- Pipeline Flow: Functions like PANHANDLE_A, PANHANDLE_B, and WEYMOUTH_FLOW are industry standards for natural gas transport.
- Stagnation and Critical Flow: P_STAGNATION and T_STAGNATION compute properties at zero velocity, while IS_CHOKED_FLOW determines if flow has reached sonic velocity.
- Thermodynamic Processes: ISENTROPIC_WORK and ISOTHERMAL_WORK calculate energy requirements for compression and expansion.
Drag and Particle Dynamics
Drag characterizes the resistance of an object moving through a fluid.
- Drag Coefficients: DRAG_SPHERE provides a unified interface for various correlations like CD_CLIFT and CD_MORRISON.
- Terminal Velocity: V_TERMINAL calculates the steady-state falling speed of particles, essential for sedimentation and fluidization analysis.
Flow Metering
Flow meters are essential for process monitoring and control.
- Differential Pressure Meters: ORIFICE_DISCHARGE_C implements the ISO 5167 standard for orifice plates.
- Mass Flow Calculation: FLOW_METER_DISCH computes flow rates from pressure drop measurements.
Photovoltaics
Photovoltaic systems convert sunlight into electricity using the photovoltaic effect. Engineering analysis involves solar resource characterization, module performance modeling, and system design optimization.
Solar Position and Irradiance
Understanding the sun’s position and the radiation incident on a tilted surface is fundamental to PV system design.
- Solar position algorithms: SOLARPOSITION calculates solar azimuth, elevation, and apparent zenith using precise astronomical algorithms from pvlib.
- Plane-of-array irradiance: IRRADIANCE decomposes global horizontal irradiance into beam, diffuse, and ground-reflected components on a tilted surface. This accounts for transposition models, shading, and angle-of-incidence effects.
PV Performance Modeling
Two primary approaches model PV module performance: single-diode equivalent circuit models and empirical regression models.
- CEC (California Energy Commission) model: A single-diode model using manufacturer datasheet parameters. CALCPARAMS_CEC calculates the five model parameters at given irradiance and cell temperature.
- Single diode IV curve: I_FROM_V solves the single-diode equation to find current at a given voltage, enabling maximum power point tracking (MPPT) analysis.
- PVWatts model: A simplified empirical approach suitable for preliminary assessments. PVWATTS_DC estimates DC power output based on irradiance, temperature, and a single efficiency parameter.
Psychrometrics
Psychrometrics is the study of air-water vapor mixtures—essential for HVAC design, drying processes, combustion analysis, and environmental control.
Key properties include: - Wet-bulb temperature: The temperature of adiabatic saturation, critical for cooling tower design. - Dew point: The temperature at which condensation begins, vital for preventing moisture damage. - Humidity ratio: The mass of water vapor per unit mass of dry air. - Enthalpy: The total energy content, used to calculate heating and cooling loads.
The PSYCHROMETRICS function provides comprehensive calculations for these interdependent properties, implementing rigorous thermodynamic relationships from standards like ASHRAE Fundamentals.
Thermodynamics
Thermodynamics provides the framework for energy conversion and material properties.
- Chemical Properties: CHEMICAL_PROPERTIES provides access to a vast database of thermophysical data for pure substances and mixtures, leveraging the Thermo library.
Native Excel capabilities
Excel offers limited built-in support for engineering calculations:
- Basic formulas: Fundamental arithmetic, trigonometric, exponential, and logarithmic functions handle simple calculations.
- Engineering Functions: The
CONVERTfunction handles unit conversions, while specialized functions likeBESSELJ,ERF, andDELTAsupport specific mathematical needs. - Complex Numbers: Functions like
IMSUM,IMPRODUCT, andIMABSallow for basic complex number arithmetic, useful in electrical engineering. - Goal Seek and Solver: Goal Seek can solve single implicit equations (e.g., Colebrook), while Solver handles optimization and systems of equations—but with significant performance limitations.
- No property databases: Excel lacks built-in access to fluid properties (viscosity, density, thermal conductivity), thermodynamic data (steam tables, refrigerants), or solar radiation databases.
- Manual correlation implementation: Engineers must manually code complex correlations, increasing error risk and maintenance burden.
Python-based functions provide access to validated libraries (fluids, pvlib, CoolProp) with comprehensive property databases, industry-standard correlations, and robust iterative solvers.
Third-party Excel add-ins
- NIST REFPROP: The gold standard for thermophysical properties of pure fluids and mixtures. Offers an Excel add-in but requires a commercial license.
- CoolProp Excel Add-in: Open-source alternative providing thermodynamic properties for 122 pure fluids and over 40 incompressible fluids and brines.
- PIPE-FLO: Industrial fluid flow software with Excel integration for piping system design.
- AFT Fathom/Arrow: Advanced fluid flow analysis tools for incompressible and compressible flow.
- PV*SOL and PVsyst: Comprehensive PV simulation software with Excel export capabilities, though primarily standalone applications.
- ASHRAE Psychrometric Chart Add-in: Provides interactive psychrometric charts but limited calculation capabilities compared to programmatic approaches.
Fluids
Atmosphere
| Tool | Description |
|---|---|
| AIRMASS | Calculate the mass of air per square meter in the atmosphere along a given angle using a density profile. |
| ATMOS_NRLMSISE00 | Compute temperature, density, and pressure using the NRLMSISE-00 atmospheric model. |
| ATMOSPHERE_1976 | Calculate standard atmospheric properties at a given altitude using the US Standard Atmosphere 1976 model. |
Compressible
| Tool | Description |
|---|---|
| FRITZSCHE_FLOW | Calculate gas flow rate using the Fritzsche formula. |
| IGT_FLOW | Calculate gas flow rate using the IGT (Institute of Gas Technology) formula. |
| IS_CHOKED_FLOW | Determine if a flow is choked (critical) based on pressure ratio. |
| ISENTROPIC_EFF | Convert between isentropic and polytropic efficiency for compression. |
| ISENTROPIC_T_RISE | Calculate the temperature rise for isentropic compression or expansion. |
| ISENTROPIC_WORK | Calculate work of compression or expansion for a gas in an isentropic process. |
| ISOTHERMAL_GAS | Calculate mass flow rate for isothermal compressible gas flow in a pipe. |
| ISOTHERMAL_WORK | Calculate work of compression or expansion for a gas in an isothermal process. |
| MULLER_FLOW | Calculate gas flow rate using the Muller formula. |
| P_CRITICAL_FLOW | Calculate critical flow pressure for a fluid at Mach 1. |
| P_STAGNATION | Calculate stagnation pressure from static conditions. |
| PANHANDLE_A | Calculate gas flow rate in a pipeline using the Panhandle A formula. |
| PANHANDLE_B | Calculate gas flow rate in a pipeline using the Panhandle B formula. |
| POLYTROPIC_EXP | Calculate polytropic exponent or polytropic efficiency for compression. |
| STAGNATION_ENERGY | Calculate the increase in enthalpy due to fluid velocity. |
| T_CRITICAL_FLOW | Calculate critical flow temperature for a fluid at Mach 1. |
| T_STAG_IDEAL | Calculate ideal stagnation temperature from velocity and heat capacity. |
| T_STAGNATION | Calculate stagnation temperature from pressure ratio. |
| WEYMOUTH_FLOW | Calculate gas flow rate in a pipeline using the Weymouth formula. |
Control Valve
| Tool | Description |
|---|---|
| CV_CAV_INDEX | Calculates the cavitation index of a control valve. |
| CV_CHAR_EQ_PERC | Calculates the flow coefficient characteristic for an equal percentage control valve. |
| CV_CHAR_LINEAR | Calculates the flow coefficient characteristic for a linear control valve. |
| CV_CHAR_QUICK_OP | Calculates the flow coefficient characteristic for a quick opening control valve. |
| CV_CHOKE_PRESS_GAS | Calculates the pressure at which choked flow occurs in a gas control valve. |
| CV_CHOKE_PRESS_LIQ | Calculates the pressure at which choked flow occurs in a liquid control valve. |
| CV_CONVERT_COEFF | Converts between different flow coefficient scales (Kv, Cv, Av). |
| CV_NOISE_GAS_2011 | Calculate the A-weighted sound pressure level for gas flow through a control valve per IEC 60534-8-3 (2011). |
| CV_NOISE_LIQ_2015 | Calculates the sound made by a liquid flowing through a control valve according to the standard IEC 60534-8-4 (2015) using fluids.control_valve.control_valve_noise_l_2015. |
| FF_CRIT_PRESS_L | Calculates FF, the liquid critical pressure ratio factor, for use in IEC 60534 liquid valve sizing calculations using fluids.control_valve.FF_critical_pressure_ratio_l. See https://fluids.readthedocs.io/fluids.control_valve.html#fluids.control_valve.FF_critical_pressure_ratio_l for details. |
| IS_CHOKED_GAS | Determines if a gas flow in a control valve is choked (critical) or not according to IEC 60534. |
| IS_CHOKED_LIQ | Determines if a liquid flow in a control valve is choked (critical) or not according to IEC 60534. |
| LOSS_COEFF_PIPING | Calculates the sum of loss coefficients for reducers/expanders around a control valve. |
| REYNOLDS_FACTOR | Calculates the Reynolds number factor FR for a valve according to IEC 60534. |
| REYNOLDS_VALVE | Calculates the Reynolds number of a control valve according to IEC 60534. |
| SIZE_CV_GAS | Calculates flow coefficient of a control valve passing a gas according to IEC 60534 using fluids.control_valve.size_control_valve_g. |
| SIZE_CV_LIQUID | Calculates the flow coefficient (Kv) of a control valve passing a liquid according to IEC 60534. |
Dimensionless
| Tool | Description |
|---|---|
| ARCHIMEDES | Calculate the Archimedes number (Ar) for a fluid and particle. |
| BEJAN | Compute the Bejan number (length-based or permeability-based). |
| BOILING | Calculate the Boiling number (Bg), a dimensionless number for boiling heat transfer. |
| BOND | Calculate the Bond number using fluids.core.Bond. |
| CAPILLARY | Calculate the Capillary number (Ca) for a fluid system using fluids.core.Capillary. |
| CAVITATION | Calculate the Cavitation number (Ca) for a flowing fluid. |
| CONFINEMENT | Calculate the Confinement number (Co) for two-phase flow in a channel. |
| DEAN | Calculate the Dean number (De) for flow in a curved pipe or channel. |
| DRAG | Calculate the drag coefficient (dimensionless) for an object in a fluid. |
| ECKERT | Calculate the Eckert number using fluids.core.Eckert. |
| EULER | Calculate the Euler number (Eu) for a fluid flow. |
| FOURIER_HEAT | Calculate the Fourier number for heat transfer. |
| FOURIER_MASS | Calculate the Fourier number for mass transfer (Fo). |
| FROUDE | Calculate the Froude number (Fr) for a given velocity, length, and gravity. |
Drag
| Tool | Description |
|---|---|
| CD_ALMEDEIJ | Calculate drag coefficient of a sphere using the Almedeij correlation. |
| CD_BARATI | Calculate drag coefficient of a sphere using the Barati correlation. |
| CD_BARATI_HIGH | Calculate drag coefficient of a sphere using the Barati high-Re correlation (valid to Re=1E6). |
| CD_CEYLAN | Calculate drag coefficient of a sphere using the Ceylan correlation. |
| CD_CHENG | Calculate drag coefficient of a sphere using the Cheng correlation. |
| CD_CLIFT | Calculate drag coefficient of a sphere using the Clift correlation. |
| CD_CLIFT_GAUVIN | Calculate drag coefficient of a sphere using the Clift-Gauvin correlation. |
| CD_ENGELUND | Calculate drag coefficient of a sphere using the Engelund-Hansen correlation. |
| CD_FLEMMER_BANKS | Calculate drag coefficient of a sphere using the Flemmer-Banks correlation. |
| CD_GRAF | Calculate drag coefficient of a sphere using the Graf correlation. |
| CD_HAIDER_LEV | Calculate drag coefficient of a sphere using the Haider-Levenspiel correlation. |
| CD_KHAN_RICH | Calculate drag coefficient of a sphere using the Khan-Richardson correlation. |
| CD_MIKHAILOV | Calculate drag coefficient of a sphere using the Mikhailov-Freire correlation. |
| CD_MORRISON | Calculate drag coefficient of a sphere using the Morrison correlation. |
| CD_MORSI_ALEX | Calculate drag coefficient of a sphere using the Morsi-Alexander correlation. |
| CD_ROUSE | Calculate drag coefficient of a sphere using the Rouse correlation. |
| CD_SONG_XU | Calculate drag coefficient of a particle using the Song-Xu correlation for spherical and non-spherical particles. |
| CD_STOKES | Calculate drag coefficient of a sphere using Stokes law (Cd = 24/Re). |
| CD_SWAMEE_OJHA | Calculate drag coefficient of a sphere using the Swamee-Ojha correlation. |
| CD_TERFOUS | Calculate drag coefficient of a sphere using the Terfous correlation. |
| CD_YEN | Calculate drag coefficient of a sphere using the Yen correlation. |
| DRAG_SPHERE | Calculate the drag coefficient of a sphere using various correlations based on Reynolds number. |
| SPHERE_FALL_DIST | Calculate distance traveled by a falling sphere after a given time. |
| SPHERE_VEL_AT_T | Calculate the velocity of a falling sphere after a given time. |
| TIME_V_TERMINAL | Calculate time for a particle in Stokes regime to reach terminal velocity. |
| V_TERMINAL | Calculate terminal velocity of a falling sphere using drag coefficient correlations. |
Filters
| Tool | Description |
|---|---|
| RND_EDGE_GRILL | Calculate the loss coefficient for a rounded edge grill or perforated plate. |
| RND_EDGE_MESH | Calculate the loss coefficient for a round edged open net or screen mesh. |
| RND_EDGE_SCREEN | Calculate the loss coefficient for a round edged wire screen or bar screen. |
| SQ_EDGE_GRILL | Calculate the loss coefficient for a square edged grill or perforated plate. |
| SQ_EDGE_SCREEN | Calculate the loss coefficient for a square edged wire screen, bar screen, or perforated plate. |
Fittings
| Tool | Description |
|---|---|
| BEND_MITER | Calculate the loss coefficient (K) for a single-joint miter bend in a pipe. |
| BEND_ROUNDED | Calculate the loss coefficient (K) for a rounded pipe bend (elbow) using various methods. |
| CONTRACTION_ROUND | Calculate the loss coefficient (K) for a rounded pipe contraction (reducer). |
| CONTRACTION_SHARP | Calculate the loss coefficient (K) for a sharp edged pipe contraction (reducer). |
| CV_TO_K | Convert imperial valve flow coefficient (Cv) to loss coefficient (K). |
| DIFFUSER_CONICAL | Calculate the loss coefficient (K) for a conical pipe expansion (diffuser). |
| DIFFUSER_SHARP | Calculate the loss coefficient (K) for a sudden pipe expansion (diffuser). |
| ENTRANCE_ANGLED | Calculate the loss coefficient (K) for an angled sharp entrance to a pipe flush with a reservoir wall. |
| ENTRANCE_BEVELED | Calculate the loss coefficient (K) for a beveled or chamfered entrance to a pipe flush with a reservoir wall. |
| ENTRANCE_ROUNDED | Calculate the loss coefficient (K) for a rounded entrance to a pipe flush with a reservoir wall. |
| ENTRANCE_SHARP | Calculate the loss coefficient (K) for a sharp entrance to a pipe flush with a reservoir wall. |
| EXIT_NORMAL | Calculate the loss coefficient (K) for a normal pipe exit discharging into a reservoir. |
| HELIX | Calculate the loss coefficient (K) for a helical coil pipe section. |
| K_BALL_VALVE | Calculate the loss coefficient (K) for a ball valve using the Crane method. |
| K_BUTTERFLY_VALVE | Calculate the loss coefficient (K) for a butterfly valve using the Crane method. |
| K_GATE_VALVE | Calculate the loss coefficient (K) for a gate valve using the Crane method. |
| K_GLOBE_VALVE | Calculate the loss coefficient (K) for a globe valve using the Crane method. |
| K_SWING_CHECK_VALVE | Calculate the loss coefficient (K) for a swing check valve using the Crane method. |
| K_TO_CV | Convert loss coefficient (K) to imperial valve flow coefficient (Cv). |
| K_TO_KV | Convert loss coefficient (K) to metric valve flow coefficient (Kv). |
| KV_TO_K | Convert metric valve flow coefficient (Kv) to loss coefficient (K). |
| SPIRAL | Calculate the loss coefficient (K) for a spiral coil pipe section. |
Flow Meter
| Tool | Description |
|---|---|
| DIFF_PRESS_BETA | Calculate the beta ratio (diameter ratio) for a differential pressure flow meter. |
| DIFF_PRESS_C_EPS | Calculate discharge coefficient and expansibility factor for differential pressure flow meters. |
| DIFF_PRESS_DP | Calculate non-recoverable pressure drop across a differential pressure flow meter. |
| FLOW_METER_DISCH | Calculate mass flow rate through a differential pressure flow meter based on measured pressures and meter geometry. |
| ORIFICE_DISCHARGE_C | Calculate the discharge coefficient for an orifice plate using the Reader-Harris-Gallagher correlation (ISO 5167 standard). |
| ORIFICE_EXPAND | Calculate the expansibility factor for an orifice plate based on geometry and pressure conditions. |
| ORIFICE_PRESS_DROP | Calculate non-recoverable pressure drop across an orifice plate based on geometry and discharge coefficient. |
Friction
| Tool | Description |
|---|---|
| BLASIUS | Calculates Darcy friction factor for turbulent flow in smooth pipes using the Blasius correlation. |
| CHURCHILL | Calculate Darcy friction factor using the Churchill (1977) universal equation for all flow regimes. |
| CLAMOND | Calculate Darcy friction factor using Clamond’s high-precision solution accurate to nearly machine precision. |
| COLEBROOK | Calculate Darcy friction factor using exact solution to the Colebrook equation. |
| DP_GRAV | Calculate gravitational pressure drop component for single-phase flow in inclined pipes. |
| FF_CURVED | Calculate friction factor for fluid flowing in a curved pipe or helical coil, supporting both laminar and turbulent regimes. |
| FP_MARTIN | Calculate Darcy friction factor for single-phase flow in Chevron-style plate heat exchangers using Martin (1999) correlation. |
| FP_MULEY_MANGLIK | Calculate Darcy friction factor for single-phase flow in Chevron-style plate heat exchangers using Muley-Manglik correlation. |
| FRICTION_FACTOR | Calculate the Darcy friction factor for fluid flow in a pipe using various correlations, automatically selecting appropriate method based on Reynolds number and relative roughness. |
| FRICTION_LAMINAR | Calculate the Darcy friction factor for laminar flow using the theoretical solution fd = 64/Re. |
| FT_CRANE | Calculate the Crane fully turbulent Darcy friction factor for flow in commercial pipe. |
| HAALAND | Calculate Darcy friction factor using the Haaland (1983) approximation. |
| HELICAL_RE_CRIT | Calculate the transition Reynolds number for fluid flowing in a curved or helical pipe between laminar and turbulent flow. |
| MOODY | Calculate Darcy friction factor using the Moody (1947) correlation. |
| ONE_PHASE_DP | Calculate single-phase pressure drop in a pipe using the Darcy-Weisbach equation. |
| SWAMEE_JAIN | Calculate Darcy friction factor using the Swamee-Jain (1976) equation. |
| TRANS_FACTOR | Convert between Darcy friction factor and transmission factor for compressible gas pipeline flow. |
| VON_KARMAN | Calculate Darcy friction factor for rough pipes at infinite Reynolds number from the von Karman equation. |
Photovoltaics
| Tool | Description |
|---|---|
| CALCPARAMS_CEC | Calculate five CEC model parameters for the single diode equation at given irradiance and cell temperature. |
| I_FROM_V | Calculate the device current at a given device voltage for a PV cell/module using the single diode model. |
| IRRADIANCE | Calculate the plane of array irradiance components on a tilted surface using PVLib. |
| PVWATTS_DC | Calculate the DC power output of a PV module using the PVWatts DC model. |
| SOLARPOSITION | Calculate solar azimuth, elevation, and apparent zenith for given times and location. |