You are on page 1of 115

GPS-X TUTORIAL GUIDE

A STEP-BY-STEP GUIDE FOR LEARNING


AND GETTING FAMILIAR WITH GPS-X

GPS-X v6.3
Copyright ©1992-2012 Hydromantis Environmental Software Solutions, Inc. All rights reserved.

No part of this work covered by copyright may be reproduced in any form or by any
means - graphic, electronic or mechanical, including photocopying, recording, taping, or
storage in an information retrieval system - without the prior written permission of the
copyright owner.

The information contained within this document is subject to change without notice.
Hydromantis Environmental Software Solutions, Inc. makes no warranty of any kind with
regard to this material, including, but not limited to, the implied warranties of
merchantability and fitness for a particular purpose. Hydromantis Environmental
Software Solutions, Inc., shall not be liable for errors contained herein or for incidental
consequential damages in connection with the furnishing, performance, or use of this
material.

Trademarks
GPS-X and all other Hydromantis trademarks and logos mentioned and/or displayed are
trademarks or registered trademarks of Hydromantis Environmental Software Solutions,
Inc. in Canada and in other countries.
ACSL is a registered trademark of AEgis Research Corporation.
Adobe and Acrobat are trademarks of Adobe Systems Incorporated.
MATLAB is a registered trademark of The MathWorks, Inc.
JAVA is a trademark of Oracle Corporation.
Microsoft, Windows, Windows 8, Windows 7, Windows Vista, Windows XP are
trademarks of Microsoft Corporation.
TABLE OF CONTENTS

Table of Contents
TUTORIAL 1 ............................................................................................................................................... 4

Building a Plant Layout.......................................................................................................................... 4


Introduction ..................................................................................................................................... 4
Objectives ........................................................................................................................................ 5
Building a Simple Plant Layout......................................................................................................... 5
Selecting Object Models ................................................................................................................ 12
Generating Source Code and Binary Executable ........................................................................... 16
The Simulation Environment ......................................................................................................... 17
Creating Input Controls .................................................................................................................. 18
Creating a New Input Control Window.......................................................................................... 18
Creating Output Graphs ................................................................................................................. 20
Creating a QuickDisplay Output ..................................................................................................... 21
Creating a New Output Graph ....................................................................................................... 22
Running a Simulation ..................................................................................................................... 26
Analyzing the Plant ........................................................................................................................ 28

TUTORIAL 2 ............................................................................................................................................. 30

Editing Layouts and Using Scenarios................................................................................................... 30


Objectives ...................................................................................................................................... 30
Expanding the Plant ....................................................................................................................... 31
Using Scenarios .............................................................................................................................. 34
Generating a Static Report............................................................................................................. 37
Creating a New Output Table Tab.................................................................................................. 39

TUTORIAL 3 ............................................................................................................................................. 43

Influent Data & Influent Advisor ......................................................................................................... 43


Problem Statement ........................................................................................................................ 43
Objectives ...................................................................................................................................... 43
Influent Data .................................................................................................................................. 44
Using Influent Advisor .................................................................................................................... 45
Influent Advisor Warnings ............................................................................................................. 48

TUTORIAL 4 ............................................................................................................................................. 49

Data Input & Output ........................................................................................................................... 49


Problem Statement ........................................................................................................................ 49
Objectives ...................................................................................................................................... 49
Setting up Dynamic Input .............................................................................................................. 50

TUTORIAL 5 ............................................................................................................................................. 56

i
TABLE OF CONTENTS
Using Automatic Controllers ............................................................................................................... 56
Problem Statement ........................................................................................................................ 56
Objectives ...................................................................................................................................... 56
Setting up an Automatic MLSS Controller ..................................................................................... 57
Tuning the Automatic MLSS Controller ......................................................................................... 59
Using an Automatic DO Controller ................................................................................................ 63

TUTORIAL 6 ............................................................................................................................................. 66

The Define Function ............................................................................................................................ 66


Problem Statement ........................................................................................................................ 66
Objectives ...................................................................................................................................... 66
Setting up the Layout ..................................................................................................................... 67
Defining Mass Flows ...................................................................................................................... 68
Defining an SRT .............................................................................................................................. 70
Defining Averages .......................................................................................................................... 73
Controlling SRT with Waste Pump Rate ......................................................................................... 74

TUTORIAL 7 ............................................................................................................................................. 76

Sensitivity Analysis .............................................................................................................................. 76


Problem Statement ........................................................................................................................ 76
Objectives ...................................................................................................................................... 76
Setting up the Layout ..................................................................................................................... 77
Setting up the Parameters for Analysis ......................................................................................... 77
Steady-State Analysis ..................................................................................................................... 78
Time Dynamic Analysis .................................................................................................................. 80
Phase Dynamic Analysis ................................................................................................................. 81

TUTORIAL 8 ............................................................................................................................................. 83

Parameter Optimization ..................................................................................................................... 83


Problem Statement ........................................................................................................................ 83
Objectives ...................................................................................................................................... 83
Initial Manual Calibration .............................................................................................................. 84
Automatic Calibration Using the Optimizer ................................................................................... 85

TUTORIAL 9 ............................................................................................................................................. 91

Basic Customization ............................................................................................................................ 91


Problem Statement ........................................................................................................................ 91
Objectives ...................................................................................................................................... 91
Setting Up and Customizing a Layout ............................................................................................ 92
Running Simulations ...................................................................................................................... 99

TUTORIAL 10 ......................................................................................................................................... 100

ii
TABLE OF CONTENTS
Dynamic Parameter Estimator (DPE) ................................................................................................ 100
Problem Statement ...................................................................................................................... 100
Objectives .................................................................................................................................... 100
Setting Up the Layout .................................................................................................................. 101
Setting Up the DPE ....................................................................................................................... 103
Running the DPE .......................................................................................................................... 105

TUTORIAL 11 ......................................................................................................................................... 107

Monte Carlo Analysis ........................................................................................................................ 107


Problem Statement ...................................................................................................................... 107
Objectives .................................................................................................................................... 107
Setting Up the Layout .................................................................................................................. 108
The End ........................................................................................................................................ 113

iii
GPS-X TUTORIAL GUIDE

TUTORIAL 1

Building a Plant Layout

Introduction

Dynamic process models have great potential for assisting operators, engineers and managers.
However, in the past dynamic models were not used very often because the cost of building
models, running simulations and interpreting the results were too expensive. In order to
simplify the modelling process and therefore reduce costs, you need tools to aid you with the
steps in any modelling exercise.

A tool like GPS-X is invaluable as its easy-to-use interface connected to a powerful library of
simulation models will greatly reduce the expense of carrying out simulation studies.

There are five major steps in any modelling study:

1. Model construction

2. Model calibration

3. Scenario development

4. Simulation

5. Interpretation of results

In this chapter you will develop a simple dynamic model of an activated sludge system.

4
BUILDING A PLANT LAYOUT
Objectives
This tutorial covers the following topics:

1. Building a simple plant layout

2. Preparing the source and binary code

3. Setting up graphics and interactive controls

4. Running interactive simulations

When you have finished this tutorial, you will be able to build and run full-scale dynamic
treatment process models. You will learn how GPS-X automatically generates error-free
code when a model is built, the procedures for creating time series graphics and
interactive controls, and how to run the model you have prepared. These essential
features provide a foundation on which other advanced features are built; therefore, it is
important to understand the material in this chapter first before going on to more
complicated tasks.

Building a Simple Plant Layout


After starting GPS-X

1. Select the Carbon Nitrogen Library (cnlib) from the Model Library drop down
menu in the main toolbar (see Figure 1-1)

Figure 1-1 Selecting a GPS-X Library

NOTE: If a white drawing board is not displayed, start a new


file by clicking on the New button on the tool bar.

Page 5
GPS-X TUTORIAL GUIDE

2. Locate the Process Table on the left-hand side of the GPS-X window. These icons
are used to build a plant layout. Icons represent the unit processes and control
points in a layout. The icons are separated into groups of like objects, such as
Preliminary Treatment, Clarification and Settling, and Biosolids Treatment.

The Process Table contains the unit process icons used to construct a treatment plant
model. Each icon is identified by process name (see Figure 1-2). The process name is also
displayed if you hold the cursor over any object in your drawing board.

Figure 1-2 Process Table

We will start by building a simple wastewater treatment plant consisting of 3 objects:

• An influent
• An aeration tank
• A secondary clarifier

Page | 6
BUILDING A PLANT LAYOUT

3. Place the influent object on the drawing board. If the “Influent” group is not
selected in the process table, click on the “Influent” process group to display the
influent process objects. Place the cursor over the grey arrow influent object.
Click on the left mouse button and with the button pressed, drag the cursor to
the centre of the drawing board and drop the object by releasing the mouse
button. The influent object now appears in the drawing board. You can drop as
many of these objects as desired by repeating this procedure. For now, drop only
one influent object.

4. Select the plug flow tank icon (Suspended Growth Processes group) and drop it
on the drawing board to the right of the influent object.

5. Select the circular secondary clarifier icon (Clarification and Settling Process
group) and drop a circular secondary clarifier object to the right of the plug flow
reactor. Close the Process Table by clicking on the left-pointing arrow at the top-
right corner of the Process Table.

The drawing board should now look similar to Figure 1-3

Figure 1-3 Building the Layout

Page 7
GPS-X TUTORIAL GUIDE

6. Zoom in by using the Locator feature. This is a simple plant and there is a lot of
white space on the drawing board. We can zoom in to get a better view of the
layout using the Locator feature of GPS-X.

To use the Locator, click the Locator button on the tool bar. The Locator window
will be displayed as shown in Figure 1-4.

Figure 1-4 GPS-X Locator Window

7. Zoom in or out by selecting a region in the Locator window (click, drag and
release). Try selecting an area much larger than the rectangle currently displayed
in the Locator window. When you release the mouse button the GPS-X drawing
board is refreshed and the icons in the drawing board appear smaller. Try
dragging-out a smaller rectangle and note the effect in the main drawing board
area. You should see an enlarged view like that shown in Figure 1-5.

NOTE: The area in the Locator window represents the total available drawing
area. When you drag out a region in the Locator window and release the mouse
button the region within the drag rectangle is displayed in the drawing board
area, scaled as necessary.

You can also zoom the layout in and out by holding the mouse point over the
layout and rotating the mouse wheel.

8. Specify the connectivity between the objects. This is critical in the specification
of a flow sheet as all material balances - and therefore the equations which result
- are based on the connectivity in the layout. When you specify these
connections, remember that the flow lines are directional, i.e., materials flow
from the initial point to the terminal point of the flow connection.

Page | 8
BUILDING A PLANT LAYOUT

Figure 1-5 Enlarged View of the Layout

