One thing that wasn't addressed in the requirements but will be necessary later is the need for utility functions. These are often found in applications and provide functionality for the main program, but don't directly apply to the core logic.
For this program, we will require a number of utility functions:
- Calculate liquid flow rate due to gravity
- Static hydraulic pressure of a fluid due to its height
- Conversion programs for pressure: specifically, we need to convert fluid head (measured in feet) in to pounds per square inch (PSI)
The functions are shown next (in separate parts), with explanations following each part:
# utility_formulas.py (part 1)
1 #!/usr/bin/env python3 2 3 import math 4 5 GRAVITY = 32.174 # ft/s^2 6 WATER_SPEC_WEIGHT = 62.4 # lb/ft^3 7 WATER_DENSITY = 1.94 # slugs/ft^3 8 WATER_SPEC_GRAV = 1.0
Line 1 is the "...