EnviroSim is pleased to announce the latest issue of “**The BioWin Advantage**” e-tech newsletter BioWin Advantage 7.3 : Using Function Series in BioWin.

**Introduction**

In this issue we describe a BioWin charting feature known as “function series”, explain the procedure for adding a function series to a chart, and demonstrate some useful ways to use function series in BioWin.

**Files**

A function is a series type available from the album that uses one or more existing series in a chart as its data source in order to perform a functional operation. For example, if we have two series ‘**A**' and ‘**B**’ and we apply the **ADD** function to those series, a third series ‘**C**’ will be generated which has the sum of series ‘**A**’ and ‘**B**’ values as its data source.

Once a function series has been added to a chart, it can be formatted and manipulated just like a regular series. The function series is “live”; *e.g.* if a dynamic or steady state simulation is run that changes the values of its source series, the function series will automatically update. It also is possible to modify the source series of a function series after its creation. Function series may be added to Current Value and Time Series charts.

### Adding a Function Series

- Right-click on the chart and click
**Add Series**in the resulting popup menu. - On the
**Functions**tab, click the**New Function…**button.

- Choose the function that you wish to apply from the
**BioWin Functions**gallery and click the**OK**button.

- From the
**Available**list, select the series that you wish to use as the function series data source and move them to the**Selected**list in one of the following ways:- You may move all of the series by clicking on the button marked with two right-pointing arrows.
- You may move contiguous multiple series by clicking on the first desired series, and while holding down the
**Shift**key, double-clicking the last desired series. - You may move non-contiguous multiple series by holding the
**Ctrl**key, clicking on the desired series, and double-clicking on the last desired series. - You may move series one at a time by either double clicking on each series or clicking on each series and then clicking the button marked with one right-pointing arrow.

You may also use all of these techniques for removing series from the **Selected **list, using the buttons marked with left-pointing arrows.

- If you wish, you may enter a name for the function series in the
**Series Name**text edit area. - For certain function types, you may be presented with other options such as
**Period**,**Fitted Curve Order**,**Weighted**, or**Weight %**. Set these to the appropriate value. For more information on these parameters, refer to the BioWin Help Manual under: Data Output (charts, tables, reports) > BioWin Album > Series Available from the Album > Function Series (Album) - When you are satisfied with your function series settings, click the
**Close**button to finish. At any point before this final step you may change the type of function you are applying using the**Function**drop list box.

### Examples of Useful Function Series

Function series can be used to calculate other parameter values that are not directly reported by BioWin. To demonstrate this functionality, we will use the BioWin cabinet file **Anaerobic digester.bwc** with a diurnal influent flow and loading pattern.

#### Unit Conversion - Alkalinity

In BioWin alkalinity is reported in units of mmol/L. We can use a function series to convert alkalinity to the commonly used units of mg/L as CaCO_{3}. As an example, we will plot the current value and time-series alkalinity concentration in the Aerobic reactor. We will then apply the **multiply with a constant** function to the alkalinity series to convert the units from mmol/L to mg/L as CaCO_{3}.

*Note: Alkalinity is defined as the ability of a liquid solution to neutralize hydrogen (H ^{+}) ions without changing the pH. Calcium carbonate dissociates to Ca^{2+} and CO_{3}^{2-} in water. By this definition, one milligram mole (100 mg/ 1 mmol) of CaCO_{3} is actually two millimoles of alkalinity. So, to convert the units of alkalinity from mmol/L to mgCaCO_{3}/L, multiply by a factor of (100 mg / 1 mmol)/ 2 = 50 mg/mmol. *

Start by adding a new page to the BioWin album and selecting the layout shown below.

On the top, we will add a current value chart, select **Alkalinity **from the Combined variables list and select **Bioreactor > Aerobic** from the Elements list. Click “Plot selected” to close the window.

On the bottom, add a time series chart, select **Alkalinity **from the Combined variables list and select **Bioreactor > Aerobic** from the Elements list. Click “Plot selected” to close the window.

