A Computer Program for Modeling the Conversion of Organic Waste to Energy

This paper presents a tool for the analysis of conversion of organic waste into energy. The tool is a program that uses waste characterization parameters and mass flow rates at each stage of the waste treatment process to predict the given products. The specific waste treatment process analysed in this paper is anaerobic digestion. The different waste treatment stages of the anaerobic digestion process are: conditioning of input waste, secondary treatment, drying of sludge, conditioning of digestate, treatment of digestate, storage of liquid and solid effluent, disposal of liquid and solid effluents, purification, utilization and storage of combustible gas. The program uses mass balance equations to compute the amount of CH4, NH3, CO2 and H2S produced from anaerobic digestion of organic waste, and hence the energy available. Case studies are also presented.


Introduction
The anaerobic digestion of organic waste involves biochemical and physico-chemical processes.Biochemical processes are catalyzed by enzymes and act on organic matter, whereas physico-chemical processes involve association or dissociation, and transfer between the gas and liquid phases as well as precipitation.In biochemical process reactions the organic waste is hydrolyzed to monosaccarides and amino acids which are then degraded to organic acids, hydrogen and carbon dioxide.This is termed the acidogenesis stage.The organic acids are further converted to acetate, hydrogen and carbon dioxide at an acetogenesis stage.Finally at a methanogenesis stage, hydrogen produced is consumed by a methanogenic group of bacteria producing acetic acid.The acetic acid is consumed by an aceticlastic methanogenic group of bacteria to form methane.These complex biochemical and physico-chemical reactions are implemented mathematically to analyze the amount of methane that can be generated from anaerobic digestion of organic waste.There is also a need to analyze how much of the energy contained in the methane produced can be used to generate heat and electricity.
Research into models that simulate anaerobic digestion of organic waste include ADM1 (Anaerobic Digestion Model No. 1) from the IWA (International Water Association) [1].ADM1 was proposed by the IWA Task Group for Mathematical Modeling of Anaerobic Digestion Processes as a tool for modeling waste water treatment.The kinetic parameters of ADM1 have been modified so that it can be used to simulate dairy manure anaerobic digesters and thermophilic anaerobic co-digestion of olive mill wastewater and olive mill solid waste [2].A general integrated solid waste co-digestion model [3] was developed for optimization and assessment of co-digestion of any combination of solid waste streams.The tool estimates particulate waste fractions of carbohydrates, proteins, lipids and inerts and thus generates inputs for ADM1 which subsequently predicts biogas generation.
A number of studies have been carried out and different tools have been presented to predict biogas yield and assess economic viability of energy generation from waste.This paper describes a tool developed for technical and economic analysis of treatment of organic waste.The tool is a program called MATTEUS whose first version was developed at the Hydro-Quebec Research Institute.In these studies, the chemical composition of biomass is determined by carrying out a proximate and ultimate analysis.Ultimate analysis is used to determine the percentage of C, H, O, N and S in biomass.Proximate analysis is used to determine the percentage of volatile matter, moisture, fixed carbon and ash in biomass.The computer program described in this paper uses data from the literature on proximate and ultimate analysis to compute mass fractions of the waste components for subsequent use in a mass balance equation.
In [4] proximate analysis and thermal analysis were used to determine the chemical characteristics of the waste.In this study the most appropriate method of conversion of MSW (Municipal Solid Waste) to energy was determined.The paper emphasized the need to use the physical and chemical properties of the waste just as is done in the computer program.The percentage of volatile matter, moisture, fixed carbon and ash content were determined using the proximate analysis method.Based on the chemical and physical properties of the MSW, [4] concluded that anaerobic digestion was the most appropriate method of energy conversion.A description of the biochemistry of anaerobic digestion was given.The stoichiometric equations of each of the phases of the anaerobic digestion process were given, however a mass balance equation was not given.[4] estimated the volume of biogas generated per tonne of MSW and stated that this was based on the chemical composition of the MSW.There was no link between the proximate analysis and thermal analysis carried out, and estimation of volume of biogas generated.The stoichiometric equations cited were not used to obtain a mass balance equation that would subsequently have been used to estimate the volume of biogas generated.The gap in the research is addressed by the computer program.The input waste is characterized, and a mass breakdown of the anaerobic digestion process is carried out.This is subsequently used in a mass balance equation to estimate mass flow rate of biogas generated.
In [5] a review of biomass as a fuel for boilers was done.Data from proximate and ultimate analyses was used to characterize the chemical composition of the biomass, in addition to data from other analyses.The percentage composition of C, H, O, N, S and Cl for different types of biomass was determined.[5] shows that proximate and ultimate analysis is an acceptable method of waste characterisation.The computer program described in this paper also uses proximate and ultimate analyses for waste characterisation.
In [6] the potential application of agricultural and animal waste to energy production in Greece was investigated.The study cited the criteria for selection of the method of waste treatment as: the moisture content of the input waste, the C/N (Carbon-to-Nitrogen) ratio and physical and chemical characteristics of the input waste.All these criteria are used in the computer program discussed in this paper.The computer program would thus be a useful tool in the investigation carried out in [6].
In [7] a digester configuration that could be used for anaerobic digestion of grass silage was investigated.The investigation used a mass balance approach similar to that used in the computer program.The study also used data from literature on the ultimate analysis of the grass silage.The mass balance equation was derived from the resulting chemical characteristics of the grass silage.
In [8] anaerobic digestion technology for industrial wastewater treatment was studied.In this study, the operating conditions for the anaerobic digestion process were identified as the organic loading rate, temperature, pH and chemical properties of the input waste.Temperature and organic loading rate of the anaerobic digestion process are also key operating conditions for the computer program analyzed in this paper.[8] cited the optimal pH range for methane producing bacteria as 6.8-7.2, and an acidic pH for acid forming bacteria.The determination of pH is important to the anaerobic digestion process analysis.This ensures that the accumulation of VFA (Volatile Fatty Acids) is monitored.The computer program however does not compute pH at the various stages of the waste treatment process.[9] estimated the methane yield from characteristics of input waste, total solid content in volatile solids and volatile solids content.Batch tests were carried out on different substrates to determine these parameters, and the methane yield was estimated.This differs from the approach of the computer program which gives the detailed formulation of the mass balance equation used to estimate methane yield.
In [10] India's biogas generation potential from anaerobic digestion of organic waste was assessed.The study obtained data on the amount of waste generated and characterized this into compostable and inert material.Based on studies carried out on the rate of biogas generation from solid waste [10], the biogas potential was estimated.Waste was generalized as MSW, crop residue and agricultural waste, animal manure, wastewater and industrial waste.The chemical characteristics of each type of waste were not taken into consideration.The computer program improves on such an assessment.It uses the chemical characteristics of the different types of waste, together with the operating conditions of the anaerobic digestion process, to estimate the biogas yield.[11] presented an overview of biogas production in Zimbabwe.[11] characterized the different types of waste as MSW, sewage sludge, animal manure and crop residue.Data from literature reviewed was extrapolated to estimate biogas generation potential from these types of waste.Use of the computer program presented in this paper would give better estimates of the biogas generation potential.Similarly in [12], methods for evaluation of renewable energy sources were outlined.For the evaluation of energy yield from wet biomass, the author identified biogas yield as being dependent on the physical and chemical composition of the waste.This study also used experimental data from literature.Biogas yield was obtained by multiplying the mass of input waste by a waste availability factor, percentage of dry matter in the waste and the rate of biogas generation per unit of the substrate.Characterization of the waste in study [12] was better than that of [10] and [11], in that it specified dry matter content, organic matter content, percentage of total nitrogen, percentage of P 2 O 5 , percentage of K 2 O and C/N ratio.The computer program presented in this paper would however still give better estimations of biogas yield since it makes use of a number of physical and chemical characteristics of the waste.
The waste treatment processes of the computer program discussed in this paper are laid out in modules.A similar approach was used in [9], where an investment decision tool for biogas production from agricultural waste was presented.The paper modeled the anaerobic digestion waste treatment process as a four module process for three different types of feedstock.These processes included pre-treatment of waste, anaerobic digestion, gas treatment and solids treatment.These waste treatment processes are similar to those of the computer program.The gas treatment process involved biogas cleaning and utilization in an internal combustion engine or flaring of the biogas.The computer program offers additional options for utilization of the biogas namely; a boiler, a gas turbine and a gas absorption refrigeration system.Both study [9] and the computer program use mechanical dehydration for the solids treatment process.In [9] liquid effluent is treated by evaporation or reverse osmosis, or is used for irrigation.The computer program however offers more options for liquid effluent treatment, which include ultraviolet radiation, ultraviolet peroxidation, ozonisation, biofiltration and active carbon filtering.
The computer program carries out an economic analysis of the waste treatment processes.Similar work has been done in this area in a number of studies and comparisons of the depth of analysis can be made.In [9] an investment decision tool for biogas production from agricultural waste was presented.There is a significant difference in the economic analysis carried out in [9] and that carried out in the computer program.In the former, a financial evaluation was carried out to check the viability of the process.The financial evaluation included a calculation of IRR (Internal Rate of Return), NPV (Net Present Value) and payback period.The computer program however computes avoided costs of sending the waste to a landfill, and revenue from sales of products of the waste treatment process.
In [13] a technical and economic evaluation of a biogas based water pumping system is carried out in order to assess its viability.[13] also predicts the potential reduction in CO 2 emissions as a result of using biogas.This aspect of the analysis is similar to that of the computer program.The savings from not using fertilizers were however not quantified by study [13].[13] however carried out an economic assessment based on NPV, benefit to cost ratio and IRR.This depth of economic analysis is not done in the computer program described in this paper.
The rest of the paper describes the computer program and is organized as follows: Section 2 is a description of the program, Section 3 explains the mathematical modeling of the process, Section 4 explains the determination of heat generated by boilers, Section 5 gives energy conversion efficiencies of spark ignition engines, Section 6 explains the method of economic analysis and Section 7 gives case studies to which the program is applied.

