pipepermcalc.pipe module
- class pipepermcalc.pipe.Pipe(segment_list)
Bases:
objectPipe object class to make segments of the pipe and calculate the peak and mean concentration of a chemical in groundwater and soil.
- segment_list
list of the pipe segment objects which make up the pipe
- Type:
list
- _conditions_set
Default False, True when the groundwater conditions have been set.
- Type:
Boolean
- _flow_rate_set
Default False, True when the flow rate has been set.
- Type:
Boolean
- _concentration_groundwater_set
Default False, True when the flow rate has been set.
- Type:
Boolean
- _is_validated
Default False, True when the flow rate has been set.
- Type:
Boolean
- total_volume
Total volume of the pipe, summed from the pipe segments, m3
- Type:
float
- total_length'
Total length of the pipe, summed from the pipe segments, m
- Type:
float
- flow_rate
Flow rate through pipe, m3/day.
- Type:
float
- CAS_number
CAS is a unique identification number assigned by the Chemical Abstracts Service (CAS)
- Type:
string
- chemical_name_EN
Name of the chemical in English
- Type:
string
- chemical_name_NL
Name of the chemical in Dutch
- Type:
string
- molecular_weight
Mass of one mole of a given chemical, g/mol
- Type:
float
- solubility
solubility of given chemical in water, g/m3
- Type:
float
- log_octanol_water_partitioning_coefficient
Partition coefficient for the two-phase system consisting of n-octanol and water, Log Kow, [-]
- Type:
float,
- log_distribution_coefficient
Ratio of the amount of chemical adsorbed onto soil per amount of water, m3/g
- Type:
float
- chemical_group
Grouping of chemicals (expert opinion) with similar properties for permeation: Group 1: PAK, MAK, ClArom, ClAlk, Arom, Alk, Group 2: PCB, Group 3: overig, onbekend, O2, Cl, BDE. See KWR 2016.056
- Type:
string
- chemical_group_number
Integer corresponding to the chemical group
- Type:
integer
- molecular_volume
Volume occupied by one mole of the substance at a given temperature and pressure, cm3/mol.
- Type:
float
- Drinking_water_norm
Concentration allowable in the Dutch Drinking water decree, g/m3.
- Type:
float
- _Kd_known
True when a distribution coefficient (Kd) for the chemical is known. Kd is needed to convert from soil to groundwater concentration.
- Type:
Boolean
- concentration_groundwater
Concentration of the given chemical in groundwater, g/m3.
- Type:
float
- tolerance
The degree of acceptable error in the accuracy of the calculation, calculated as the difference between the calculated and actual drinking water concentration, default value of 0.01 (1%), [-].
- Type:
float
- max_iterations
Maximum number of iterations allowed in the optimization scheme.
- Type:
int
- temperature_groundwater
Temperature of the groundwater, degrees Celcius.
- Type:
float
- stagnation_time
Time in seconds which water in pipe is stagnant, unit of seconds. The stagnation factor is only valid for a stagnation time of 8 hours (28800 seconds), therefore using another other stagnation time is not advised.
- Type:
float
- concentration_soil
Concentration of the given chemical in soil, mg/kg.
- Type:
float
- scale_factor_upper_limit
Scale factor used to set the upper limit of the bounds for calculating the mean concentration of drinking water or groundwater. Upper limit taken as the concentration of groundwater (solving for drinking water concentration) or solubility (solving for groundwater concentration) multiplied by the scale factor. Default value of 0.999
- Type:
float
- scale_factor_lower_limit
Scale factor used to set the upper limit of the bounds for calculating the mean concentration of drinking water or groundwater. Lower limit taken as the concentration of groundwater (solving for drinking water concentration) or solubility (solving for groundwater concentration) multiplied by the scale factor. Default value of 0.0001.
- Type:
float
- ASSESSMENT_FACTOR_GROUNDWATER
Factor used to correct calculations for observations in actual pipe permeation. Permeation of PE house connections in groundwater = 3, other pipe materials = 1. See section 7.2 in KWR 2016.056
- Type:
float
- ASSESSMENT_FACTOR_SOIL
Factor used to correct calculations for observations in actual pipe permeation. All pipe materials = 1.
- Type:
float
Note
All parameters are in SI units: m, m2, g/m3 (equivalent to mg/L), seconds. Except for the flow rate, which is given in m3/day.
- ASSESSMENT_FACTOR_GROUNDWATER = 3
- ASSESSMENT_FACTOR_SOIL = 1
- MAX_ITERATIONS_DEFAULT = 1000
- SCALE_FACTOR_LOWER_LIMIT = 0.0001
- SCALE_FACTOR_UPPER_LIMIT = 0.999
- STAGNATION_TIME_DEFAULT = 28800
- TEMPERATURE_GROUNDWATER_DEFAULT = 12
- TOLERANCE_DEFAULT = 0.01
- calculate_mean_allowable_gw_concentration(tolerance=0.01, max_iterations=1000, debug=False)
Calculates the mean 24 hour concentration in groundwater which would not result in a drinking water concentration exceeding the drinking water norm. If the distribution coefficient is known the soil concentration is also calculated.
- Parameters:
tolerance (float) – The degree of acceptable error in the accuracy of the calculation, calculated as the difference between the calculated and actual drinking water concentration, default value of 0.01 (1%), [-].
max_iterations (int) – Maximum number of iterations allowed in the optimization scheme
debug (Boolean) – If True, return the groundwater concentration, goodness_fit and lower and upper limits every iteration.
- Returns:
concentration_mean_allowable_groundwater – Mean concentration in groundwater which would would not result in a mean daily (24 hours) concentration in drinking water exceeding the drinking water norm, g/m3.
- Return type:
float
- calculate_mean_dw_concentration(tolerance=0.01, max_iterations=1000, debug=False)
Calculates the mean concentration in drinking water for a 24 hour period given a groundwater concentration.
- Parameters:
tolerance (float) – The degree of acceptable error in the accuracy of the calculation, calculated as the difference between the calculated and actual drinking water concentration, default value of 0.01 (1%), [-].
max_iterations (int) – Maximum number of iterations allowed in the optimization scheme
- Returns:
mean_concentration_pipe_drinking_water – Calculates the mean concentration in drinking water for a 24 hour period given a groundwater concentration.
- Return type:
float
- calculate_peak_allowable_gw_concentration(tolerance=0.01, max_iterations=1000, debug=False)
Calculates the peak (maximum) concentration in groundwater water for a given a stagnation period that would not result in a peak concentration in drinking water exceeding the drinking water norm for each pipe segment. Stagnation period default of 8 hours. If the distribution coefficient is known the soil concentration is also calculated.
- Parameters:
tolerance (float) – The degree of acceptable error in the accuracy of the calculation, calculated as the difference between the calculated and actual drinking water concentration, default value of 0.01 (1%), [-].
max_iterations (int) – Maximum number of iterations allowed in the optimization scheme
debug (Boolean) – If True, return the groundwater concentration, goodness_fit and lower and upper limits every iteration.
- Returns:
concentration_peak_allowable_groundwater – Concentration in groundwater which, after a stagnation period, would not result in a peak concentration in drinking water exceeding the drinking water norm, g/m3.
- Return type:
float
- calculate_peak_dw_concentration(tolerance=0.01, max_iterations=1000, debug=False)
Calculates the peak (maximum) concentration in drinking water for a given a stagnation period given a groundwater concentration. Stagnation period default of 8 hours.
- Parameters:
tolerance (float) – The degree of acceptable error in the accuracy of the calculation, calculated as the difference between the calculated and actual drinking water concentration, default value of 0.01 (1%), [-].
max_iterations (int) – Maximum number of iterations allowed in the optimization scheme
- Returns:
peak_concentration_pipe_drinking_water – Calculates the peak (maximum) concentration in drinking water for a given a stagnation period given a groundwater concentration.
- Return type:
float
- parameter_validation_dictionary = {'chemical_name': {'value_dtype': [<class 'str'>]}, 'concentration_drinking_water': {'min_value': 0, 'value_dtype': [<class 'float'>, <class 'int'>]}, 'concentration_groundwater': {'min_value': 0, 'value_dtype': [<class 'float'>, <class 'int'>]}, 'concentration_soil': {'min_value': 0, 'value_dtype': [<class 'float'>, <class 'int'>]}, 'diffusion_path_length': {'min_value': 0, 'value_dtype': [<class 'float'>, <class 'int'>]}, 'flow_rate': {'min_value': 0, 'value_dtype': [<class 'float'>, <class 'int'>]}, 'inner_diameter': {'min_value': 0, 'value_dtype': [<class 'float'>, <class 'int'>]}, 'language': {'str_options': ['NL', 'EN'], 'value_dtype': [<class 'str'>]}, 'length': {'min_value': 0, 'value_dtype': [<class 'float'>, <class 'int'>]}, 'material': {'str_options': ['PE40', 'PE80', 'SBR', 'EPDM', 'PVC'], 'value_dtype': [<class 'str'>]}, 'name': {'value_dtype': [<class 'str'>]}, 'permeation_direction': {'str_options': ['perpendicular', 'parallel'], 'value_dtype': [<class 'str'>]}, 'stagnation_time': {'min_value': 0, 'value_dtype': [<class 'float'>, <class 'int'>]}, 'temperature_groundwater': {'min_value': 0, 'value_dtype': [<class 'float'>, <class 'int'>]}, 'wall_thickness': {'min_value': 0, 'value_dtype': [<class 'float'>, <class 'int'>]}}
- ppc_database = CAS_number ... Drinking_water_norm 0 66-25-1 ... NaN 1 71-55-6 ... 0.0010 2 79-34-5 ... NaN 3 79-00-5 ... 0.0010 4 75342 ... 0.0010 .. ... ... ... 422 108-88-3 ... 0.0010 423 NaN ... 0.0001 424 1979-01-06 ... 0.0100 425 NaN ... NaN 436 1975-01-04 ... 0.0001 [299 rows x 11 columns]
- set_conditions(chemical_name, concentration_groundwater=None, concentration_soil=None, flow_rate=None, concentration_drinking_water=None, temperature_groundwater=12, stagnation_time=28800, suppress_print=False, suppress_warning=False, language='NL')
Specifies the chemical of interest, concentration and temperature in the groundwater and returns the parameters as attributes of the class. If the concentration of groundwater is given, or the soil concentration and Kd are known, the diffusion and permeation parameters are calculated for the pipe segment(s).
- Parameters:
chemical_name (string) – Name of the chemical for which to calculate the permeation
concentration_groundwater (float) – Concentration of the given chemical in groundwater, g/m3
concentration_soil (float) – Concentration of the given chemical in soil, mg/kg.
flow_rate (float) – Flow rate through pipe, m3/day.
concentration_drinking_water (float) – Concentration of given chemical in drinking water pipe, g/m3. If no value given, concentration is assigned the drinking water norm value.
temperature_groundwater (float) – Temperature of the groundwater, degrees Celcius
stagnation_time (float) – Time in seconds which water in pipe is stagnant, unit of seconds. The stagnation factor is only valid for a stagnation time of 8 hours (28800 seconds), therefore using another other stagnation time is not advised.
suppress_print (Boolean) – Suppress printing the chemical name and matching name, e.g. in loop calculations
language (str) – Language fo the chemical name to search for, default is Dutch (‘NL’), English (‘EN’) also possible
- validate_input_parameters()
Check that the input parameters are valid values and types for the Pipe and Segment objects
- view_database_chemical_names(language='NL')
Function to view a list of the possible chemical names from the database.
- Parameters:
language (str) – Language fo the chemical name to search for, default is Dutch (‘NL’), English (‘EN’) also possible