Note that we need to run a dynamic simulation to add the time-series alkalinity data to the database so that it will appear on the time-series plot. Once we’ve plotted the current value and time-series alkalinity in the Aerobic bioreactor, we can edit the axes, graph title, legend, series, *etc*. to customize the appearance of our plots. Chart formatting procedures are described in detail in the BioWin Help Manual under: Data Output (charts, tables, reports) > BioWin Album > Chart Formatting Procedures.

The next step is to add a function series to each plot. To do this, right-click on the Current Value plot and select **Add Series** in the resulting popup menu. On the **Functions** tab, click the **New Function…** button, select the **Multiply with a constant** function and click the **OK** button.

Select the **Alkalinity (mmol/L) **series from the **Available **list and use the right-pointing arrow to bring it to the **Selected **list. Name this function series **Alkalinity (mgCaCO3/L)**. At the bottom of this window, type **50** beside the “Multiply by”. Click close to add this function series to the graph.

The function series appears as a line type by default. It will look better on the current value plot if we change it to a bar type. To do so, right-click on the plot, select **Edit Series**, select the **Alkalinity (mgCaCO3/L)** series, click the **Change** button, select **Bar** and click **OK**.

If we want to show both series on the same graph, we can plot the function series to the right axis and label that axis **ALKALINITY (mgCaCO3/L)**. To plot the function series to the right axis, right-click on the chart, select **Edit Series**, double click on the **Alkalinity (mgCaCO3/L) **series, open the **General **tab, open the **Options** sub-tab and from the drop-down menu under **Vertical Axis**, select **Right**. Finish by clicking **Close**. We can modify the appearance of the right axis and the function series as desired.

We can follow the same approach to add a function series to the time-series plot that shows alkalinity in units of mg/L as CaCO3.

#### Unit Conversion - Clarifier Solids Loading Rate

BioWin reports the solids loading rate in the **Ideal clarifier** and **Model clarifier **elements. We can view this in the bottom right summary pane window by placing our cursor over either of these elements on the BioWin drawing board. We can also choose to show the solids loading rate in tables and graphs in the BioWin album. BioWin reports the solids loading rate in units of lb/(ft^{2} d) or kg/(m^{2} d), depending on whether US or metric units are applied in Project > Current Project Options > Unit System. Some design references (Tchobanoglous *et al*., 2003) report the solids loading rate in units of lb/(ft^{2} **h**) or kg/(m^{2} **h**). A function series can be used to convert the solids loading rate from kg/(m^{2} d) to kg/(m^{2} **h**).

Using the **Anaerobic digester.bwc** BioWin cabinet file, plot the current and time-series solids loading rate in the secondary clarifier (Ideal clarifier element). Next, add a function series to each plot and follow the same approach described above in the alkalinity example. Use the **Multiply with a constant** function and type **1/24 = 0.041667 **in the window beside “Multiply by” to convert the units from d^{-1} to h^{-1}. Plot the solids loading rate kg/(m^{2} d) on the left axis and the solids loading rate kg/(m^{2} **h**) on the right axis. The typical design solids loading rate for settling following air-activated sludge is an average of 4 to 6 kg/(m^{2} **h**) and peak of 8 kg/(m^{2} h) (Tchobanoglous *et al*., 2003). To make the chart even more visibly appealing, add a colour band, colour line and annotations to each plot to show these design solids loading rates.

#### Unit Conversion -

Solids Concentration Across Sludge Thickener

The point clarifier and dewatering unit are two elements commonly used to simulate sludge thickening. These elements can be used to simulate operations such as filtration, centrifugation and flotation. Both of these elements have no volume. Specify the percent (solids) removal and the flow split between the thickened sludge (U) and stream containing the reduced solids concentration (O). BioWin reports the total solids concentration in units of mgTSS/L across the point clarifier and dewatering unit. We may find it helpful to present the change in percent solids across these elements as equipment manufacturers often report the achievable sludge thickening in terms of percent solids.

Using the **Anaerobic digester.bwc** BioWin cabinet file, plot the current and time-series solids concentration across the WAS thickener (Dewatering unit element). Next, add a function series to each plot and follow the same approach described above in the alkalinity example. Use the **Multiply with a constant** function and type **0.0001 **in the window beside “Multiply by” to convert the units from mgTSS/L to percent solids. Plot the solids concentration (mgTSS/L) on the left axis and the percent solids on the right axis.