To specify the connectivity between objects, in the drawing board, move the pointer over
the influent object connection point. You will know that you are over the connection
point when the mouse pointer changes from the default `Windows' arrow to a connecting
arrow. When the connecting arrow appears, click to anchor the flow line at this initial
point.

Next, drag the pointer from the influent object to the influent connection point of the
plug flow tank (top left hand corner of the icon, NOT the return flow connection point just
below on the left hand side of the icon). When the connecting arrow re-appears, release
the mouse button. A connecting pipe will be drawn between the influent object and the
plug flow tank. In a similar manner, connect the effluent point from the plug flow tank
(top right hand corner of the icon) to the secondary clarifier. Finally, connect the
underflow from the secondary clarifier (bottom of the secondary clarifier icon) to the
return flow point of the aeration tank (lower left hand corner of the aeration tank icon).
In this example excess sludge will be wasted from the bottom of the secondary clarifier
(lower right hand corner of the clarifier icon). As this model does not consider any
downstream processing of the excess sludge, it is not necessary to specify a flow
connection from this point (see Figure 1-6)

Page 9
GPS-X TUTORIAL GUIDE

Figure 1-6 Completed Layout

NOTE: When flow connections are being specified, GPS-X interprets mouse button clicks in
a certain way. The first mouse button click within the drawing board is assumed to be a
flow stream initiating point and the mouse release event signals the terminal point. You
must be on a valid connection point for these assignments to be made correctly. GPS-X
does not allow invalid flow connections. For example, flows which initiate at the influent of
an object and terminate at the effluent of a second object are not allowed. GPS-X will
disallow an incorrect connection by displaying an invalid sign. If you experience some
difficulty in specifying flow connections, you can delete the flow lines by placing the cursor
at the flow initiation point and dragging the flow line to an empty cell on the drawing
board. As soon as the cursor button is released the flow line will be deleted

9. Show or re-name the stream labels. In the completed layout shown in Figure 1-6
there are numbers associated with each of the flow streams. To display these
stream labels click on the Labels button on the tool bar. A drop-down menu will
appear as shown in Figure 1-7. Check the Streams checkbox.

Page | 10
BUILDING A PLANT LAYOUT

Figure 1-7 Selecting to Show the Stream Labels

To change a stream label, right-click on an object icon and the process data menu will be
displayed. Select the Labels item from this menu. New label names can be input on the
form that is displayed. Save these changes by choosing Accept. If there is a conflict
between your label assignments and existing labels, a message will be displayed. An
example of a labels window is shown in Figure 1-8.

Figure 1-8 Changing the Labels of the Process Units and Streams

Page 11
GPS-X TUTORIAL GUIDE

NOTE: Variable names in GPS-X models use the connection labels to


identify a particular stream (e.g. qinf for the influent flowrate, and
qfe1 for effluent flowrate in this case). These variable names are
displayed on some of the forms you will see as you progress through
the tutorial chapters

The plant layout is now ready! If you experienced some difficulty in selecting or placing
the objects in this layout, you can delete objects from the drawing table by selecting the
object (a dotted red square appears around the object) and then pressing the Delete
button. Alternatively, you can close the current drawing board and click on the New
button

Selecting Object Models


In the previous section we selected the basic objects to be modelled in our plant. These
objects are the major unit processes and control points only. No mathematical models
were assigned to the various objects in the layout.

Each object in the layout has a number of attributes or properties, and each attribute has
a certain value. One of the most important attributes for GPS-X objects is the set of
equations (or model) that define the dynamic behavior of that object. Remember to
distinguish between an object type and the model for that object as some objects have
more than one possible model. Before you can build the plant model, a model must be
specified for each object in the layout.

10. Verify the influent model. Right-click on the influent icon. An influent object-
specific data menu appears as shown below (see Figure 1-9). The first item in the
menu is Models. Click on this item to activate the sub-menu, and verify that the
codstates item is selected by default.

Page | 12
BUILDING A PLANT LAYOUT

Figure 1-9 Model Selection for the Influent

11. Verify the plug flow tank model by repeating this procedure, but for this object
make sure that the mantis item is selected.

12. Verify the secondary clarifier object model by making sure that the simple1D
(non-reactive 1-dimensional clarification model) item 1 is selected

13. Save the layout. Go to the File menu, and select the Save As… menu item.
When you make this selection the Save dialog box is displayed. A list of
directories and files in the current directory is shown in the list box. Navigate
through your directories to an appropriate directory and type a filename in the
File name: text box, as shown in Figure 1-10.

1
See GPS-X Technical Reference for more information on these Models

Page 13
GPS-X TUTORIAL GUIDE

Figure 1-10 -GPS-X: Save As… Dialogue Box

When you have specified a directory and file name, click on the Save button. A message
is displayed if a file having the same name is in the listed directory. Choose Yes to save
over the old file (overwriting the previous file) or No to select a different file name. Note
that you must have write privileges for that directory.

You may have noticed that an object's process menu contains a number of items for
specifying other attributes of an object, for example, parameters and initialization
properties (see Figure 1-11). In this tutorial we will use the default properties for the
objects you have selected with four exceptions; the influent total COD concentration,
influent total suspended solids concentration, influent total TKN concentration and the
excess sludge wastage rate from the final clarifier.

14. Change the influent composition by right clicking on the influent object, move to
the Composition sub-menu and select the Influent Characterization menu-item.
A data entry form will appear on the screen. Change the total COD entry from
430 to 380 gCOD/m3, and the total TKN entry from 40 to 35 gN/m3 as shown in
Figure 1-11. Note that the values are now highlighted in blue, to indicate that
they have been changed from the GPS-X defaults. Click on the Accept button.

Page | 14
BUILDING A PLANT LAYOUT

Figure 1-11 Changing the Influent Composition

15. Change the secondary clarifier wastage rate by right-clicking on the secondary
clarifier object, move to the Input Parameters sub-menu and select the
Operational menu-item as shown in Figure 1-12. A data entry form will appear
on the screen. Change the pumped flow entry from 40 m 3 /d to 60 m3/d, as
shown in Figure 1-13. Once you have changed this flow, click on the Accept
button.

Figure 1-12 Secondary Clarifier Operational Menu Item

Page 15
GPS-X TUTORIAL GUIDE

Figure 1-13 Changing the Pumped Flow

16. Save the layout again by clicking the Save button on the tool bar. Selecting Save
rather than Save As… saves the layout with the current name (shown on the
GPS-X main window title bar) overwriting any previous files with the same name.

The layout is now fully-specified and you can build the plant model.

Generating Source Code and Binary Executable


The next step is to translate the plant layout and the model parameters, first into source
code, and then into a binary file, which will be executed by GPS-X. The translation and
compilation process involves several steps; however, GPS-X has been designed in such a
way that these steps are executed without user input. This enables you to concentrate
your efforts on process understanding rather than the mechanics of model construction.

17. Generate the model source and binary code by clicking on the Simulation
button. This starts the process of compilation and linking, resulting in the
creation of an executable model. The time required to complete this process
depends on the speed of your workstation, and the complexity of the model.
Upon completion of the build step, the message Completed will be displayed in
the Build window as shown in Figure 1-14

Page | 16
BUILDING A PLANT LAYOUT

Figure 1-14 Compilation Completed Message

The Simulation Environment


Once the model has been compiled, GPS-X will present a blank simulation environment,
as shown in Figure 1-15. The layout is shown in the lower left-hand corner, with blank
areas for inputs and outputs ready for use

Figure 1-15 Simulation Environment

Page 17
GPS-X TUTORIAL GUIDE

Creating Input Controls


GPS-X is an interactive simulation program, or simulator, which can run both pre-defined
simulations and interactive sessions. We will now set up an interactive session that
allows us to investigate the effects of changes in the influent flow rate on the plant
effluent quality.

Creating a New Input Control Window


Our first task is to create a new, blank input control. An input control is a interactive tool,
which can be used to change the value of model variables during the course of a
simulation run. You can create as many input controls as desired. Here, we will create a
single control for the plant influent flow so that this variable can be changed during a
simulation.

18. Drag the influent flow to the blank input control window by right-clicking on the
influent object and select the Flow Data item from the Flow sub-menu as shown
in Figure 1-16. In the Flow Data entry form, drag the influent flow variable to the
blank input control area above the layout, as shown in Figure 1-17. Remember to
accept the changes by clicking the Accept button on the bottom right-hand
corner of the form

Figure 1-16 Flow Data Menu

Page | 18
BUILDING A PLANT LAYOUT

Figure 1-17 Drag influent flow to an Input Control Tab

Note that a new tab (labeled “Input 1”) has been created for the input control. Multiple
controls can be placed on a single tab, or on as many tabs as required

19. Edit the control window properties by clicking on the Input Control Properties…
button just above the input control tabs. The input control properties menu is
shown in Figure 1-18. You can use this form to set minimum (Min), maximum
(Max), and control increment (Delta) values for a particular variable. Select 0 for
minimum flow and 12000 for maximum flow. It is not necessary to enter a value
in the Delta column, as we will use a slider-type control, which does not require a
value for this attribute. Note the small menu mark (inverted triangle) on the
right-hand side of each entry below the Type column heading. If you click on this
menu mark, a list of control types is displayed. Make sure that Slider is selected
for the influent flow item. Remember to save your entries by clicking on the
Accept button.

Page 19
GPS-X TUTORIAL GUIDE

Figure 1-18 Input Control Window Setup

20. Rename the control window by double-clicking on the input control tab name
“Input 1”. Enter an appropriate title for the input control tab, and press Enter.

An input control window with the plant influent flow has now been created. The
window shown in Figure 1-19 appears containing a slider that allows you to
change the influent flow from 0 to 12000 m 3 /d. You can test the slider control
by dragging the small slider knob, but note that if you move the slider bar, the
influent flow value will change to the value displayed on the control. Before
proceeding, use the “reset” button (curved arrow) at the far right of the slider to
move the slider back to the default position of 2000 m 3/d (alternatively, you may
enter the value into the control with the keyboard).

Figure 1-19 Interactive Controller

Creating Output Graphs


At this point the plant model has been prepared and an interactive control has been
created but we have no way to observe the results of a simulation. GPS-X provides six
different types of graphic display for output of simulation results. In this tutorial, we will
set up two standard unit process outputs, as well as a single time series graphic window
to plot two important model variables, the influent flow and the effluent suspended
solids concentration.

Page | 20
BUILDING A PLANT LAYOUT

Creating a QuickDisplay Output


21. Create a QuickDisplay Output by double-clicking directly on the aeration basin
object in the layout window. Create another QuickDisplay Output for the
secondary clarifier. New tabs will appear on the right-hand side of the screen,
containing the QuickDisplay summary tables. Note that no model output is
shown until a simulation has been carried out. The QuickDisplay output tab for
the aeration basin is shown in Figure 1-20

Figure 1-20 QuickDisplay Output

Page 21
GPS-X TUTORIAL GUIDE

Creating a New Output Graph


In addition to the model results summaries available on the QuickDisplay outputs, users
can create new custom-designed output graphs for various variables located in the
Output Variables menu of each object. These variables cover a wider range of model
outputs than those shown in the QuickDisplay outputs and can be used to supplement
the standard output in the QuickDisplays.

22. Create a new, blank output tab by clicking on the New Tab button on the toolbar
above the output tabs. A new, blank output tab will be created

23. Create a graph of the influent flow by right-clicking on the influent object and
select the Flow item from the Output Variables sub-menu as shown in Figure 1-21

Figure 1-21 Opening an Output Variable Menu

24. In the Flow output form, drag the influent flow variable to the blank output
graph, as shown in Figure 1-22. Remember to accept the changes by clicking the
Accept button on the bottom right-hand corner of the form.

Page | 22
BUILDING A PLANT LAYOUT

Figure 1-22 Dragging an Output Variable to Create a Graph


25. Next, move the pointer over the effluent point of the final clarifier (overflow).
When the pointer is positioned correctly, the cursor will change to a connecting
arrow to indicate that you have located a connection point 2. Right-click and
select the Composite Variables item from the Output Variables sub-menu. Drag
the total suspended solids variable to the same output graph as the influent flow.
Close the form by choosing Accept. Resize and arrange the output graph by
clicking on the Autoarrange button above the output tabs

Your simulation environment should appear as shown in Figure 1-23.

NOTE: There is a difference between data entry forms and output variable
forms even though both have a similar appearance and may contain the same
variable name entries. Data entry forms contain a field on the right-hand side
for entering data. In output variable forms this field displays model results,
and cannot be edited. To review: variables dragged from a data entry form
can be placed on input control tabs (above the layout pane), whereas variables
dragged from an output variable form can be placed on graphs (to the right of
the layout window) and saved to data files.

2
Output variables are defined within each object and at each of the object's connection points

Page 23
GPS-X TUTORIAL GUIDE

Figure 1-23 Simulation Environment with Output Graph Completed

26. Edit the output graph properties by right-clicking on the output graph and
selecting the Output Graph Properties item from the drop-down menu (see
Figure 1-24) to set and adjust your output graphs. The Output Graph Properties
form is used to specify plotting attributes including the minimum y-axis value
(Min), maximum y-axis value (Max), whether you want to save the data which is
generated during simulation (Save) and which colors you want to use to display
the output variables (Color). You can either use the Autoscale feature to set the
y-axis ranges, or enter a minimum and maximum value for each variable, i.e.,
0 and 10,000 m3/d for flow, and 0 and 150 g/m3 for suspended solids (see
Figure 1-25). You may want to edit the color of the output variable by clicking on
the Color box and selecting an alternate color. Accept the changes when you are
finished.

The graphic type specification is made by right-clicking on the output graph and
selecting the Output Graph Type item from the drop-down menu (see
Figure 1-24). By default, the graph type is X-Y (time series) but this can be
changed by making a different selection from the drop-down menu. Before
continuing, re-select the X-Y type so that the results you get match the figures
shown in this tutorial.

Page | 24
BUILDING A PLANT LAYOUT

Figure 1-24 Edit Output Graph Properties and Output Graph Type.

Figure 1-25 Output Graph Properties Menu…

27. Rename the output graph by right-clicking on the output graph and selecting the
Rename Output Graph item from the drop-down menu. Enter an appropriate
title for the output graph

Page 25
GPS-X TUTORIAL GUIDE

Running a Simulation
You are now ready to run the model. All of the controls that you will need to run a
simulation are located on the Simulation Control tool bar at the bottom of the screen
(see Figure 1-26).

28. Specify a simulation duration time of 20 days by clicking on the arrow button
adjacent to the Stop label on the Simulation Control tool bar. (Stop should
increment by 1 day).

Figure 1-26 Simulation Control Tool Bar

29. Start the simulation by clicking on the Start button on the Simulation Control
tool bar. The flow and effluent suspended solids will be displayed in the output
window.

You can now change the flow with the input control slider bar, and assess the
effect of changes in influent flow on the effluent suspended solids of the plant. If
the flow is high enough (say 5,000 m3/d) you will see a significant increase in the
effluent suspended solids due to clarifier overload. An example run is depicted in
Figure 1-27. If the simulation proceeds too quickly, you can artificially slow down
the simulation by inserting a delay. Add a delay by putting 0.5 (or any other
number, the magnitude of the number dictates the degree of delay) into the
Delay entry field using the Stop/Communication/Delay drop-down menu on the
Simulation Control tool bar.

Page | 26
BUILDING A PLANT LAYOUT

Figure 1-27 Example Run

30. Run the simulation again, but this time, adjust the influent flow by dragging the
influent flow slider away from 2,000 m3/d

NOTE: If the simulation time exceeds the stop time (Stop) the model will halt.
At that time, you have two choices:

• Restart the simulation by clicking on the Start button in the


Simulation Control window; or

• Increase the length of the simulation by increasing the value of Stop


and clicking Continue to continue the simulation.

If you Continue, GPS-X will begin simulating from where it previously stopped and
continue until the new stop time is reached. If you click on Start, GPS-X reruns
the previous simulation.

Page 27
GPS-X TUTORIAL GUIDE

Analyzing the Plant


We will now take a more detailed look at our plant's performance by investigating the
effect of increased flow on the secondary clarifier. We will first set-up an output graph
displaying the solids profile inside the final clarifier. We will then simulate steady-state
conditions with the design flow of 2,000 m3/d and investigate the change in the solids
profile inside the final clarifier by running the model at a higher flow rate (i.e. simulating a
storm condition).

To investigate the effect of increased flow on final effluent quality, set up a graphical
output of the solids profile inside the final clarifier.

31. Display the secondary clarifier solids profile by right-clicking on the secondary
clarifier object and selecting from the Output Variables sub-menu item,
Suspended Solids. Drag the suspended solids (see Figure 1-28) item to the blank
area to the right of the existing output tabs and Accept the form. A new tab and
corresponding output graph will automatically be created.

Figure 1-28 Dragging the Suspended Solids Profile to a New Tab

If you right-click on the output graph and select the Output Graph Type item, you will
notice that the Bar Chart type has already been selected. Select the Bar Chart
(Horizontal) type for this graph. To rename this graph, right-click on the output graph
and select the Rename Output Graph item from the drop-down menu and enter an
appropriate title. Resize the graph by clicking the Autoarrange button.

Note that you can change the name of any tab by double-clicking on the tab name and
entering a new one.

Page | 28
BUILDING A PLANT LAYOUT

32. Select the Steady-State option and Start the simulation setting Stop to 10 days.
Make sure that the influent flow is set to 2,000 m 3 /d on the input control
window. Figure 1-29 shows a bar chart profiling the solids distribution inside the
final clarifier.

33. Increase the influent flowrate to a higher value (i.e. 5,000 m3/d) with the
controller. Adjust Stop to 20 days and Continue the simulation. The bar chart
profiling the solids distribution inside the final clarifier will change to reflect the
build-up of solids due to higher flows. Following this, save the layout by clicking
on the Save button on the tool bar.

Figure 1-29 Final Clarifier Solids Profile

Page 29
GPS-X TUTORIAL GUIDE

TUTORIAL 2

Editing Layouts and Using Scenarios

For this tutorial, consider a situation where the plant you developed in the first tutorial is
expected to treat increased flow due, for example, to extra sewer connections. Assume
that the plant has adequate aeration capacity but requires an extra clarifier

Objectives
GPS-X makes it easy to build models to help you examine changes in plant design and
operation. This tutorial will show you how to use the layout editing tools such as Copy
and Paste to make additions to the layout. Once the new model is built, the scenario
features of GPS-X will be introduced. Using scenarios, you can set up specialized data sets
for comparing the performance of the clarifiers in the event of uneven flow distribution
under both steady state and dynamic conditions. After running each scenario, it may be
desirable to record the model parameters and variables that were used. The report
feature of GPS-X is introduced to facilitate this task.

When you are finished with this tutorial, you will have developed the ability to create and
edit plant layouts and will have developed a better understanding of static 3 data input
and output in GPS-X. You will be able to prepare simulation scenarios to test different
hypothetical situations and be able to run the scenarios to test alternative plant designs
or examine operational changes. You will also be able to produce a record of model
dependent and independent variables.

3
The term static is used to describe the process of data input and output in this case in order to
differentiate it from the case of input and output involving time series data which is described in
Tutorial 4

Page | 30
EDITING LAYOUTS AND USING SCENARIOS

Expanding the Plant


1. Recreate the layout used in Tutorial 1 or open the layout that you previously
created

2. Save the layout under a different name (`tutorial2’, for example).