Description of the Program
The main feature of the program is characterization and analysis of input waste, waste flow streams and by-products of waste processing.Physical properties and volume flow rates of the waste streams are computed.The program analyses conditioning of input waste, primary waste treatment, secondary waste treatment and handling of by-products.An economic analysis of the waste treatment methods is also done.
The various waste treatment stages of the program are laid out in modules.The process flow from inputs to production of energy and disposal of final products is shown in Figure 1.The type of waste to be treated has to be characterized by parameters given in Table 1.The program has a database of mass fractions for the different classifications of waste based on a literature review of ultimate and proximate analysis of the types of waste.Users can choose to use the parameters from the database or to enter their own parameters from a literature review of ultimate or proximate analysis.Although provision has been made for entry of pH, it is not used in computations in the worksheet.This will be included in future versions of the program.The program requires definition and entry of operating conditions and economic parameters for the various waste treatment stages.The user is required to define mass flow rates of input waste, physical properties of waste, hydraulic retention time, elimination of volatile solids, equipment costs, operational and maintenance costs, transportation, energy required, utilization rates, site conditions, global warming factors, costs scaling factors and capital costs.Section 3 on mathematical modeling of the processes describes how the operating conditions and economic parameters are obtained.The program does not compute precipitation of phosphorus during the waste treatment process.