#### Digester Loading Rate

BioWin directly reports many useful parameters to allow us to assess the performance of the anaerobic digester. These parameters include the VSS destruction, off gas flow rate, digester gas sales credit, *etc*. We can view some of these parameters in the bottom right summary pane window by placing the cursor over the anaerobic digester element on the BioWin drawing board. We can also choose to show digester-specific parameters in tables and graphs in the BioWin album.

Although the VSS loading rate on the anaerobic digester (in units of lb/(ft^{3} **h**) or kg/(m^{3} **h**)) is not directly reported by BioWin, function series can be used to show this.

Let’s create a current value and time-series chart of the digester VSS loading rate using the BioWin cabinet file **Anaerobic digester.bwc**. To start, plot the liquid volume of the anaerobic digester and VSS mass rate from the Sidestream Mixer element labelled “Digester Input”. Our current value plot appears as shown below. BioWin reports the VSS mass rate in units of kgVSS/d (or lbVSS/d).

Add a function series to divide the VSS mass rate by the digester volume. Right-click on the Current Value plot and select **Add Series** in the resulting popup menu. On the **Functions** tab, we click the **New Function…** button, select the **Divide** function and click the **OK** button.

We first bring the **VSS mass rate (kg VSS/d) **series from the **Available **list to the **Selected** list. Next, bring the **Liquid volume (m3) **series to the **Selected **list. When applying the **Divide **function, the series at the top of the **Selected **list (VSS mass rate (kg VSS/d)) will be divided by the series below (Liquid volume (m3)). Name this function series **Loading (kg/(m3 d))**. Click close to add this function series to the graph.

The function series appears as a line type by default. We can change it to a bar type following the same approach described above in the Alkalinity example.

We can then add a second function series to the plot to convert the loading from units of **kg/(m3 d) **to** kg/(m3 h)**. Follow the same approach described above in the alkalinity example. We’ll use the **Multiply with a constant** function and bring the **Loading (kg/(m3 d)) **series to the **Selected **series window. Type **0.041667 **in the window beside “Multiply by” to convert the units from **d ^{-1} **to

**h**.

^{-1}Plot the digester VSS loading in units of kg/(m3 d) on the left axis and in units of kg/(m3 h) on the right axis. Follow the same approach as described above to plot the digester VSS loading on a time-series graph.

### AB Plant Example

We can use function series to help us design and assess the performance of an Adsorption-Bio-Oxidation (AB) treatment process in BioWin. We will use the BioWin file **AB Process Example.bwc** with a constant influent flow and load.

This model represents a typical AB Process with the A-stage receiving a high BOD load and producing sludge at a high rate and the B-stage receiving a low BOD load and producing sludge at a low rate. The A-stage receives raw influent and removes organic matter mainly by adsorption to sludge. In the B-stage, the substrate is hydrolyzed and degraded by biomass. In the example BioWin model, the SRT of the A-stage is 0.29 d (7 hours) and the SRT of the B-stage is 11.5 days.

The BOD loading on the A-stage is typically greater than 2 kg BOD_{5} / (kgTSS d) (Bohnke, 1990). The BOD loading on the B-stage is typically 0.15 to 0.30 kg BOD_{5} / (kgTSS d) (Dong *et al*., 2006). This BOD loading is calculated by dividing the BOD mass rate entering the A-stage reactor by the total solids mass in the reactor. We can use a function series to calculate and display the BOD loading on the A-stage and B-stage. Start by creating a current value chart and plotting the Total solids mass in the A Reactor and BOD mass rate from the Influent element. For the B-stage, plot a current value chart showing the Total solids mass in the B Reactor and BOD mass rate from the “Stage B Loading” General Mixer element. Our current value plots appear as shown below.