3. Display the drawing board grid by selecting the Grid button from the tool bar. In
order to facilitate expansion to the layout, more space is required on the drawing
board. Open the Locator window and outline a larger working area. This will
allow you to place more objects on the drawing board

4. Move the influent and plug-flow tank objects by clicking and dragging out a box
around the influent and plug-flow objects. Then, with the mouse button pressed
on one of the selected objects, drag the selected area to its new location on the
drawing board (see Figure 2-1).

Figure 2-1 Moving a Group of Objects

Page 31
GPS-X TUTORIAL GUIDE

5. Copy the final clarifier by selecting the existing secondary clarifier located on the
drawing board. A red outline around the clarifier grid cell will appear. Click on
the copy button and select a destination cell by dragging out a small box inside
the destination cell. The destination cell will get a red outline. Next, click on the
paste button. This will paste a copy of the clarifier and all its attributes to the
new location. Your layout should now look like Figure 2-2.

Figure 2-2 Copying the Final Clarifier

6. Follow the procedure outlined in Tutorial 1 and complete the layout by adding:

• A two-way splitter to divide the mixed liquor from the aeration tank
to the two clarifiers

• A two-way combiner to join the recycled sludge from the two


clarifiers with the raw sewage as feed to the tank.

• A two-way combiner to mix the final effluent from the two final tanks

Prior to connecting the new objects you must delete some old connections (see
note box below Step 8 of Tutorial 1 for this procedure). Delete the connection from
the plug flow reactor to the final tank as well as the connection between the
clarifier underflow and the plug flow reactor.

Page | 32
EDITING LAYOUTS AND USING SCENARIOS

Next, select a two-way splitter from the Flow Combiners and Spitters group of icons
in the Process Table and place it downstream of the plug-flow tank on the drawing
board. Then, position a two-way combiner underneath the plug-flow tank and
another downstream of the two clarifiers. If necessary, reposition the objects so
that your layout now resembles Figure 2-3

Figure 2-3 Adding Objects

7. Connect all objects. The last step of the plant expansion is to connect all the
objects. You may find it helpful to reorganize your layout and/or rotate the
combiner object located underneath the plug flow reactor. This is done by
selecting the combiner grid cell and clicking on the Rotate button until the
desirable orientation is achieved. The layout should resemble Figure 2-4.

Page 33
GPS-X TUTORIAL GUIDE

Figure 2-4 Connecting the New Units

8. Recompile the model by clicking on the Simulation button on the tool bar.

Using Scenarios
Having built the modified layout, you can proceed with the plant performance
investigation. To do this, change the following model parameters:

• Influent flow, to simulate the additional sewer connections

• Influent type, to simulate a dynamic fluctuation of the influent wastewater

To change a model parameter (in this case change from a constant influent flow to a
sinusoidal influent flow), without recompilation, you must become familiar with the
scenarios function. Each user-defined scenario can have a different set of model
parameters so that the same model can quickly be simulated using different operating
conditions

9. Create a new scenario by selecting the New option from the Scenario drop-down
menu on the Simulation Control tool bar. Type in a name for your new scenario
and Accept the form (see Figure 2-5).

Page | 34
EDITING LAYOUTS AND USING SCENARIOS

Figure 2-5 Defining a New Scenario

10. Change the influent flow type and rate by selecting Flow Data from the Flow
menu of the influent object. This will open a form entitled
Flow Data-SIMULATION IS LOADED. The latter part of the title is a reminder that
the model is loaded and that changes made in this form will be saved in the
current scenario. Click on the flow type pull-down menu and select Sinusoidal.
Change the influent flow in the Data sub-section of the same form to 5000 m3/d.
You will notice that changes made in a scenario are highlighted in green. Accept
the form.

You can display the items saved with a particular scenario by selecting Show...
from the Scenario Control drop-down menu. Similarly, you can revert back to the
layout parameters (i.e. reset the parameters to those used during the model
build) by selecting the Default scenario from the Select Scenario submenu
(accessed from the Scenario Control drop-down menu and scroll to Select
Scenario > Default Scenario).

Page 35
GPS-X TUTORIAL GUIDE

