| Title: | Langmuir Semi-Empirical Coagulation Model | 
| Version: | 0.1.1 | 
| Maintainer: | Dewey Dunnington <dewey@fishandwhistle.net> | 
| Description: | Implements the Edwards (1997) <doi:10.1002/j.1551-8833.1997.tb08229.x> Langmuir-based semi-empirical coagulation model, which predicts the concentration of organic carbon remaining in water after treatment with an Al- or Fe-based coagulant. Data and methods are provided to optimise empirical coefficients. | 
| Depends: | R (≥ 3.6.0) | 
| License: | GPL-3 | 
| Encoding: | UTF-8 | 
| LazyData: | true | 
| RoxygenNote: | 7.2.1 | 
| URL: | https://paleolimbot.github.io/edwards97/, https://github.com/paleolimbot/edwards97 | 
| BugReports: | https://github.com/paleolimbot/edwards97/issues | 
| Imports: | rlang, tibble, broom, cli, withr, glue | 
| Suggests: | testthat (≥ 3.0.0), covr | 
| Config/testthat/edition: | 3 | 
| NeedsCompilation: | no | 
| Packaged: | 2022-09-01 01:57:26 UTC; deweydunnington | 
| Author: | Dewey Dunnington | 
| Repository: | CRAN | 
| Date/Publication: | 2022-09-01 02:20:06 UTC | 
edwards97: Langmuir Semi-Empirical Coagulation Model
Description
Implements the Edwards (1997) doi:10.1002/j.1551-8833.1997.tb08229.x Langmuir-based semi-empirical coagulation model, which predicts the concentration of organic carbon remaining in water after treatment with an Al- or Fe-based coagulant. Data and methods are provided to optimise empirical coefficients.
Author(s)
Maintainer: Dewey Dunnington dewey@fishandwhistle.net (ORCID)
Authors:
Other contributors:
- Marc Edwards [contributor] 
- Tai Tseng [contributor] 
See Also
Useful links:
- Report bugs at https://github.com/paleolimbot/edwards97/issues 
Low-level langmuir coagulation calculations
Description
The Edwards (1997) model is a Langmuir-based semiempirical model designed to predict OC removal during alum coagulation. The model is on a non-linear function derived from physical relationships, primarily the process of Langmuir sorptive removal (Tipping 1981, Jekyl 1986).
Usage
coagulate(data, coefs)
coagulate_base(DOC, dose, pH, UV254, K1, K2, x1, x2, x3, b, root = -1)
Arguments
| data | A data frame containing columns  | 
| coefs | The output of  | 
| DOC | The initial DOC concentration (mg/L). | 
| dose | The coagulant metal concentration (Al3+ or Fe3+) in mmol/L. | 
| pH | The pH of coagulation. | 
| UV254 | The absorbance of UV254 (1/cm). With  | 
| K1,K2 | Empirical fitting coefficients relating to SUVA. | 
| x1,x2,x3 | Empirical fitting coefficients relating to pH. | 
| b | The Langmuir term. | 
| root | The solution to the equation presented in Edwards (1997) is
a quadratic with two roots.  | 
Value
A vector of predicted organic carbon concentrations (in mg/L) following coagulation.
References
Edwards, M. 1997. Predicting DOC removal during enhanced coagulation. Journal - American Water Works Association, 89: 78–89. https://doi.org/10.1002/j.1551-8833.1997.tb08229.x
Jekel, M.R. 1986. Interactions of humic acids and aluminum salts in the flocculation process. Water Research, 20: 1535-1542. https://doi.org/10.1016/0043-1354(86)90118-1
Tipping, E. 1981. The adsorption of aquatic humic substances by iron oxides. Geochimica et Cosmochimica Acta, 45: 191-199. https://doi.org/10.1016/0016-7037(81)90162-9
Examples
alum_jar_tests <- edwards_data("Al")
alum_jar_tests$DOC_final_model <- coagulate(alum_jar_tests, edwards_coefs("Al"))
plot(DOC_final_model ~ DOC_final, data = alum_jar_tests)
Calculate the dose of diminishing return
Description
Calculate the dose of diminishing return
Usage
dose_of_diminishing_returns(
  dose,
  DOC_final,
  molar_mass = 297,
  threshold = 0.3/10
)
dose_for_criterion(dose, DOC_final, criterion)
Arguments
| dose | The coagulant metal concentration (Al3+ or Fe3+) in mmol/L. | 
| DOC_final | The final DOC concentration, probably modeled using  | 
| molar_mass | The moalr mass of the coagulant, in grams per mol Al or Fe. | 
| threshold | The point of diminishing return threshold, in mg/L DOC per mg/L dose. Often this is taken to be 0.3 mg/L DOC per 10 mg/L dose (Brantby 2016). | 
| criterion | A desired final DOC concentration in mg/L | 
Value
The dose (in mmol/L) of diminishing returns.
References
Bratby, J. 2016. Coagulation and Flocculation in Water and Wastewater Treatment. IWA Publishing. https://books.google.ca/books?id=PabQDAAAQBAJ
Examples
dose_curve <- coagulate_grid(fit_edwards("Low DOC"), DOC = 4, UV254 = 0.2, pH = 5.5)
dose_of_diminishing_returns(dose_curve$dose, dose_curve$DOC_final)
dose_for_criterion(dose_curve$dose, dose_curve$DOC_final, criterion = 3)
Coagulation coefficients
Description
These are coefficients intended for general use. Use
fit_edwards_optim() to optimise these coefficients
for a specific source water.
Usage
edwards_coefs(type)
edwards_data(type)
fit_edwards(type)
Arguments
| type | One of "Low DOC", "Fe", "Al", "General-Fe", "General-Al", or "empty". | 
Value
A named vector of empirical coefficients to be used in
coagulate().
References
Edwards, M. 1997. Predicting DOC removal during enhanced coagulation. Journal - American Water Works Association, 89: 78–89. https://doi.org/10.1002/j.1551-8833.1997.tb08229.x
Examples
edwards_coefs("Low DOC")
Example Jar Tests
Description
Example Jar Tests
Usage
edwards_jar_tests
Format
An object of class tbl_df (inherits from tbl, data.frame) with 1372 rows and 7 columns.
Author(s)
Marc Edwards and Tai Tseng
References
Edwards, M. 1997. Predicting DOC removal during enhanced coagulation. Journal - American Water Works Association, 89: 78–89. https://doi.org/10.1002/j.1551-8833.1997.tb08229.x
Fit Empirical Coefficients
Description
The coefficients calculated by Edwards (1997) and returned by
edwards_coefs() were designed to produce reasonable results
for several general cases, however each source water will have
a set of empirical coefficients that produce more accurate
predictions than the general case. This function calculates
the optimal coefficients given a test set of known initial
values (DOC)
Usage
fit_edwards_optim(
  data,
  initial_coefs = edwards_coefs("Al"),
  optim_params = list()
)
fit_edwards_coefs(coefs, data = edwards_data("empty"))
## S3 method for class 'edwards_fit_optim'
coef(object, ...)
## S3 method for class 'edwards_fit_coefs'
coef(object, ...)
## S3 method for class 'edwards_fit_base'
predict(object, newdata = NULL, ...)
coagulate_grid(
  object,
  DOC,
  UV254,
  dose = seq(0.01, 2, length.out = 50),
  pH = seq(5, 8, length.out = 50)
)
## S3 method for class 'edwards_fit_base'
fitted(object, ...)
## S3 method for class 'edwards_fit_base'
residuals(object, ...)
## S3 method for class 'edwards_fit_base'
tidy(x, ...)
## S3 method for class 'edwards_fit_base'
glance(x, ...)
## S3 method for class 'edwards_fit_base'
print(x, ...)
## S3 method for class 'edwards_fit_base'
plot(x, ...)
Arguments
| data | A data frame with columns
 | 
| optim_params | Additional arguments to be passed to  | 
| coefs,initial_coefs | A set of initial coefficients from which to
start the optimisation. Most usefully one of the coefficient
sets returned by  | 
| object,x | A fit objected created with  | 
| ... | Not used. | 
| newdata | A data frame with columns
 | 
| DOC | The initial DOC concentration (mg/L). | 
| UV254 | The absorbance of UV254 (1/cm). With  | 
| dose | The coagulant metal concentration (Al3+ or Fe3+) in mmol/L. | 
| pH | The pH of coagulation. | 
Value
An S3 of type "edwards_fit_optim" with components:
- data, initial_coefs, optim_params
- References to inputs. 
- fit_optim
- The fit object returned by - stats::optim().