Mathematical Modeling of the Process
Section 3 is on the technical analysis of the waste treatment process and outlines equations used.Only the anaerobic digestion process will be analyzed, based on mass balance of the organic matter.Mass flow rates are computed for each waste treatment stage.The procedure for analysis of the waste treatment process involves sequential analysis of the mass flow rates, physical properties of the treated waste and products, through the various waste treatment stages.An economic analysis of the process is also carried out based on required capacity.Required capacity is estimated from the mass balance analysis carried out.Mass balance equations used to compute breakdown of organic matter are given.Equations for computation of physical properties like generation of heat, density, LCV (Lower Calorific Value), HCV (Higher Calorific Value), reaction rates and dryness are given.

Dryness of Matter
The dryness of input waste is computed as it is one of the properties used to characterize waste flow.Dryness of matter ω ms is the content of dry matter in wet matter and is computed using Equation (1).
where m ms is the mass of dry matter and m mh is the mass of wet matter.

Calorific Values of Input Waste
LCV and HCV of input organic matter are required to compute energy released from the reactions in a digester.These are computed using Equations ( 2) and ( 3) respectively in GJ/t ms [14].The mass fraction of dry weight over wet weight is used to compute the calorific values.Mass fractions of dry weight are used instead of mass of wet weight.This is because Equations ( 2) and ( 3) are formulated by curve fitting of experimental data from ultimate analysis, where ultimate analysis gives the composition of the input matter in terms of dry mass for C, H, O, S and N.
where ω C , ω H , ω O , ω N , ω S and ω ashes are mass fractions of C, H, O, N, S and ashes respectively, in the input waste.Equation (2) can generate negative values (which is incorrect) if the content of inorganic matter in the waste is more significant than the content of organic matter in the waste.In this case, Equation ( 2) is used without the term for mass fraction of ashes in the waste, and thus the equations are modified to Equations ( 4) and (5).
where ω C , ω H , ω O , ω N and ω S are mass fractions on a dry basis of C, H, O, N and S respectively, contained in the volatile solids of the input waste.
If the user provides data on mass fractions of the waste components, LCV and HCV are corrected using Equations ( 6) and ( 7) respectively.
where LCV is the lower calorific value of the components entered by the user, LCV ref is the lower calorific value of the input reference from the program's database, HCV is the higher calorific value of the components entered by the user and HCV ref is the higher calorific value of the input reference from the program's database.

Density of Input Waste
Density of input waste is the bulk density of the sludge.Figure 2 is a profile of variation of bulk density of sludge with water content.The profile in Figure 2 is drawn from data on dryness and density of different types of waste given in Table 2 [15][16][17][18][19].   8) and ( 9) are formulated and are used to compute the bulk density based on the dryness of the sludge.
where ρ b is bulk density of the waste and ϕ b is dry content of the waste.

Volume Throughput of Waste
The program works with mass throughput in the computation of the waste flow through the treatment stages.However some waste treatment stages like transport, secondary treatment and storage, work with volume throughput.Therefore Equation ( 10) is used to compute volume throughput using mass throughput and bulk density of the sludge.
where V is volume flow rate and ṁmh is mass flow rate on a wet basis.

Volume Throughput of Biogas
Volume throughput of the biogas is computed from the mass flow rates and densities of the components of the biogas.The density of a component of the biogas ρ i at a given temperature and pressure is computed based on the perfect gas law Equation (11).
where p i is the partial pressure of the gas component, M i is the molecular mass of the gas component, R is the universal perfect gas constant and T is the temperature of the gas in Kelvin.Thus the volume flow rate of each of the biogas components V i is computed using Equation (12).
where m i is the mass flow rate of the gas component.The sum of the volume throughputs of the components of the biogas will give the volume throughput of the biogas.