11. Create an input control (slider type) for the flow split fraction (in the "MLSS
Splitter") as described in the Creating Input Controls section of Tutorial 1
(Steps 18-20). Set the minimum and maximum values to 0 and 1, respectively.

12. Create an QuickDisplay output for the new clarifier as described in the Creating
QuickDisplays section of Tutorial 1 (Step 21)

13. Create an output graph for the solids profile in the new (copied) clarifier as
described in the Creating Output Graphs section of Tutorial 1 (Steps 23-27).

14. Create an output graph for the effluent SS for each clarifier, and the combined
effluent as described in the Creating Output Graphs section of Tutorial 1. In each
case, the total suspended solids variable can be found in the
Output Variables >Composite Variables menu of each object's outflow stream.
Display all three concentrations on one graph.

15. With the steady state box checked, run a 1-day dynamic simulation.

16. Change the split fraction to 0.3 using the interactive controller and increase the
stop time to 2 days. Click Continue on the Simulation Control window and let the
simulation proceed until it stops.

17. Increase the flow to the plant to 8,500 m3/d, increase the stop time to 3 days and
Continue the simulation. A set of typical results are shown in Figure 2-6. These
graphs show the effect of the imbalanced flow split on final clarifier performance
and combined final effluent SS.

If you encounter difficulties, examine the procedure for creating the


‘Expansion’scenario

Page | 36
EDITING LAYOUTS AND USING SCENARIOS

Figure 2-6 Typical Results

Generating a Static Report


You may wish to create a report with a list of all the parameter values, as well as the
model results for a particular run. GPS-X has a feature which will allow you to just that, by
creating either a standard or custom report in Microsoft Excel format

Page 37
GPS-X TUTORIAL GUIDE

18. Click on the Report button in the main GPS-X toolbar (or select the Report...
item from the File menu). This will open a menu that gives you options to print a
report Direct to Printer, or create a Standard or Custom Spreadsheet Report.
Select Standard, and click the Generate button at the bottom of the window.

19. A Save Report… dialogue box similar to the one shown in Figure 2-7 will appear
and allow you to save the report to a folder of your choice (the default location is
the same folder as the current layout). Save the report.

Figure 2-7 Save Report Dialogue Box

20. You will be asked if you want to open the newly created report. Click Yes, and
the report will be opened in Excel (see Figure 2-8). Browse through the various
worksheets to see the model layout, details of each object, and output graph
data.

Page | 38
EDITING LAYOUTS AND USING SCENARIOS

Figure 2-8 Standard GPS-X Report

Creating a New Output Table Tab


In addition to the viewing model results and summaries on the QuickDisplay and Graph
outputs discussed in Tutorial 1, users can create new custom-designed output tables for
observing model variables. These output tables can be populated with a wider range of
model outputs and present the data as a summary of stream or process variable across
the simulated layout.

Page 39
GPS-X TUTORIAL GUIDE
1. Create a new, blank output tab by clicking on the New Table Tab button on the
toolbar above the output tabs. This will open the table tab wizard as shown in
Figure 1-21.

Figure 2-9 New Tab Table Wizard

2. Populate the table by right-clicking on the Stream Choices and Variable Choices
check boxes on the wizard. The selected Variable Choices are the variables that
will be included in the table for each of the selected Stream Choices.

3. On the Stream Choices form select the Influent(inf) > inf; Aeration Tank(mlss) >
mlss; Final Clarifier 1(fe1) > fe1; Final Clarifier 2(fe2) > fe2; and FE Combiner(fe)
> fe. These selections can be seen in Figure 2-11.

4. On the Variable Choices form select only the Solids > TSS and VSS; Organic
Variables > COD; and the Nitrogen Variables > Ammonia Nitrogen and Nitrate
and Nitrite and click Accept. These selections can be seen in Figure 2-11.

Page | 40
EDITING LAYOUTS AND USING SCENARIOS

Figure 2-11 New Tab Table Wizard Selection

5. Run a Steady State simulation and observe the new table tab. From the table we
can observe the reduction in the TSS and COD concentrations across both
secondary clarifiers (fe1, fe2 and fe streams); and the nitrification occuring across
the aeration tank (inf and mlss streams).

Figure 2-10 Tab Table Steady State Results

6. Copy data out of the table and into another application by right click on the table
and selecting Copy complete table to clipboard. Open Microsoft Excel or your
spreadsheet program of choice and paste the complete table of steady state
results.

7. To graph the table data as a bar chart click on the Create


Bar Chart icon on the table or right click on the table row
of interest and select Create bar Chart.

Page 41
GPS-X TUTORIAL GUIDE

Figure 2-12 Tab Table COD Bar Graph

Page | 42
EDITING LAYOUTS AND USING SCENARIOS

TUTORIAL 3

Influent Data & Influent Advisor

Problem Statement
You have some historical data related to the influent wastewater for your plant and it
does not resemble the default data presented in the GPS-X influent object forms.
Unfortunately, a full characterization of your influent wastewater has not been
performed. Nevertheless, you need to estimate the influent wastewater characterization
so that the model can be used with an influent that approximates your influent data. In
this tutorial, you will investigate the influent models, the impact of the local biological
model on the influent calculations and the use of Influent Advisor as a tool to help
characterize influent data.

Objectives
This chapter covers two important features of GPS-X:

• Influent data entry

• Use of Influent Advisor as a characterization tool.

Page 43
GPS-X TUTORIAL GUIDE

Influent Data
The following historical data have been gathered at your plant and represent average
values for your influent.

Measured Parameter Value Units


carbonaceous BOD5 190 mg/l
soluble COD 42 mg COD/l
total COD 365 mg COD/l
total suspended solids 210 mg/l
volatile suspended solids 168 mg/l
ammonia 26 mgN/l
total TKN 36 mgN/l
soluble TKN 31 mgN/l

Table 3-1 Average Historical Data

1. Create a New Layout by clicking on File > New…, . Select the Carbon-Nitrogen
Library (cnlib) from the Model Library drop-down menu in the main toolbar. Save
the layout as `tutorial3’ using the Save As... command from the File menu.
After saving, drag a single wastewater influent object on the drawing board, and
recompile the model by clicking on the Simulation button on the tool bar.

2. Set up a new scenario for an influent case study. Create a new scenario named
Influent as described in Tutorial 2 (Step 9)

3. Access the wastewater influent object process menu and choose


Composition>Influent Characterization. The Influent Advisor characterization
tool will be displayed as shown in Figure 3-1.

Page | 44
INFLUENT DATA & INFLUENT ADVISOR

Figure 3-1 Influent Advisor

4. Enter the total COD, total TKN and free and ionized ammonia data from the
table above into the form (see Figure 3-1) and press Enter. The entries are shown
in green, indicating that these changes are part of the Influent scenario you
created earlier.

5. Check the remaining variables in Table 3-1 against their corresponding values in
GPS-X. The right-hand column in the Influent Advisor tables show the new
composite variable values. The values reflect the new COD, TKN and ammonia
input, but use the default influent fractionation. Note that the TSS, VSS and BOD
numbers differ from the data shown in the table.

Clearly, the influent model calculations are inconsistent with the data for your
plant indicating that one or more of the default settings (i.e. composition data or
stoichiometric fraction) are inconsistent with your wastewater. We will
investigate the steps required to reconcile these discrepancies

Using Influent Advisor


The Influent Advisor tool has been designed to make the characterization of the influent
waste stream as straightforward as possible. It would be possible to run a series of
simulations (while adjusting influent parameters on sliders and observing plotted output)
to find the correct settings, this method would require setting up input and output and
could be potentially time-consuming

Page 45
GPS-X TUTORIAL GUIDE

The Influent Advisor tool shows all input and output in an interactive way, allowing users
to determine which inputs affect each output, and to trace all dependencies. The sheet
contains three columns:

Inputs State Variables Composite Variables

Figure 3-2 Influent Advisor Columns

6. Find the VSS variable in the right-hand column, and click on the value. You will
notice that a formula has been displayed in the formula box at the bottom of the
sheet. This formula corresponds to the formula used in GPS-X to calculate the
value clicked on. Values used in the calculation are highlighted as well. Click on
other cells to see other formulas.

Let’s proceed to make adjustments to the influent parameters (fractions and/or


concentrations) to reconcile the model predictions with the measured values
from Table 3-1.

7. Note that the particulate COD to VSS ratio (XCOD/VSS) is used in the calculation
of VSS. This is one of several important relationships can be calculated from the
existing data. For instance:

VSS:TSS ratio (ivt) = 168/210 = 0.8


particulate COD: VSS ratio (icv) = (365-42)/168= 1.92

8. Enter these values into the Inputs column under the Influent Fractions
sub-heading. Note that doing this seemingly results in values further away from
what you are looking for. Further changes will be required.

Page | 46
INFLUENT DATA & INFLUENT ADVISOR

9. Click on VSS to display the calculation formula. By continuing to click on the cells
in the formula, you should be able to determine that vss is a function of xcod,
which in turn is a function of cod and scod. Clicking on scod reveals that scod is a
function of frsi and frss, the fractions of total COD for soluble inert and soluble
substrate. It is these two fractions that we can adjust to control the relationship
between the measured variable (vss) and the model predictions that need to be
reconciled.

10. Adjust frsi (soluble inert fraction of total COD) to 0.02. Because we need to
increase VSS, we need to increase the particulate COD components. This can be
done by decreasing the amount of total COD that is assigned to the two soluble
components (soluble inert si and soluble substrate ss). By decreasing the soluble
inert component from 5% to 2% of total COD, the particulate substrate
component xs has increased, thereby increasing VSS

11. Adjust the frss value to bring the calculated soluble COD value in line with the
measured value. When entering a new frss value, press Enter to update all other
calculations.

12. Lastly, adjust the soluble TKN (stkn) value. Click on the equation to determine
the appropriate input parameter to adjust, and make the necessary changes.

NOTE: In reality you will characterize your influent and adjust these
unknown parameters based on the model behavior and how that model
behavior relates to what has been observed or measured at the plant. Each
wastewater is different and each will require some adjustment of these
parameters to get a characterization that results in model behavior that is
consistent with your plant behavior.

The final characterization should appear as shown in Figure 3-3.

Page 47
GPS-X TUTORIAL GUIDE

Figure 3-3 Completed Influent Characterization

Influent Advisor Warnings


Strictly as an exercise to demonstrate a point, you will now change the influent
characterization so that a warning message is generated as a result of an improperly
characterized influent.

13. Change the total TKN value (tkn) to 15 mgN/L. After clicking Enter, you will
notice that some output variables have been highlighted in red. This indicates a
negative concentration, which sometimes can some from usual or poor
characterization data. Negative influent concentrations can cause mass balance
errors and convergence problems, so these values must be addressed before
proceeding with a simulation. Note that if you Accept the characterization and
click on the Start button, a window will pop up to warn you of the negative
influent concentration.

Page | 48
INFLUENT DATA & INFLUENT ADVISOR

TUTORIAL 4

Data Input & Output

Problem Statement
You are interested in testing your plant under more dynamic or stressful conditions such
as a storm. Unfortunately, you do not have access to real storm flow data. Therefore you
will generate a simulated storm loading to your plant and then input this data as a driving
function for the model. You will investigate the effect of step feed during the storm.

Interactive controllers provide an easy-to-use method for exploring the dynamic response
of the model. However, in most modelling projects, it is desirable if not essential to input
real forcing functions to examine how the model behaves under real conditions. The
forcing functions can be flows or influent concentrations, or any other model parameter,
but are always in the form of time dynamic data; that is, variable values over time. A
typical set of time dynamic data would be the influent flowrate to the plant over a period
of time. GPS-X facilitates the input of this data so that the model will be used under real
conditions.

Objectives
This chapter covers an important and useful feature of GPS-X:

• Using a data file as an input to control simulations

Page 49
GPS-X TUTORIAL GUIDE

Setting up Dynamic Input


1. Open the layout built in Tutorial 1 and save it as `tutorial4’ using the Save
As... command from the File menu. After saving, recompile the model by clicking
on the Simulation button on the tool bar.

2. Right-click on the Influent Object Composition > Influent Characterization menu


to bring up the Influent Advisor page. Drag total COD, total TKN and free and
ionized ammonia to the control window to create interactive sliders. Open the
properties menu and change all three sliders to File Input controllers. (You
should now have 4 File Input controllers in total)

3. Click on the Input Control Properties… button above the input tabs to access the
properties menu. Set the controller type to File Input for all four parameters, as
shown in Figure 4-1

Figure 4-1 Setting the Input File Controller

The next step is set up the data in files to be read by GPS-X during a simulation. There are
two different ways that data files can be prepared for the file input controllers:

i. Manually preparing spreadsheets outside of GPS-X (best used for preparing


data for multiple variables), and selecting the data file with the GPS-X
Scenario Configuration… menu.

or

ii. Using the Data File… tool in the GPS-X interface (best used for preparing data
a single variable)

Page | 50
DATA INPUT & OUTPUT

This tutorial will use both methods to illustrate their use. We have created a data filf or
you to use during this tutorial. Locate and open the Tutorial 4 Example Data.xls
spreadsheet file in the following folder:

c:\gpsx62\layouts\22tutorials\tutorial04 \

We will use data from this file as our dynamic dataset, and start by using the Scenario
Configuration… menu to point GPS-X to the data to be used in the simulation.

The Tutorial 4 Example Data.xls file should appear as shown below. It is a typical set of
influent input data that you might use to simulate a change in influent loading over time.

4-2 Data File

The first column is labeled “t” for time, and is always in the units of days. The remaining
columns contain data for each of the parameters being read from the file. The names at
the head of each column are the “cryptic variable name” (which is the internal “short
form” variable name within GPS-X calculations) for each variable. These names are
specific to the layout you have created, and are different for each variable and object

Page 51
GPS-X TUTORIAL GUIDE
within the layout. When preparing new files, you will need to determine the cryptic
variable name for each of the variables you want to read in.

The simplest way to do this is to go to the File Input tab, and holding the mouse cursor
over the variable name in the controller window. A pop-up will show the cryptic variable
name, as shown in Figure 4-3

Figure 4-3 Showing the GPS-X Cryptic Variable Name

The cryptic variable names for the 4 variables in this tutorial are:

qconinf – influent flow

codconinf – influent COD

tknconinf - influent TKN

snhconinf – influent free and ionized ammonia

4. The next step is to tell GPS-X where to find the file with the data to be read in
during the simulation. Click in the Scenario Menu in the bottom task bar, and
select Default Scenario > Configuration… menu.

4-4 Selecting the Scenario > Configuration Menu

Page | 52
DATA INPUT & OUTPUT

5. The configuration menu will show all of the scenarios available (which should be
just the Default Scenario). Click on the Data Files… button, to bring up the data
files menu. Click on the Add… button to add the existing Tutorial 4 Example
Data.xls file to this simulation.

4-5 Adding a Data File

6. Browse to the file, click Add. The Data File menu should appear as follows:

4-6 Data File Added to Default Scenario

Page 53
GPS-X TUTORIAL GUIDE

7. Close the Scenario Configuration menu, and run a 5-day simulation with Steady-
State click ON. As the simulation proceeds, the values of the influent flow and
concentration will change in the input controller. The model responds
dynamically to the changing input, as shown in the increasing effluent solids.

The above methodology is useful for simulations where data for many parameters are
being read in simultaneously, and it is easy to assemble that data externally in a
spreadsheet. There is another option that is useful for simple simulations where just one
or two parameters are being read from a file, and you want to input those values directly
into GPS-X. For this situation, you can use the GPS-X Data File… tool.

8. Right-click on an open spot in the layout background, and select System > Input
Parameters > Physical, and drag liquid temperature to the input tab. This will
create a new slider controller. Switch this controller to FileInput in the Input
Control Properties… menu.

9. Right-click on liquid temperature in the Control Window and select the Data
File… option. A data input menu will open, as shown in Figure 4-7.

Figure 4-7 Accessing the Data File... Menu

Page | 54
USING AUTOMATIC CONTROLLERS

10. Click on cell in the upper-left-hand corner of the table. The data field becomes
active, so that you can manually enter values by typing. Enter in values for the
time series as shown below:
Time [d] temp [C]

1 17

2 18

3 20

4 22

5 24

NOTE: If you wish to copy-and-paste data from another program, the two
columns of data (timestamps and the variable values) have to be adjacent
columns.

11. Save the time-series data using the Save… button on the data file window (use
the default filename provided by GPS-X), and then click Close to return to the
main GPS-X interface.
12. Run a 5-day simulation with Steady-State clicked ON. As the simulation
proceeds, the value of the influent flow, concentrations and temperature will
change in the input controller as the simulation proceeds.

Page 55
GPS-X TUTORIAL GUIDE

TUTORIAL 5

Using Automatic Controllers

Problem Statement
Automatic process control is well established in many applications ranging from large
refineries using multivariate model-based control to climate control of buildings using
simple on/off control. Wastewater treatment plants are no exception. The
implementation of even basic automatic control should improve performance and save
money. In GPS-X, the user can simulate the effects of automatic process control.

To improve and stabilize operation, as well as realize energy savings, you decide to
implement MLSS and dissolved oxygen control. You will do this by incorporating MLSS
and DO controllers into your system.

Objectives
This tutorial will show you how to setup an MLSS controller to automatically adjust the
biosolids wastage rate in order to meet the specified MLSS set point. This tutorial also
will show you how to setup a dissolved oxygen controller that automatically changes the
aeration rate in order to meet the dissolved oxygen set point.

Page | 56
USING AUTOMATIC CONTROLLERS

Setting up an Automatic MLSS Controller


1. Open the layout completed in Tutorial 1 and save it as `tutorial5’ using the
Save As... command from the File menu. If you no longer have a copy of this
layout you will need to recreate it. As we will be defining new variables for MLSS
control, make sure that you DO NOT click on the Simulation button. If you have
already clicked on the Simulation button, simply click on the Modelling button so
that you can set up the MLSS controller.

2. Access the plug-flow tank's Aeration Setup menu by opening the


Input Parameters > Operational form. From the specify oxygen transfer by…
drop-down menu, select Entering Airflow

Figure 5-1 Setting up the MLSS Controller (a)

3. Identify the manipulated variable for the MLSS controller. The most logical
variable for this is the wastage flowrate, which in this case, is the pumped flow
from the clarifier. Some of the pumped flow control parameters are found in the
secondary clarifier Input Parameters > Operational form. Turn the Pumped Flow
controller ON. Additional pumped flow control parameters are found on a
subsequent form displayed using the More... button found at the bottom of the
Pumped Flow sub-section. Initially your forms will appear slightly different than
the ones shown in Figure 5-1 and Figure 5-2; however, you are going to modify
your forms to resemble those shown.

Page 57
GPS-X TUTORIAL GUIDE

Figure 5-2 Setting up the MLSS Controller (b)

4. Define the control variable for the MLSS controller. In the secondary clarifier
Input Parameters > Operational > More... form, type xmlss, (the variable which
corresponds to the MLSS in the aeration basin effluent stream) in the text field
next to the control variable label. If this stream is not labelled as mlss in your
layout then the variable name you will need to type is x<stream label>
where <stream label> is the plug-flow tank effluent stream label.

5. Set the controller tuning constants by entering 0.05 days as the controller
sampling time (this represents the frequency with which the controller samples
the control variable, or MLSS in this case). The controller effect on control
variable - direct should be turned OFF. This means that the manipulated
variable, the wastage flow rate, is increased in order to reduce the control
variable, MLSS. (A different control loop such as air flow and DO concentration
would require the controller effect on control variable - direct switch to be
turned on as an increase in the manipulated variable, air, would result in an
increase in the control variable, DO.)

6. Set the maximum pumped flow rate to 200 m3/d and Accept this form (Figure
5-2)

Page | 58
USING AUTOMATIC CONTROLLERS

7. Set the setpoint for the control variable (in the Input Parameters > Operational
form, Figure 5-1) to 2000 mg/l. Accept this form, Save your layout and recompile
the model by clicking on the Simulation button.

Tuning the Automatic MLSS Controller


8. Create a new input control window as described in Tutorial 1 and set-up the
window with the controller constants (proportional gain, integral time and
derivative time), the MLSS setpoint and the controller switch (see Figure 5-3).
Set the minimum and maximum for setpoint for control variable, proportional
gain, integral time and derivative time to 0-4000 g/m3, 0-50, 0-10 d and 0-10 d,
respectively.

9. Create a new output graph as described in Tutorial 1 and set-up the MLSS, the
influent flowrate and the wastage flowrate on the same output graph. The
output variable (MLSS) can be found in the Output Variables > Composite
Variables form of the plug-flow tank effluent stream. Set the minimum and
maximum for MLSS concentration, influent flow and wastage flow to
0-5000 g/m3, 0-5000 m3/d and 0-600 m3/d, respectively.

Figure 5-3 MLSS Interactive Controls

10. Run a 10-day dynamic simulation with a sinusoidal influent flow pattern
(see Tutorial 2 if you have forgotten how to do this) and the controller turned
ON.

Page 59
GPS-X TUTORIAL GUIDE

Initially, you will find that the manipulated variable oscillates wildly between its
minimum and maximum values. This is a controller tuning problem. It is usually
possible to obtain reasonable controller performance by trial and error. In this
example, one may conclude that the controller gain is too large. One option for
tuning this controller by trial-and-error is as follows:

• Start with a low proportional gain (0.001), high integral time, (10 days),
and low derivative time (0 days). This creates a sluggish but stable
controller.

• Watch how the wastage rate changes to counteract the effect of a


disturbance (e.g. influent flow rate). If it does not react quickly enough,
try increasing the proportional gain. Continue to increase the
proportional gain until you get a reasonably responsive control effect, but
still a stable response.

• If the wastage rate becomes unstable (wild oscillations) decrease the


proportion gain.

• With the proportional effect stable, try decreasing the integral time to
increase the performance of your controller.

• If there is too much overshoot, try increasing the derivative time

A simplified understanding of the three elements of a PID controller is: fast, persistent
and predictive for the P, I and D terms respectively. Remember that automatic process
control is not a simple subject and it may not be possible to achieve the level of control
that you desire. Consider the process time constant of the MLSS in the aeration basin. It
takes several days for a plant to reach a new steady-state given a change in wastage rate,
while the plant upsets (changes in the influent flow rate) that can have a dramatic effect
on the MLSS can occur in a matter of hours or even minutes.

There are several published approaches for finding good initial tuning constants for PID
controllers. One approach is to use the Ciancone correlations (Marlin, 1995 i) which are
included in GPS-X's PID tuning tool. The Ciancone correlations provide the tuning
constants given the gain, time constant, and dead time of the process, under the
assumption that the process dynamics may be represented with reasonable accuracy by a
first-order plus dead time model. In GPS-X's PID tuning tool, the process response to a
step change in the manipulated variable is fit to a first-order plus dead time model using
least squares (in tuning mode). The Ciancone correlations are then used to determine the
appropriate values for the tuning constants.

Page | 60
USING AUTOMATIC CONTROLLERS

11. Activate the pumped flow control tuning mode, by creating a new scenario from
the Simulation Control tool bar as described in Tutorial 2. In the final clarifier
Input Parameters > Operational form (under the Pumped Flow More... button,
under Pumped Flow Control Tuning) turn the tuning switch ON. The fractional
step size can be specified on that form and can be a positive or negative value. In
this case, set the fractional step size to 0.5. Accept this form. Now turn the
MLSS controller turned OFF set the pumped flow value to 100 m 3 /d. This
fractional step size corresponds to a step in pumped flow rate from 100 m 3 /d to
150 m 3 /d. Accept the operational forms.

12. Turn the MLSS controller ON and run a 0-day steady state simulation with the
newly created scenario. Once this is complete, turn the MLSS controller OFF
using the ON-OFF control switch 4 and run a 10-day dynamic simulation.

The simulation performed in tuning mode is shown in Figure 5-4. The essential
characteristics of a successful tuning mode simulation are:

• It must be started under steady-state, with values of the manipulated


(pumped flow) and control (MLSS) variables representative of normal
operating conditions.

• The simulation should last long enough to capture most of the process
dynamics (i.e. the simulation should end at steady-state, or be
approaching steady-state), and

• The step in the manipulated variable should be large enough to dominate


other "noise" that affects the controlled variable (in this case the
sinusoidal influent flow pattern).

4
For the tuning mode to operate properly, the controller sampling time must be set to a
reasonable value, e.g. the execution time of the controller to be implemented. This is why the
controller sampling time was left as 0.05 days

Page 61
GPS-X TUTORIAL GUIDE

Figure 5-4 Tuning Mode Simulation

At the end of the simulation, PID tuning constants will be calculated (this may take
several seconds), and will appear in the Command window. A notification will appear on
screen when the calculation is complete (see Figure 5-5). The Command window can be
opened by selecting this option from the Simulation Control drop-down menu on the
Simulation Control tool bar.

Figure 5-5 Calculated PID Tuning Constant

13. Turn the MLSS controller ON and turn the tuning mode OFF (under Input
Parameters > Operational) and set the controller tuning constants to these
values. The simulation shown in Figure 5-6 was performed using these tuning
parameters for the MLSS controller. The MLSS setpoint was 2000 mg/l and the
average influent flow rate was decreased to test the performance of the
controller under dynamic conditions.

Page | 62
USING AUTOMATIC CONTROLLERS

Figure 5-6 Simulation with MLSS Controller

Using an Automatic DO Controller


14. Create a new scenario named ‘DO Control’ as described in Tutorial 2.

15. Access the plug flow tank’s Aeration Setup menu by opening the
Input Parameters>Operational form of the plug flow tank, shown in Figure 5-7.
From the Specify Oxygen Transfer by… drop-down menu, select Using a DO
Controller to activate the automatic DO controller. The other important item in
this form is the DO Setpoint Array button [(...)] found under the Aeration Control
menu. By clicking on the Array button, another form will appear showing the
setpoints. The default setpoints are all set to 2.0. Accept all forms.

Page 63
GPS-X TUTORIAL GUIDE

Figure 5-7 Setting up a DO Controller


16. Create a new input control window as described in Tutorial 1 and set-up the
window with the first and last DO setpoints (see Figure 5-8).

Figure 5-8 DO Input Control Window

17. Create a new output graph as described in Tutorial 1 and set-up the graph to
display the dissolved oxygen concentration in the first and fourth tanks of the
plug-flow tank and the effluent free and ionized ammonia. The dissolved oxygen
variables can be found in the Output Variables > State Variables > dissolved
oxygen > [(...)] form (Figure 5-9 and Figure 5-10) of the plug-flow tank (ensure
that you do not click on a connection point to or from the tank as in this case we
want variables internal to the object). Accept both forms. Find the free and
ionized ammonia variable in the Output Variables > State Variables form of the
plug-flow tank effluent stream. Use similar min/max ranges as above for the
DO setpoints and ammonia concentration.

18. Autoarrange the windows. Ensure that the MLSS controller is turned ON.

Page | 64
THE DEFINE FUNCTION

19. Run a simulation, varying the influent flowrate and the DO setpoints. The
automatic controller behaves quite well with the default tuning constants.

Figure 5-9 DO Output Variables

Figure 5-10 Dragging to DO onto an Output Graph

Page 65
GPS-X TUTORIAL GUIDE

TUTORIAL 6

The Define Function

Problem Statement
Some important operational variables in a wastewater treatment plant are site specific
and difficult to generalize. These variables include sludge residence time (SRT) and food-
to-microorganism ratio (F/M). In addition, other calculations, such as daily averages,
moving averages, and mass flows are applied to most water quality parameters
throughout the plant. Consequently, it is desirable for any wastewater treatment plant
model to contain these traditional process variables, and GPS-X provides you with this
capability

Objectives
This tutorial will show you how to define operational variables such as SRT. In addition,
mathematical operations such as averaging and flux calculations will be demonstrated.
These operations are centered around the Define function (Tools > Define menu or the
Define button located on the GPS-X toolbar).

Page | 66
THE DEFINE FUNCTION

Setting up the Layout


1. Develop a new layout consisting of an influent object, control splitter, plug-flow
tank, rectangular secondary clarifier and a combiner. Use CN library and the
default model selections (codstates influent model, the mantis plug flow tank
model and the simple1d rectangular clarifier model). The completed layout with
the stream labels is shown in Figure 6-1. You should edit the stream labels of
your unit process so that they are the same as those in Figure 6-1. Labels can be
edited via the Labels... item of the object's process menus. The control-splitter
unit process will be used to simulate a bypass weir.

Figure 6-1 The Define Function Layout

2. Set the clarifier operational parameters by setting the recycle fraction as 80% of
the influent flow rate. This is done through the clarifier's Input Parameters >
Operational menu. Switch ON the proportional recycle switch and in the space
next to location to which recycle is proportional replace `blank’ with the
name of the influent stream to the aeration tank. In Figure 6-1 this is labeled
`inf’. The default value for the recycle fraction is already 0.8 so it is not
necessary for you to change it. These changes to the operational parameters are
depicted in Figure 6-2.

Page 67
GPS-X TUTORIAL GUIDE

3. Specify a value for the pumped flow (which will be used as the wastage rate) by
changing the default pumped flow value from 40 m3/d to 100 m3/d. Accept this
form.

Figure 6-2 Proportional Recycle Set-up

Defining Mass Flows


4. Specify a mass flow on the effluent solids using the Define feature. This mass
flow is defined as the effluent suspended solids multiplied by the effluent flow
rate. Click on the inverted triangle to the immediate right of the f(x) symbol on
the Define button to display the Define drop-down menu. Select Mass Flow from
the list, and the Status Bar at the bottom of the main window will indicate Mode:
Define - Mass Flow. (see Figure 6-3)

Right-click the plant effluent stream leaving the final clarifier (se label) and
choose the Defined Variables > Composite Variables menu item. Tag total
suspended solids and Accept this form. Repeat this procedure for the total
suspended solids in the plant bypass stream, and for suspended solids in the
stream labeled finaleff.

Page | 68
THE DEFINE FUNCTION

5. Exit Define Mode by clicking on the Define button again to uncheck the Define
Mode checkbox. The Status Bar message should revert to Mode: Edit.

6. You should now Save the model and then recompile it by clicking on the
Simulation button

Figure 6-3 Defining a Mass Flow

7. Create a new output graph as described in Tutorial 1 and set-up the three mass
flows on a graph. Right-click on the clarifier se stream and select the Output
Variables > Defined Variables > Mass Flow menu item. Drag the Mass Flow.total
suspended solids variable to an output graph and Accept this form. Repeat this
procedure for the bypass and the finaleff streams so that all three mass
flows are displayed on the same output graph. Set the minimum and maximum
mass flows on that graph to 0 and 1,000 kg/d respectively (see Figure 6-4).

Page 69
GPS-X TUTORIAL GUIDE

Figure 6-4 Mass Flow Output Graph Set-up

8. Place the influent flow rate on an input control window as described in


Tutorial 1. Set the minimum flow to 0 m3/d and the maximum flow to
10,000 m3/d.

9. Autoarrange the windows and run a 20-day dynamic simulation.

10. Increase the influent flow rate and notice that when the influent flow rate is
above 2000 m3/d (the default pump flow rate for the CONTROL SPLITTER object),
some flow will begin to bypass the plant and show up in the bypass stream. You
can try changing the bypass flow limit by increasing the pumped flow rate in the
CONTROL SPLITTER object. To prevent having to recompile the model, this must
be done either by defining a scenario or by placing the bypass pump flow on an
input control window.

11. Re-run the simulation and try to reduce the total mass flow of solids discharged
to the receiving water.

Defining an SRT
In this section you will learn how to calculate and display SRT, the solids residence time in
the system.

12. Click on the Modelling button and click on the Define button. If the SRT
Manager window does not pop-up, pull down the Define options menu with the
inverted triangle to the immediate right of the f(x) symbol on the Define button.
Select Solids Retention Time from the list, and the Status Bar at the bottom of
the main window will indicate Mode: Define – Solids Retention Time, and the
SRT Manager window will be displayed.

Page | 70
THE DEFINE FUNCTION

13. Define a SRT calculation by clicking on the “+” button immediately below the left-
hand window in the SRT Manager menu. You will be prompted for a unique
name for the SRT calculation. Enter srttank and click OK. A new blank SRT
equation will be shown in the right-hand window (see Figure 6-5).

Figure 6-5 Defining the SRT Equation


14. Click on the aeration basin in the drawing board to start defining the SRT
equation. You may need to move the SRT Manager window out of the way to
access the aeration basin on the drawing board. You will be prompted to select
which of the reactors within the plug-flow tank are to be included in the SRT
equation. Leave all reactor selected and click Close.

There are two parts to the SRT equation. The numerator is the mass section of
the equation, and it includes the mass of solids held in each tank. Typically SRT
calculations only include the mass of solids held in the aeration basin, but it is
also possible to calculate SRT by summing the mass in the aeration basin and the
final clarifier. While the SRT equation is shown, every time you click on a tank the
mass of solids in that unit process will be included in the SRT calculation. As you
first pointed at the aeration basin, the mass of solids in the aeration basin is
already included in the calculation. If you click on the clarifier, its label (se) is
added to the numerator of the equation indicating that the mass of solids
contained in the clarifier is now part of the SRT calculation. If you click on the
clarifier again, the label (se) will be removed from the equation and the mass of
solids in the clarifier will not be included in the calculation.

Page 71
GPS-X TUTORIAL GUIDE

You also need to define the denominator part of the equation, the excess solids
mass flow lines that are used to calculate SRT. This is done by pointing to the
flow lines which convey solids out of the system. Typically this will only include
the waste flow. If you point to the waste flow line (the cursor will change to the
block connector arrow), you will see a label representing the waste flow line, was,
appearing in the denominator of the SRT equation. For this example, we will also
include the solids flux in the effluent line by clicking on the clarifier effluent
stream (labeled se). The SRT equation should now look like Figure 6-6:

Figure 6-6 SRT Manager Window

15. Close the SRT Manager window to accept the equation. Click on the Define
button menu to turn OFF Define Mode.

16. Save the model and then recompile it by clicking on the Simulation button.

17. Display the new SRT variable on a graph by clicking on the Define button (which
has now changed to SRT) to bring up the SRT Manager window.

As described in Tutorial 1, drag the SRT variable directly from the SRT Manager
window to a new output graph and assign it the appropriate max/min values in
the Output Graph Properties (e.g. 0 to 30 days).

Page | 72
THE DEFINE FUNCTION

Figure 6-7 Displaying SRT on an Output Graph

18. Put the wastage flow rate on an input control window as described in Tutorial 1.
It is located in the clarifier’s Input Parameters>Operational form.

19. Try running a few simulations, observing the SRT as you change the amount of
solids being wasted out of the system. After you are finished, click on the
Modelling button.

Defining Averages
The procedure for defining averages is similar to setting up mass flow calculations. In
addition, averaging calculations can also be applied to a defined mass flow, SRT, or F/M
ratio. Here, you will apply averaging calculations to the Mass Flow in the discharge
stream defined above.

20. Click on the Define button and select Daily Average. Now right-click on the
finaleff stream and select the Defined Variables > Defined Variables > Mass
Flow menu item. Tag the mass flow variable and Accept the form. You have now
set up a daily average calculation for the mass flow of suspended solids in the
finaleff stream.

Page 73
GPS-X TUTORIAL GUIDE

21. Use the same procedure and define a moving average for the mass flow of
suspended solids in the finaleff stream. Click on Define button and select
Moving Average. Now right-click on the finaleff stream and select the
Defined Variables > Defined Variables > Mass Flow menu item. Tag the mass
flow variable and Accept the form. Exit Define Mode by clicking on the Define
button again to uncheck the Define Mode checkbox. The Status Bar message
should revert to Mode: Edit

22. Save the model and then recompile it by clicking on the Simulation button.

23. Create a new output graph as described in Tutorial 1 and set-up the moving
average and daily average for display. Use a maximum limit of 1,000 kg/d for
both variables. You will notice in the display menu for the moving average (from
the finaleff stream, Output Variables > Defined Variables > Moving
Average) that a number will appear to the right of the variable name (see Figure
6-8). This number represents the number of days that are used in each moving
average calculation. Note that you must be in Modelling mode to edit this # of
Days value

Figure 6-8 Moving Average

24. Run the model and change the influent and wastage flow rates to observe the
moving and daily averages.

Controlling SRT with Waste Pump Rate


When defining a SRT equation, you have the option to create a process controller for SRT.
This controller will adjust the waste flow rate to achieve a given SRT setpoint. To set the
SRT controller, click on the Define button (in Modelling Mode) to bring up the SRT
Manager window. Select a SRT to control, and click on the “Estimate WAS using set SRT”
option, as shown in Figure 6-9.

Page | 74
SENSITIVITY ANALYSIS

Figure 6-9 Controlling WAS using SRT Setpoint

Enter the desired SRT (in days) into the Set Point Value field, and select the desired
wastage flow to be manipulated by choosing the appropriate flow stream label from the
drop-down list “Controlled Flow”. Only one SRT can be controlled at a time via this
method. If multiple SRT controllers are required (e.g. for plants in parallel) then a PID
control loop can be used in the pump control section of the secondary clarifier or a
toolbox object.

Once complete, go to Simulation Mode, and the model will need to be rebuilt. Run
simulations at various SRT setpoints to observe required WAS flowrate to achieve the
desired SRT.

Page 75
GPS-X TUTORIAL GUIDE

TUTORIAL 7

Sensitivity Analysis

Problem Statement
With any model, one of the first exercises to carry out is a sensitivity analysis of the
model parameters. There are two reasons for doing so: 1) to validate the model results
and 2) to identify parameters to be adjusted during calibration. The former reason
should allow the modeler to develop some confidence in the model so that it behaves in
an expected manner. For example, lowering the air flow rate to the aeration basin should
result in a lower dissolved oxygen concentration. The latter reason for performing a
sensitivity analysis, parameter identification, is useful because it helps determine the
parameters that have the most impact on the model response. We do not want to adjust
parameters during a calibration run that have little effect on the model behavior.

After the model is calibrated and verified, sensitivity analyses are useful for other
reasons. Mathematical models can be revealing, sometimes allowing us to explore
operational strategies that might never have been contemplated otherwise. In this
chapter, you will explore the steady-state and dynamic sensitivity of a basic model.

Objectives
The purpose of this tutorial is to see how we can extract as much information as possible
from a GPS-X model. By the end of this tutorial you should have developed a working
knowledge of the Analyze functions. This includes setting up and running steady state,
phase dynamic, and time dynamic sensitivity analyses. By completing this tutorial, you
will also learn how to interpret the results from these simulations.

Page | 76
SENSITIVITY ANALYSIS

Setting up the Layout


Because this GPS-X feature requires multiple simulations, for demonstration purposes the
work will be carried out on a simple model consisting of an influent, a CSTR, and a circular
final clarifier. The layout should resemble that shown in Figure 7-1, with a codstates
influent model, mantis CSTR model and simple1d clarifier model. Save the model and
then recompile it by clicking on the Simulation button.

Setting up the Parameters for Analysis


1. Create a new scenario and set up a sinusoidal influent flow and load pattern by
specifying Sinusoidal for both the influent Flow > Flow Data > flow type
parameter and the influent Composition > Load Type Options > loadtype
p
a
r
a
m
e
t
e
r
.

Figure 7-1 Layout for the Tutorial

Page 77
GPS-X TUTORIAL GUIDE

2. Place the influent flow and the air flow into aeration tank on an input control
window. The influent flow variable can be found in the influent object
Flow >Flow Data form, and the air flow into aeration tank can be found in the
CSTR object Input Parameters > Operational form. Also, from the specify oxygen
transfer by… drop-down menu (found under the Aeration Setup menu), select
Entering Airflow and set the air flow into aeration tank to 15,000 m3/d. Put
both parameters on the same input control, with limits of 0-10,000 m3/d for the
influent flow and 10,000-25,000 m3/d for the air flow.

3. Create output graphs for the effluent ammonia, BOD 5 and total nitrogen
concentrations, as well as the DO concentration in the aeration tank. Place
these outputs on four separate graphs. The effluent free and ionized ammonia
variable is found on the clarifier effluent stream's Output Variables > State
Variables form. Similarly, the total carbonaceous BOD5 concentration is found in
the clarifier effluent stream's Output Variables > Composite Variables form. The
total nitrogen concentration is found in the clarifier effluent stream's Output
Variables > Composite Variables > More… form, while the dissolved oxygen in
the aeration basin can be found in the CSTR's Output Variables > State Variables
form. Use limits of 0-30 gN/m3 for NH 3 -N, 0-30 gO 2 /m3 for cBOD 5 , 0-30 gN/m3 for
total nitrogen and 0-5 gO 2 /m3 for DO. Run a 1 day simulation (with Steady State
checked) to verify that the model is working.

Steady-State Analysis
You will now carry out a steady state sensitivity analysis of the air flow into the aeration
tank on the dependent variables that you have selected for display (NH 3 -N, cBOD 5 , total
nitrogen, DO).

4. In order to carry out the analysis, set the air flow into aeration tank as an
Analyze type in the Input Control Properties form, ensuring that there is a delta
value of 300 which sets the variable increment for the analysis (see Figure 7-2).

Page | 78
SENSITIVITY ANALYSIS

Figure 7-2 Setting up the Independent Variable

5. NAutoarrange the windows. Select Steady State from the Analyze drop-down
menu (see Figure 7-3) and then click on the Analyze icon (in the GPS-X toolbar) to
switch to Analyze mode.

6. Start a 0-day simulation (the steady state option will be checked automatically by
the software).

Observe the effect of an increase in the air flow on DO and the effluent BOD 5,
NH 3 and total nitrogen. Typical results are shown in Figure 7-4. Note that an air
flow of 20,200 m3/d results in a DO level of 2.0 gO 2 /m3. Try the analysis using
different influent flows.

Figure 7-3 Select Steady State Analysis

Page 79
GPS-X TUTORIAL GUIDE

Figure 7-4 Analysis Results

Time Dynamic Analysis


You will now carry out a time dynamic sensitivity analysis of the air flow into the aeration
tank on the dependent variables that you have selected for display (NH 3 -N, cBOD 5 , total
nitrogen, DO).

7. Select Options>Preferences>Input/Ouput and change the Number of Runs


displayed (analyze/optimize) to 7.

8. Select Time Dynamic from the Analyze drop-down menu.

9. Set the simulation time to 1-day (with Steady State checked so that the initial
conditions are at steady state) and Start the simulation. The results of this
simulation are shown in Figure 7-5.

Each successive curve on the various graphs is the result of a dynamic simulation
using a specific air flow into the aeration tank. Notice in Figure 7-5 that for
increasing values of air flow, the DO concentration in the aeration tank
increases - it also fluctuates over time because of the sinusoidal influent flow and
load patterns.

Page | 80
SENSITIVITY ANALYSIS

Figure 7-5 Typical Results from a Time Dynamic


Analysis-Seven Dynamic Runs for Air Flows Ranging between
22,900 and 25,000 m3/d in Increments of 300 m3/d.

Phase Dynamic Analysis


You will now carry out a phase dynamic sensitivity analysis of the air flow into the
aeration tank on the dependent variables that you have selected for display
(NH 3 -N, cBOD 5 , total nitrogen, DO).

10. Select Phase Dynamic from the Analyze drop-down menu.

11. Set the Simulation time to 1-day (with Steady State checked so that the initial
conditions are at steady state) and Start the simulation.

Page 81
GPS-X TUTORIAL GUIDE

This type of analysis allows you to run the same dynamic simulation as in the
previous step. The only difference is in the graphical display. Here the results will
be plotted against the analyze variable and not against time. The length of the
simulations will set the phase. Typical results are shown in Figure 7-6 for a
sinusoidal influent. In this case, the results are very similar to the Steady State
analysis type since the simulation was not very dynamic. The graph shows the
DO concentration after 1.0 day for an air flow of 10,000 to 25,000 m3/d (as
opposed to showing the steady-state value at time t=0 when carrying out the
Steady State analysis.)

Figure 7-6 Typical Results from a Phase Dynamic Analysis

Page | 82
PARAMETER OPTIMIZATION

TUTORIAL 8

Parameter Optimization

Problem Statement
Model calibration and verification is one of the most important components of any
modeling project. Model calibration, also known as parameter estimation, is defined as
the process of adjusting model parameters such that the difference between observed
and simulated results is minimized. For example, if the difference between observed and
simulated effluent suspended solids is too large, it is likely that you will want to adjust
some of the model parameters.

GPS-X provides a very convenient way of adjusting the model parameters, based on a
non-linear dynamic multi-parameter optimization algorithm (Nelder-Mead simplex
method).

In this example, the estimation of two kinetic parameters (heterotrophic growth rate and
half saturation constant) is carried out in order to fit the model-predicted soluble
substrate concentration with the measured data. Although this is a simple example,
using only a CSTR unit process, the procedure outlined below is the important subject.

Objectives
The purpose of this tutorial is to develop a basic understanding of parameter estimation
using GPS-X. After this tutorial you will be able to target variables that you are interested
in fitting to the data, select the model variables to be adjusted and specify the form of the
objective function. Other optimizer variables such as termination criteria and number of
data points will be explained in this tutorial.

Page 83
GPS-X TUTORIAL GUIDE

Initial Manual Calibration


1. Develop a simple layout (in the CN Library) consisting of a single CSTR using the
mantis process model.

2. Set the initial readily biodegradable substrate concentration to 200 gCOD/m3


from the first page of the initial concentrations form
(Initial Conditions>Initial Concentrations (see Figure 8-1)). Next, from the Specify
Oxygen Transfer by… drop-down menu, select Entering Airflow and set the air
flow into aeration tank to 40,000 m3/d
(found in the Input Parameters > Operational form)

Figure 8-1 Initial Concentrations

3. Change the Date & Time at t = 0 by selecting the


Options > General Data > System > Input Parameters > Simulation Setup form.
Click on the date and time at t=0 array [(...)] and change the year to 2010, the
month to 6, and the day to 15. Change the Communication interval to 0.01 days.
Lastly, using the appropriate ON-OFF control switch, set the Show Process
Warnings (found under the Consistency Check menu) to OFF and set the Apply
Aeration Limits (airflow per diffuser, found under the Aeration Limit Settings
menu) to OFF.

Page | 84
PARAMETER OPTIMIZATION

4. Save the model with the name ‘tutorial 8’ and recompile it by clicking on
the Simulation button.

5. Place the effluent readily biodegradable substrate on an output graph, which


can be found in the CSTR effluent stream's
Output Variables > State Variables form. Use limits of 0-200 gCOD/m3 for the
output graph.

6. Run a 0.25-day simulation (make sure Steady State is NOT checked.)

You will now optimize two kinetic parameters in order to obtain the best fit
between effluent soluble substrate data and simulation results.

7. Place the heterotrophic maximum specific growth rate and the readily
biodegradable substrate half saturation coefficient on an input control window
with limits of 0.5-5 d-1 for the growth rate, and 0.5-10 gCOD/m3 for the half
saturation coefficient. These parameters can be found in the CSTR's
Input Parameters > Kinetic form.

The observed data from the plant is saved in a file called


tutorial8_optimize_2010_6_15.xls. Make sure you have this file in
the directory where you are saving your layout. You can copy it from the
c:\gps-x60\layouts\18tutorials\tutorial08 directory.

8. Try re-running the simulation, manually changing the growth rate and half
saturation parameters with the goal of minimizing the difference between the
simulated and measured data.

Automatic Calibration Using the Optimizer


After manually calibrating the model in the previous section (i.e. adjusting the
heterotrophic maximum specific growth rate and readily biodegradable substrate half
saturation coefficient parameters using the sliders and re-running the simulation), you
will now automate the calibration process of fine-tuning these parameters.

NOTE: It is always advisable to carry out a manual calibration first in order to


determine the effects of parameters on the simulated response before carrying out
an optimization.

Page 85
GPS-X TUTORIAL GUIDE

9. Set up the independent variables (the two kinetic parameters) in the Input
Control Properties form as Optimize types (see Figure 8-2). The Min and Max
values are used as bounds on the independent variable.

Figure 8-2 Independent Variables Setup


10. Click on the Modeling button, then select the Time Series menu item from the
Type menu found in the Optimize drop-down menu. (see Figure 8-3)

Figure 8-3 Choosing Time Series Optimization

11. Select the Maximum Likelihood option in the Objective Function sub-menu of
the Optimize drop-down menu. See the GPS-X Technical Reference for details on
the Maximum Likelihood objective function.

12. Switch to Optimize Mode by clicking on the Optimize icon or by clicking on


Optimize Mode in the Optimize drop-down menu.

Page | 86
PARAMETER OPTIMIZATION

13. The Target Variables must now be identified by tagging them in the Target
Variables forms. The menu items which were labeled Output Variables
previously (when in edit mode) are now labeled Target Variables. In this example
we will use the effluent readily biodegradable substrate concentration as the
target variable. This variable is located on the CSTR effluent's Target Variables >
State Variables form. After tagging this target variable you can display it and any
other target variables by selecting the Target Variables... menu item from the
Optimize drop-down menu (in this case you should see the form shown in Figure
8-4). Switch back to Edit mode by clicking on the Optimize icon. The Status Bar
message should revert to Mode: Edit.

Figure 8-4 Selected Target Variables

NOTE: While in optimize mode you cannot select Output Variables for
display on output graphs. To do so, first turn off the optimize mode by
clicking on the Optimize icon or by clicking on Optimize Mode from the
Optimize drop-down menu.

14. Save the model and then recompile it by clicking on the Simulation button.

Once the model has been recompiled with the optimize-type input controls and
appropriate target variable specified (i.e. readily biodegradable substrate), you
should click on the Modelling button so that you can set some of the optimizer
parameters in the
Options > General Data > System > Input Parameters > Optimizer form. You can
also access this form by right-clicking anywhere on the drawing board where
there are no objects, as shown in Figure 8-5.

Page 87
GPS-X TUTORIAL GUIDE

Figure 8-5 Choosing Optimizer System Parameters

15. In this form, you must specify the number of Optimized Parameters, in this
case 2, followed by the Number of Data Points that you wish to use (typically you
would enter the number of rows in the data file). In this case, enter 26 for the
Number of Data Points.

Four different optimizer termination criteria can also be set. For this example, the
default termination criteria are sufficient. For an explanation of the termination
criteria see the GPS-X Technical Reference.

16. In the Optimizer form, switch the Detailed Statistical Report parameter ON so
that a statistical analysis is printed to the Command window.

17. In the Maximum Likelihood sub-section of the Optimizer form, switch the
Heteroscedasticity Model to ON. The Heteroscedasticity Model is a power-law
variance model that accounts for non-constant measurement variance. Click on
the Heteroscedasticity Parameters (...) button and enter a value of 2 for the
Heteroscedasticity Parameter. This value signifies that we are assuming that the
measurements have a constant relative error. The Heteroscedasticity Parameter
is the exponent used in the power law.

Page | 88
PARAMETER OPTIMIZATION

18. In the Confidence Limits sub-section of the Optimizer form, switch the Printing
of Confidence Limits Parameter to ON. When this switch is ON, confidence limits
are provided for the parameter estimates in the Command window at the end of
the optimization. The confidence level for the confidence limits is set by the
Confidence Level for Confidence Limits Parameter. By default it is set to 0.95
which corresponds to 95% confidence limits. Note that when the printing of
confidence limits is switched ON, the variance-covariance and correlation
matrices are also reported in the Command window. The correlation matrix
shows the correlation between the estimated parameters.

19. In the Portmanteau sub-section of the Optimizer form, switch the Portmanteau
test on weighted residuals parameter to ON. The Portmanteau test checks for
serial correlation (i.e. trends) in the residuals. The residuals are the differences
between the measured values and the model predictions at each data point. If
there are trends in the residuals, then the fitted model does not account for all
the non-random variability in the data. The Portmanteau test is a type of model
adequacy test.

Remember to Accept the changes in the Optimizer form.

NOTE: The lack of fit test is not used in this example because we do not have
replicate measurements.

20. Save the model and then recompile it by clicking on the Simulation button.
Autoarrange the windows.

21. Switch to Optimize Mode by clicking on the Optimize icon in the GPS-X Toolbar.

22. You can display the Command window at this point if desired, but keep in mind
that it will slow down the optimization. The Command window can be opened by
selecting this option from the Simulation Control drop-down menu on the
Simulation Control tool bar.

23. Set the Stop time to 0.25 days, the Communication Interval to 0.01 days, and
Start the simulation. (Steady State should NOT be checked)

Page 89
GPS-X TUTORIAL GUIDE

At each optimization iteration, GPS-X plots the simulation results (i.e. predicted
values) that correspond to the current parameter values. It retains the 10 most
recent simulations on the graph. The simulation results are shown by a black line
and the data are shown by red markers.

Note that the initial parameter values used in the optimization are the default
values found in GPS-X.

The optimization is complete when the Simulation Time counter stops changing
and the Solution Report is printed to the Command window. The solution report
includes the final parameter values and the results of the statistical tests.

A plot of the fitted model and the measured data is shown in Figure 8-6.

Figure 8-6 Results of the Optimization

Page | 90
BASIC CUSTOMIZATION

TUTORIAL 9

Basic Customization

Problem Statement
No wastewater treatment plant modeling/simulation tool can be general enough to
automatically handle ALL conceivable plant layouts or desired variables. So, GPS-X
facilitates model layout customization. This is an advanced feature of GPS- X and requires
a basic understanding of ACSL, the simulation language upon which GPS-X is based. The
potential of the tool will be demonstrated using the following simple example.

In this tutorial you will add two equations to calculate the specific oxygen uptake rate
(SOUR) for the first stage of the plug-flow tank. One of the equations will assume an ideal
oxygen uptake rate (OUR) measurement and the second will simulate measurement noise
on the oxygen uptake rate measurement. This variable is often used for toxicity detection
and in process control strategies.

Objectives
This tutorial is designed to introduce you to the steps required to input your own code for
a specific plant layout. You will learn how to setup the GPS-X interface, allowing you to
input and output these customized variables as if they were part of the original layout.

Page 91
GPS-X TUTORIAL GUIDE

Setting Up and Customizing a Layout


1. Open the layout completed in Tutorial 1 and save it as `tutorial9’ using the
Save As... command from the File menu. If you no longer have a copy of this
layout you will need to recreate it. The layout for this tutorial includes an influent
object, a plug-flow tank and a circular secondary clarifier and is shown below in
Figure 9-1

Figure 9-1 Layout

2. Change the influent flow type by selecting Flow Data from the Flow menu of the
influent object. This will open a form entitled Flow Data. Click on the inverted
triangle and select Sinusoidal. Accept the form. Next, from the Specify Oxygen
Transfer by… drop-down menu, select Entering Airflow and set the air flow into
aeration tank to 30,000 m3/d (found in the Input Parameters > Operational
form).

3. Save the model and then recompile it by clicking on the Simulation button.

Page | 92
BASIC CUSTOMIZATION

4. Create a new output graph as described in Tutorial 1 and set-up the influent flow
and the oxygen uptake rate in the first tank of the plug flow tank on the same
graph. The influent flow can be found in the Output Variables>Flow form of the
influent object and the oxygen uptake rate in the first tank can be found in the
Output Variables>Internal Variables>Actual Oxygen Uptake Rate> [(…)] form of
the plug flow tank (see Figure 9-2). In the Output Graph Properties window, set
the minimum OUR to 250 mgO 2 /L/d and the maximum OUR to 1,500 mgO 2 /L/d.
Set the minimum flow to 0 m3/d and the maximum flow to 10,000 m3/d.

Figure 9-2 Selecting the Oxygen Uptake Rate for Display

5. Run a 10-day dynamic simulation (with the steady-state box checked) to ensure
that the model is correctly set-up. You should be able to produce a graph similar
to Figure 9-3. Once this is complete, click on the Modelling button, so that you
can customize the layout code.

Page 93
GPS-X TUTORIAL GUIDE

Figure 9-3 Example Dynamic Simulation

6. Open the ‘tutorial9.usr file by choosing the


Options>General Data>User Files>Macros… menu item. (see Figure 9-4).

Figure 9-4 Macros… Menu Item

Page | 94
BASIC CUSTOMIZATION

In this file, which is generated when you save the layout for the first time, there are a
number of sections separated by asterisks. They correspond to the different sections of
the ACSL program structure. In this example, you will add new code to the DERIVATIVE
SECTION as shown in Figure 9-5.

Figure 9-5 The tutorial9.usr File

Page 95
GPS-X TUTORIAL GUIDE

In the DERIVATIVE SECTION, four new variables are calculated, noise, ourwithnoise,
sourone and sourtwo, from the actual oxygen uptake rate and the VSS in the first stage of
the plug-flow tank. The cryptic variable name for the actual oxygen uptake rate can be
found in the Output Variables > Internal Variables > actual oxygen uptake rate > [(...)]
form of the plug-flow tank (see Figure 9-2). Moving the mouse pointer over the variable
name will display a tooltip with the variable description and the variable's cryptic variable
(see Figure 9-6). The cryptic variable name for the mixed liquor volatile suspended solids
can be found in the Output Variables > Composite Variables > mixed liquor volatile
suspended solids > [(...)] form of the plug-flow tank.

Figure 9-6 Displaying the Cryptic Variable Name

The variable noise makes use of an ACSL command, GAUSS to simulate measurement
noise.

The method by which user defined constants are setup for input into GPS-X requires the
use of another file named ‘tutorial9.con.’

7. Open the ‘tutorial9.con’file by choosing the


Options>General Data>User Files>Constants… menu item. This file allows you to
setup the input variables on the same type of input control windows as the other
GPS-X variables. For this example, the ‘tutorial9.con’file is shown below
in Figure 9-7.

Page | 96
BASIC CUSTOMIZATION

Edit the ‘tutorial9.con’ file, adding the code shown in Figure 9-7. In this
file Noise Variables is the text string that will appear under
Options > General Data > User > Input Parameters, as shown in Figure 9-8. The
other important additions to the file are the keyword constant, signifying that this
variable is an ACSL constant; the cryptic variable names mean and stdev, equal
to assigned default values; a descriptive variable name for each within
exclamation marks before and after the name; and the units (if any) for the
variables.

Figure 9-7 The tutorial9.con File

Figure 9-8 User Menu

Page 97
GPS-X TUTORIAL GUIDE

8. Open the ‘tutorial9.var’by choosing the


Options>General Data>User Files>Output Variables… menu item. This file allows
you to make new variables available for output. As shown in Figure 9-9, and
similar to the ‘tutorial9.con’file, a Menu Item followed by a list of
variables is included. The difference between this file and the
‘tutorial9.con’ file is that here, the keyword display is used instead
of the keyword constant, and the variable is not assigned any default value as
it will be calculated by GPS-X.

Figure 9-9 The tutorial9.var File

9. After modifying these three files, Save the layout. You will need to close the
tutorial9 layout (use File>Close) and reopen the layout. (use File>Open). This
process re-reads the custom code you’ve entered. Now you can recompile the
layout by clicking on the Simulation button.

10. Place the Average Measurement Noise and the Measurement Noise Standard
Deviation on an Input Control window. These variables can be found in the
Options>General Data>User>Input Parameters>Noise Variables form. In the
Input Control Properties form, set the minimum average noise to 50 gO 2 /(m3.d)
and the minimum measurement noise standard deviation to 0 gO 2 /(m3.d) and
the maximum measurement noise standard deviation to 100 gO 2 /(m3.d).

Page | 98
BASIC CUSTOMIZATION

11. Create a new Output Graph as described in Tutorial 1 and set up the two new
SOUR variables on this graph. The SOUR variables can be found in the
Options>General Data>User>Output Variables>Uptake Variables form. In the
Output Graph Properties form, set the minimum SOUR to 0 mgO2/(gVSS.d) and
the maximum SOUR to 1,000 mgO 2 /(gVSS.d). Place the OUR with noise variable
(ourwithnoise) on the graph created in Step 4 of this tutorial. The OUR with noise
variable can be found in the
Options > General Data > User > Output Variables > Uptake Variables form. In
the Output Graph Properties form, set the minimum OUR to 250 gO 2 /(m3.d) and
the maximum OUR to 1,500 gO 2 /(m3.d) for this variable.

Running Simulations
12. Autoarrange the windows and run a 10-day dynamic simulation with the steady-
state box checked. You should produce an output similar to Figure 9-10.

13. Vary the noise parameters with the Input Control windows and observe the
impact on the output. Try running several simulations using different settings.

Figure 9-10 Running the Simulation

Page 99
GPS-X TUTORIAL GUIDE

TUTORIAL 10

Dynamic Parameter Estimator (DPE)

Problem Statement
With many of the dynamic models used in GPS-X most of the model parameters are
assumed to be constant over the entire calibration period. For example, the clarifier's
flocculent zone settling parameter is normally set to one specific value for the entire
simulation. One reason for doing so is that it is difficult to determine or identify the
changes in this parameter over time since it is difficult to measure on-line. The best the
modeler can do is assume that the parameter doesn't change over the simulation period,
and therefore use only one value to fit the target or measured data.

A more rigorous approach, however, might be to try to fit the measured data by varying
the parameter over the simulation period. This has two advantages: a better agreement
between the model and data, and an indicator of the dynamic response of the parameter.
Of course this technique assumes that the measured data is relatively free of error.

Objectives
After completing this chapter you should be able to setup and run the dynamic parameter
estimator (DPE). The GPS-X Advanced Tools module is required to complete this tutorial.

Page | 100
DYNAMIC PARAMETER ESTIMATOR

Setting Up the Layout


1. Open the 10realplant layout from the
\gps-x60\layouts directory

2. Click on the Modelling button and modify this layout, deleting everything
downstream of the combiner after the primary clarifier. The layout should look
like the one shown in Figure 10-1. Use the Locator as necessary to adjust the
layout view

Figure 10-1 Layout for DPE

3. Save the model and then recompile it by clicking on the Simulation button.

4. Remove the primary effluent ammonia variable from the Primary Eff NH3 & TSS
Graph by right clicking on the variable and selecting this option (using the drop-
down menu), as shown in Figure 10-2. Also, Open the Output Graph Properties
form, and change the max value for the primary effluent [pe] suspended solids
from 1000 to 300g/m3, as shown in Figure 10-3. Remember to Accept the form
when finished.

Page 101
GPS-X TUTORIAL GUIDE

Before continuing, you should also delete all Input Control windows and Output
Graphs that do not pertain to the influent flow and composition, and the primary
effluent (i.e. Input Control windows and Output Graphs with no variables
assigned to them.)

Figure 10-2 Remove Graph Variable

Figure 10-3 Output Graph Setup

5. Autoarrange the windows. Select the Calibration scenario from the Scenario
drop-down menu on the Simulation Control tool bar.

6. Run a 4-day dynamic simulation with the steady-state box checked.

The graph of the primary effluent TSS shows a reasonable fit with the real
measured data but there is considerable room for improvement. These results
are shown in Figure 10-4.

Page | 102
DYNAMIC PARAMETER ESTIMATOR

Figure 10-4 Primary Effluent TSS

Setting Up the DPE


At this point, it is desirable to improve the fit between the primary effluent TSS and the
data by optimizing the flocculent zone settling parameter as it varies with time

7. Click on the Modeling button and select the Optimize>Type>DPE mode. Then
click on the Optimize icon to switch to optimize mode. The status bar at the
bottom of the GPS-X window should display Optimize DPE on its right hand side.

8. Specify the primary effluent TSS concentration as the target variable for the
optimization. To do this, simply tag the appropriate variable on the upper
influent connection point of the combiner
Target Variables > Composite Variables form. Note that while the Optimize
mode is on, the menu item that was formerly labeled Output Variables has
changed to Target Variables (see Figure 10-5). Switch back to Edit mode by
clicking on the Optimize icon. The Status Bar message should revert to
Mode: Edit.

9. Under the Options>General Data>System>Input Parameters>Optimizer menu,


set a DPE timewindow of 0.4 days. In addition, se the Parameter Tolerance to
0.001.

10. Save the model and then recompile it by clicking on the Simulation button.

Page 103
GPS-X TUTORIAL GUIDE

Figure 10-5 Tagging the Target Variable

11. Place the flocculent zone settling parameter, which is found in the
Primary Tank Input Parameters > Settling form, on the "Pump Controls" Input
Control Window. In the Input Control Properties form, set the Min to 0.0001
and the Max to 0.005 m3/gTSS. Lastly, select the Optimize type of control for this
parameter.

12. Once the Optimize Control is setup, click on the Modelling button. Save the
model and then recompile it by clicking on Tools > Build. Once the model is
recompiled, click on the Simulation button to go into Simulation mode.

13. Place the DPE timewindow, which is found under the


Options > General Data > System > Input Parameters > Optimizer form, on the
"Pump Controls" input control tab. In the Input Control Properties form, set the
Min to 0 and the Max to 4. Lastly, make sure that the Slider type of control is
selected for this parameter.

Page | 104
DYNAMIC PARAMETER ESTIMATOR

14. On the overflow stream from the primary clarifier, select


Output Variables > Input Parameters > Settling and place the flocculent zone
settling parameter on a new Output Graph. In the Output Graph Properties
form, set the Min value to 0.0001 m3/gTSS and the Max value to 0.003 m3/gTSS.
Accept this form. Right-click on the graph and change the title of this graph to
PE - Settling Parameter in the Rename Output Graph form.

Running the DPE


15. Autoarrage the windows. Select the Calibration scenario and check steady-state
on the Simulation Control tool bar.

16. Select Optimize>Type>DPE and then click on the Optimize icon to switch to
Optimize Mode.

17. Set the Simulation time to 4 days and Start the optimization.

The results are shown in Figure 10-6 and Figure 10-7. Try repeating the
simulation with a shorter timewindow or tighter convergence criteria
(parameters found in the
Options>General Data>System>Input Parameters>Optimizer form.)

Figure 10-6 DPE Results

Page 105
GPS-X TUTORIAL GUIDE

Figure 10-7 Flocculant Parameter

Page | 106
MONTE CARLO ANALYSIS

TUTORIAL 11

Monte Carlo Analysis

Problem Statement
When developing a plant model we may wish to not only explore what loads a plant will
fail under, but the frequency with which these failures might occur. While linear analysis
can tell us at which points the plant will fail Monte Carlo analysis allows us to determine
the frequency with which the plant will fail.

Monte Carlo analysis is also useful in exploring plant performance under different design
assumptions. For example, when designing a plant you need to choose a value for the
autotrophic maximum specific growth rate and the alpha factors for your reactors.
Neither of these values can be fully known in advance, however we can approximate the
range in which these values will fall. We may know that the alpha factor for the waste
water will fall somewhere between 0.4 and 0.7 and that the probability of it being any
particular number inside this range is uniform. By assigning probabilities to the range of
values we can use Monte Carlo analyses to not only investigate the plant’s performance
over the range but the probability of the observed performance characteristics.

Objectives
The purpose of this tutorial is to develop a basic understanding of Monte Carlo analysis in
GPS-X. Upon completion of this tutorial you will be able to carry out Monte Carlo analysis
of model variables. In this tutorial we will be looking into how the D.O. in the tank reactor
and free and ionized ammonia in the plant effluent are affected by various alpha factors
and autotrophic maximum specific growth rates.

The GPS-X Advanced Tools module is required to complete this tutorial.

Page 107
GPS-X TUTORIAL GUIDE

Setting Up the Layout


1. Open a new GPS-X layout and set the library to CN Library. For this tutorial the
plant layout will consist of an influent, a CSTR, and a circular secondary clarifier.
The layout should resemble the layout shown in Figure 11-1.

Figure 11-1 Plant Layout

2. Set the Influent Model to codstates, the CSTR model to mantis, and the clarifier
model to simple1d.

3. To simulate cold winter conditions, set the liquid temperature of the plant to
10°C. Right click on an empty space on the layout and select
System>Input Parameters>Physical.

4. Configure the CSTR so that oxygen transfer is controlled by entering airflow and
NOT by a DO Controller. To do this, right click on the
CSTR Input Parameters>Operational and setting specify oxygen transfer by… to
entering airflow. Once entering airflow has been selected, change the airflow
into the aeration tank to 15000.0 m3/d.

5. Change the wastage rate of the secondary clarifier to 70m3/d. To do this, right
click on the secondary clarifier, under Input Parameters>Operational, change the
pumped flow to 70 m3/d.

6. Save the layout and compile the model.

7. Place the Autotrophic Maximum Specific Growth Rate on the Input Control Tab.
The autotrophic maximum specific growth rate can be found by right clicking on
the CSTR and selecting Input Parameters>Kinetic.

Page | 108
MONTE CARLO ANALYSIS

8. Open the Input Control Properties and chance the control type for the growth
rate from the Slider to Analyze – Monte Carlo. To the right of the drop-down
menu, a Distribution Settings button will appear. Click on the Distribution
Settings button to open the Distribution Settings Panel. From this panel we can
change the type of distribution to Normal, the mean to 0.75 and the Standard
Deviation to 0.1. Once the distribution has been set up, make the range from 0.5
to 1.2.

Figure 11-2 Input Control Properties

9. Create an Input Control for the number of Monte Carlo Runs. Right click on the
layout and select System>Input Parameters>Analyzer. Set the control type to
Slider.

10. For this tutorial, we will need separate graphs of both the autotrophic
maximum specific growth rate and the free and ionized ammonia in the plant’s
effluent. To create the autotrophic maximum specific growth rate graph, right
click on the CSTR and select the Output Variables>Input Parameters>Kinetic. To
create the free and ionized ammonia graph, right click on the effluent stream of
the secondary clarifier and select Output Variables>State Variables.

Page 109
GPS-X TUTORIAL GUIDE

11. Change the graphs’ properties to graph probabilistic Monte Carlo data. For
both graphs change the type of graph to Probabilistic (Monte Carlo) and turn on
auto scaling for all axes. This graph type will plot a histogram of our Monte Carlo
results. With the Monte Carlo graph type selected you will notice that a number
of additional options such as, number of bins and target will appear on the panel.
Target specifies a target value for this variable; in this case the concentration of
free and ionized ammonia. The greater than less than button beside the target
value allows you to specify whether you are interested in the percentage of runs
that are greater or less than the target value. The number of bins specifies the
number of bins in to be used in the histogram. For the free and ionized ammonia
graph set the target value to 10 and the number of bins to 20.

Figure 11-3 Monte Carlo Output Graph Properties

12. Click on the arrow beside the Analyze button and select Monte Carlo from the
list. Click on the Analyze button to put GPS-X into Analyze Mode. To ensure that
you are in the correct mode, the bottom right hand corner of the GPS-X window
should display Mode: Analyze – Monte Carlo.

Page | 110
MONTE CARLO ANALYSIS

13. Run the simulation. When the simulation completes you should see the
autotrophic maximum specific growth rate following the normal distribution
that was defined. Each bar in the free and ionized ammonia graph displays the
probability of that specific concentration range occurring. Try rerunning the
simulation but this time vary the numbers of runs and see how the number of
runs impacts accuracy. A small number of runs will not be sufficient to find an
accurate result; while increasing the number of runs will increase the accuracy of
the Monte Carlo results.

Figure 11-4 Autotrophic Maximum Specific Growth Rate Results

Page 111
GPS-X TUTORIAL GUIDE

14. Place the Alpha Factor for the CSTR on an Input Control Tab, set its control type
to Analyze – Monte Carlo and its distribution to Uniform. Set the range of the
Alpha Factor to 0.4 to 0.7.

15. Place the Alpha Factor and D.O. of the CSTR on separate graphs on a new
Output Tab. To create the Alpha Factor graph, right click on the CSTR and select
Output Variables>Input Parameters>Operational and click on the Diffused
Aeration’s More button. Drag the Alpha Factor (fine bubble) onto a new Output
Tab. D.O. can be found by right clicking on the CSTR and selecting
Output Variables>State Variables

16. Set both graphs to Probabilistic (Monte Carlo) autoscale both axis and set the
number of bins to be displayed on the D.O. graph to 20. Autoarrage both graphs.

17. Set the number of Monte Carlo runs to 1000 and run the simulation. Both the
Alpha Factor and the Autotrophic Maximum Specific Growth Rate will be
assigned random values falling within the defined range and conforming to the
probabilities that have been assigned to them. When the simulation completes
the probabilities for various D.O. concentrations and free and ionized ammonia
concentrations will be displayed.

Page | 112
MONTE CARLO ANALYSIS

Figure 11-5 Alpha Factor and Autotrophic Maximum Specific Growth Rate Results

The End
You have finished all the tutorials and should now be comfortable in developing model
layouts, running simulations and displaying outputs. Additional details on GPS-X models
are included in the GPS-X Technical Reference manual.

i
Reference: Marlin T.E., Process Control: Designing Processes and Control Systems for
Dynamic Performance, McGraw-Hill, 1995

Page 113

You might also like