Next, add a function series to each plot to divide the BOD5 mass rate by the Total solids mass. We right-click on the Current Value plot and select **Add Series** in the resulting popup menu. On the **Functions** tab, click the **New Function…** button, select the **Divide** function and click the **OK** button. First, bring the **BOD Load **series from the **Available **list to the **Selected** list. Next, bring the **Reactor Solids Mass **series to the **Selected **list. The **BOD **Load (top of Selected list) will be divided by the **Reactor Solids Mass **(bottom of Selected list). Name this function series **Specific BOD Load**. Click close to add this function series to the graph. We can format the chart as desired. Our charts show that the specific BOD Load is 4.03 kgBOD/(kg MLSS d) in the A-stage and 0.28 kgBOD/(kg MLSS d) in the B-stage, which is in line with the typical values of greater than 2 kgBOD/(kg MLSS d) in the A-stage and between 0.15 and 0.30 kgBOD/(kg MLSS d) in the B-stage.

We can also use function series to calculate and display the BOD removal across Stage A and B. The BOD removal is calculated as follows:

We start by plotting the BOD mass rate into and out of Stage A and Stage B.

We then add a function series to each plot to subtract the BOD_{Out} from BOD_{in}. Right-click on the Current Value plot and select **Add Series** in the resulting popup menu. On the **Functions** tab, we click the **New Function…** button, select the **Subtract** function and click the **OK** button. First, bring the **BOD In **series to the **Selected** list and then bring over the **BOD Out **series. The **BOD Out **(bottom of Selected list) will be subtracted from the **BOD In **(top of Selected list). Let’s name this function series **Delta**. We then click the **New Function…** button, select the **Divide** function and click the **OK** button. Bring the **Delta **series from the **Available **list to the **Selected** list and then bring the **BOD In **series to the **Selected **list so that the **Delta **will be divided by the **BOD In**. Name this function series **Fraction**. We then click the **New Function…** button, select the **Multiply with a constant** function and bring the **Fraction **series to the **Selected **series window. Type **100 **in the window beside “Multiply by” to convert the fraction to a percent. Name this function series **% BOD REM**. Since we are only interested in seeing the BOD mass rates and percent BOD removed, we can hide the **Fraction **and **Delta **function series from the chart. We right-click on the chart, select **Edit Series **and then uncheck the box beside **Delta **and **Fraction** to hide these series.

We can plot the **BOD In** and **BOD Out** to the left axis and the **% BOD Removed** to the right axis. Our charts appear as shown.

The BOD removal across the A-stage in our BioWin model is 63.3%, which is slightly higher than the typical range of 50% to 60% (Bohnke, 1990). Almost all of the remaining BOD is removed across the B-stage (95.6%), which is expected because the B-stage has a relatively long SRT.

We can use function series to calculate and display the removal of total nitrogen (TN) and total phosphorous (TP) across Stage A and B and across the entire plant. We start by plotting the TN and TP mass rates in the Plant Influent, into Stage B and in the Plant Effluent. We then follow the same approach described above for the BOD removal to calculate the TN and TP removals. We can use these plots to compare our modeled removals with design or literature values. For example, our model predicts a 63% removal of TP removal across the A-stage whereas Bohnke (1990) reports a removal of 45%.

### 3 Stage Phoredox with Primary Fermenter

We will use the BioWin file **3 stage Phoredox with primary fermenter.bwc **to demonstrate further applications of function series.

#### VSS Destruction

BioWin directly reports the VSS destruction in the **Anaerobic digester** element. We often connect the digester element in a loop with a volumeless sludge separating element such as a dewatering unit to simulate the separation of solids from the liquid in the digester. This allows us to increase the digester SRT and separate it from the digester HRT. It may be valuable to know the VSS destruction across this loop. We can use function series to calculate this.

First, we will create a current value chart and plot the mass rate of **VSS In **(from the PST underflow), **VSS Primary Sludge** and **VSS Out **(in the fermenter supernatant which is the centrate from the dewatering unit). The VSS destroyed is calculated as:

We can use the **Add** function series to sum **VSS Primary Sludge **and **VSS Out**. Name this function series **OUT + PS**. We can use the **Divide** function series to divide **OUT + PS **by **VSS In**. Name this function series **(OUT + PS)/In**. Use the **Multiply by a constant **function series to multiply **(OUT + PS)/In** by 100 to convert it from a fraction to a percent. We can name this function series **VSS Destroyed**.