Total Throughput of Properties of the Waste
Total throughput of properties of the waste is required in the waste analysis, for example for formulation of the mass balance equation Equations ( 20) and (21).Each stage of the waste treatment process generates partial mass throughputs as well as partial calorific values of the waste components.The total throughput and total calorific value are then obtained by summing the partial throughputs Equation (13).
where x k,n is the total mass throughput or calorific value of matter i with n components.k is the respective property, i.e., mass throughput, HCV or LCV.Total volume throughput of the matter i cannot be obtained from the sum of the partial volume throughputs of its components since the components do not have the same density, as seen in Section 3.5.Volume flow rate of biogas is obtained from the mass and density of its components, not from summation of volume throughputs of its components.Total volume throughput of the matter i is thus computed using Equation (12).

Temperature and Pressure of Waste
The various stages of waste treatment also require values of temperature and pressure of inputs and outputs.If the temperature and pressure of a given waste treatment stage affects the temperature and pressure of the following treatment stage (this applies when there is energy transfer without delay), the temperature and pressure of the latter are computed by a weighted average of the respective mass throughputs as expressed in Equation ( 14).
where x n is the temperature or pressure of the waste, m i is the mass throughput of the waste component i, x i is the temperature or pressure of the waste component i and m m is the mass throughput of the waste at the previous treatment stage.
If the temperature and pressure of the waste treatment stage does not impact the temperature and pressure of the following waste treatment stage, the program uses default values contained in the worksheet.
The following sections give mass balance equations that are used by the program to analyse the formation of biogas and new biomass from anaerobic digestion of organic waste.Computation of parameters that determine the operating conditions of the anaerobic digestion process is also included.These conditions include organic loading rate, dilution of digester effluent, heat losses from the digester and heat of reaction of the effluent in the digester.

Organic Loading Rate
Organic loading rate is expressed as COD, i.e., the mass of oxygen required to entirely oxidize the compounds contained in the digester effluent.Organic loading rate is computed using Equation (15).
where m COD is the mass of oxygen required for the oxidization, m ms is the mass of dry matter, and α, β, γ, δ and ε are mass fractions of biomass of composition Nitrogen is considered inert and thus formation of nitrogen oxides is neglected.The nitrogen component is not included in Equation (15).

Digester Operating Temperature
The user of the model specifies the operating temperature of the digester.There is an option for thermophilic, mesophilic or psychrophilic temperatures.The thermophilic temperature is set to 55 • C, the mesophilic temperature is set to 35 • C and the psychrophilic temperature is set to 20 • C. It is assumed that the operating temperature of the digester is kept constant throughout the year by heating the digester.

Dilution of Digester Effluent
Digester effluent may be diluted to reduce dryness or toxicity.The anaerobic digester module computes dryness and toxicity of nitrogen in the effluent, in order to compare the values achieved with maximum values set.This impacts on the economic analysis since it involves addition of water to the effluent.Equation ( 16) computes the desired dryness of digester effluent.
where ϕ 1+2 is desired dryness of the digester effluent, m 1 is mass throughput of wet matter, ϕ 1 is dryness of matter before addition of water and m 2 is mass of water added.
If the desired dryness of the digester effluent is known and the amount of water to be added is required, Equation ( 17) is used.

Heat of Reaction of Effluent
Elimination of the COD by anaerobic digestion results in generation or absorption of heat in the digester effluent, depending on the nature of the organic material.Estimation of the net heat generated is calculated by HCV before − HCV after , using Equation (4).

Rate of Elimination of Volatile Solids
The anaerobic digester's performance is characterized by effectiveness of elimination of total volatile solids, η VSt .This is separated into mass breakdown of dissolved volatile solids and non-dissolved volatile solids.The effectiveness of elimination of dissolved volatile solids, η DVS , is higher than the effectiveness of elimination of non-dissolved volatile solids, η NDVS .Based on the respective masses of the components of the input, partial effectiveness of elimination of dissolved volatile solids and partial effectiveness of elimination of non-dissolved volatile solids are computed separately and are used in Equation (18) to define the effectiveness of elimination of total volatile solids.
where η VSt is the effectiveness of elimination of total volatile solids, m VSt is the mass of total volatile solids, η DVS is effectiveness of elimination of dissolved volatile solids, m DVS is the mass of dissolved volatile solids, η NDVS is effectiveness of elimination of non-dissolved volatile solids and m NDVS is the mass of non-dissolved volatile solids.
The program uses a rate of elimination of dissolved and non-dissolved volatile solids of 95% and 40% respectively, at 37 • C for a hydraulic retention time of 25 days.Equation ( 18) and a typical rate of elimination of total volatile solids of 60% is used to estimate the rate of elimination of non-dissolved volatile solids.The value 60% is obtained from liquid manure of pigs containing typically 37% of non-soluble volatile solids.This is confirmed with the rates of biological breakdown measured by [20], for papers and carton whose m DVS = 0.

