Boiler Feed Water and Cooling Tower Chemicals Dosing

How are the chemicals dosing calculated and decided by the chemicals manufacturer for boiler water and cooling towers? What are the parameters for the dosing calculations and what is the formula which gives the best approximation?