Integration of complete elemental mass-balanced stoichiometry and aqueous-phase chemistry for bioprocess modelling of liquid and solid waste treatment systems − Part 2: Bioprocess stoichiometry

COPYRIGHT © The Author(s) Published under a Creative Commons Attribution 4.0 International Licence (CC BY 4.0) Bioprocesses interact with the aqueous environment in which they take place. Integrated bioprocess and threephase (aqueous−gas−solid) multiple strong and weak acid/base system models are currently being developed for a range of wastewater treatment applications including anaerobic digestion, biological sulphate reduction, autotrophic denitrification, biological desulphurization and plant-wide water and resource recovery facilities. In order to model, measure and control such integrated systems, a thorough understanding of the interactions between the bioprocesses and aqueous phase multiple strong and weak acid/bases are required. In the first of this series of five papers, the generalized procedure for deriving bioprocess stoichiometric equations was explained. This second paper presents the stoichiometric equations for the major biological processes and shows how their structure can be analysed to provide insight into how bioprocesses interact with the aqueous environment. Such insight is essential for confident, effective and reliable use of model development protocols and algorithms. It shows that the composite parameters, total oxygen demand (TOD, electron donating capacity) and alkalinity (proton accepting capacity), are conserved in bioprocess stoichiometry and their changes in the aqueous phase can be calculated from the bioprocess components. In the third paper, the measurement of the organics composition is presented. The link between the modelling and measurement frameworks of the aqueous phase, which uses the composite parameter alkalinity, is described in the fourth paper. Aqueous ionic speciation modelling is described in detail in the fifth. Integration of complete elemental mass-balanced stoichiometry and aqueous-phase chemistry for bioprocess modelling of liquid and solid waste treatment systems − Part 2: Bioprocess stoichiometry