Limits of Reaction by C/N Ratio
The mixture of inputs to the anaerobic digestion process should ideally have a C/N ratio of between 20 and 40 to allow a balanced growth of micro-organisms.The program computes the C/N ratio of the mixture of inputs and sends an error message if the C/N ratio exceeds 40.It will nevertheless carry on with the process analysis.The effective C/N ratio is computed using Equation ( 19) that considers the total carbon available to the anaerobic digestion process, and the total nitrogen in the dissolved and non-dissolved matter.Organic carbon that is non-biodegradable such as lignin is not considered in Equation ( 19) because it is considered biologically inert.
where C N | eff is the effective carbon to nitrogen ratio in the mixture of inputs, m C-biodegradable , is the total carbon available to the anaerobic digestion process and m N-total is the total nitrogen in the dissolved and non-dissolved matter.

Dilution to Control Dryness and Toxicity
The program imposes a constraint on the maximum dryness allowed for inputs to the digester.If the inputs are too concentrated, the program will compute the quantity of water of dilution required to ensure that the dryness reaches the set limit, using Equation (17).After calculation of the composition of the digestate, an additional quantity of water of dilution may be required if the set toxic limit is exceeded.Toxic limits used by the program are given in Table 3.The amount of water to be added to the digestate to ensure the toxic limit is not above the set value is computed by Equation (17).The program however only controls the toxic limit of nitrogen.

Mass Breakdown of the Anaerobic Digestion Process
Section 3.14 describes the formulation of the mass balance equation of the anaerobic digestion process.In the anaerobic digestion process, in addition to formation of biogas, there is secondary formation of biomass of molar formulation C á,H b,O ć,N d,S é, the entire process of which is described by Equation (20), where the proportions are expressed on a molar basis.Equation ( 20) is then rewritten on a mass basis of volatile solids as Equation (21).
where α, β, γ, δ and ε are mass fractions per unit basis of the volatile solids in the initial biomass of composition C α H β O γ N δ S ε , ά, β, γ, δ and έ are mass fractions per unit basis of volatile solids in the new biomass of composition C άH β O γ N δS έ and Φ is the ratio of the mass of the new biomass to the mass of the initial biomass (on a dry basis of volatile solids and without ashes).Nitrogen contained in the initial organic matter which is not found in the new biomass is converted into ammonia.Sulphur contained in initial organic matter is converted into H 2 S which will be found in the biogas.CH 4 , CO 2 and H 2 S produced are added to the gas phase and constitute biogas.Phosphorous present in the resulting effluent is mineral based.Water is taken out or added in the liquid phase.Water can be produced in the reaction (a positive value) or consumed (a negative value), depending on the composition of the organic matter.NH 3 is added to the dissolved volatile solids because it is entirely soluble.The new biomass is added to the non-soluble volatile solids.The program uses a rate of elimination of dissolved and non-dissolved volatile solids of 95% and 40% respectively at 37 • C and hydraulic retention time of 25 days [21].
Equation (21) gives the mass balance equation of organic matter following the anaerobic digestion reaction.The following steps outline how the program computes the term x k − Φx k in Equation ( 21) from the properties of the mixture of inputs.
Calculations are done separately for dissolved and non-dissolved volatile solids.This starts with calculation of volatile solids eliminated for each element k.The mass throughput of the element in the initial volatile solid, m k,o , in the phase considered, and the rate of removal of volatile solid η el is used in Equation (22).
where m k,el is the mass of volatile solids eliminated for each element k.
The mass throughput of the volatile solids eliminated in the phase considered is obtained by the sum of the partial mass throughputs of the elements that constitute the input.It is calculated by Equation (23).
where m VS,el is the mass throughput of the volatile solids eliminated.Equation ( 24) is then used to calculate the mass throughput of the new biomass which appears at a rate Φ.Φ is defined as the ratio of the mass of the new biomass to the mass of the initial biomass (on a dry basis of volatile solids and without ashes).The program uses a default value for Φ of 0.04 t ms /t CODeliminated [22].
where m VS,b is the mass throughput of the new biomass.Using Equation ( 25), the partial mass throughput of each element that constitutes the volatile solids of the new biomass is then calculated starting from the mass fraction ωk,b , of the element k in the volatile solid, of the new biomass.This does not take into consideration ash content.The mass fractions of elements in the new biomass are given in Table 4 and are obtained from experimental analysis [23] and [24].The mass throughput of each by-product is thus given by Equation ( 21), in which the term x k − Φx k is given by Equation (26), which is obtained from Equations ( 22)- (25).

Heat Generation by Boilers
The program defines the exhaust temperature of boilers of given capacity based on data given in Table 5.Table 5 gives the stoichiometric ratios of air and the temperatures of exhaust gases.The stoichiometric ratio of air and temperatures of exhaust gases of the respective boiler capacities is what is used to estimate heat production from combustion of gases in a boiler.

Spark Ignition Engine Generator Set
The efficiency of energy conversion is used to compute the amount of electricity generated for a given rating of a spark ignition engine-generator set.The program estimates the efficiency of energy conversion based on linear interpolation using Equation (27).
where η e is the efficiency of energy conversion and P e is the electrical power output.If exhaust heat is recovered, total CHP efficiency in relation to LCV is given in Table 6 [26] for different spark ignition engine ratings.The total CHP efficiency in turn is used to estimate electricity and heat production for a CHP system.Table 6.CHP efficiencies of spark ignition engine generator sets.