We can also calculate the percent VSS removed across the loop according to:

Use the **Subtract** function series to subtract the **VSS Out **from the **VSS In**. Name this function series **In - Out**. Use the **Divide** function series to divide **In – Out **by **VSS In**. We can name this function series **(In - Out)/In**. Next, use the **Multiply by a constant **function series to multiply **(In - Out)/In** by 100 to convert it from a fraction to a percent. Finally, name this function series **VSS Removed**.

Since we are only interested in seeing the VSS mass rates, VSS destroyed and VSS removed, we can hide the other function series from the chart. To do this, right-click on the chart, select **Edit Series **and then uncheck the box beside function series we wish to hide.

We can format our chart as desired. When we place our cursor over the Primary Sludge Fermenter on the BioWin flow sheet, we see in the bottom right summary pane that the steady-state VSS destruction is 10.2%. However, the function series **VSS Destroyed** that we have plotted in the BioWin album shows that the VSS destruction across the fermenter-thickened-sludge loop is actually 65.7%.

The dewatering unit used to separate the solids from the liquid in the fermenter has a specified solids removal of 99.4%. The function series **VSS Removed** that we have plotted in the BioWin album shows that the VSS removed across the fermenter-thickened-sludge loop is actually 98.2%.

#### Process Mass Distribution

The BioWin album of the cabinet file **3 stage Phoredox with primary fermenter.bwc** contains current value pie charts showing the process mass distribution.

It can be informative if we plot the time-varying process mass distribution using function series. To do this, we first add a time-series chart for the total solids mass in the **Aerobic**, **Anaerobic** and **Anoxic** zones and **Clarifier** to the BioWin album. Next, add a function series and use the **Add** function to sum the **Aerobic**, **Anaerobic**, **Anoxic** and **Clarifier** total solids mass. Name this function series **Total Solids Mass**. Now add a function series and use the **Divide **function to divide the **Aerobic** by the **Total Solids Mass**. We can name this function **Aerobic Fraction**. Repeat this step for the **Anaerobic Fraction**, **Anoxic Fraction** and **Clarifier Fraction**. To express the distribution as percentages, we can add a function series and use the **Multiply by a constant** function to multiply the **Aerobic Fraction** series by **100**. Name this function series **Aerobic %**. We can repeat this step for the **Anaerobic %**, **Anoxic %** and **Clarifier %**. Finally, hide all the function series from the chart except for the last four.

Simulate from steady-state conditions for a duration of one day and format our chart as desired.

Some additional considerations regarding function series:

- A function series will disappear from a chart when one or more of the series in its data source are deleted.
- When duplicating a page containing a chart with a function series, only the source series and not the function series will be copied; the function series must be recreated.

Further details on function series are found in the BioWin Help manual under: Data Output (charts, tables, reports) > BioWin Album > Series Available from the Album > Function Series (Album)

### Conclusion

In this edition of the BioWin Advantage, we demonstrated how to add various function series to a chart and presented many useful applications of function series in BioWin. We trust that you found this technical topic both interesting and informative.

Please feel free to contact us at support@envirosim.com (Subject: The BioWin Advantage) with your comments on this article or suggestions for future articles.

Thank you, and good modeling.

**From the EnviroSim Team**

### References

- Bohnke, B. 1990. Das AB-Verfahren zur Biologischen Abwasser-Reinigung. Aachen, FRG: Forschunsinstitut fur Wasertechnologie and der RWTH.
- Dong, W., H. Du, L. Zou, J. Miao, and B. Wang. 2006. Operational Retrofits of AB Process for Biological Removal of Nitrogen and Phosphorus. Water Practice & Technology. 1:4:78-85.
- Tchobanoglous, G., F.L. Burton, and H.D. Stensel. 2003. Wastewater Engineering Treatment and Reuse, Fourth Edition. McGraw-Hill. New York.

To subscribe to "**The BioWin Advantage**" please **click here**.