INTRODUCTION
A generalized approach to deriving bioprocess stoichiometry was presented in Part 1 of this series (Brouckaert et al., 2021). Integrating the bioprocess stoichiometry with aqueous phase mixed weak and strong acid/base chemistry for pH prediction is necessary because some bioprocesses or combinations of bioprocesses have a strong influence and/or dependence on pH. Examples of technologically relevant bioprocesses, where accurate pH prediction is important, include methanogenic anaerobic digestion (AD) of (i) high strength low nitrogen (N) industrial organics wastewater which requires alkalinity addition to maintain a stable AD pH above 7 (Van Zyl et al., 2008), (ii) co-digestion of sewage sludge and high strength variable N organics such as whey, vinasse or food waste for energy generation, and (iii) co-digestion of sewage primary sludge and phosphorus (P) rich waste activated sludge at biological N and P removal plants in which significant mineral precipitation can take place (Van Rensburg et al., 2003;Harding et al., 2011). The expression of the stoichiometric balances in terms of a linearly independent set of equilibrium speciation model components, as advocated in Part 1 (Brouckaert et al., 2021), results in a compact and flexible formulation which can be conveniently integrated with speciation models in both steady-state and dynamic models. However, the bioprocess stoichiometric balances derived in this way provide little insight into the weak acid/base chemistry that has an important role in governing the overall system behaviour.
The purpose of this paper, Part 2, is to take a deeper look at the stoichiometry of the major bioprocesses included in wastewater treatment models, as well as their interactions with the multiple strong and weak acid/base systems. Part 2 therefore will contribute the following: • Derivation of the major bioprocess stoichiometry using the ionic components introduced in Part 1 (Brouckaert et al., 2021). • Derivation of empirical formulae for complex organic and inorganic components in terms of their carbon (C), hydrogen (H), oxygen (O), nitrogen (N), phosphorus (P), sulphur (S) and charge (ch) content. • Demonstrating how an understanding of the weak acid/base chemistry can be used to construct a simplified speciation model that is appropriate for some steady-state bioprocess models. • Exploring the application of the general principles discussed to two major bioprocesses typically included in water resource and recovery facility (WRRF) models, i.e., methanogenesis and sulphidogenesis.
Parts 3, 4 and 5 will be published in later issues of Water SA.
In this paper, the mass-balanced stoichiometry of bioprocess models including P, S and charge, with some of their associated bioprocesses, are derived with the objectives of: (i) demonstrating the general principles of integrated bioprocess and aqueous phase modelling; and (ii) deriving the complete elemental CHONPS, charge and chemical oxygen demand (COD) mass-balanced stoichiometry for some bio-systems, based on the S cycle, such as BSR in acid mine drainage (Poinapen and Ekama, 2010b), the sulphate reduction autotrophic denitrification nitrification integrated system (SANI) process for saline sewage treatment (Lu et al., 2012), leachate treatment and anaerobic and intermittently aerated landfill treatment (Raga et al., 2011) and co-treatment of simplified wet flue gas desulphurization wastewater (Qian et al., 2013(Qian et al., , 2015. The procedure is general, and can be applied to any bioprocess, including those not considered in this paper.

BIOPROCESS STOICHIOMETRY AND EXCHANGED ELECTRONS
As noted in Part 1 (Brouckaert et al., 2021), the mass-balanced stoichiometry for bioprocesses can be derived from the procedure of electron (e − ) balance of McCarty (1975). This procedure was advanced by Gujer and Larsen (1995) and , applied to steady-state models by Ekama (2009) and generalized for WRRF models by Grau et al. (2007). This series of papers extends the methodology by adding S and charge and shows the intimate connection between the bioprocesses and the aqueous phase mixed strong and weak acid/ base systems within which they function for both dynamic and steady-state plant-wide WRRF models. This brings the aqueous phase behaviour and pH calculation in bioprocess models from the background to equal importance with the bioprocesses.
The primary purpose of biological WRRFs is usually to reduce the COD of the waste, by breaking down complex organic compounds and/or inorganic pollutants such as ammonia, sulphide, sulphite or thiosulphate, into simpler benign or reusable molecules and ions, such as CO 2 , H 2 O, CH 4 , N 2 , SO 4 2or HS -. Synthesis and maintenance of the active biomass, required to mediate these bioprocesses, also consume some of the influent COD and nutrients. The excess biomass produced is typically separated into a concentrated sludge, which is further reduced in volume and COD content by digestion. All of these biological transformations involve reduction-oxidation (redox) reactions and the key prior system knowledge, required to construct the appropriate bio-chemical stoichiometric balances, concerns which electron donors and electron acceptors are involved in which transformations under which operating conditions, and what the products of these reactions are.
Eight common bioprocesses can take place under anaerobic, anoxic and aerobic conditions, such as in activated sludge, BSR, AD and intermittently aerated (partially aerobic) landfill systems. The electron donors and acceptors for these eight bioprocesses are listed in Table 1. The electron (e − ) donor is the substrate for growth of a particular organism mediating a particular bioprocess. The interaction of these bioprocesses in intermittently aerated landfill waste (Raga et al., 2011) is shown in Fig. 1. Table 1. Some bioprocesses that can take place in anaerobic, anoxic and aerobic liquid and solid waste treatment systems. Stoichiometric details of these bioprocesses are given in Table 4 Bioprocess   Table 1 in intermittently aerated landfill solid waste in which products of one bioprocess become reactants for another. The numbers in boxes refer to the bioprocess numbers in Table 1, circled components are dissolved or gaseous reactants and products and the ionized reactants and products are in the aqueous phase https://doi.org/10.17159/wsa/2021.v47.i3.11858 To illustrate the procedure of formulating biological process stoichiometry, consider the oxidation of a generic organic or , H + and H 2 O, which are the products of C, N, P, and S. These are products of aerobic heterotrophic growth and nitrification (combined Bioprocess 3 and 4 in Table 1). Following the methodology presented in Part 1 (Brouckaert et al., 2021), the reaction equation is derived from the CHONPS element and charge balances.
The term (4x + y -2z + 5a + 5b + 6c -ch) represents the exchanged electrons (γ s , e − /mol donor) (Part 1, Brouckaert et al., 2021), for the selected set of electron (e − ) donor and acceptor reactants and products, i.e: J s x y z a b c ch 4 2 5 5 6 (2) So Eq. 1 becomes: Equations 1 and 3 are given in arrow notation with reactants on the left-hand side (LHS) and products on the right-hand side (RHS) of the arrow. This notation conveys the idea that a stoichiometric equation represents a directional vector of changes in composition that the element balances allow. The equations can also be written in Gujer notation, with reactants −ve and products +ve, summing to zero. This has the advantage that it corresponds to the output of a computational stoichiometry generator (Part 1, Brouckaert et al., 2021) and corresponds with the way in which reaction processes are set up in modelling software. In this paper, the reaction equations use arrow notation, and stoichiometry tables use Gujer notation. ) and corresponding pH, subject to the component mass balances and thermodynamic dissociation equilibrium equations.
As discussed in Part 1 (Brouckaert et al., 2021), the traditional approach of dividing bioprocesses into electron donor and acceptor half-reactions is not necessary to achieve element-and charge-balanced stoichiometry for the overall reaction. However, breaking the overall reaction into its constituent parts facilitates better understanding of the reaction, and allows combining e − donors with different e − acceptors.
Indeed, since a stoichiometric equation is a linear element and electron balance, all manner of linear transformations can be applied to it to highlight specific issues. The issues which are of most interest for understanding the impacts of the bioprocess on solution properties are the transfers of electrons and protons (H + ions) between oxidants, reductants, organic and inorganic components, and the mediating micro-organisms. Thus, the overall reactions can be broken down into electron donor, electron acceptor, anabolic (providing material for micro-organism growth) and catabolic (providing energy to drive the anabolic process) reactions, where the anabolic and catabolic processes are the electron sinks and together form the metabolism of the organism. Furthermore, the reactions can be split into the contributions of each of the CHONP and S elements and charge separately − the overall reaction is then simply the sum of the individual element and charge contributions. These appear in Eq. 5e and more generally in Table 2.
The overall bioprocess redox reaction can be formally split into two half-reactions, in which the electrons transferred from the electron donor to the electron acceptor are explicitly shown, i.e.:  Table 1. To repeat: the selection of the electron acceptor reactants and products is based on knowledge of the bioprocess, and needs to be determined beforehand to derive its stoichiometry.
In Eq. 4a, the generic electron donor C x H y O z N a P b S c ch reacts to form particular oxidized products of each of its constituent elements, giving up y s electrons, which are taken up by the electron acceptor O 2 according to Eq. 4b.
Rearranging Eq. 4a to pair the terms γ s e − and γ s H + yields: This pairing of some of the protons with electrons in the redox halfreactions, Eq. 4b and Eq. 4c, is discussed further in later sections; suffice to state here that any H + not paired with an e − affects the aqueous-phase alkalinity and pH. The next sections discuss the key features that electron donor (source) and electron acceptor (destination) reactions have in common, and demonstrate how the general equations are applied to specific bioprocesses.

ELECTRON (e − ) DONOR REACTIONS
An electron donor reaction is a half-reaction in which a substrate (electron donor) or other chemical component reactant gives up electrons to produce more oxidized forms of its constituent elements as in Eq. 4a.

Oxidation products
The first important point to note is that the redox state of the oxidation products of the electron donor reaction is determined by the bioprocess.
where the exchanged electrons γ s of Eq. 5a is now given by: Note that γ s in Eq. 6 is also referred to as the electron donating capacity (EDC) of the electron donor. However, the EDC is not a function of the electron donor only, but also of the reaction products, which, in turn, depend on the conditions under which the reaction takes place (e.g. aerobic, anoxic or anaerobic). When reaction balances are set up in terms of 1 mol of substrate as in Eq. 2, then the exchanged electrons of reaction will equal the EDC of the substrate.
The difference between Eqs 2 and 6 for γ s is that NH 4 + and HSare the oxidation products of the N and S elements in Eq. 5a instead of NO 3 and SO 4 2in Eq. 1. Because NH 4 + and HScan each donate 8e − to become NO 3 and SO 4 2-, respectively, the γ s of Eq. 6 is 8a and 8c e − /mol lower than the γ s of Eq. 2, i.e., the coefficients of the a and c terms in the γ s equation have changed from +5 and +6 in Eq. 2 to −3 and −2 in Eq. 6. The 8 e − /mol electron donating capacity (EDC) of each of the NH 4 + and HSlead to the wellknown 4.57 gO/gN ammonia nitrified to nitrate (from 8 e − /mol x 8 gO/e − divided by 14 gN/mol) and 2.0 gO/gS sulphide oxidized to sulphate (from 8 e − /mol x 8 gO/e − divided by 32 gS/mol).
Pairing the e − and H + in Eq. 5a yields: Eq. 5b can also be written as Eq. 5d below, viz. and γ s remains equal to Eq. 6, showing that the protonated form of the selected reaction product components does not affect the exchanged electrons of the reaction.
Furthermore, as mentioned above, Eq. 5d can be considered the sum of reactions involving individual elements, which are shown in Eq. 5e and more generally in This disaggregation of the reaction stoichiometry in Eq. 5e is the basis of Table 2. Equation 5d is reconstructed by adding Rows 1b, 2, 3, 4a, 5b, 6a and 7. The alkalinity with respect to the most protonated species imparted to the aqueous phase by the electron donor is included in Table 2. The sum of the relevant rows in Column 7 of Table 2 yields the alkalinity of the reaction products ∑ Alk Tproducts . The overall alkalinity change of reaction depends on the alkalinity of the electron donor Alk ed as discussed in Part 1 (Brouckaert et al., 2021).
−ch a In this table, reactants (Columns 1 and 2) are given a −ve sign to represent consumption, and products (Columns 3 to 5) are given a +ve sign to represent production, as in a Gujer matrix. Each constituent part of each reaction sums to zero across each row to conform to mass balance as indicated in Row 6. The procedure is general and applies to weak and strong acid/bases, e.g.
The persistent alkalinity contribution (Column 7) with respect to the most protonated species of the IC, FSA, OP, sulphide and acetate weak-acid/bases is the number of weak-acid anion equivalents produced by the reaction, minus the number of protons produced that can associate with them, i.e., excluding those paired with electrons (Eq. 5c). So the Alkp in Column 7 is given by (Column 5 -Column 4) + NxColumn 3, where N is the number of H + that can be accepted by the weak-acid/base oxidation product to make reference species (strong acids remain fully dissociated), e.g. for Row 5a: 5b − 8b + 3(b) = 0. For a given electron donor reaction, alkalinity of the reaction products, ∆AlkTproducts (Eq. 20, Part 1, Brouckaert et al., 2021) is obtained by adding the alkalinity contributions in Column 7 of the relevant rows; e.g. Alkp for Eq. 5c is obtained by adding Row 1a, 2, 3, 4b, 5a, 6b and 7 = 0 + 0 + 0 + a + 0 + 0 − ch = a − ch. Note that H + and e − are always included in the calculation of ∆AlkTproducts from Table 2  The equality of the γ s of Eqs 5a, 5b, 5c, 5d and 5e confirms that the protonated forms chosen for the reactants and products do not change the EDC of the electron donor reaction, e.g., the EDC (or γ s ) of the H 2 CO 3 and CO 3 2are both zero. This can also be shown with the γ s of Eq. 6 (or 2): For H 2 CO 3 , γ s = 4 x 1 + 1 x 2−2 x 3 + 5 x 0 + 5 x 0 + 6 x 0 -0 = 0 and for CO 3 2-, γ s = 4 x 1 + 1 x 0 − 2 x 3 + 5 x 0 + 5 x 0 + 6 x 0 −(−2) = 0. In general, the γ S equation can be applied to each part of an electron donor reaction to give the EDC of that part relative to the oxidation state selected for each CHONP and S element.

Exchanged electrons (of reaction)
As discussed previously, the McCarty (1975) approach is based on the concept of an electron balance. The advantage of breaking the overall balanced stoichiometry into half-reactions is that it highlights both the source and destination of the exchanged electrons γ s and it allows pairing of electron donor reactions with different electron acceptor reactions. The exchanged electrons in the electron donor reaction are a function of the change in oxidation state of the constituent elements of the electron donor, and are therefore a stoichiometric property of the reaction, depending on both the composition of the electron donor and the oxidation state of the reaction products. Because Eq. 1 is written in terms of the most oxidized products of each constituent element in the electron donor, γ s in Eq. 2 is the maximum number of exchangeable electrons, whereas γ s in Eq. 6 is not the maximum possible because the NH 4 + and HSproducts can still donate electrons. McCarty used the term exchangeable electrons, which suggests that they are a property of just the substrate, whereas in fact they depend on all the components participating in the half-reaction. So a more suitable term, exchanged electrons of reaction, has been adopted for this series of papers, with exchanged electrons as an abbreviation.
Extending the pattern of Eq. 5e, Table 2 shows the contribution of each element in the electron donor to the exchanged electrons as a function of the oxidation product of the N and S elements. While the protonated state of the C and P components may be different, their oxidation state is the same in all the bioprocesses considered here. For the purpose of calculating the exchanged electrons, each element in the generic electron donor is treated as having an oxidation state of zero. The true oxidation state of each atom in the electron donor might not actually be zero. However, since the electrons involved are just re-distributed within the molecular structure, the net effect is the same as assuming that their oxidation states are all zero. Consider the contribution of carbon: Because the C in C x H y O z N a P b S c ch all becomes CO 3 2-(or H 2 CO 3 ), where it has an oxidation state of +4 (a deficiency of 4 electrons), the electron donor component donates 4 electrons per carbon atom, hence the 4x in Eqs 2 and 6. The total exchanged electrons or γ s for a given reaction is the sum of the contributions from each element in C Table 2, Column 5. The terms of the γ s equation associated with the different oxidation products of N and S are obtained by summing the relevant rows in Column 5. For example, the γ s term associated with Eq. 5a with NH 4 + and HSas oxidation products is obtained by adding Rows 1a, 2, 3, 4b, 5a, 6b and 7 in Column 5. Similarly, the γ s terms for Eq. 1 are obtained by adding Rows 1a, 2, 3, 4e, 5a, 6e and 7 in Column 5.
It can be seen from Table 2 that only the selection of the oxidation state of the products affects the exchanged electrons (γ s ), not which components are selected to represent the oxidation products. For all the reactions considered here, C, H, O and P always contribute +4, +1, −2 and +5 to γ s relative to their elemental state. The electron contributions of N and S to the γ s depend on the specific electron donor product oxidation states involved, and may be positive, zero or negative. If the oxidation states of the N and S are the most oxidized forms, i.e., NO 3 and SO 4 2-, their coefficients in the γ s equation are +5 and +6 because they donate 5 and 6 e − relative to their elemental N and S states (Eq. 2). If the oxidation state of the N and S are the least oxidized forms, i.e., NH 4 + and H 2 S, their coefficients in the γ s equation are −3 and −2 because now they take up 3 and 2 e − relative to their elemental state (Eq. 6). The coefficients of the γ s equation associated with the oxidation products of CHONP and S elements are shown schematically in Fig. 2. Figure 2. Electron (oxidation) state of different components involved in bioprocesses relative to their zero electron state (0, centre column). The EDC (or the electron-accepting capacity EAC = −EDC) is equal to the electron state difference between two components of the same element, EDC from left to right and EAC from right to left; e.g. ammonia's EDC relative to nitrate = +5 − (−3) = +8 e − /mol, nitrate's EDC (−EAC) relative to nitrogen gas = 0 − (+5) = −5 e − /mol (or EAC = +5 e − /mol, so nitrate can accept 5 e − /mol), and the EDC of methane relative to CO 2 is 4 − (−4) = +8 e /mol https://doi.org/10.17159/wsa/2021.v47.i3.11858

Composition of the electron donor
As discussed in Part 1 (Brouckaert et al., 2021), having precise element and electron balanced bioprocess stoichiometry is key to successfully integrating bioprocess and physico-chemical reaction models. This is a particular challenge for bioprocess models since wastewater typically consists of a diverse mixture of complex organic molecules of unknown composition and structure. The convention adopted in this series of papers, and in the plant-wide WRRF model based on this approach, PWM_SA (Ikumi et al., 2011, is to represent each group of complex organic substrates (soluble, particulate, biodegradable, unbiodegradable, settleable, non-settleable) by the generalized empirical formula where the stoichiometric coefficients x, y, z, a, b and c can be calculated from the mass fractions of the various elements determined by wastewater characterization (Part 3 of this series).
Note that the composition of any electron donor containing any combination of CHONPS can be obtained by substituting the appropriate values of the stoichiometric coefficients x, y, z, a, b, c and ch into the general formula. This includes simple organics like acetate and inorganic substrates such as thiosulphate and nitrite. Similarly, the exchanged electrons of reaction for complete oxidation of any such electron donor can be derived from Eq. 2, because in Eq. 2 all the elements are in their most oxidized state as far as bioprocesses are concerned. Furthermore, any of the oxidation reactions can also be derived as a linear combination of the oxidation reactions of the constituent elements of the electron donor (Table 2). Common examples are listed below.
Ammonia to nitrate: Ammonia to nitrite: Nitrite to nitrate: Ammonia to nitrogen gas: Sulphide to sulphate: Sulphite to sulphate: Thiosulphate to sulphate:

Paired e − and H +
Any reaction or half-reaction that starts from a set of reactants that is charge-balanced must produce a charge-balanced set of reaction products (as in Eq. 5e with ch = 0). Thus the electrons in an oxidation or reduction half-reaction must be balanced by positively charged ionic products, of which the most common in biological reactions is H + . Conversely, every H + that is involved in the reaction must be matched by a corresponding negatively charged component. H + is of particular interest, because of its role in determining solution pH and alkalinity. However, these properties are not mediated by the H + ions alone, but also by the anions with which they are paired. In redox half-reactions, pairings with H + ions can be divided into 3 significant categories: with electrons; with anions of strong acids; and with anions of weak acids.
Free electrons cannot accumulate in solution, so they only appear in half-reactions. Therefore, an electron donor half-reaction always has to be combined with an electron acceptor halfreaction, in which the electron is a reactant, so that the electrons cancel out in the overall reaction (see below). This means that the H + ions that are paired with the electrons in the electron donor half-reaction and the electron destination half-reactions will also cancel out, and consequently have no effect on the solution properties. However, any deficit or surplus of H + after the pairing of H + with e − has to be supplied or absorbed by the aqueous phase with changes of pH and alkalinity. The increase or decrease in H + and other aqueous component products of the bioprocess, such as PO 4 3and CO 3 2-, disturb the equilibrium of the aqueous phase, which then re-speciates to re-establish equilibrium. The H + that are paired with strong acid anions, such as sulphate or nitrate, remain virtually completely dissociated, and so have a strong effect on pH. In contrast, the H + that are paired with weakacid anions, such as acetate, carbonate or phosphate, will tend to remain partially associated with them, and so have no effect on total alkalinity, and a weak and variable effect on pH, depending on the specific pK values of the anions involved relative to the pH of the solution.

Chemical and total oxygen demand (COD and TOD)
COD is the electron-donating capacity (EDC) of components (or groups of components) expressed as oxygen, as if all the electrons donated by the components were accepted by oxygen. , H + and H 2 O. Note that in the COD test, ammonia is not oxidised, but sulphide is, so the COD measure excludes the EDC of the ammonia but includes the EDC of the sulphide, where the EDC is expressed in terms of mass of oxygen. The total oxygen demand (TOD) is the amount of oxygen required to convert the electron donor to the most oxidized forms of its reaction products, including the oxidation of the nitrogen content to NO 3 -, i.e., the products of the TOD reaction are CO 3 The EDC corresponding to COD of an electron donor can be constructed from Table 2 by adding Rows 1a, 2, 3, 4b, 5a, 6e and 7, i.e.: Pairing the e − with H + in Eq. 10a yields: The COD then is 8 γ s gO 2 /mol of C x H y O z N a P b S c ch , where the 8 represents 8 gO per e − accepted. The COD as an EDC basis is very convenient for bioprocess modelling because, not only is there an accurate test for its measurement (Standard methods, 2017), it also allows modelling nitrification and BSR bioprocesses separately without correction of the measurement, and therefore is applicable to both aerobic and anaerobic processes. The TOD or COD of a component can be calculated with Eq. 2 or Eq. 11, respectively, from its element and charge composition. It shows, as mentioned before, that the EDC as COD (8 γ sCOD ) or TOD (8 γ sTOD ) is not affected by the associated protons of the component. https://doi.org/10.17159/wsa/2021.v47.i3.11858

Adding speciation to the electron donor half-reaction
For simplified steady-state bioprocess models with pH estimation (e.g. in spreadsheets) speciation may be added to the electron donor reaction. This requires writing the stoichiometry so that the components match the dominant species within the specified pH range wherein the bioprocess usually operates. For example, in the pH range 6.8 to 8.6, within which most bioprocesses operate, the dominant species of the IC, FSA, OP, sulphide and acetate weak acid/base systems are HCO 3 -, NH 4 + , H 2 PO 4 -, HPO 4 2-, H 2 S, HSand HAc. The bioprocess stoichiometry is therefore written in terms of the relevant protonated state of these species directly. This is what Sötemann et al. (2005a) and Poinapen and Ekama (2010a) did in their steady-state methanogenic and sulphidogenic models. Whereas only one species is needed for the IC, FSA and acetate systems because their pK values are more than 0.5 pH units outside the 6.8−8.6 pH range, two species of the OP and sulphide systems are needed because these each have a pK value inside the range, which significantly complicates pH calculation when OP and FSS are present in significant quantities. This aspect is considered further below and in Part 5 of this series.

ELECTRON DESTINATION REACTIONS
The electrons donated by the electron donor are used in two sub-bioprocesses by the organisms that mediate a particular bioprocess, (i) anabolism, which is the production of the cell material of the biomass, and (ii) catabolism, which generates energy to transform the electron donor (substrate) to cell material (McCarty, 1975;Ekama, 2009). Both electrons and energy are conserved: The energy associated with the electrons used in anabolism is energy conserved as new cell material and the energy associated with the electrons used in catabolism is transformed to heat. Anabolism and catabolism together form the metabolism of organism growth when mediating a particular bioprocess.
If the electron donor substrate is sufficiently concentrated, the catabolic heat generation will heat the water in which the bioprocesses take place. This is the main heat source in autothermal aerobic digestion (Messenger and Ekama, 1993;Pitt and Ekama, 1996). By including the heat of reaction in the breakdown and formation of components in bioprocesses, Fernández-Arévalode et al. (2015) developed a general plant-wide WRRF model that can predict temperature in its different reactors.

Anabolism (biomass growth)
Using the products of the COD reaction (Eq. 10) as the reactants, the biomass formation reaction can be written in terms of standard aquatic chemistry components and with paired H + and e − as follows: and γ B is the exchanged electrons of the biomass growth reaction (e − /mol).
The COD of the biomass is 8 γ B gCOD/mol, since Eq. 12 is just the COD reaction (Eq. 10) in reverse.
Rearranging Eq. 12 so that all terms are electro-neutral yields: Therefore, Eq. 12 could also be written as: In Eqs 12 and 15, the components retain the same oxidation states -it is only their number of associated protons that have changed. This follows the pattern of Eq. 5e in reverse (with ch = 0), so all the comments made there apply to this anabolic biomass growth process also. Note that while the generic substrate component C x H y O z N a P b S c ch includes a stoichiometric coefficient ch for charge, the generic stoichiometric formula for biomass C k H l O m N n P p S s does not because it is generally assumed that biomass is uncharged.
For the purposes of setting up the stoichiometric biotransformation model equations, it fundamentally does not matter whether either the substrate or biomass is represented as charged or neutral, as the charge will be balanced overall by either adding or subtracting protons as illustrated in Eq. 15. However, when a component is also involved in the ionic speciation model, it is more convenient to use a charged representation. For example, it would be awkward and inconvenient for a speciation model to include separate reaction equations for all the possible neutral ion-pairs involving acetate that could be present in solution [HAc, NaAc, KAc, Mg(Ac) 2 etc.], so it is convenient to use the charged form (Ac -) as the component, and account for the cations separately.
However, while available experimental evidence (Westergreen et al., 2012) indicates that biomass does include functional groups that can participate in protonation/deprotonation reactions, the overall protonation state does not vary significantly in the pH range 6.8-8.6 in which most of the bioprocesses of interest occur. Therefore, biomass is not included in the ionic speciation model and can be conveniently modelled as an uncharged component.
In the same way as the general electron donor reaction can be generated by adding the oxidation reactions of the individual elements making up the electron donor (Table 2), so also can the general biomass formation reaction be generated by adding the biomass anabolic reactions of the individual CHONP and S elements that make up the biomass C k H l O m N n P p S s . This is shown in Table 3 for the same components of the CHONP and S elements that can be taken up from the aqueous phase to form biomass as electron donor products released to the aqueous phase in Table 2, and are also written as mass-balanced reactions summed across the rows to zero. Because anabolism is the reverse of the electron donor reaction, Table 3 is essentially the reverse form of Table 2 and all the comments on Table 2 also apply to Table 3.
Note that it is not necessary to include all six elements in the biomass composition. If appropriate, the biomass can be simplified to C k H l O m N n by assigning zero to the p and s molar composition values of P and S. Table 3 shows that different oxidation states of the components of the N and S elements can also be selected to synthesize the biomass.
In bioprocess model stoichiometry it is most convenient (but not necessary) to generate biomass from the electron donor reactant or product components of the N and S elements (as in Eq. 10 paired with Eq. 12), rather than some other component of these elements, not present as an electron donor reactant or product. For example, with biological sulphite and thiosulphate reduction to sulphide (Bioprocesses 2b and 2c in Tables 1, 4c and 4d), the electron donor reactants sulphite or thiosulphate are selected as the S components for biomass synthesis, rather than another S component like sulphate. Similarly, for autotrophic denitrification with sulphide, sulphite or thiosulphate as electron donor and nitrate or nitrite as electron acceptor (Bioprocesses 5a, 5b and 5c in Tables 1, 4e and 4f), sulphate is selected as the S element component for biomass synthesis because it is present in the stoichiometry as electron donor product. So from a stoichiometric perspective, the choice of N or S element component that is taken up for biomass synthesis is usually governed by whether or not it is available as an electron donor reactant or product, unless there is https://doi.org/10.17159/wsa/2021.v47.i3.11858 compelling evidence that a particular species is used for biomass synthesis (as for anammox bacteria, see below). In this regard, the oxidation state of the reaction products aligned with the COD test ( , Eq. 10) are usually best suited for modelling bioprocesses because nitrification of ammonia and BSR are modelled with their own bioprocesses (Bioprocesses 2, 3 and 5 in Tables 1 and 4).
As mentioned above for the electron donor reactions, the selection of the species of the C, N, P and S elements that are to be the components and formed as bioprocess products depends on the purpose of the model for which the bioprocess stoichiometry is derived. The same applies to anabolism (and catabolism -see below). For a steady-state model, some simplifying assumptions can be made, and the components selected to simplify pH calculation from the products (e.g. the AD model of Sötemann et al., 2005a). For a dynamic model or a steady state model with speciation and calculation of pH, it is preferable to select components from the standard aquatic chemistry set (see Part 5 of this series).

Catabolism
The catabolic electron acceptor reaction is built on the bioprocess's terminal electron acceptor and the species (specifically the redox state) of the particular element that is formed when it accepts the electrons. For example, if SO 3 2− is the electron acceptor, then S 2 O 3 2− , S or HScan be formed (not SO 4 2− because that would constitute SO 3 2− donating electrons, Fig. 2). Experimental observation is required to know which specific species of the electron acceptor element are formed. If two species are formed, e.g. S 2 O 3 2− and HS - (Qian et al., 2015) or SO 3 2− and S from S 2 O 3 2− (Deng et al., 2019), then two separate bioprocesses are required to model the system.
The electron acceptor reactions of the most common electron acceptor species of the C, O, N and S elements (components of P are not usually electron acceptors and H 2 is an electron donor) involved in the bioprocesses listed in Table 1  is the number of accepted electrons; The coefficient q depends on the element being oxidized (accepting electrons):

ELECTRON BALANCE AND OVERALL STOICHIOMETRY The overall electron balance
The previous sections presented purely stoichiometric descriptions of the three parts of a bioprocess reaction: the electron donor reaction, the anabolic electron destination reaction, and the catabolic electron acceptor reaction. By 'purely stoichiometric' it is meant that the only information contained in the reaction equation is the set of chemical components involved and their embedded element mass and electron (charge) balances.
The overall bioprocess reaction involves the combined set of components for each part, and is subject to the same material balance constraints. Thus, the overall bioprocess reaction stoichiometry can be constructed as a linear combination of the three sub-reactions. In geometric terms, the sub-reactions are basis vectors of the compositional space; i.e., directions along which the composition is allowed to change by the material balance constraints. The overall reaction is a vector, which is a linear combination of the basis vectors. The way this combination is constructed is commonly understood in terms of an overall electron balance in which the electrons donated by the donor (substrate) are divided between the anabolic and catabolic destination reactions, i.e.: However, it is not just the exchanged electrons that are combined in this way, but the entire electron donor, anabolic and catabolic stoichiometric equations, as shown schematically in Fig. 3.
The overall reaction equation for the bioprocess is no longer purely stoichiometric, because the coefficient E depends on non-stoichiometric factors, such as thermodynamic constraints and details of micro-organism metabolism. The most common approach has been to treat E as an empirical parameter; however, deriving its value from a metabolic model is also possible (Smolders et al., 1995;Rittman and McCarty, 2001). In dynamic models, E is the biomass yield coefficient (Y) expressed as gCOD biomass synthesized/gCOD substrate utilized. Because endogenous respiration is modelled with a bioprocess of its own in dynamic models, E = Y for heterotrophic bioprocesses, where the electron donor and biomass are both expressed as COD. However, in fully mass-balanced plant-wide models which express components in terms of mass (Ikumi et el., 2015, Solon et al., 2015, the E value has to be converted to Y in mass units (g biomass/g substrate), i.e.: where M B = (12k + l + 16m +14n + 31p + 32s) g biomass/mol and M S = (12x + y + 16z + 14a + 31b + 32c) g substrate/mol In steady-state models, E is the net (observed) yield, which is a combination of the growth and mass loss processes, i.e.: for aerobic activated sludge with growth and mass loss modelled as endogenous respiration (Ekama, 2009) and for methanogenesis with and mass loss modelled as death regeneration (Sötemann et al., 2005a).
Also, yield coefficients for autotrophic processes (Y A ) are typically expressed in non-COD units, e.g., gVSS/g NH 4 -N for nitrification. For the electron balance equation (Eq. 21) to apply, these autotrophic yields must be converted to the ratio of donated electrons taken up by anabolism. For example, consider the case of nitrification where ammonia is aerobically converted to nitrate (Bioprocess 3, electron donor reaction Eq. 7a). From the stoichiometry (Table 4a Columns 4 and 9), Y A g VSS biomass produced per g NH 4 -N consumed is: ' Alk a s ch T = = 0-0-(-1) = 1 2 (22b) Figure 3. Electron source (donor) and electron destination reactions (biomass -anabolism) and electron acceptor reduction from reactant to product (catabolism). For dynamic models, the proportion of the donor e − to biomass is the specific biomass yield (Y, gCOD biomass produced per gCOD substrate donor utilized). For steady-state models, the proportion of the donor e − to biomass is the net specific biomass and endogenous residue produced (E, gCOD biomass and endogenous residue produced per day per gCOD substrate donor utilized per day: Ekama, 2009) https://doi.org/10.17159/wsa/2021.v47.i3.11858 The anabolic reaction is given by Eq. 12: , such as SO 3 2− (Bioprocesses 2b and 2d) and S 2 O 3 2− (Bioprocess 2c) as described in Table 5. For example, for Bioprocess 2c with thiosulphate as the electron acceptor reactant, sulphate is replaced by thiosulphate (Eqs 10a and 24b) and the terms 6c and 6s in Eqs 11 and 13 are replaced by 2c and 2s, respectively (Rows 6c in Tables 2 and 3, respectively). Equation 24b does not apply to nitrification (3, 3a, 3b) because it does not include the appropriate electron donor products for nitrogen (NO 3 − or NO 2 − ). However, an analogous overall reaction can be constructed by substituting the appropriate electron donor equation for Eq. 10a in Eq. 24a. The resulting stoichiometric coefficients are listed in Tables A1 and A2 (Appendix). The stoichiometric coefficients for sulphidogenesis are listed in Tables A3. For Bioprocesses 2b−2d, both the electron donor sulphur product and sulphur source for anabolism were made the same as the electron acceptor reactant. The electron donor balance approach illustrated in Fig. 3 has to be further modified in the case of anammox (Bioprocess 7) because anammox has the peculiarity that it uses different e − donors for anabolism and catabolism. Anammox is discussed in greater detail below. , instead of SO 4 2in bioprocesses 2b, 2c and 2d respectively. This changes the c and s terms in the γ S Eq. 11 and γ B Eq. 13 from 6c and 6s to 4c, 2c and 4c and 4s, 2s and 4s respectively.   The revisions made to obtain the stoichiometry in Tables A1-A3 are listed in Table 4. Note that changing the products and reactants in the electron donor and anabolic reactions results in changes in the formulae for y S and y B . As discussed previously, y S and y B can be calculated for different oxidations of the products and reactants by summing the appropriate rows in Column 5 of Table 2 and Column 3 of Table 3, respectively. The required changes are noted in Table 4.

The Gujer matrix
The Gujer matrix format is the standard and systematic way of writing bioprocess stoichiometry of WRRF models. It is an easyto-read fingerprint of a bioprocess model (Gujer, 2008). The matrix (like Tables A1-A3) lists the bioprocesses in rows and the components in columns. Usually, the matrix is completed by adding the kinetic rate expressions of the bioprocesses in a column on the right (Gujer, 2008). When water is included, as is done here with complete element mass balancing, all the elements CHONPS, e − (or COD = 8γ S ) and charge are balanced across the rows (bioprocesses). In ASM1 (Henze et al., 1987) for example, this is not the case -only COD and N are mass balanced across the rows, not CHOPS and charge. When water is added as in Tables A1-A3, the bioprocess produced or consumed water has to be accounted for separately from the water in the bioreactor. If this is not done, then, with time, models of aerobic and anaerobic reactors increase and decrease in water volume.
Gujer matrices of bioprocess models comprising multiple bioprocesses can be verified for mass balance by summing the product of the CHONPS and ch content of each component and its stoichiometric term across each row (Gujer, 2008;Hauduc et al., 2010) -the elements in the bioprocess are balanced if the sums are all zero. The COD and TOD mass balances can also be checked this way by summing the products of component COD or TOD (8γ COD and TOD 8γ TOD , respectively), and the stoichiometric term for each bioprocess (Columns 1 -19 in Tables A1 -A4). γ COD and γ TOD , are calculated from Eqs 11 and 1, respectively. However, if the CHONPS and ch are balanced, then the COD and TOD must also be balanced because, as Eqs 11 and 1 show, the COD and TOD are properties of the component composition. Note that for Bioprocesses 2b, 2c and 2d in Table A2, the coefficients of the S (c and s) in the γ S (Eq. 11) and γ B (Eq. 13) equations have changed to 4, 2 and 4, respectively, because the electron acceptor reactant is SO 3 2-, S 2 O 3 2and SO 3 2-(see Fig. 2).
Bioprocess stoichiometry is entered into the WRRF simulator WEST (MikebyDHI, 2021) in Gujer matrix format and the software has a facility for automatically checking the elemental mass balances of the bioprocesses entered. We have developed a MATLAB code that can generate the general bioprocess stoichiometry for selected electron donor and acceptor reactants and products (available from https://washcentre.ukzn.ac.za/bio-process-models/). The output of the MATLAB code includes the generalized stoichiometric terms of the reactants and products in the same format as the WEST model code, so that it can be pasted directly into the WEST conversion model editor. The 3-phase (aqueous−gas−solid) plantwide WRRF model including P and S, PWM_SA in WEST (Ikumi et al., 2014Ghoor, 2019) was originally coded this way. This procedure eliminates transcription errors when coding new bioprocesses into simulation models and saves much time in model debugging and mass balance verification.

Conversion of one organic component to another
The stoichiometry in Table 4 assumes that all the e − from the donor are passed to the terminal electron acceptor, and conserved in biomass. In the intermediate bioprocesses (which are used in dynamic models, but not steady-state models) this does not always happen. In the University of Cape Town Sludge Digestion Model (UCTSDM1) (Sötemann et al., 2005b) and its successor PWMSA_AD (Ikumi et al., , 2014(Ikumi et al., , 2015, hydrolysis of complex organics produces the intermediate component glucose, which is acidified by acidogens to acetate and hydrogen, both of which have non-zero COD. Eqs 1 to 11 for complete oxidation of the electron donor do not apply in these cases. Furthermore, in the dynamic models, the intermediate organic compounds are not typically represented as being utilized in biomass production. Nevertheless, the principle of transferable e − and mass balance is still applied in the derivation of the relevant stoichiometric balances. Instead of liberating all the e − relative to COD, (or TOD) end products and producing e − donor products that have zero COD, the e − are conserved in reaction products that have COD (or TOD). The transformation of the general organics component C x H y O z N a P b S c ch from one form to another C k H l O m N n P p S s with element, COD and charge mass balance, expressed in terms of standard aquatic chemistry components, is obtained from Eq. 24b with E = 1, viz.
Equation 25, which is identical to Eq. 15 in Part 1 (Brouckaert et al., 2021), is used to represent hydrolysis of complex organics of various organic types such as fermentable biodegradable soluble organics (FBSO) and biodegradable particulate organics (BPO), each with their own x, y, z, a, b, c composition, to glucose (C 6 H 12 O 6 ) without acidogen biomass growth.
The glucose in turn is acidified by acidogens with biomass growth to acetate and hydrogen via: In PWMSA_AD (Ikumi et al., , 2014(Ikumi et al., , 2015, α is set at 2/3, so that two thirds of the glucose EDC (COD) excluding biomass is converted to acetate and one third to H 2 . This, again, is imposed on the stoichiometry from prior knowledge of the bioprocess.
The generic product C k H l O m N n P p S s in Eqs 25 and 26 is represented without charge, but this does not reduce their generality, because one can always choose a neutral species to represent the component -e.g. CH 3 COOH instead of CH 3 COO − .

Anaerobic ammonia oxidation
Usually a proportion of the e − donor (Y or E) is converted to biomass and the remainder passed on to the terminal e − acceptor (Fig. 3), however, anaerobic ammonia oxidation (anammox) is an exception. https://doi.org/10.17159/wsa/2021.v47.i3.11858 Anammox bacteria use ammonia as the nitrogen source for biomass growth and as an electron donor for autotrophic denitrification (the catabolic reaction is NH 4 + + NO 2 − → N 2(g) + H 2 O). However, nitrite is the electron donor for anabolism where it is oxidized to nitrate, and also the electron acceptor in the denitrification reaction as illustrated in Fig. 4) (Van Niftrik et al., 2004). The e − donor equation is obtained by taking Eq. 8 for NH 4 + and N 2 as e − donor reactant and product and the e − acceptor Eq. 20 for NO 2 and N 2 as e − acceptor reactant and product. The anabolism equation is obtained from Eq. 12 where the (e − + H + ) pair is supplied by the oxidization of NO 2 to NO 3 -, Eq. 7c ÷ 2, to give the stoichiometry in Table A1

READING BIOPROCESS BEHAVIOUR FROM THE STOICHIOMETRY
Mass-balanced bioprocess stoichiometry ensures that the fluxes of elements CHONPS and charge which exit a biological system are equal to the fluxes entering it. For example, for an AD, the CH 4 and CO 2 gas flows and aqueous-phase pH are entirely defined and dependent on the CHONPS and charge composition of the biodegradable organics degraded in it. In the interests of brevity, only some insights into the very common methanogenic and increasingly exploited sulphidogenic bioprocesses that can be read from their stoichiometry are presented below. It needs to be understood that bioprocess stoichiometry connected to external speciation routines implicitly models the steps described below. In steady-state models, some aqueous-phase speciation reactions and simplifications are explicitly included in the bioprocess stoichiometry described above, so that pH can be calculated directly from the relevant bioprocess products.

Simplified speciation model for methanogenesis
Assuming that (i) the methanogenic AD system remains at nearneutral pH (6.8−8.6) during the reaction; and (ii) BSR does not take place; and (iii) VFA are present at low enough concentration to not significantly influence pH, then based on the pK values of the remaining weak acid/base systems, the dominant species for the FSA is NH 4 + , for the OP are HPO 4 2and H 2 PO 4 and for the IC are HCO 3 and dissolved CO 2 (often represented as carbonic acid: H 2 CO 3 ↔ CO 2 + H 2 O). Accordingly, the CO 3 In Eq. 27 it is assumed that any H + excess or deficit (i.e., not paired with an e − ) will be supplied or absorbed by the IC system. Also, in Eq. 27c, f op is a parameter with a value between 0 and 1 that increases with solution pH, which is fixed by the requirements of both the IC and OP systems. For the IC system this is via the H 2 CO 3 alkalinity (represented by the HCO 3 concentration), and CO 2 liquid-gas equilibrium via the partial pressure of the CO 2 in the head space (Henry's law, Sötemann et al., 2005a). For the OP system this is via the H 2 PO 4 and HPO 4 2dissociation with its pK' p2 value near 7, i.
, substituting Eqs 27a to c yields a more general steady-state model stoichiometry for methanogenic AD (Eq. 28) than that of Sötemann et al. (2005a). Coupled with the aqueous-gas phase CO 2 equilibrium calculated using Henry's law, the products of this stoichiometry can be used to calculate the AD pH, provided it is between 6.8 and 8.6.
The total alkalinity change (∆Alk T ) of Eq. 28 is obtained by subtracting the contributions of the weak acid/base reactant species from the contributions of the weak acid/base product species. The contribution of a weak acid/base species to the alkalinity is its deficit of protons relative to its reference species, i.e., HCO 3 contributes one equivalent of alkalinity whereas H 2 PO 4 and HPO 4 2contribute one and two equivalents, respectively, if the reference species is H 3 PO 4 . For Eq. 28 ∆Alk T is: 1. The only product terms that have non-zero EDC (COD) are the methane and biomass. Therefore, the COD of the CH 4 is equal to the COD of the biodegradable organics degraded (minus the very small amount, 2−5% of COD, in the AD biomass produced and residual VFA). CH 4 is the main (>95%) AD product from the biodegradable organics that has EDC. 2. Ignoring the small amount of C in the biomass and residual VFA, the C content of the organics digested exits the AD via three routes -CH 4 and CO 2 gas and dissolved CO 2 (as HCO 3 -). So the C not converted to CH 4 gas becomes dissolved CO 2 (HCO 3 -) and gaseous CO 2 . 3. The N content of the biodegradable organics (minus the very small amount of N in AD biomass) represents the electron donor's persistent alkalinity. (In Eq. 29, the S content also affects ∆Alk T but in most cases c << a). In the breakdown of the organics this alkalinity is transferred to the aqueous phase and so the total alkalinity of the aqueous phase increases by a mol/L, minus (i) the very small amount in N taken up into the AD biomass produced (nEγ S /γ B ) and (ii) any alkalinity in the residual VFA (not included in Eqs 28 and 29). So in the 6.8−8.6 pH range of ADs, the organic component's latent alkalinity is transferred to the HCO 3 of the IC system. In fact, in plant-wide models, the alkalinity taken up from the aqueous phase in the form of N into activated sludge biomass in anabolism (Eq. 12) in the AS reactor is transferred to the AD in the biomass of the thickened WAS and released to the aqueous phase in its breakdown at high concentration. Similarly, in the AD of industrial, food or agricultural wastes containing proteins, the alkalinity taken up in the formation of the proteins (external to the AD) is released to the aqueous phase in the AD in their breakdown and adds alkalinity and buffer capacity to the aqueous phase for pH control. Therefore, to keep pH above 7 in AD without alkalinity dosing, the feed to ADs should include proteinaceous material. 4. When organic P is released to the aqueous phase from the breakdown of organics, the ∆Alk T does not change (as can be seen in Eq. 29) but the addition of orthophosphate results in the re-speciation of all the weak acid/base systems present (as can be seen in Eq. 28). This re-speciation transfers alkalinity from the HCO 3 of the IC system to the H 2 PO 4 and HPO 4 2species of the OP system. So the release of P from the breakdown of organics increases the alk H 3 PO 4 but decreases the alk H 2 CO 3 (using the Loewenthal et al., 1989Loewenthal et al., , 1991 terminology) by the same amount. This increases the CO 2 that leaves the AD as gas (by b{2−f op } in the CO 2 term of Eq. 28), which increases the p CO2 of the gas phase. The decrease in HCO 3 causes the pH of the digester to decrease, but now the requirement of the OP system, via its H 2 PO 4 -/HPO 4 = dissociation, also has to be met to establish the pH − the f op value at which dissociation requirements of both the OP and IC systems is met establishes the AD pH. The effect on the AD pH of the hydrolysis of polyphosphate from phosphorus accumulating organisms (PAOs), which is different to that of the release of P in the e − donor organics, and its precipitation as struvite, is presented by Harding et al. (2011) andIkumi et al. (2014), who show that these processes also cause digester pH to decrease and may stimulate struvite and other mineral precipitation in the digester. 5. If an organic substrate contains organically bound S (not poly-sulphide or other S granules), this decreases its latent alkalinity, since the release of this S as SO 4 2− in the breakdown of the organics decreases the Alk T of the aqueous phase. This decrease is due to the 2 H + paired with SO 4 2-, and decreases the HCO 3 − concentration by 2c mol/L (Eq. 29). The decreased HCO 3 − increases the CO 2 that exits the digester as gas, similar to the release of organic P (5 above), and so also increases the p CO2 of the AD gas, which, together with the decrease in HCO 3 − , decreases the AD pH. However, in the AD the SO 4 2− may be reduced to sulphide. This BSR is best modelled by its own bioprocess(es) (2a in Tables 1 and 4). If SO 4 2− is reduced to sulphide, the 2c mol/L alkalinity decrease will be (partially) restored by the uptake of H + in BSR, i.e. SO 4 2− + (f os + 1)H + + 8(e − +H + ) = f os H 2 S + (1-f os )HS − + 4H2O, where the 8(e − +H + ) is supplied by the organics e − donor. If the free (H 2 S) and saline (HS − ) sulphide (FSS) is significant, the H 2 S/HS − dissociation also needs to be taken into account to determine the pH in the pH range 6.8-8.6. Dealing with multiple weak acid/base systems in bioprocess stoichiometry with added speciation to calculate pH, such as Eq. 29, is complex (Harding et al., 2011), which makes using external speciation routines for pH calculation, such as the one described in Part 5 of this series, attractive even for steady-state models. 6. Based on Eq. 32, and as discussed in Part 1 (Brouckaert et al., 2021), ∆Alk T = 0 for the conversion of acetate to bicarbonate. Thus, the VFA's persistent alkalinity is transferred to the IC system, which tends to increase the pH since the IC system has a higher pK than the VFA system. So from Points 3 and 6 above, AD aqueous alkalinity is increased only by the alkalinity fed to it, which comes from the release of N from the influent organics, and utilization of dissociated VFA in the feed, i.e. Alk T = a + j mol/L. Also, from Points 4 and 5, with the release of P and S from the organics, the CO 2 from the organics that remains dissolved as HCO 3 − decreases while the CO 2 exiting as gas increases. Because the methane gas is fixed by the EDC (COD) of the degraded organics, the increased CO 2 gas increases the partial pressure of CO 2 (p CO2 ) in the AD headspace and decreases the aqueous phase pH. However, as the OP and sulphide concentrations increase, so the OP and sulphide weak acid/base systems have an increasing effect on establishing the AD pH, because the equilibrium requirements of all weak acid/ bases present have to be met, which establish the pH. The influent alkalinity (and pH), the two aqueous alkalinity-increasing processes (3 and 6 above) and the two aqueous alkalinityconsuming processes (Point 5 and anabolism), establish the Alk T and p CO2 in the AD and hence the AD pH. The other processes, like the release of OP from the breakdown of organic P (Point 5 above), do not change the Alk T but only the speciation. So the net aqueous Alk T increase (= a −2s + j mol/L, ignoring AD biomass formation) is completely defined by the composition of the influent organics digested and the type of bioprocess, in this case methanogenesis, which itself does not increase the aqueous alkalinity, as BSR does (Poinapen and Ekama, 2010a).
Some of these considerations are illustrated in Fig. 5, prepared using a steady-state methanogenic model based on Sötemann et al. (2005a). Table 2 from that paper includes experimental data for anaerobic digestion of a sludge substrate in a mixed laboratory digester with a retention time of 20 days. An elemental composition of C 3.5 H 7 O 2 N 0.196 was used to represent the sludge, calculated from laboratory measurements. This gives a substrate N/COD ratio of 0.0259 g N/g COD. Figure 5 shows the model predictions of pH and alkalinity as N/COD is varied by changing the coefficient of N in the substrate formula. (Note that this model did not consider pH inhibition of methanogenesis, and so did not indicate at what point digestion would fail.)

Simplified speciation model for sulphidogenesis (Bioprocess 2 -BSR of sulphate to sulphide)
The general stoichiometry (Eq. 24b) tailored to BSR of sulphate to sulphide, with sulphide represented by HS -(Bioprocess 2a in Table 1), is given in Table A2. Assuming (i) the BSR reactor pH is between 6.8 and 8.6; (ii) the VFA present is insufficient to affect pH; and (iii) any H + excess or deficit (i.e. not paired with e − ) will be supplied or absorbed by the IC and sulphide systems: then the dominant species are NH 4 + for the FSA, H 2 S and HSfor the sulphide system (pK s1 ~7.0) , HPO 4 2and H 2 PO 4 for the OP system (pK p2~ 7.2) and HCO 3 for the IC system (pK c1~6 .4).
Note that unlike for methanogenesis, CO 2 is not included as a product, based on the empirical observation that gas evolution from BSR is negligible. This is because ( This can be understood in contrast to what happens in methanogenesis. It can be shown that ∆Alk T for methanogenesis (Eq. 29) is approximately equal to the coefficient of HCO 3 in Eq. 28 (assuming E, b, c ≈ 0). This means that under steady-state conditions, any carbonate produced in excess of ∆Alk T has to be released from solution as CO 2 gas for the pH to remain constant. In BSR, the alkalinity change due to the degradation of the substrate is the same as in methanogenesis (first two terms of Eqs 29 and 32); however, additional alkalinity (third term of Eq. 32) is produced from the reduction of sulphate to sulphide (Eq. 18a). In this case it can be shown that Eq. 32 is approximately equal to the sum of the coefficients of HCO 3 and HSin Eq. 31.
Note that the amount of sulphide produced in BSR is a function of the substrate COD or y s . It is this additional sulphide alkalinity which buffers the pH near 7 without the loss of CO 2 . In Poinapen and Ekama's (2010a) model, the pH is estimated from the HS − and H 2 S concentration ratio, i.e., pH = pK' s1 +log{[HS -]/[H 2 S]}. The lack of gas evolution in BSR points to a biosulphide potential (BSP) test in which gas measurements are not necessary and the aqueous concentrations are sufficient for characterizing the biodegradable organics (Chen et al., 2018; Part 3 of this series; Gaszynski et al., 2018).
Note that the assumption of zero CO 2 gas production is not strictly true, because if there is any dissolved carbonate in the system the corresponding equilibrium partial pressure of CO 2 will be non-zero, and there will be the potential for CO 2 gas to diffuse out of solution into the reactor headspace, or to accumulate in sludge granules. A steady-state BSR model including a speciation subroutine (Brouckaert and Brouckaert, 2014) was used to simulate the BSR in the sulphate reduction upflow sludge bed (SRUSB) reactor of Lu et al. (2012). The equilibrium partial pressure of CO 2 (p CO2 ) was calculated to be very low (at ~0.00050 atm). However, assuming that 10% of the dissolved CO 2 diffused into the headspace resulted in the pH increasing from 7.2 to 7.6 (Lu et al., 2012 measured the pH at 7.8), then, while the loss of CO 2 from solution had a small effect on the C mass balance, it had a noticeable effect on the pH. Furthermore, this shows why it is important that the biosulphide potential (BSP) is conducted in a sealed reactor with no headspace (Part 3 of this series, Gaszynski et al., 2018).

CONCLUSIONS
Complete element mass balance stoichiometry, fully integrated with three-phase (aqueous-gas-solid) physico-chemical processes, is required to predict biosystem pH because the bioprocesses take up from, as reactants, and add to, as products, the aqueous phase ionic mix in which they operate. The aqueous phase in turn exchanges material with the gas phase, and ions with the solid phase in mineral precipitation processes, combining to govern the bioprocess reactor pH. The principles and procedures for the derivation of complete element mass balance stoichiometry were presented in this paper. The remarkable structured order of this, demonstrated in this paper, allows the derivation to be automated and performed computationally, which was set out in Part 1 of this series (Brouckaert et al., 2021). This may give a false impression that stoichiometry provides all that is required to model a process. However, the required prior information is, in fact, largely covered by knowing what components and species are involved in the process; once these are known, the systematic approach explained in this Part 2 of the series will go a long way towards completing the process description. The prior information imposed on the bioprocess stoichiometry required for different modelling purposes, is made explicit in this Part 2.
Dynamic models usually have to take account of intermediate components and species of a process, and so generally require more detailed knowledge than steady-state models, as input to the stoichiometry. The extra complexity that this entails makes it more important to align components and species with the wellestablished and systematic framework of the standard aquatic chemistry components, and associated speciation models.
With complete element mass-balanced stoichiometry, all the material of the bioprocess reactants − inter alia, influent substrate(s) − are conserved in the bioprocess products, most of which are dissolved aqueous species. Not only are the elements CHONPS and charge conserved but also alkalinity, which is an integral part of the bioprocess stoichiometry. The aqueous species all engage with the physico-chemical processes, most particularly aqueous (re)speciation, gas exchange and mineral precipitation. This intimate interconnection between the bioprocesses and the aqueous phase in which they operate means that the behaviour and progression of bioprocesses can be measured and monitored by changes in the aqueous phase species, which includes the alkalinity. To exploit this interconnection for the purpose of gaining insight into bioprocess behaviour and provide a means for their control, requires two transformation interfaces − one for the organic substrate and one for the aqueous inorganic material -which translate the model variables (components) to measurable parameters and vice versa. For the organic substrate, measurements need to be made to define the composition of the biodegradable organics (if these are not known) and a procedure is developed to determine the composition values (x, y, z, a, b, c and ch) in C x H y O z N a P b S c ch from measurements in Part 3. To characterize the aqueous phase, the alkalinity is often used to quantify the inorganic system. Alkalinity is a summary parameter representing many aqueous species, and so an aqueous speciation procedure is required to disaggregate the measured alkalinity into its subsystem species and model components. This is considered in Part 4. The last paper, Part 5, describes the aqueous phase speciation routine mentioned in this paper. Tables A1-A4 uses a common set of components (columns), numbered 1 to 19. Columns with no entries in a particular table are omitted. Table A1. General bioprocesses stoichiometry for Bioprocesses 1, 3, 4 and 6-8 in Table 1 Components 1