Economic Analysis
Section 6 gives equations used to carry out the economic analysis of the waste treatment process.

Scaling Parameter
The program uses reference capital costs C ref which are published values compared to a given capacity (referred to as capacity of reference Q ref ).There is a relationship between the cost of a unit of equipment and its capacity.If this cost is plotted against the capacity on a logarithmic scale, the best fit curve obtained is a straight line.The equation of the line is obtained as Equation ( 28) [27].This equation is used to estimate the capital costs C 1 of the desired or required capacity Q 1 .
where v is a scaling parameter.The program uses a default scaling parameter of 0.6.The value of the scaling parameter is generally in the interval 0 ≤ v ≤ 1.The most frequently used value is 0.6 [27].
The economic analysis requires computation of total reference capacity cost that is given by Equation (29).
where C total ref is the total reference capacity cost, C ref 1 is the reference investment cost, C installation is the installation cost and C eng admin is the cost of engineering and administration.

Operation and Maintenance Costs
The program sets the annual operational and maintenance costs to 5% of equipment costs by default (excluding the energy costs).If however the specific operational and maintenance cost Ĉref is known for a given reference capacity Q ref , the operational and maintenance cost Ĉ1 for another capacity Q 1 can be extrapolated using Equation (30).
where v is the scaling parameter set to 0.6 [27].Specific costs of energy are not scaled down as they remain the same as those of the reference capacity, since they apply to unit cost of the treatment capacity or energy production.
The digester capacity is computed from the volume flow rate of input waste and the hydraulic retention time using: where Q digester is the capacity of the digester, V is the volume flow rate of input waste in m 3 /h and HRT is the hydraulic retention time in days.

Comparison of the Computer Program's Predictions with Results from Case Studies
The previous sections described the computer program for organic waste analysis.This section compares predictions of the computer program with actual biogas yields and biogas composition.Two case studies have been looked at, A.A. Dairy farm [28] and Noblehurst Dairy farm [29].Ultimate and proximate analysis data of the case studies was unavailable, hence ultimate analysis data was derived using a transformation matrix [30].Proximate analysis data available in the computer program's database was used.
This section describes a transformation matrix that has been used to estimate ultimate analysis data.It also gives the digesters' operating conditions.

Transformation Matrix
Since the computer program uses ultimate analysis to characterize the biomass waste, this data had to be determined in order to predict biogas generated.A transformation matrix developed by [30] is used to estimate ultimate analysis data.The transformation matrix was developed to estimate the composition of carbohydrates, proteins and lipids in input waste, and subsequently input components to the ADM1 model [1].The ADM1 model is a wastewater treatment process model developed by the International Water Association.It is based on the anaerobic digestion process.The ADM1 model formulates the anaerobic digestion process mathematically using the concentrations of components at each of the stages of disintegration, hydrolysis, acidogenesis and acetogenesis.The transformation matrix is an interface between measurable waste characteristics and the ADM1 model's input waste components.The inputs to the transformation matrix are COD, VFA, total organic carbon, organic nitrogen, total ammonia in nitrogen, orthophosphate phosphorus, total inorganic carbon, alkalinity, fixed solids and input waste volume flow rate.The transformation matrix was developed on the basis that waste components can be expressed as mass fractions of the elements C, H, O, N and P. The waste components also have an associated charge.The ADM1 input components are thus derived by evaluation of the mass and charge balances during the conversion processes.The input waste is converted to ammonia, bicarbonate, orthophosphate, cations, VFA, sugars, lipids, proteins, carbohydrates and organic inerts.The process flow for the derivation of the ADM1 components using the transformation matrix is illustrated in Figure 3.In Figure 3, v represents a conversion process, I is an input waste characteristic and X is an ADM1 component.The stoichiometric coefficients of the theoretical oxygen demand, the elements and charge are represented by i ThoD, i C, i N, i O, i H, i P and i charge, respectively.

