Learn R Programming

tidywater (version 0.7.0)

solvedose_ph: Calculate a desired chemical dose for a target pH

Description

solvedose_ph calculates the required amount of a chemical to dose based on a target pH and existing water quality. The function takes an object of class "water" created by define_water, and user-specified chemical and target pH and returns a numeric value for the required dose in mg/L.

solvedose_ph uses uniroot on chemdose_ph to match the required dose for the requested pH target.

Usage

solvedose_ph(water, target_ph, chemical)

Value

A numeric value for the required chemical dose.

Arguments

water

Source water of class "water" created by define_water

target_ph

The final pH to be achieved after the specified chemical is added.

chemical

The chemical to be added. Current supported chemicals include: acids: "hcl", "h2so4", "h3po4", "co2"; bases: "naoh", "na2co3", "nahco3", "caoh2", "mgoh2"

See Also

define_water, chemdose_ph

Examples

Run this code
water <- define_water(ph = 7, temp = 25, alk = 10)

# Calculate required dose of lime to reach pH 8
solvedose_ph(water, target_ph = 8, chemical = "caoh2")

Run the code above in your browser using DataLab