Tutorial
Tutorial
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, 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, 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, GMI and all other Hydromantis trademarks and logos mentioned and/or displayed are trademarks
or registered trademarks of Hydromantis, 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 Sun Microsystems, Inc.
Microsoft, Windows, Windows NT, Windows 95, Windows 98, Windows 2000 and Windows ME are
trademarks of Microsoft Corporation.
TABLE OF CONTENTS
Preface..................................................................................................................... vii
Introduction............................................................................................................... vii
Intended Audience ........................................................................................... vii
How This Guide is Organized.................................................................................. viii
Modules and Libraries................................................................................... ix
Companion Documents ................................................................................. ix
Conventions ...........................................................................................................x
Resources and Support .................................................................................. xi
TUTORIAL 1...................................................................................................................... 1
Building a Plant Model ................................................................................ 1
Introduction .......................................................................................................... 1
Objectives .............................................................................................................. 2
Building a Simple Plant Layout ................................................................. 2
Selecting Object Models ................................................................................ 9
Generating Source Code and Binary Executable ........................... 13
Defining & Displaying Interactive Control Windows .................. 14
Defining a Control Window ................................................................... 14
Displaying a Control Window .............................................................. 18
Defining & Displaying Output Windows............................................. 18
Defining an Output Window .................................................................. 19
Displaying an Output Window ............................................................. 22
Organizing the Display ................................................................................ 22
Running a Simulation .................................................................................... 23
Analyzing the Plant ........................................................................................ 25
What's Next? ...................................................................................................... 27
TUTORIAL 2.................................................................................................................... 29
Editing Layouts and Using Scenarios ............................................. 29
Problem Statement .......................................................................................... 29
Objectives ............................................................................................................ 30
Expanding the Plant....................................................................................... 30
Using Scenarios ............................................................................................... 34
Generating a Static Report ......................................................................... 36
What's Next ......................................................................................................... 38
TUTORIAL 3.................................................................................................................... 39
iv Table of Contents
Preface
Introduction
GPS-X is a modular, multi-purpose modeling environment for the simulation
of municipal and industrial wastewater treatment plants. It is the world's
premier wastewater treatment plant simulator. GPS-X uses an advanced
graphical user interface to facilitate dynamic modelling and simulation. No
other software for modeling and simulation of wastewater treatment
processes provides the power and flexibility available with GPS-X. It is
state-of-the-art technology, using the most recent advances in process
modeling, simulation technology, graphics and a host of productivity tools
that simplify model construction, simulation and interpretation of results.
This allows you to examine the complex interactions between various unit
processes in your plant, interactively and dynamically. Understanding these
relationships is critical for effective design, operation and control of
wastewater treatment plants.
Intended Audience
The GPS-X Tutorial Guide is primarily intended for first-time users of GPS-
X but is also useful for experienced users who need information on a specific
feature. To understand the material in this tutorial best, you should have a
background in the fundamentals of wastewater treatment including the unit
processes in a typical wastewater treatment facility and the operation of these
processes. It is helpful if you have some knowledge of modeling and
simulation but this is not required.
viii Preface
Tutorial 3, Influent Data & Influent Advisor, examines the procedure for
entering influent data and using Influent Advisor to help debug potential
problems with influent data.
Tutorial 4, Data Input and Output, examines the procedure for saving
simulation data and reading data from an input file when you run a
simulation. The report generation feature is also examined in this chapter.
Tutorial 10, Dynamic Parameter Estimator (DPE), explains how the DPE
module can be used to estimate time-varying parameters using on-line or
historical data.
Simulator
Builder
Analyzer
Optimizer
Advanced Tools
Multi-Instance Licenses
The Simulator module is delivered with all copies of GPS-X and most users
will have ordered the Builder module option as well. The other modules are
options available to you at the time of order or at any time in the future
should you decide to upgrade your system.
Chapters 1 through 5 are useful for all users and require only the GPS-X
Simulator module. GPS-X users without the Builder module can skip the
development section of the tutorial, and simply open in the pre-built model
from the Windows `Start' menu. The remaining chapters require additional
modules as outlined below.
Companion Documents
This document is part of the GPS-X software manual set which includes:
Conventions
This manual uses the following typeface conventions:
Hydromantis has a presence on the World Wide Web. Its web site address is:
http://www.hydromantis.com
There, you will find information on the company and details about our
software, upcoming events, etc.
Building a Plant Model 1
TUTORIAL 1
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.
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.
2 GPS-X Tutorial Guide
Objectives
This tutorial covers the following topics:
Users who do not have the GPS-X Builder module should open the
tutorial1 layout located in the GPS-X tutorial directory. This file can
also be accessed from the `Start' menu. After doing this, these users should
proceed to the Defining & Displaying Interactive Control Windows (Page 14)
section and continue with the rest of the tutorial.
This chapter assumes you have installed GPS-X and supporting files on your
workstation. Refer to your workstation documentation and the GPS-X User's
Guide for information on these initial set-up procedures.
Note: If a white drawing board is not displayed, start a new file by clicking
on the New button on the tool bar.
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 43 unit process icons. Each object 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 layout.
4 GPS-X Tutorial Guide
an influent
an aeration tank
a secondary clarifier
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.
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.
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.
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 (Figure 1-6).
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
Building a Plant Model 9
Figure 1-8 Changing the labels of the process units and streams.
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.
11. Specify the plug flow tank model by repeating this procedure, but for
this object select the asm1 item.
12. Specify the secondary clarifier object model by selecting the simple1D
(non-reactive 1-dimensional clarification model) item1.
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.
Building a Plant Model 11
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 (Figure 1-11). In this tutorial we will use the
default properties for the objects you have selected with three exceptions; the
influent soluble substrate fraction, the influent biological model and the
excess sludge wastage rate from the final clarifier.
15. Change the influent soluble substrate fraction by right clicking on the
influent object, move to the Composition sub-menu and select the Influent
Stoichiometry menu-item. A data entry form will appear on the screen as
shown in Figure 1-13. Change the soluble substrate/BODultimate entry from
0.3 to 0.4 as shown in Figure 1-13 and select ASM1 from the local model
selection drop-down menu [note that changing the local model selection
ensures that the influent calculations are consistent with the down-stream
biological model in the plug-flow tank]. Click on the Accept button.
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.
17. Generate the model source and binary code by clicking on the Build
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. Click on the Accept button
when this message is displayed.
Before defining an interactive control for the influent flow, the variable must
be tagged, i.e., it must be identified as a controllable variable. This is done
by marking that variable as a control variable in its data entry form.
A data entry form will open displaying the current influent flow value. Click
on the checkbox to the left of the influent flow variable. A check mark (9)
will appear in the box as shown in Figure 1-16. The influent flow has now
been tagged as a variable that can be controlled during the course of a
simulation run. Remember to accept the changes made in the data entry form
by clicking the Accept button on the bottom right-hand corner of the form.
19. Define the control window by clicking on the arrow on the right hand
side of the Controls buttons. A drop-down menu is displayed containing the
following items:
The first menu item is used to define control windows. Select this item and a
form will be displayed entitled Controls Define. Click on the Add button and
this will insert a blank item in the bottom position of the list box. Each listed
item represents a control window. You create control windows by inserting
new items in this list. The text you enter for the item is the name that will be
displayed in the title bar of that control window.
Next, click in the text field to the right of the word Title: type in an
appropriate title for the control window (Figure 1-17). The text will appear
in the title list box.
Note the numerical value indicated in the small box next to the word Title: in
the lower left hand corner of the control window definition form. This
number uniquely identifies the control window and is referenced when
specifying the control window on which to place a control. Control windows
are always numbered sequentially, so if you have 5 control windows defined,
these will be numbered 1 to 5.
When you have finished defining the control windows, click the Accept
button. Your entries will be saved and the form will close.
20. Select the Setup... item from the Controls drop-down menu to activate
the Controls Setup form (Figure 1-18 and Figure 1-19). The Control Setup
form is used to specify the type and placement for controls linked to each of
the model independent variables you have tagged. The first 3 entries (rows)
on this form are reserved for system variable controls, which are placed on
the simulation control window. You can use this form to set minimum (Min),
maximum (Max) and control increment (Delta) values for simulation delay,
stopping time and communication interval.
The fourth line displays the previously tagged variable, which in this case is
influent flow. Click on the inverted triangle in the #: window box and a drop-
down menu will appear with the title and number of all defined control
windows. Select 1 for the control window number, 0 for minimum flow and
10000 for maximum flow (Figure 1-19). 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.
These types are discussed in more detail in a subsequent tutorial. For now,
note that the Up/Down type is used for the first three items and that Slider is
used for the influent flow item. Make sure that these types are set correctly
before proceeding. Remember to save your entries by clicking on the Accept
button.
18 GPS-X Tutorial Guide
21. Display the control window by clicking on the Controls icon. The
window shown in Figure 1-20 appears containing a slider that allows you to
change the influent flow from 0 to 10000 m 3 /d. You can move the control
window to any convenient position on the screen. You can test the slider
control by dragging the small slider button, but note that if you move the
slider bar, the influent flow value will change to the value displayed on the
control. Before proceeding, move the slider back to a position corresponding
to 2000 m 3 /d, or alternatively you may enter the value into the control with
the keyboard.
NOTE: There is a difference between data entry forms and display 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. Display variable forms do not contain this field. To
review: variables tagged on a data entry form can be placed on a control
form, whereas variables tagged on a display variable form can be placed on
graphs or saved to data files. For more information on the display and data
entry form see the GPS-X User's Guide.
A display variable form will appear as shown in Figure1-22. Tag the flow
variable by clicking in the checkbox to the left of flow. A small check mark
(9) will appear in the box as shown in Figure 1-22.
Click Accept to save the variable tagging information and close the display
variable form.
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 point1.
Right-click and select the Composite Variables item from the Display
Variables sub-menu (Figure 1-23). Tag the total suspended solids variable by
clicking on the checkbox to the left of the variable name as shown in Figure
1-23. Close the form by choosing Accept.
23. Define the display graphs by clicking on the inverted triangle on the
right hand side of the Outputs button on the tool bar. Select the Define... item
from the drop-down menu. A form will appear entitled Output Define (Figure
1-24). Select the Add button and this will insert a blank item in the bottom
position of the list box under the heading Title. Next, click in the text field to
the right of the word Title: Type in an appropriate title for the graphic
1
Display variables are defined within each object and at each of the objects connection points.
Building a Plant Model 21
window such as that shown in Figure 1-24. The text will appear in the list
box.
Unlike control windows which can contain more than one type of control,
graphics windows can contain only one type of graph. Because of this, the
graphic type specification is made in the graphic windows definition form.
By default, the graph type is X-Y (time series) but this can be changed by
making a selection from the Type: drop-down menu. To make a different
selection, click on the menu mark next to the Type: label, and select the
desired graph type. Before continuing, re-select the X-Y type so that the
results you get match the figures shown in this tutorial.
You can also use the Delete button to delete items from the list. When you
have finished defining the output windows, click on the Accept button. Your
entries will be saved and the form will close.
24. Select the Setup... item from the Outputs drop-down menu. The
previously tagged variables should appear on the Output Setup form which is
displayed. The Output Setup form, like the Controls Setup, form is used to
specify plotting attributes including the output window in which to plot the
22 GPS-X Tutorial Guide
variable, the minimum y-axis value (Min), maximum y-axis value (Max) and
whether you want to save the data which are generated during simulation
(Save).
For this tutorial, we want to plot both variables on the same graph so click on
the inverted triangle in the #: Window box and a drop-down menu with the
title and number of all defined output windows will appear. Select 1 for each
variable. Enter a minimum and maximum value for each variable, i.e., 0 and
10000 m3/d for flow, and 0 and 150 g/m3 for suspended solids (see Figure 1-
25). Accept the changes.
When you make this selection, the defined output windows will be displayed
(Figure 1-26). These windows can be moved to a convenient position.
Output windows can also be re-sized and the graphic will re-scale.
Running a Simulation
You are now ready to run the model. Before you do this, make sure the
interactive controls and output windows are displayed. The next step is to
load the model.
27. Load the model by clicking on the Load button in the Simulation Control
window.
29. Start the simulation by clicking on the Start button in the Simulation
Control window. The flow and effluent suspended solids will be displayed in
the output window.
You can now change the flow with the control window 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 6000 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
24 GPS-X Tutorial Guide
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 on the
Simulation Control window.
30. Run the simulation again, but this time adjust the influent flow by
dragging the influent flow slider away from 2000 m3/d.
NOTE: If the simulation time exceeds the stop time (Stop) the model
will halt. At that time, you have three 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; or
unload the model by clicking Unload .
Next, click on the Outputs button and select Define from the drop-down
menu. Select the Add button and insert a blank item underneath the existing
label. Click in the text field box to the right of the word Title: and type in a
title for the output window (see previous example in Figure 1-24). Click on
the inverted arrow in the box entitled Type: and from the drop-down menu
select Bar Chart.
Select the Setup... item from the Outputs drop-down menu, and specify the
#: Window, minimum and maximum for the new graphic display. Set the
minimum to 0 g/m 3 and the maximum to 10000 g/m 3 (Figure 1-29). Accept
the form.
26 GPS-X Tutorial Guide
Figure 1-29 Setting up the solids profile inside the final clarifier as an output variable.
Show the outputs and the controls, and Autoarrange them using the
autoarrange button. From the Simulation Control window, Load the model.
32. Select the Steady-State option and Start the simulation setting Stop to
one day. Figure 1-30 shows a bar chart profiling the solids distribution
inside the final clarifier.
33. Increase the influent flowrate to a higher value (for example 6500 m 3
/d) with the controller. Adjust Stop to two 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-30 Solids profile across the final clarifier. The top of the clarifier is represented by the
bars on the left, and the bottom of the clarifier is on the right.
Building a Plant Model 27
What's Next?
This tutorial covered the basic features of GPS-X. There are many additional
features which make GPS-X more powerful and flexible. The next tutorial
will expand on the layout prepared in this tutorial. GPS-X scenarios will be
introduced as a method of storing simulation setup data.
1. See the GPS-X Technical Reference for more information on these models.
2. Display variables are defined within each object and at each of the object's connection points.
28 GPS-X Tutorial Guide
Editing Layouts and Scenarios 29
TUTORIAL 2
Problem Statement
The previous tutorial examined the five major steps in a modeling study. A
special note was made of the iterative nature of modeling and simulation.
Making and running a model is rarely, if ever, a linear step-by-step process.
Model construction, calibration and refinement are part of the development
cycle. Once you see the results of a simulation, you will likely think of new
ways to alter or add to the model to improve its predictive power.
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.
30 GPS-X Tutorial Guide
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 static1 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.
Users who do not have the GPS-X Builder module can simply open in the
tutorial2 layout located in the GPS-X tutorial directory. This file can
also be accessed from the `Start' menu. Users that wish to use this pre-
compiled layout should proceed to the section Using Scenarios on Page 33.
NOTE: Before proceeding with the layout alterations make sure that
the model is not loaded
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.
1
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 Chapter 4.
Editing Layouts and Scenarios 31
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 (Figure 2-1).
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.
Editing Layouts and Scenarios 33
8. Recompile the model by clicking on the Build 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:
9. Display the Simulation Control window and Load the model from the
Simulation Control window.
10. Define a new scenario by selecting the New option from the Scenario
drop-down menu in the Simulation Control window. Type in a name for your
new scenario and Accept the form (see Figure 2-5).
11. 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 inverted triangle and select Sinusoidal.
Editing Layouts and Scenarios 35
Change the influent flow in the Data sub-section of the same form to 5000
m3/d. Accept the form. You can display the items saved with a particular
scenario by selecting Scenario > Show... from the Simulation Control menu
bar. 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 Simulation Control window (click on the inverted triangle
to the right of the Scenario: text box located at the bottom of the Simulation
Control window and select Default).
12. Define and set-up an interactive controller (slider type) for the flow
split fraction (in the "MLSS Splitter") as described in the Defining &
Displaying Control Windows section of Tutorial 1 (Steps 18-21).
Alternatively, you can use the Quick Help function by selecting Help > Quick
Help and clicking the Controls icon to display the steps to define and set-up
an interactive controller.
13. Define and set-up output graphs for the solids profiles in the new
(copied) clarifier as described in the Defining & Displaying Output
Windows section of Tutorial 1 (Steps 22-25). Alternatively, you can use the
Quick Help function by selecting Help > Quick Help and clicking the Outputs
icon to display the steps to define and set-up an output graph.
14. Define and set-up an output graph for the effluent SS for each
clarifier, and the combined effluent as described in the Defining &
Displaying Output Windows section of Tutorial 1. In each case, the total
suspended solids variable can be found in the Display Variables > Composite
Variables menu of each object's outflow stream. Display all three
concentrations on one graph.
17. Change the split fraction to 0.35 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.
18. Increase the flow to the plant to 6000 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.
19. Select the Report... item from the File menu. This will open a new,
blank window. If you select Generate from the Report drop-down menu in
this window, a text file will be displayed in the window. Click `save' to save
an ASCII copy of the window contents to the current working directory. The
name of this file includes the layout name with an extension `.rpt . The
values of all the variables in the report correspond to the values in the model
when the report was generated. Therefore, if you wish to save the
concentrations corresponding to a steady-state simulation, the report should
be generated immediately after bringing the model to steady-state. If you
wish to save the concentrations corresponding to a particular point in time
(remember that the report produces a static picture of the plant) then, run the
simulation to that time and then generate the report (Figure 2-7). By default,
all the model parameters (including physical, operational, stoichiometric,
kinetic and settling parameters, and composite and state variable
concentrations) are selected to be included in the generated report. Note that
if you wish to generate several reports for the same layout, you must rename
the report file before generating another or else you will overwrite the
previous report.
Editing Layouts and Scenarios 37
What's Next
This tutorial covered some of the GPS-X editing features as well as the
scenario and report generation features within the context of a plant
expansion analysis.
The next tutorial will examine influent data entry and the use of Influent
Advisor as a tool to help understand the interactions and dependencies in
influent data.
1. 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
Chapter 4.
Influent Data and Influent Advisor 39
TUTORIAL 3
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
The following historical data have been gathered at your plant and represent
typical average values for your influent.
40 GPS-X Tutorial Guide
2. Display the Simulation Control window, Load the model and display the
Log window by checking the Log checkbox in the View menu of the
Simulation Control window.
3. Set up a new scenario for an influent case study. Create a new scenario
named influent as described in Tutorial 2 (Step 10).
5. Enter the total carbonaceous BOD5 and total suspended solids data from
the table above into the form and click Accept.
6. Check the influent data by clicking Start with the Steady State checkbox
unchecked, and Stop: set to 0. This checks for influent state variable
calculation errors. If an influent state variable error has occurred, then a
warning message will be printed to the Log window. No error should occur
Influent Data and Influent Advisor 41
with this layout. If one is printed, refer to Tutorial 1, Step 15 and ensure the
influent is set up as described.
7. Check the entered data and the resulting calculations by accessing the
influent object's process menu, selecting the Display Variables > Composite
Variables sub-menu.
8. Move the cursor over the total COD menu item and left-click. A quick
display pop-up window will be displayed showing the current value of the
influent total COD (Figure 3-2). Compare this value to the value for the total
COD given in the table above. 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. A similar check can be done for
ammonia, by accessing the ammonia quick display in the Influent > Display
Variables > State Variables sub-menu.
9. Start Influent Advisor from the Start menu as shown in Figure 3-3. For
this program to work properly, you must Enable Macros at start-up. The
Influent Advisor introductory screen will be displayed (Figure 3-4). Please
ensure that the macro security setting in Excel is set to Medium (located in
the Tools>Macro>Security menu).
10. Select the appropriate options in the three selection boxes. As you
are using the CNP library, and ASM1 as the biological model, select CNP in
the Library box, ASM1 in the Biological Model box and click on the
BODbased button. This will display the CNP/ASM1/BODbased Influent
Advisor sheet (Figure 3-5).
Influent Data and Influent Advisor 43
11. Click on the Reset Input to Default Values button at the top of the sheet
to ensure that the sheet is displaying the GPS-X default values in all input
cells.
12. Enter 210 next to total carbonaceous BOD5, 205 next to total suspended
solids, and 0.4 next to soluble substrate/BODultimate in the User Inputs table
on the left-hand side of the sheet. Note that the values calculated for total
COD (right-hand table, third from the top) and ammonia (middle table) are in
agreement with the values calculated in GPS-X.
13. Click on the total COD value. You will notice that a formula has been
displayed in the formula box at the top of the sheet. This formula
corresponds to the formula used in GPS-X to calculate the value clicked on.
Click on other cells to see other formulas.
From the data listed in Figure 3-1, several important relationships can be
calculated. For instance:
14. Enter these values into the User Inputs table under the Stoichiometric
Coefficients sub-heading. Note that doing this seemingly results in values
further away from what you are looking for.
16. Decipher what input variables are important for the calculation of
scod. The calculated scod is much larger than the measured value so, to
decrease this calculated value it is important to know what input values to
adjust. Clicking on subsequent cells will reveal that scod is dependent on ss,
44 GPS-X Tutorial Guide
which is dependent on fss and the BOD5/BODultimate ratio in the User Inputs
table.
17. Adjust the fss value and see how the dependent values change. By
adjusting the fss value to 0.02, you will see that it is possible to achieve
reasonably close agreement between the calculated and measured scod and
cod. However, it is important to realize that this value results in a very small
ss value being calculated. This may be correct, though it is probably
unrealistically low given the BOD of 210 mg/l. As an alternative, try
adjusting the fss up to 0.1, which is in a typical range for this parameter.
18. Adjust the fbod value and see how the dependent values change. As
you adjust fbod up, you will notice that the scod value decreases. Again a
reasonable assumption will have to be made, such that the fbod is not too
high. For this case, a value of 0.8 can be used.
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.
After adjusting these values you will notice that the xnd cell is now shaded
red to indicate that xnd has gone negative. In this case you have several
options. You can, adjust total TKN, fnh, fxn or you can adjust the nitrogen
fractions of the particulate state variables. In this case (using ASM1) it is
best to stick to total TKN, fnh and fxn, unless you have a measure of these
nitrogen fractions. Note that the calculated ammonia concentration is much
lower than the measured value.
20. Adjust the total TKN up until you get an approximate agreement
between the calculated and measured ammonia. In doing so, you will have to
substantially increase the TKN to a values which for this wastewater may be
too high.
21. Increase fnh to 0.75 and adjust total TKN to get an approximate
agreement. Note that this TKN may be more in keeping with a wastewater of
this strength.
22. Return to the GPS-X influent object forms and adjust the
parameters on those forms to the values determined using Influent Advisor.
ALL PARAMETERS NOT SHOWN ON THE INFLUENT ADVISOR SHEET
SHOULD BE SET TO ZERO. Figure 3-6 and Figure 3-7 show the completed
forms.
Influent Data and Influent Advisor 45
23. Check the influent data by clicking Start with the Steady State
checkbox unchecked, and Stop: set to 0. If a warning is printed, refer to the
Influent Advisor sheet and make sure that the data has been entered correctly
into the GPS-X data forms.
24. Check the entered data and the resulting calculations by accessing
the influent object's process menu, selecting the Display Variables >
Composite Variables sub-menu. Move the cursor over the total COD menu
item and left-click. A quick display pop-up window will be displayed
showing the current value of the influent total COD. This value should agree
with the value calculated in Influent Advisor.
Model Dependency
Strictly as an exercise to demonstrate a point, you will now examine the
impact of changing the local biological model.
25. Access the influent object's process data menu and select the
Composition > Influent Stoichiometry sub-menu.
26. Change the local biological model to Mantis and Accept this form.
Influent Data and Influent Advisor 47
27. Check the influent data by clicking Start with the Steady State
checkbox unchecked, and Stop: set to 0. A warning will be printed in the Log
window.
28. Return to Influent Advisor, click on the Introduction Sheet button at the
top of the sheet.
29. Select the CNP library, the Mantis biological model and click on the
BODbased button. The appropriate sheet will be displayed. Click on the
Reset Input to Default Values button.
30. Enter the input data into this sheet as it appears on the GPS-X influent
object forms. Note that indeed as you do this xnd is negative and shaded red.
One way to fix this particular problem is to increase fxn to 0.95 from 0.9.
This redistributes the organic nitrogen from snd to xnd, and clears the
negative problem.
The reason for this difference between the Mantis and ASM1 models is the
nitrogen fractions. In ASM1, the default values are 0.086 & 0.06. In the
Mantis model, the defaults are 0.068 & 0.068. You should match the local
biological model to the biological models used downstream where possible.
This will ensure that similar defaults are used as the nitrogen fractions of
these components are not often changed from the defaults. However, if
information about these fractions is available and that information indicates
something different from the defaults, then the user should adjust the
fractions used in the reactor as well as the fractions used in the influent to
maintain consistency.
This simple exercise demonstrates how the local biological model choice is
an important component of the influent data entry.
What's Next?
You have briefly examined the procedure for entering influent data and
examining that data for possible consistencies using Influent Advisor.
Further investigation of the plant under stress conditions can be carried out.
In order to do so, the next tutorial will introduce the aspects of inputting and
outputting time series data.
48 GPS-X Tutorial Guide
Data Input and Output 49
TUTORIAL 4
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.
Objectives
This chapter covers two important and useful features of GPS-X:
3. Set up a new scenario for a step_feed case study. Create a new scenario
named step feed as described in Tutorial 2 (Step 10).
5. Next we will create a data file containing a storm that can be re-used in
order to test the plant under the step_feed scenario that was just created. In
the Output Setup window, there is a box under the column heading Save
adjacent to every item to be displayed. Tag the box next to the flow item and
Accept the window. This will save the influent flow data from any
subsequent simulation to a text-based (ASCII) data file (the file will have the
naming convention of: <layout name>_<scenario name>_<time stamp>.out,
where, <timestamp> = yyyy_mm_dd).
Figure 4-4 shows the completed Output Setup form. When you vary the
influent flow rate using the interactive controller, this flow data will be saved
to the output file and can be used as an input for future simulations.
you to develop a realistic storm, try increasing the Delay time on the
Simulation Control window to 0.5 seconds and rerun the simulation.
8. Unload the model to properly close the newly created data file. If you
look in the directory that contains your layout you will see a new file with the
name:
tutorial4_step_feed_1994_11_01.out
t qconinf
10. Save this file under the same name, but with a new file extension of
.dat rather than the original .out. If using WordPad, make sure the `Save
as type' field on the Save As window is set to `Text Document'. Figure 4-5
illustrates an example of a completed storm data file. You now have a data
file containing the same storm flows that you just simulated. Close the text
editor.
Data Input and Output 53
Figure 4-5 Editing the .out file and saving it as a .dat file.
12. Change the type of flow controller from Slider to File Input in the
Controls Setup window. Accept the Controls Setup window (Figure 4-6).
Show the Controls and Outputs, and Autoarrange the windows.
13. Load the model (if not already loaded), and select your step_feed
scenario from the Scenario: drop-down menu. Check the Steady State
checkbox and Start a two-day simulation. You will notice that the influent
flowrate slider has changed to an indicator which displays the flow values as
they are read from the data file. This is also reflected on the graph window
where the storm is reproduced exactly as it was generated (Figure 4-7).
54 GPS-X Tutorial Guide
14. Create an output window for the MLSS (found through the plug-flow
tank's effluent stream - Display Variables > Composite Variables menu),
effluent suspended solids (clarifier effluent stream - Display Variables >
Composite Variables menu) and sludge blanket height. Sludge blanket height
can be tagged in the Display Variables > Clarifier Variables menu accessed
through the final clarifier effluent stream. The outputs can all be put on the
same graph by using the same number in the Outputs Setup window. Try
running simulations with different step feed combinations.
Figure 4-7 Controller and graph showing the storm event and its impact.
Data Input and Output 55
What's Next?
You have briefly examined the procedure for using data files as input to your
simulations, as well as saving the time dynamic response (or "output") of the
model in the context of investigating plant performance under storm
conditions. Although you saved only the influent flowrate, the procedure is
identical for saving other variables such as effluent TSS, DO, etc. These
files can then be opened with other software packages for post processing or
presentation.
The next tutorial will introduce the procedure for setting up automatic
process control algorithms to simulate their implementation at a plant for
process improvements.
56 GPS-X Tutorial Guide
Using Automatic Controllers 57
TUTORIAL 5
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 control1.
Objectives
This tutorial will show you how to setup an MLSS controller to
automatically adjust the bio-solids 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.
1
For more detailed controller design, an additional GPS-X module, which uses MATLABs Control
System Toolbox, is available.
58 GPS-X Tutorial Guide
from the `Start' menu. After doing this, these users can proceed to Step 8, or
skip the section on MLSS control and proceed directly to the section on DO
control.
2. 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 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
Using Automatic Controllers 59
will appear slightly different than the ones shown in Figure 5-1and Figure 5-
2; however, you are going to modify your forms to resemble those shown.
3. Define the control variable for the MLSS controller. In the secondary
clarifier Parameter > 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. Tag the tuning constants (proportional gain, integral time and derivative
time), so that they can be set-up on an interactive controller (Figure 5-1 and
Figure 5-2).
6. Set the maximum pumped flow rate to 200 m 3 /d and Accept this form
(Figure 5-2).
7. Set the setpoint for the control variable (in the Parameters > Operational
form, Figure 5-1) to 2000 mg/l. Tag the setpoint for control variable and the
controller ON-OFF switch so that they can be set up on an interactive
controller. Accept this form, Save your layout and Build the model.
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 proportional 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) 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.
11. Activate the pumped flow control tuning mode, by creating a new
scenario in the Simulation Control window as described in Tutorial 2. In
the final clarifier 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 pumped flow value of
80 m 3 /d and a fractional step size to 0.5. This fractional step size
corresponds to a step in pumped flow rate from 80 m 3 /d to 120 m 3 /d.
Accept all the operational forms.
62 GPS-X Tutorial Guide
12. Start a 0-day steady state simulation with the newly created scenario
and turn the MLSS controller turned ON. Once this is complete, turn the
MLSS controller off using the ON-OFF control switch1 and run a 10-
day dynamic simulation.
(ii) 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
At the end of the simulation, PID tuning constants will be calculated (this
may take several seconds), and will appear in the log window. A notification
will appear on screen when the calculation is complete (Figure 5-5). The log
window can be opened by checking the Log checkbox in the View menu of
the Simulation Control window.
1
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.
Using Automatic Controllers 63
13. After setting the controller tuning constants to these values, (under
Parameters > Operational) turn the tuning mode OFF and turn the MLSS
controller ON. 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 a decrease in the average level of the influent flow rate was
introduced to test the performance of the controller under these conditions.
64 GPS-X Tutorial Guide
The other important item in this form is the DO setpoint array button [(...)].
By clicking on the array button, another form will appear showing the
setpoints. The default setpoints are all set to 2.0. At this point you should
tag the first and last setpoints (see Figure 5-8) so that they can be put on an
interactive control window. Accept all forms.
17. Set the controller sampling time (found on the plug-flow tank's
Parameters > Operational > Aeration Control More... form) to a shorter time
(say 0.001 days, which is approximately 1.5 minutes). Accept all forms.
66 GPS-X Tutorial Guide
19. Define 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 tagged in the Display 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. Tag the free and ionized ammonia variable in the Display Variables >
State Variables form of the plug-flow tank effluent stream. Use similar
min/max ranges as above for the setpoints.
20. Show both the Controls and Outputs and Autoarrange the windows.
Ensure that both the MLSS and DO controllers are turned ON.
21. Run a simulation, varying the influent flowrate and the DO setpoints.
The automatic controller behaves quite well with the default tuning
constants.
Using Automatic Controllers 67
What's Next?
You have finished a brief explanation of the automatic process control
features within GPS-X. Although we have only looked at two control loops,
you can setup many more using the built-in control forms for any of the
object pumped flows. This essentially means that any user specified pumped
flowrate can be setup as a manipulated variable in order to maintain a control
variable at its set point.
The next tutorial examines the use of the GPS-X Define feature for creating
special variables which are plant layout dependent. This tutorial will require
the GPS-X Builder module.
Reference
Marlin T.E., Process Control: Designing Processes and Control Systems for
Dynamic Performance, McGraw-Hill, 1995.
1. For more detailed controller design, an additional GPS-X module which uses MATLAB's
Control System Toolbox is available.
2. 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.
The Define Function 69
TUTORIAL 6
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). This tutorial requires the GPS-X Builder module.
access to the control-splitter object, so you will have to open the pre-built
layout from the GPS-X tutorials directory). 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.
2. Assign appropriate models to the objects and use the bodbased influent
model, the mantis plug flow tank model and the simple1d rectangular clarifier
model.
4. Specify a value for the pumped flow (which will be used as the wastage
rate) by changing the default pumped flow value from 0 to 100. Accept this
form.
72 GPS-X Tutorial Guide
Right-click the plant effluent stream leaving the final clarifier (eff 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 discharge.
6. 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.
select the Display Variables > Defined Variables > Mass Flow menu item. Tag
the Mass Flow.total suspended solids variable and Accept this form. Repeat
this procedure for the bypass and the discharge streams. Set the
minimum and maximum mass flows on that graph to 0 and 1,000,000
respectively (Figure 6-4).
9. You should now Save the model and Build the layout.
10. Load the model and set the Stop time to 2 days. Show the Controls and
Outputs and Start the simulation.
11. Increase the influent flow rate and notice that when the influent flow
rate is above 2000 m 3 /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 re-build the model, this must be done either by defining a scenario or by
placing the bypass pump flow on an interactive controller.
12. Re-run the simulation and try to reduce the total mass flow of solids
discharged to the receiving water.
74 GPS-X Tutorial Guide
Defining an SRT
In this section you will learn how to calculate and display SRT, the solids
residence time in the system.
14. Define the SRT calculation by choosing SRT from the define list as
described above. Point to the aeration basin and click on it. An SRT
equation will appear in the Status Bar (bottom left hand side of the drawing
board) as shown in Figure 6-5.
There are two parts to the 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 tank will be included in the SRT
The Define Function 75
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 (eff) 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.
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 eff). The
SRT equation should now look like this:
15. Click on the aeration basin to accept the equation. A window will
appear with the defined equation. Accept this window if the equation is
correct or Discard this equation if you have made a mistake. Unselect the
Define checkbox.
17. Define a new output graph as described in Tutorial 1 and set-up the
SRT variable on it with appropriate limits (e.g. 0 to 50 days).
20. 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,
UNLOAD the model.
76 GPS-X Tutorial Guide
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.
21. Click on the Define button and select Daily Average. Now right-click
on the discharge 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 discharge stream.
22. Use the same procedure and define a moving average for the mass
flow of suspended solids in the discharge stream. Click on the Define
button and select Moving Average. Now right-click on the discharge
stream and select the Defined Variables > Defined Variables > Mass Flow menu
item. Tag the mass flow variable and Accept the form. Turn `off' Define
Mode.
23. Select the moving average and daily average for display. You will
notice in the display menu for the moving average (from the discharge
stream, Display Variables > Defined Variables > Moving Average) that a number
will appear to the right of the variable name (see Figure 6-7). This number
represents the number of communication intervals (Communication in the
Simulation Control window) that are used in each moving average calculation.
For example, if the number in the Moving Average window is 100, and the
Communication interval is 0.05 days, then the moving average calculation
will use data from the previous 5 days (100 x 0.05 days).
24. Define a new output graph as described in Tutorial 1 and set-up the
moving average and daily average for display using a maximum limit of
1,000,000 for both variables.
26. Run the model and change the influent and wastage flow rates to
observe the moving and daily averages.
The Define Function 77
What's Next?
You have now navigated through the use of the Define function. Although all
the possibilities for its use have not been demonstrated, you should have a
basic understanding of its function. The next tutorial examines the
sensitivity analysis tool which requires the GPS-X Analyze module.
Sensitivity Analysis 79
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
80 GPS-X Tutorial Guide
sensitivity analyses. By completing this tutorial, you will also learn how to
interpret the results from these simulations.
Users who wish to complete this tutorial must have the GPS-X Analyzer
module. The Builder module is not necessary.
If you do not have the GPS-X Builder module, open the layout by selecting
Hydromantis GPS-X 4.1 > Tutorials > Tutorial7 > Tutorial (Start) from
the Windows Start menu and proceed to the next section below. If you have
the GPS-X Builder module you may prefer to reconstruct the layout yourself
(use the CN library). The layout should resemble that shown in Figure 7-1,
with a bodbased influent model, mantis CSTR model and simple1d clarifier
model. Remember to define a wastage flow, say 40 m 3 /d, in the secondary
clarifier (the pumped flow under the Operational parameters). Save and Build
this new layout.
2. Place the influent flow and the oxygen mass transfer coefficient (KLa)
on an interactive control window. The influent flow variable can be tagged
from the influent object Flow > Flow Data form, and the oxygen mass transfer
coefficient can be tagged on the CSTR object Parameters > Operational form.
Assign both parameters to a new control window, with limits of 0-10,000
m3/d for the influent flow and 20-120 d-1 for the KLa.
Steady-State Analysis
You will now carry out a steady state sensitivity analysis of the oxygen
transfer coefficient on the dependent variables that you have selected for
display (DO, CBOD5, NH3).
82 GPS-X Tutorial Guide
4. In order to carry out the analysis, set the mass transfer coefficient as an
Analyze type in the Controls Setup form, ensuring that there is a delta value
of 20 which sets the variable increment for the analysis (see Figure 7-2).
5. If the model is not Unloaded, do so now. Now re- Load the model and
select your sinusoidal scenario.
6. Now click on the Controls icon to display the controls and then click
on the Outputs icon to display the output graphs.
8. 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.
The analysis will not work if you show the outputs before showing the
controls. Observe the effect of an increase in KLa on DO and the effluent
CBOD5 and NH3. Typical results are shown in Figure 7-4. Note that a value
of 58 d -1 for the oxygen mass transfer coefficient results in a DO level of 2.0
gO2/m3. Try the analysis using different influent flows.
Sensitivity Analysis 83
You will now carry out a time dynamic sensitivity analysis of the oxygen
transfer coefficient on the dependent variables that you have selected for
display (DO, CBOD5, NH3).
10. Unload the model in order to turn off the analyze mode. Load the
model again and select your scenario containing the sinusoidal influent.
11. Select Options > Preferences > Run and change the Number of runs
displayed to 10.
12. Show first the control windows, and then the output graphs (again,
the order is important).
14. Select Time Dynamic from the Analyze menu and then click on the
Analyze icon to switch to analyze mode.
15. Start a one-day simulation with steady state checked. The results of
this simulation are shown in Figure 7-5.
Figure 7-5 Typical results from a time dynamic analysis. Six dynamic runs
for kLa values ranging between 20 and 120 d-1 in increments of 20 d-1.
15. Again Unload the model to turn off the time dynamic analyze mode.
Re- Load the model and select your sinusoidal scenario.
18. Select Phase Dynamic from the Analyze drop-down menu and click on
the Analyze icon to switch to analyze mode.
19. Set the simulation time to 1.0 day (with Steady State checked so that
the initial conditions are at steady state) and Start the simulation.
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
86 GPS-X Tutorial Guide
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 a KLa of 20.0 to
120.0 d -1 (as opposed to showing the steady-state value when carrying out
the Steady State analysis).
What's Next?
This tutorial has concentrated on the procedure for setting up the three
different types of sensitivity analysis. You should now feel comfortable to
do this and may wish to take some time to carry out further analyses on
different model parameters. The next tutorial examines the use of the GPS-X
Optimize module. This includes selecting the parameters to be optimized, the
objective function, and the control of the optimizing routine.
Parameter Optimization 87
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.
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
88 GPS-X Tutorial Guide
3. Change the Date & Time at t = 0 by selecting the Options > General Data
> System > Parameters > Simulation Setup form. Click on the date and time at
t=0 array [(...)] and change the year to 1997, the month to 6, and the day to 15.
4. Save the model with the name tutorial8, and Build it.
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 interactive 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 Parameters > Kinetic form.
9. Unload the model, then select the Time Series menu item from the Type
menu found in the Optimize drop-down menu (Figure 8-2).
90 GPS-X Tutorial Guide
10. 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. The Target Variables must now be identified by tagging them in the
Target Variables forms. The menu items which were labeled Display
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-3).
Note: While in optimize mode you cannot define Display Variables for
outputs. 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.
Parameter Optimization 91
13. Now you must set up the independent variables (the two kinetic
parameters) in the Controls Setup form as Optimize types (see Figure 8-4).
The Min and Max values are used as bounds on the independent variable.
You should now set some of the optimizer parameters in the Options >
General Data > System > 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.
14. 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.
15. In the Optimizer form switch the detailed statistical report parameter
ON so that a statistical analysis is printed to the Log window.
17. 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 Log 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 Log window. The correlation
matrix shows the correlation between the estimated parameters.
Note: The lack of fit test is not used in this example because we do not have
replicate measurements.
19. The show process warnings parameter should be switched OFF. You
can find it in the Options > General Data > System > Parameters > Simulation
Setup form.
20. Save and Build the model and Load it in the Simulation Control
window.
Parameter Optimization 93
21. Switch to optimize mode by clicking on the Optimize icon in the GPS-
X toolbar.
22. Display first the control windows, then the output graphs.
23. You can display the Log window at this point if desired but keep in
mind that it will slow down the optimization. You may prefer to display
the Log window at the end of the optimization. To view the Log window
select View and then Log in the Simulation Control window.
24. 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).
Note that the initial parameter values used in the optimization are the default
values found in GPS-X.
A plot of the fitted model and the measured data is shown in Figure 8-6.
What's Next?
This tutorial has shown you how to setup and use the optimizer. Although
emphasis was placed on using the optimizer for calibration, it can also be
used for process optimization. For example, if a target value of effluent TSS
and TKN are in a data file, the optimizer could be used to determine the best
(minimum) volume to do so. The next tutorial examines the basic
customization features of GPS-X. This includes adding your own code to a
specific model layout.
Basic Customization 95
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.
3. 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.
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.
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 controllers as the other GPS-X variables. For
this example, the tutorial9.con file is shown below in Figure 9-7.
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 > 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.
Basic Customization 101
8. Open the tutorial9.var file by choosing the Options > General Data
> User Files > Display Variables... menu item. This file allows you to make
the new variables available for output. As shown below 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.
102 GPS-X Tutorial Guide
9. After modifying these three files, Save the layout. You will then 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 re- Build the layout.
11. Define 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 tagged
in the Options > General Data > User > Display Variables > Uptake Variables
form. In the Output Setup window, set the minimum SOUR to 5 and the
maximum SOUR to 10 mgO2/gVSS/h. Set-up the OUR with noise variable
(ourwithnoise) on the graph created in Step 2 of this tutorial. The OUR
with noise variable can be tagged in the Options > General Data > User >
Display Variables > Uptake Variables form. In the Output Setup window, set
the minimum OUR to 15 and the maximum OUR to 25 gO2/m3/h for this
variable.
12. Display the Simulation Control window, the Outputs, and the Controls.
Running Simulations
14. Run a steady-state simulation followed by a 10-day dynamic
simulation. You should produce an output similar to Figure 9-10.
15. Vary the noise parameters with the interactive controllers and
observe the impact on the output. Try running several simulations using
different settings.
What's Next
This tutorial presented an example on how to make basic customizations to a
GPS-X layout through the modifications of the .usr, .con, and .var
auxiliary files. The next tutorial covers Dynamic Parameter Estimation.
104 GPS-X Tutorial Guide
Dynamic Parameter Estimator (DPE) 105
TUTORIAL 10
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 and
Builder modules are required to complete this tutorial.
Users who do not have the GPS-X Builder Module can simply open in the
tutorial10 layout located in the GPS-X tutorial directory. This file can
also be accessed from the Start Menu. Users that wish to use this pre-
compiled layout should proceed to the step 16.
106 GPS-X Tutorial Guide
4. Open the Outputs Setup form, and change the Max value for the
primary effluent [pe] suspended solids from 1000 to 300 g/m3. Also
remove the primary effluent ammonia variable from this graph by selecting
the asterisk option for the graph name (using the drop-down menu), as shown
in Figure 10-2. Remember to Accept the form when finished.
Dynamic Parameter Estimator (DPE) 107
5. Load the model. Select scenario5 and check Steady State in the
Simulation Control window.
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-3.
108 GPS-X Tutorial Guide
7. Unload the model 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. In the primary tank Parameters > Settling form, tag the flocculent zone
settling parameter.
9. Select the Optimize type of control for the flocculent zone settling
parameter in the Controls Setup form. Also, place this item in window "3:
Pump Controls" with a Min of 0.0001 and a Max of 0.001 m3/gTSS.
10. Next 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 Display Variables has changed to
Target Variables (see Figure 10-4).
Dynamic Parameter Estimator (DPE) 109
11. Finally, under the General Data > System > Parameters sub-menu
Optimizer, set a DPE timewindow of 0.4 days and make this variable
available for control. In addition set the parameter tolerance to 0.001.
12. In the Controls Setup form put the DPE timewindow in control window
"3: Pump Controls" and set the Min to 0 and the Max to 4.
14. While the model is building, switch to edit mode by clicking on the
Optimize icon. In doing so you will now be able to setup the flocculent zone
settling parameter for display.
15. On the overflow stream from the primary clarifier, select Display
Variables > Parameters > Settling and tag the flocculent zone settling
parameter. In the Output Setup form, locate the newly tagged variable and
select window "3: Primary Eff - BOD5 & COD", the Min value (0.0001
m3/gTSS) and the Max value (0.001 m3/gTSS). Also, select the asterisk
option for all other variables currently displayed on the "3: Primary Eff -
BOD5 & COD" output graph. Accept this form. It is recommended to also
change the title of the graph in the Outputs > Define form. Change the third
title to PE - Settling Parameter.
110 GPS-X Tutorial Guide
17. Select Optimize > Type > DPE and then click on the Optimize icon to
switch to optimize mode.
19. Set the simulation time to 4 days and Start the optimization.
The results are shown in Figure 10-5 and Figure 10-6 below. Try repeating
the simulation with a shorter time window or tighter convergence criteria
(found in the General Data > System > Parameters > Optimizer form).
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 particular GPS-X features can be found in the GPS-X
User's Guide, while details about the models are included in the GPS-X
Technical Reference.