Estimating Ultimate Analysis Data
Some of the parameters generated by the transformation matrix for use by the ADM1 model are applied in this analysis in order to estimate mass fractions of C, N, H, O and P in input waste.The ADM1 model specifies mass fractions of the composite organic matter, but these cannot be used directly in the computer program because they were derived for modeling of anaerobic digestion in the wastewater treatment process [1].The method thus proposed in this paper is to apply the transformation matrix to obtain mass fractions of elements in the specific organic waste.As shown in Figure 4, the ADM1 models the organic component of the input waste as composite material that disintegrates into inert particulate matter, soluble inert matter and soluble organic matter [1].The soluble organic matter is hydrolyzed into carbohydrates, proteins and lipids.In the procedure used in this paper, the mass fractions of elements in carbohydrates, proteins, lipids, inert particulate matter and soluble inert matter are obtained by application of the transformation matrix.The organic mass fractions of each of the elements in the input waste are then derived from the mass fractions of these components.The organic mass fractions of the elements are what are used by the computer program for waste characterization.Table 7 gives measured waste characterisation parameters from the A.A. Dairy farm [28,31] and the Noblehurst Dairy farm [29] case studies.The values of measured parameters used for the two case studies, the A.A. Dairy farm [28,31] and the Noblehurst Dairy farm [29] are given in Table 8, in terms of COD or gm −3 .The acronyms used in Table 8 are defined in the appendix.The values in Table 8 were derived from the measured waste characteristics and the following is an explanation on how these values were obtained.
where VFA gCOD/cubicm is VFA expressed in gCODm −3 , VFA mg/kg is VFA expressed in mg/kg and ρ input is density of input waste in kgm −3 .
The conversion to gCODm −3 is calculated from the number of moles of oxygen required to fully oxidize one mole of the acetic acid [30].This is illustrated in Equation (34) where two moles of oxygen are required to fully oxidize one mole of acetic acid.One mole of oxygen has a molecular mass of 32 g, hence one mole of acetic acid is 64 gCOD.The molecular mass of acetic acid was computed from its molecular formula and obtained as 60 g, hence the factor 64/60 in Equation (33).
Total organic carbon and total inorganic carbon in the manure were not measured in the case studies reviewed and thus were computed using Equation (35) [28,32], Equation (36) [3] and Equation (37) respectively.The factor 0.555 was also used by the case study of the A.A. Dairy farm [28] and by [32] to estimate total organic carbon.The factor 0.486 used to compute the mass fraction of total carbon in TS was obtained from the ratio of total carbon and total inorganic carbon in [3], for dilute manure.A case study on dilute manure was selected for this estimation because the manure from the farms is mixed with milking parlor wash water.TOC = 0.555 * TVS [gCm −3 ]  (35) where TOC is total organic carbon, TVS are total volatile solids, TC is total carbon, TS are total solids and TIC is total inorganic carbon.TP−orthoP is the difference between total phosphorus and orthophosphate phosphorus.Alkalinity was not measured for both case studies and was thus obtained from [3] for dilute manure.
The transformation matrix was applied with the inputs given in Table 8.The outputs of the transformation matrix used for mass fraction estimation are COD values of X ch (carbohydrates), X pr (proteins) and X li (lipids).These are given in Table 9.In order to obtain mass fractions of the elements on a dry weight basis, the total mass of the elements in the components is expressed as a fraction of the TS.As shown in Table 9 these components are expressed in COD units and have to be converted to mass units in order to obtain mass fractions of elements on a dry weight basis.The conversion is done by Equation (38) using the theoretical oxygen demand of each of the components [33].
where X kg/cubicm is the mass in a cubic metre of component X k , X kgCODcubicm is the COD value of component X k and ThOD Xk is the theoretical oxygen demand of the component X k .The mass fractions of elements in the individual components were obtained from the ADM1 model [33] and are given in Table 10.The mass fractions of the elements in the components and value of TS are used to compute the mass fractions of elements in the input manure on a dry weight basis Equation (39).The resulting values are given in Table 11.
where ωi is the mass fraction of element i on a dry weight basis, α iXch is the mass fraction of element i in carbohydrates, α iXpr is the mass fraction of element i in proteins, α iXli is the mass fraction of element i in lipids and TS are total solids.Not all the proximate and ultimate analysis data could be computed, therefore some values were obtained from the computer program.Table 12 gives data that was obtained from the computer program.Operating conditions of the digesters from the case studies [28,29] were entered into the computer program.These conditions are given in Table 13.
Table 13.Operating conditions of digesters.The specification of the reduction in TVS is important in obtaining acceptable predictions from the computer program.Percentage reduction in TVS is dependent on HRT (Hydraulic Retention Time) and the temperature of the digester.The computer program's database specifies a value of 60% at 37 • C for a HRT of 25 days.In this case the percentage reduction in TVS is for a specific HRT and at a specific temperature.The rate of reduction of TVS has to be specified for each digester.The A.A. Dairy farm data indicated a 29.7% [28] reduction in TVS and the Noblehurst Dairy farm data indicated an average of 17.2% [29] reduction in TVS.These were at a HRT of 34 days [28] and 37 days [29] respectively.These values could not be used in the computer program, which specifies a percentage reduction in TVS for a different temperature and different HRT.In addition, the computer program uses the rate of elimination of dissolved volatile solids and non-dissolved volatile solids at its specified temperature and HRT to compute the rate of reduction of TVS.While doing this the computer program specifies ranges for rates of reduction of dissolved and non-dissolved volatile solids.If values outside the specified range are entered in order to match the measured reduction in TVS, the amount of biogas generated is skewed.The computer program recommended a range of 50% to 60% reduction in TVS for sludge.It was decided to work with the closest value computed that was within the allowed range of dissolved and non-dissolved volatile solids.This value was 50% for both the A.A. Dairy farm and the Noblehurst Dairy farm case studies.This is an area of improvement for the computer program in that two options should be provided for specification of reduction in TVS.Reduction in TVS may be obtained from the computer program's database, or the program should be able to estimate biogas production based on values of TVS entered by users.

Temperature HRT Reduction of TVS
Dryness of the manure influent was computed using the value of TS expressed in mg/L, and mass flow rate of manure Equation (40).
where m mh is mass flow rate of influent manure, ω ms is dryness and TS is total solids.The values of mass flow rate of input waste and dryness of manure from the farms in the case studies are given in Table 14.

Results and Discussion
The results obtained from the computer program are summarized in Table 15.The computer program predicted generation of 47.87 m 3 of biogas per hour of 47.5% methane content for the A.A. Dairy farm.Biogas generation for the Noblehurst Dairy farm was predicted at 84.53 m 3 /h and 47.2% methane content.These predictions are compared with empirical data of metered biogas from the farms.Data for both farms is obtained from [34].The metered biogas flow for the A.A. Dairy farm was obtained for April 2007 to May 2007 and is shown in Figure 5a.This period was selected because all three months had above 90% good data, which is high compared to the other months.Figure 5a and Table 15 show that the mean metered biogas flow rate is 8.8% below that predicted by the computer program.The metered biogas flow for the Noblehurst Dairy farm was obtained for December 2005 to January 2006 and is shown in Figure 5b.This period was selected because it had above 96% good data.Figure 5b and Table 15 show that the mean metered biogas flow rate is 7.9% below that predicted by the computer program.The error in prediction of methane content of biogas is 19.6% for the A.A. Dairy farm and 22.6% for the Noblehurst Dairy farm.These errors are explained by the use of an estimated value of percentage reduction in TVS.As explained in Section 7.4, the value of percentage reduction in TVS recommended by the computer program was used and not the values reported by the case studies.This was done because the computer program derives the percentage reduction of TVS from the percentage reduction of non-dissolved and dissolved volatile solids.It does not allow provision for specification of percentage reduction in TVS by the user.This introduced an error in computation of both the biogas yield and methane content.Methane content calculated by the computer program is dependent on the mass fraction of carbon and hydrogen in the organic matter and the percentage reduction in TVS.In addition, the values reported in the case studies were in cubic feet per cow day [28], to one decimal place and mg/kg [29], rounded off to the nearest whole number.These values were converted to tonnes per hour for use in the computer program, which involved conversion factors given to a number of decimal places.These conversions led to losses in accuracy, hence the additional discrepancy in actual values of biogas and methane content, from values predicted by the computer program.The density of manure was used to carry out these computations.This value was not reported by the case studies and was obtained from the computer program's database, creating another source of error.The percentage error in methane content predication for the Noblehurst Dairy farm case study [29] is particularly high.This is because the measured value includes the volume of CO 2 .The percentage volume of CO 2 in biogas was not isolated during measurement [29].Typically biogas contains 40%-75% CH 4 and 25%-60% CO 2 among other gases [35].CO 2 constitutes a significant volume of biogas, hence the large percentage error.

Conclusions
A computer program for technical and economic analysis of waste treatment processes has been described with particular reference to anaerobic digestion.The computer program can be used as a tool to predict the amount of biogas, electricity and heat generated from a biomass waste to energy conversion system.It also includes a module for the economic analysis of the various processes used.Two case studies have been used to predict the amount of biogas generated from anaerobic digestion of manure.Generation of biogas predicted by the computer program was compared with actual yields on the farms.Ultimate analysis data was not readily available therefore a transformation matrix was used to estimate this data.It has been shown how ultimate analysis data can be estimated given measurable manure characteristics.Proximate analysis data was obtained from the computer program's database.The specification of the percentage reduction in TVS has been identified as important when using the computer program.This is because of the method used by the computer program to obtain percentage reduction in TVS.This is key to obtaining realistic predictions of biogas generation.The percentage errors in predicted and actual biogas yields for both case studies were within acceptable ranges.The methane content predicted for both case studies was low.The errors in prediction of methane content for the case studies is attributed to estimation of reduction in percentage TVS.One of the case studies included CO 2 in the estimation of methane content of biogas, which increased the percentage error.

Figure 2 .
Figure 2. Variation of bulk density of sludge with bulk dryness.
) where a, b, c, d, and e are the molar quantities of the elements that constitute one mole of organic molecule of composition C a H b O c N d S e , and f is the stoichiometric coefficient of formation of the new biomass of composition C á,H b,O ć,N d,S é.

Figure 3 .
Figure 3. Illustration of the transformation matrix.

Table 1 .
Input parameters for waste characterization.

Table 2 .
Dry content and bulk density of different types of waste.
of Waste Dry Content (t ms /t mh ) Bulk Density (t mh /m 3 ) Based on Figure 2, Equations (

Table 3 .
Toxic limits in the program.

Table 4 .
Properties of new biomass.

Table 5 .
Exhaust temperatures for biogas boilers of different capacities.

Table 7 .
Data used for case studies on farms.

Table 8 .
Composition matrix for estimation of ultimate and proximate analysis from practical measurements of biomass waste.

Table 9 .
Outputs of transformation matrix.

Table 10 .
Mass fractions of elements in ADM1 components.

Table 11 .
Mass fractions of elements in input manure.

Table 12 .
Proximate and ultimate analysis data from computer program's database.

Table 14 .
Inputs to the computer program for A.A. Dairy and Noblehurst Dairy farms.

Table 15 .
Comparison of biogas yield predicted by the computer program with actual yields reported.