12.07.2015 Views

GPS-X Tutorial Guide

GPS-X Tutorial Guide

GPS-X Tutorial Guide

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>GPS</strong>-X TUTORIAL GUIDEA STEP-BY-STEP GUIDE FOR LEARNINGAND GETTING FAMILIAR WITH <strong>GPS</strong>-X<strong>GPS</strong>-X Version 6.4


Copyright ©1992-2014 Hydromantis Environmental Software Solutions, Inc. All rights reserved.No part of this work covered by copyright may be reproduced in any form or by anymeans - graphic, electronic or mechanical, including photocopying, recording, taping, orstorage in an information retrieval system - without the prior written permission of thecopyright owner.The information contained within this document is subject to change without notice.Hydromantis Environmental Software Solutions, Inc. makes no warranty of any kind withregard to this material, including, but not limited to, the implied warranties ofmerchantability and fitness for a particular purpose. Hydromantis EnvironmentalSoftware Solutions, Inc., shall not be liable for errors contained herein or for incidentalconsequential damages in connection with the furnishing, performance, or use of thismaterial.Trademarks<strong>GPS</strong>-X and all other Hydromantis trademarks and logos mentioned and/or displayed aretrademarks 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 aretrademarks of Microsoft Corporation.


TABLE OF CONTENTSTable of ContentsTUTORIAL 1 ............................................................................................................................................... 4Building a Plant Layout .......................................................................................................................... 4Introduction ..................................................................................................................................... 4Objectives ........................................................................................................................................ 5Building a Simple Plant Layout ......................................................................................................... 5Selecting Object Models ................................................................................................................ 12Generating Source Code and Binary Executable ........................................................................... 17The Simulation Environment ......................................................................................................... 18Creating Input Controls .................................................................................................................. 19Creating a New Input Control Window .......................................................................................... 19Creating Output Graphs ................................................................................................................. 21Creating a New Output Graph ....................................................................................................... 23Running a Simulation ..................................................................................................................... 27Analyzing the Plant ........................................................................................................................ 29Create a Sankey Diagram ............................................................................................................... 30TUTORIAL 2 ............................................................................................................................................. 32Editing Layouts and Using Scenarios ................................................................................................... 32Objectives ...................................................................................................................................... 32Expanding the Plant ....................................................................................................................... 33Using Scenarios .............................................................................................................................. 37Generating a Static Report ............................................................................................................. 40Creating a New Output Table Tab .................................................................................................. 42TUTORIAL 3 ............................................................................................................................................. 45Influent Data & Influent Advisor ......................................................................................................... 45Problem Statement ........................................................................................................................ 45Objectives ...................................................................................................................................... 45Influent Data .................................................................................................................................. 46Using Influent Advisor .................................................................................................................... 47Influent Advisor Warnings ............................................................................................................. 50TUTORIAL 4 ............................................................................................................................................. 51Data Input & Output ........................................................................................................................... 51Problem Statement ........................................................................................................................ 51Objectives ...................................................................................................................................... 51Setting up Dynamic Input .............................................................................................................. 52Plotting Measured Data along with Simulated Results ................................................................. 58Creating a Bar Chart for Steady-State Condition ........................................................................... 60i


TABLE OF CONTENTSTUTORIAL 5 ............................................................................................................................................. 63Using Automatic Controllers ............................................................................................................... 63Problem Statement ........................................................................................................................ 63Objectives ...................................................................................................................................... 63Setting up an Automatic MLSS Controller ..................................................................................... 64Tuning the Automatic MLSS Controller ......................................................................................... 66Using an Automatic DO Controller ................................................................................................ 70TUTORIAL 6 ............................................................................................................................................. 73The Define Function ............................................................................................................................ 73Problem Statement ........................................................................................................................ 73Objectives ...................................................................................................................................... 73Setting up the Layout ..................................................................................................................... 74Defining Mass Flows ...................................................................................................................... 75Defining an SRT .............................................................................................................................. 78Defining Averages .......................................................................................................................... 81Controlling SRT with Waste Pump Rate ......................................................................................... 82TUTORIAL 7 ............................................................................................................................................. 84Sensitivity Analysis .............................................................................................................................. 84Problem Statement ........................................................................................................................ 84Objectives ...................................................................................................................................... 84Setting up the Layout ..................................................................................................................... 85Setting up the Parameters for Analysis ......................................................................................... 85Steady-State Analysis ..................................................................................................................... 86Time Dynamic Analysis .................................................................................................................. 88Phase Dynamic Analysis ................................................................................................................. 89TUTORIAL 8 ............................................................................................................................................. 91Parameter Optimization ..................................................................................................................... 91Problem Statement ........................................................................................................................ 91Objectives ...................................................................................................................................... 91Initial Manual Calibration .............................................................................................................. 92Automatic Calibration Using the Optimizer ................................................................................... 93TUTORIAL 9 ............................................................................................................................................. 99Basic Customization ............................................................................................................................ 99Problem Statement ........................................................................................................................ 99Objectives ...................................................................................................................................... 99Setting Up and Customizing a Layout .......................................................................................... 100Running Simulations .................................................................................................................... 107ii


TABLE OF CONTENTSTUTORIAL 10 ......................................................................................................................................... 108Dynamic Parameter Estimator (DPE) ................................................................................................ 108Problem Statement ...................................................................................................................... 108Objectives .................................................................................................................................... 108Setting Up the Layout .................................................................................................................. 109Setting Up the DPE ....................................................................................................................... 110Running the DPE .......................................................................................................................... 111TUTORIAL 11 ......................................................................................................................................... 113Monte Carlo Analysis ........................................................................................................................ 113Problem Statement ...................................................................................................................... 113Objectives .................................................................................................................................... 113Setting Up the Layout .................................................................................................................. 114The End ........................................................................................................................................ 119iii


<strong>GPS</strong>-X TUTORIAL GUIDETUTORIAL 1Building a Plant LayoutIntroductionDynamic 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 buildingmodels, running simulations and interpreting the results were too expensive. In order tosimplify the modelling process and therefore reduce costs, you need tools to aid you with thesteps in any modelling exercise.A tool like <strong>GPS</strong>-X is invaluable as its easy-to-use interface connected to a powerful library ofsimulation models will greatly reduce the expense of carrying out simulation studies.There are five major steps in any modelling study:1. Model construction2. Model calibration3. Scenario development4. Simulation5. Interpretation of resultsIn this chapter you will develop a simple dynamic model of an activated sludge system.4


ObjectivesBUILDING A PLANT LAYOUTThis tutorial covers the following topics:1. Building a simple plant layout2. Preparing the source and binary code3. Setting up graphics and interactive controls4. Running interactive simulationsWhen you have finished this tutorial, you will be able to build and run full-scale dynamictreatment process models. You will learn how <strong>GPS</strong>-X automatically generates error-freecode when a model is built, the procedures for creating time series graphics andinteractive controls, and how to run the model you have prepared. These essentialfeatures provide a foundation on which other advanced features are built; therefore, it isimportant to understand the material in this chapter first before going on to morecomplicated tasks.Building a Simple Plant LayoutAfter starting <strong>GPS</strong>-X1. Select the Carbon Nitrogen Library (cnlib) from the Model Library drop downmenu in the main toolbar (see Figure 1-1)Figure 1-1 Selecting a <strong>GPS</strong>-X LibraryNOTE: If a white drawing board is not displayed, start a newfile by clicking on the New button on the tool bar.Page 5


<strong>GPS</strong>-X TUTORIAL GUIDE2. Locate the Process Table on the left-hand side of the <strong>GPS</strong>-X window. These iconsare used to build a plant layout. Icons represent the unit processes and controlpoints in a layout. The icons are separated into groups of like objects, such asPreliminary Treatment, Clarification and Settling, and Biosolids Treatment.The Process Table contains the unit process icons used to construct a treatment plantmodel. Each icon is identified by process name (see Figure 1-2). The process name is alsodisplayed if you hold the cursor over any object in your drawing board.Figure 1-2 Process TableWe will start by building a simple wastewater treatment plant consisting of 3 objects: An influent An aeration tank A secondary clarifierPage 6


BUILDING A PLANT LAYOUT3. Place the influent object on the drawing board. If the “Influent” group is notselected in the process table, click on the “Influent” process group to display theinfluent 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 tothe centre of the drawing board and drop the object by releasing the mousebutton. The influent object now appears in the drawing board. You can drop asmany of these objects as desired by repeating this procedure. For now, drop onlyone influent object.4. Select the plug flow tank icon (Suspended Growth Processes group) and drop iton the drawing board to the right of the influent object.5. Select the circular secondary clarifier icon (Clarification and Settling Processgroup) and drop a circular secondary clarifier object to the right of the plug flowreactor. Close the Process Table by clicking on the left-pointing arrow at the toprightcorner of the Process Table.The drawing board should now look similar to Figure 1-3Figure 1-3 Building the LayoutPage 7


<strong>GPS</strong>-X TUTORIAL GUIDE6. Zoom in by using the Locator feature. This is a simple plant and there is a lot ofwhite space on the drawing board. We can zoom in to get a better view of thelayout using the Locator feature of <strong>GPS</strong>-X.To use the Locator, click the Locator button on the tool bar. The Locator windowwill be displayed as shown in Figure 1-4.Figure 1-4 <strong>GPS</strong>-X Locator Window7. Zoom in or out by selecting a region in the Locator window (click, drag andrelease). Try selecting an area much larger than the rectangle currently displayedin the Locator window. When you release the mouse button the <strong>GPS</strong>-X drawingboard is refreshed and the icons in the drawing board appear smaller. Trydragging-out a smaller rectangle and note the effect in the main drawing boardarea. You should see an enlarged view like that shown in Figure 1-5.NOTE: The area in the Locator window represents the total available drawingarea. When you drag out a region in the Locator window and release the mousebutton the region within the drag rectangle is displayed in the drawing boardarea, scaled as necessary.You can also zoom the layout in and out by holding the mouse point over thelayout and rotating the mouse wheel.8. Specify the connectivity between the objects. This is critical in the specificationof a flow sheet as all material balances - and therefore the equations which result- are based on the connectivity in the layout. When you specify theseconnections, remember that the flow lines are directional, i.e., materials flowfrom the initial point to the terminal point of the flow connection.Page 8


BUILDING A PLANT LAYOUTFigure 1-5 Enlarged View of the LayoutTo specify the connectivity between objects, in the drawing board, move the pointer overthe influent object connection point. You will know that you are over the connectionpoint when the mouse pointer changes from the default `Windows' arrow to a connectingarrow. When the connecting arrow appears, click to anchor the flow line at this initialpoint.Next, drag the pointer from the influent object to the influent connection point of theplug flow tank (top left hand corner of the icon, NOT the return flow connection point justbelow on the left hand side of the icon). When the connecting arrow re-appears, releasethe mouse button. A connecting pipe will be drawn between the influent object and theplug-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 theunderflow from the secondary clarifier (bottom of the secondary clarifier icon) to thereturn flow point of the aeration tank (lower left hand corner of the plug-flow 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 anydownstream processing of the excess sludge, it is not necessary to specify a flowconnection from this point (see Figure 1-6)Page 9


<strong>GPS</strong>-X TUTORIAL GUIDEFigure 1-6 Completed LayoutNOTE: When flow connections are being specified, <strong>GPS</strong>-X interprets mouse button clicks ina certain way. The first mouse button click within the drawing board is assumed to be aflow stream initiating point and the mouse release event signals the terminal point. Youmust be on a valid connection point for these assignments to be made correctly. <strong>GPS</strong>-Xdoes not allow invalid flow connections. For example, flows which initiate at the influent ofan object and terminate at the effluent of a second object are not allowed. <strong>GPS</strong>-X willdisallow an incorrect connection by displaying an invalid sign. If you experience somedifficulty in specifying flow connections, you can delete the flow lines by placing the cursorat the flow initiation point and dragging the flow line to an empty cell on the drawingboard. As soon as the cursor button is released the flow line will be deleted9. Show or re-name the stream labels. In the completed layout shown in Figure 1-6there are numbers associated with each of the flow streams. To display thesestream labels click on the Labels button on the tool bar. A drop-down menu willappear as shown in Figure 1-7. Check the Streams checkbox.Page 10


BUILDING A PLANT LAYOUTFigure 1-7 Selecting to Show the Stream LabelsTo change a stream label, right-click on an object icon and the process data menu will bedisplayed. Select the Labels item from this menu. New label names can be input on theform that is displayed. Save these changes by choosing Accept. If there is a conflictbetween your label assignments and existing labels, a message will be displayed. Anexample of a labels window is shown in Figure 1-8.Figure 1-8 Changing the Labels of the Process Units and StreamsPage 11


<strong>GPS</strong>-X TUTORIAL GUIDENOTE: Variable names in <strong>GPS</strong>-X models use the connection labels toidentify a particular stream (e.g. qinf for the influent flowrate, andqfe1 for effluent flowrate in this case). These variable names aredisplayed on some of the forms you will see as you progress throughthe tutorial chaptersThe plant layout is now ready! If you experienced some difficulty in selecting or placingthe objects in this layout, you can delete objects from the drawing table by selecting theobject (a dotted red square appears around the object) and then pressing the Deletebutton. Alternatively, you can close the current drawing board and click on the NewbuttonSelecting Object ModelsIn the previous section we selected the basic objects to be modeled in our plant. Theseobjects are the major unit processes and control points only. No mathematical modelswere assigned to the various objects in the layout.Each object in the layout has a number of attributes or properties, and each attribute hasa certain value. One of the most important attributes for <strong>GPS</strong>-X objects is the set ofequations (or model) that define the dynamic behavior of that object. Remember todistinguish between an object type and the model for that object as some objects havemore than one possible model. Before you can build the plant model, a model must bespecified for each object in the layout.10. Verify the influent model. Right-click on the influent icon. An influent objectspecificdata menu appears as shown below (see Figure 1-9). The first item in themenu is Models. Click on this item to activate the sub-menu, and verify that thecodstates item is selected by default.Page 12


BUILDING A PLANT LAYOUTFigure 1-9 Model Selection for the Influent11. Verify the plug flow tank model by repeating this procedure, but for this objectmake 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 selected13. 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 ofdirectories and files in the current directory is shown in the list box. Navigatethrough your directories to an appropriate directory and type a filename in theFile name: text box, as shown in Figure 1-10.1See <strong>GPS</strong>-X Technical Reference for more information on these ModelsPage 13


<strong>GPS</strong>-X TUTORIAL GUIDEFigure 1-10 -<strong>GPS</strong>-X: Save As… Dialogue BoxWhen you have specified a directory and file name, click on the Save button. A messageis displayed if a file having the same name is in the listed directory. Choose Yes to saveover the old file (overwriting the previous file) or No to select a different file name. Notethat you must have write privileges for that directory.You may have noticed that an object's process menu contains a number of items forspecifying other attributes of an object, for example, parameters and initializationproperties (see Figure 1-11). In this tutorial we will use the default properties for theobjects you have selected with four exceptions; the influent total COD concentration,influent total suspended solids concentration, influent total TKN concentration and theexcess sludge wastage rate from the final clarifier.14. Change the influent composition by right clicking on the influent object, move tothe Composition sub-menu and select the Influent Characterization menu-item.A data entry form will appear on the screen. Change the total COD entry from430 to 380 gCOD/m 3 , and the total TKN entry from 40 to 35 gN/m 3 as shown inFigure 1-11. Note that the values are now highlighted in blue, to indicate thatthey have been changed from the <strong>GPS</strong>-X defaults. Click on the Accept button.Page 14


BUILDING A PLANT LAYOUTFigure 1-11 Changing the Influent Composition15. Change the secondary clarifier wastage rate by right-clicking on the secondaryclarifier object, move to the Input Parameters sub-menu and select theOperational menu-item as shown in Figure 1-12. A data entry form will appearon the screen. Change the pumped flow entry from 40 m 3 /d to 60 m 3 /d, asshown in Figure 1-13. Once you have changed this flow, click on the Acceptbutton.Figure 1-12 Secondary Clarifier Operational Menu ItemPage 15


<strong>GPS</strong>-X TUTORIAL GUIDEFigure 1-13 Changing the Pumped Flow16. After completing the layout, always remember to click the Plant WideProperties button to specify custom properties for the plant. A window will popup in which you can specify additional details for the plant and type plantinformation to keep a record. For this example, specify the liquid temperature to22°C. Click Accept to save the changes.Figure 1-14 Plant Wide Properties MenuPage 16


BUILDING A PLANT LAYOUT17. Save the layout again by clicking the Save button on the tool bar. Selecting Saverather than Save As… saves the layout with the current name (shown on the<strong>GPS</strong>-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 ExecutableThe next step is to translate the plant layout and the model parameters, first into sourcecode, and then into a binary file, which will be executed by <strong>GPS</strong>-X. The translation andcompilation process involves several steps; however, <strong>GPS</strong>-X has been designed in such away that these steps are executed without user input. This enables you to concentrateyour efforts on process understanding rather than the mechanics of model construction.18. Generate the model source and binary code by clicking on the Simulationbutton. This starts the process of compilation and linking, resulting in thecreation of an executable model. The time required to complete this processdepends on the speed of your workstation, and the complexity of the model.Upon completion of the build step, the message Completed will be displayed inthe Build window as shown in Figure 1-15Figure 1-15 Compilation Completed MessagePage 17


<strong>GPS</strong>-X TUTORIAL GUIDEThe Simulation EnvironmentOnce the model has been compiled, <strong>GPS</strong>-X will present a blank simulation environment,as shown in Figure 1-16. The layout is shown in the lower left-hand corner, with blankareas for inputs and outputs ready for use.Figure 1-16 Simulation EnvironmentPage 18


BUILDING A PLANT LAYOUTCreating Input Controls<strong>GPS</strong>-X is an interactive simulation program, or simulator, which can run both pre-definedsimulations and interactive sessions. We will now set up an interactive session thatallows us to investigate the effects of changes in the influent flow rate on the planteffluent quality.Creating a New Input Control WindowOur first task is to create a new, blank input control. An input control is an interactivetool, which can be used to change the value of model variables during the course of asimulation run. You can create as many input controls as desired. Here, we will create asingle control for the plant influent flow so that this variable can be changed during asimulation.19. Drag the influent flow to the blank input control window by right-clicking on theinfluent object and select the Flow Data item from the Flow sub-menu as shownin Figure 1-17. In the Flow Data entry form, drag the influent flow variable to theblank input control area above the layout, as shown in Figure 1-18. Remember toaccept the changes by clicking the Accept button on the bottom right-handcorner of the form.Figure 1-17 Flow Data MenuPage 19


<strong>GPS</strong>-X TUTORIAL GUIDEFigure 1-18 Drag influent flow to an Input Control TabNote that a new tab (labeled “Input 1”) has been created for the input control. Multiplecontrols can be placed on a single tab, or on as many tabs as required.20. Edit the control window properties by clicking on the Input Control Properties…button just above the input control tabs. The input control properties menu isshown in Figure 1-19. You can use this form to set minimum (Min), maximum(Max), and control increment (Delta) values for a particular variable. Select 0 forminimum flow and 12000 for maximum flow. It is not necessary to enter a valuein the Delta column, as we will use a slider-type control, which does not require avalue for this attribute. Note the small menu mark (inverted triangle) on theright-hand side of each entry below the Type column heading. If you click on thismenu mark, a list of control types is displayed. Make sure that Slider is selectedfor the influent flow item. Remember to save your entries by clicking on theAccept button.Page 20


BUILDING A PLANT LAYOUTFigure 1-19 Input Control Window Setup21. 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. Thewindow shown in Figure 1-20 appears containing a slider that allows you tochange the influent flow from 0 to 12000 m 3 /d. You can test the slider controlby dragging the small slider knob, but note that if you move the slider bar, theinfluent flow value will change to the value displayed on the control. Beforeproceeding, use the “reset” button (curved arrow) at the far right of the slider tomove the slider back to the default position of 2000 m 3 /d (alternatively, you mayenter the value into the control with the keyboard).Figure 1-20 Interactive ControllerCreating Output GraphsAt this point the plant model has been prepared and an interactive control has beencreated. Notice that a standard unit process output for each unit (Wastewater Influent,Plug-Flow Tank, and Circular Secondary Clarifier) is displayed on the output window(Figure 1-21). These are QuickDisplay summary tables, which will display output resultsafter a simulation is carried out. You can also create a QuickDisplay Output by doubleclickingdirectly on the object in the layout window. In addition to the output tables,<strong>GPS</strong>-X provides eight different types of graphic display for output of simulation results. Inthis tutorial, we will set up a single time series graphic window to plot two importantmodel variables, the influent flow and the effluent suspended solids concentration.Page 21


<strong>GPS</strong>-X TUTORIAL GUIDEFigure 1-21 QuickDisplay OutputPage 22


BUILDING A PLANT LAYOUTCreating a New Output GraphIn addition to the model results summaries available on the QuickDisplay outputs, userscan create new custom-designed output graphs for various variables located in theOutput Variables menu of each object. These variables cover a wider range of modeloutputs than those shown in the QuickDisplay outputs and can be used to supplementthe standard output in the QuickDisplays.22. Create a new, blank output tab by clicking on the New Tab button on the toolbarabove the output tabs. A new, blank output tab will be created23. Create a graph of the influent flow by right-clicking on the influent object andselect the Flow item from the Output Variables sub-menu as shown in Figure 1-22Figure 1-22 Opening an Output Variable Menu24. In the Flow output form, drag the influent flow variable to the blank outputgraph, as shown in Figure 1-23. Remember to accept the changes by clicking theAccept button on the bottom right-hand corner of the form.Page 23


<strong>GPS</strong>-X TUTORIAL GUIDEFigure 1-23 Dragging an Output Variable to Create a Graph25. 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 connectingarrow to indicate that you have located a connection point 2 . Right-click andselect the Composite Variables item from the Output Variables sub-menu. Dragthe 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 byclicking on the Auto Arrange button above the output tabsYour simulation environment should appear as shown in Figure 1-24.NOTE: There is a difference between data entry forms and output variableforms even though both have a similar appearance and may contain the samevariable name entries. Data entry forms contain a field on the right-hand sidefor entering data. In output variable forms this field displays model results,and cannot be edited. To review: variables dragged from a data entry formcan be placed on input control tabs (above the layout pane), whereas variablesdragged from an output variable form can be placed on graphs (to the right ofthe layout window) and saved to data files.2Output variables are defined within each object and at each of the object's connection pointsPage 24


BUILDING A PLANT LAYOUT26. EdittheoutputFigure 1-24 Simulation Environment with Output Graph Completedgraph properties by right-clicking on the output graph and selecting the OutputGraph Properties item from the drop-down menu (see Figure 1-25) to set andadjust your output graphs. The Output Graph Properties form is used to specifyplotting attributes including the minimum y-axis value (Min), maximum y-axisvalue (Max), whether you want to save the data which is generated duringsimulation (Save) and which colors you want to use to display the outputvariables (Color). You can either use the Autoscale feature to set the y-axisranges, or enter a minimum and maximum value for each variable, i.e., 0 and10,000 m 3 /d for flow, and 0 and 150 g/m 3 for suspended solids (seeFigure 1-26). You may want to edit the color of the output variable by clicking onthe Color box and selecting an alternate color. Accept the changes when you arefinished.The graphic type specification is made by right-clicking on the output graph andselecting the Output Graph Type item from the drop-down menu (seeFigure 1-25). By default, the graph type is X-Y (time series) but this can bechanged by making a different selection from the drop-down menu. Beforecontinuing, re-select the X-Y type so that the results you get match the figuresshown in this tutorial.Page 25


<strong>GPS</strong>-X TUTORIAL GUIDEFigure 1-25 Edit Output Graph Properties and Output Graph Type.Figure 1-26 Output Graph Properties Menu…27. Rename the output graph by right-clicking on the output graph and selecting theRename Output Graph item from the drop-down menu. Enter an appropriatetitle for the output graphPage 26


BUILDING A PLANT LAYOUTRunning a SimulationYou are now ready to run the model. All of the controls that you will need to run asimulation are located on the Simulation Control tool bar at the bottom of the screen(see Figure 1-27).28. Specify a simulation duration time of 20 days by clicking on the arrow buttonadjacent to the Stop label on the Simulation Control tool bar. (Stop shouldincrement by 1 day).Figure 1-27 Simulation Control Tool Bar29. Start the simulation by clicking on the Start button on the Simulation Controltool bar. The flow and effluent suspended solids will be displayed in the outputwindow.You can now change the flow with the input control slider bar, and assess theeffect of changes in influent flow on the effluent suspended solids of the plant. Ifthe flow is high enough (say 5,000 m3/d) you will see a significant increase in theeffluent suspended solids due to clarifier overload. An example run is depicted inFigure 1-28, where the flow was increased with the input control slider bar duringthe simulation run. If the simulation proceeds too quickly, you can artificiallyslow down the simulation by inserting a delay. Add a delay by putting 0.5 (or anyother number, the magnitude of the number dictates the degree of delay) intothe Delay entry field using the Stop/Communication/Delay drop-down menu onthe Simulation Control tool bar.Page 27


<strong>GPS</strong>-X TUTORIAL GUIDEFigure 1-28 Example Run30. Run the simulation again, but this time, adjust the influent flow by dragging theinfluent flow slider away from 2,000 m 3 /dNOTE: 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 theSimulation Control window; orIncrease the length of the simulation by increasing the value of Stopand clicking Continue to continue the simulation.If you Continue, <strong>GPS</strong>-X will begin simulating from where it previously stopped andcontinue until the new stop time is reached. If you click on Start, <strong>GPS</strong>-X rerunsthe previous simulation.Page 28


BUILDING A PLANT LAYOUTAnalyzing the PlantWe will now take a more detailed look at our plant's performance by investigating theeffect of increased flow on the secondary clarifier. We will first set-up an output graphdisplaying the solids profile inside the final clarifier. We will then simulate steady-stateconditions with the design flow of 2,000 m 3 /d and investigate the change in the solidsprofile inside the final clarifier by running the model at a higher flow rate (i.e. simulating astorm condition).To investigate the effect of increased flow on final effluent quality, set up a graphicaloutput of the solids profile inside the final clarifier.31. Display the secondary clarifier solids profile by right-clicking on the secondaryclarifier object and selecting from the Output Variables sub-menu item,Suspended Solids. Drag the suspended solids (see Figure 1-29) item to the blankarea to the right of the existing output tabs and Accept the form. A new tab andcorresponding output graph will automatically be created.Figure 1-29 Dragging the Suspended Solids Profile to a New TabIf you right-click on the output graph and select the Output Graph Type item, you willnotice 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 graphand select the Rename Output Graph item from the drop-down menu and enter anappropriate title. Resize the graph by clicking the Auto Arrange button.Note that you can change the name of any tab by double-clicking on the tab name andentering a new one.Page 29


<strong>GPS</strong>-X TUTORIAL GUIDE32. 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 controlwindow. Figure 1-30 shows a bar chart profiling the solids distribution inside thefinal clarifier.33. Increase the influent flowrate to a higher value (i.e. 5,000 m 3 /d) with thecontroller. Adjust Stop to 20 days and Continue the simulation. The bar chartprofiling the solids distribution inside the final clarifier will change to reflect thebuild-up of solids due to higher flows. Following this, save the layout by clickingon the Save button on the tool bar.Figure 1-30 Final Clarifier Solids ProfileCreate a Sankey Diagram<strong>GPS</strong>-X can create a Sankey diagram of five variables (Flow, TSS, COD, TN, and TP). Sankeydiagrams are flow diagrams that display variable quantities in terms of arrow width. Thisallows users to look at the plant's performance visually and display the results effectively.34. Run the simulation and click the Sankey Diagram button on the output controlbar (Figure 1-30). This will display the Sankey Diagram for the layout as shown inFigure 1-31.Page 30


BUILDING A PLANT LAYOUTFigure 1-31 Sankey Diagram Button on Outputs Control BarFigure 1-32 Sankey Diagram for System FlowratesFigure 1-31 shows a Sankey Diagram of the system flowrates. The diagram displays theSankey graph and the values for each stream’s flowrate. Notice that a higher flowratestream displays a wider line. Users can change settings and output variables using theDisplay, Variables, and Sankey features on top of the Sankey diagram window. TheSankey diagram can be exported using the Export features.Page 31


<strong>GPS</strong>-X TUTORIAL GUIDETUTORIAL 2Editing Layouts and Using ScenariosFor this tutorial, consider a situation where the plant you developed in the first tutorial isexpected to treat increased flow due, for example, to extra sewer connections. Assumethat the plant has adequate aeration capacity but requires an extra clarifierObjectives<strong>GPS</strong>-X makes it easy to build models to help you examine changes in plant design andoperation. This tutorial will show you how to use the layout editing tools such as Copyand Paste to make additions to the layout. Once the new model is built, the scenariofeatures of <strong>GPS</strong>-X will be introduced. Using scenarios, you can set up specialized data setsfor comparing the performance of the clarifiers in the event of uneven flow distributionunder both steady state and dynamic conditions. After running each scenario, it may bedesirable to record the model parameters and variables that were used. The reportfeature of <strong>GPS</strong>-X is introduced to facilitate this task.When you are finished with this tutorial, you will have developed the ability to create andedit plant layouts and will have developed a better understanding of static 3 data inputand output in <strong>GPS</strong>-X. You will be able to prepare simulation scenarios to test differenthypothetical situations and be able to run the scenarios to test alternative plant designsor examine operational changes. You will also be able to produce a record of modeldependent and independent variables.3The term static is used to describe the process of data input and output in this case in order todifferentiate it from the case of input and output involving time series data which is described in<strong>Tutorial</strong> 4Page 32


EDITING LAYOUTS AND USING SCENARIOSExpanding the Plant1. Recreate the layout used in <strong>Tutorial</strong> 1 or open the layout that you previouslycreated2. 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. Inorder to facilitate expansion to the layout, more space is required on the drawingboard. Open the Locator window and outline a larger working area. This willallow you to place more objects on the drawing board4. Move the influent and plug-flow tank objects by clicking and dragging out a boxaround the influent and plug-flow objects. Then, with the mouse button pressedon one of the selected objects, drag the selected area to its new location on thedrawing board (see Figure 2-1).Figure 2-1 Moving a Group of ObjectsPage 33


<strong>GPS</strong>-X TUTORIAL GUIDE5. Copy the final clarifier by selecting the existing secondary clarifier located on thedrawing board. A red outline around the clarifier grid cell will appear. Click onthe copy button and select a destination cell by dragging out a small box insidethe destination cell. The destination cell will get a red outline. Next, click on thepaste button. This will paste a copy of the clarifier and all its attributes to thenew location. Your layout should now look like Figure 2-2.6. FoFigure 2-2 Copying the Final Clarifierllow the procedure outlined in <strong>Tutorial</strong> 1 and complete the layout by adding:A two-way splitter to divide the mixed liquor from the aeration tankto the two clarifiersA two-way combiner to join the recycled sludge from the twoclarifiers with the raw sewage as feed to the tank.A two-way combiner to mix the final effluent from the two final tanksPrior to connecting the new objects you must delete some old connections (seenote box below Step 8 of <strong>Tutorial</strong> 1 for this procedure). Delete the connection fromthe plug flow reactor to the final tank as well as the connection between theclarifier underflow and the plug flow reactor.Page 34


EDITING LAYOUTS AND USING SCENARIOSNext, select a two-way splitter from the Flow Combiners and Spitters group of iconsin the Process Table and place it downstream of the plug-flow tank on the drawingboard. Then, position a two-way combiner underneath the plug-flow tank andanother downstream of the two clarifiers. If necessary, reposition the objects sothat your layout now resembles Figure 2-3Figure 2-3 Adding Objects7. Connect all objects. The last step of the plant expansion is to connect all theobjects. You may find it helpful to reorganize your layout and/or rotate thecombiner object located underneath the plug flow reactor. This is done byselecting the combiner grid cell and clicking on the Rotate button until thedesirable orientation is achieved. The layout should resemble Figure 2-4.Page 35


<strong>GPS</strong>-X TUTORIAL GUIDEFigure 2-4 Connecting the New Units8. Right-click on the Final Clarifier 2 unit and select ‘Note…’. A blank window willappear in which description of the unit can be typed.9. Click Accept to save the changes.Figure 2-5 Add Notes to a Process Unit10. Recompile the model by clicking on the Simulation button on the tool bar.Page 36


Using ScenariosEDITING LAYOUTS AND USING SCENARIOSHaving built the modified layout, you can proceed with the plant performanceinvestigation. To do this, change the following model parameters:Influent flow, to simulate the additional sewer connectionsInfluent type, to simulate a dynamic fluctuation of the influent wastewaterTo change a model parameter (in this case change from a constant influent flow to asinusoidal influent flow), without recompilation, you must become familiar with thescenarios function. Each user-defined scenario can have a different set of modelparameters so that the same model can quickly be simulated using different operatingconditions11. Create a new scenario by selecting the New option from the Scenario drop-downmenu on the Simulation Control tool bar. Type in a name for your new scenarioand Accept the form (see Figure 2-6).Page 37


<strong>GPS</strong>-X TUTORIAL GUIDEFigure 2-6 Defining a New Scenario12. Change the influent flow type and rate by selecting Flow Data from the Flowmenu of the influent object. This will open a form entitledFlow Data-SIMULATION IS LOADED. The latter part of the title is a reminder thatthe model is loaded and that changes made in this form will be saved in thecurrent 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 m 3 /d.You will notice that changes made in a scenario are highlighted in green. Acceptthe 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 thelayout parameters (i.e. reset the parameters to those used during the modelbuild) by selecting the Default scenario from the Select Scenario submenu(accessed from the Scenario Control drop-down menu and scroll to SelectScenario > Default Scenario).Page 38


EDITING LAYOUTS AND USING SCENARIOS13. Create an input control (slider type) for the flow split fraction (in the "MLSSSplitter") as described in the Creating Input Controls section of <strong>Tutorial</strong> 1(Steps 18-20). Set the minimum and maximum values to 0 and 1, respectively.14. Create an QuickDisplay output for the new clarifier as described in the CreatingQuickDisplays section of <strong>Tutorial</strong> 1 (Step 21)15. Create an output graph for the solids profile in the new (copied) clarifier asdescribed in the Creating Output Graphs section of <strong>Tutorial</strong> 1 (Steps 23-27).16. Create an output graph for the effluent SS for each clarifier, and the combinedeffluent as described in the Creating Output Graphs section of <strong>Tutorial</strong> 1. In eachcase, the total suspended solids variable can be found in theOutput Variables >Composite Variables menu of each object's outflow stream.Display all three concentrations on one graph.17. With the steady state box checked, run a 1-day dynamic simulation.18. Change the split fraction to 0.3 using the interactive controller and increase thestop time to 2 days. Click Continue on the Simulation Control window and let thesimulation proceed until it stops.19. Increase the flow to the plant to 8,500 m 3 /d, increase the stop time to 3 days andContinue the simulation. A set of typical results are shown in Figure 2-7. Thesegraphs show the effect of the imbalanced flow split on final clarifier performanceand combined final effluent SS.If you encounter difficulties, examine the procedure for creating the‘Expansion’scenarioPage 39


<strong>GPS</strong>-X TUTORIAL GUIDEFigure 2-7 Typical ResultsGenerating a Static ReportYou may wish to create a report with a list of all the parameter values, as well as themodel results for a particular run. <strong>GPS</strong>-X has a feature which will allow you to just that, bycreating either a standard or custom report in Microsoft Excel formatPage 40


EDITING LAYOUTS AND USING SCENARIOS20. Click on the Report button in the main <strong>GPS</strong>-X toolbar (or select the Report...item from the File menu). This will open a menu that gives you options to print areport Direct to Printer, or create a Standard or Custom Spreadsheet Report.Select Standard, and click the Generate button at the bottom of the window.21. A Save Report… dialogue box similar to the one shown in Figure 2-8 will appearand allow you to save the report to a folder of your choice (the default location isthe same folder as the current layout). Save the report.Figure 2-8 Save Report Dialogue Box22. You will be asked if you want to open the newly created report. Click Yes, andthe report will be opened in Excel (see Figure 2-8). Browse through the variousworksheets to see the model layout, details of each object, and output graphdata.Page 41


<strong>GPS</strong>-X TUTORIAL GUIDEFigure 2-9 Standard <strong>GPS</strong>-X ReportCreating a New Output Table TabIn addition to the viewing model results and summaries on the Quick Display and Graphoutputs discussed in <strong>Tutorial</strong> 1, users can create new custom-designed output tables forobserving model variables. These output tables can be populated with a wider range ofmodel outputs and present the data as a summary of stream or process variable acrossthe simulated layout.23. Create a new, blank output tab by clicking on the New Table Tab button on thetoolbar above the output tabs. This will open the table tab wizard as shown inFigure 1-22.Figure 2-10 New Tab Table WizardPage 42


EDITING LAYOUTS AND USING SCENARIOS24. Populate the table by right-clicking on the Stream Choices and Variable Choicescheck boxes on the wizard. The selected Variable Choices are the variables thatwill be included in the table for each of the selected Stream Choices.25. 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-12.26. On the Variable Choices form select only the Solids > TSS and VSS; OrganicVariables > COD; and the Nitrogen Variables > Ammonia Nitrogen and Nitrateand Nitrite and click Accept. These selections can be seen in Figure 2-12.Figure 2-12 New Tab Table Wizard Selection27. Run a Steady State simulation and observe the new table tab. From the table wecan observe the reduction in the TSS and COD concentrations across bothsecondary clarifiers (fe1, fe2 and fe streams); and the nitrification occuring acrossthe aeration tank (inf and mlss streams).Figure 2-11 Tab Table Steady State ResultsPage 43


<strong>GPS</strong>-X TUTORIAL GUIDE28. Copy data out of the table and into another application by right click on the tableand selecting Copy complete table to clipboard. Open Microsoft Excel or yourspreadsheet program of choice and paste the complete table of steady stateresults.29. To graph the table data as a bar chart click on the CreateBar Chart icon on the table or right click on the table rowof interest and select Create bar Chart.Figure 2-13 Tab Table COD Bar GraphPage 44


EDITING LAYOUTS AND USING SCENARIOSTUTORIAL 3Influent Data & Influent AdvisorProblem StatementYou have some historical data related to the influent wastewater for your plant and itdoes not resemble the default data presented in the <strong>GPS</strong>-X influent object forms.Unfortunately, a full characterization of your influent wastewater has not beenperformed. Nevertheless, you need to estimate the influent wastewater characterizationso that the model can be used with an influent that approximates your influent data. Inthis tutorial, you will investigate the influent models, the impact of the local biologicalmodel on the influent calculations and the use of Influent Advisor as a tool to helpcharacterize influent data.ObjectivesThis chapter covers two important features of <strong>GPS</strong>-X:Influent data entryUse of Influent Advisor as a characterization tool.Page 45


<strong>GPS</strong>-X TUTORIAL GUIDEInfluent DataThe following historical data have been gathered at your plant and represent averagevalues for your influent.Table 3-1 Average Historical DataMeasured Parameter Value Unitscarbonaceous BOD5 190 mg/lsoluble COD 42 mg COD/ltotal COD 365 mg COD/ltotal suspended solids 210 mg/lvolatile suspended solids 168 mg/lammonia 26 mgN/ltotal TKN 36 mgN/lsoluble TKN 31 mgN/l1. Create a New Layout by clicking on File > New. Select the Carbon-NitrogenLibrary (cnlib) from the Model Library drop-down menu in the main toolbar. Savethe layout as `tutorial3’ using the Save As... command from the File menu.After saving, drag a single wastewater influent object on the drawing board, andrecompile 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 namedInfluent as described in <strong>Tutorial</strong> 2 (Step 9)3. Access the wastewater influent object process menu and chooseComposition>Influent Characterization. The Influent Advisor characterizationtool will be displayed as shown in Figure 3-1.Page 46


INFLUENT DATA & INFLUENT ADVISORFigure 3-1 Influent Advisor4. Enter the total COD, total TKN and free and ionized ammonia data from thetable above into the form (see Figure 3-1) and press Enter. The entries are shownin green, indicating that these changes are part of the Influent scenario youcreated earlier.5. Check the remaining variables in Error! Reference source not found. againsttheir corresponding values in <strong>GPS</strong>-X. The right-hand column in the InfluentAdvisor tables show the new composite variable values. The values reflect thenew 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 yourplant indicating that one or more of the default settings (i.e. composition data orstoichiometric fraction) are inconsistent with your wastewater. We willinvestigate the steps required to reconcile these discrepanciesUsing Influent AdvisorThe Influent Advisor tool has been designed to make the characterization of the influentwaste stream as straightforward as possible. It would be possible to run a series ofsimulations (while adjusting influent parameters on sliders and observing plotted output)to find the correct settings, this method would require setting up input and output andcould be potentially time-consumingPage 47


<strong>GPS</strong>-X TUTORIAL GUIDEThe Influent Advisor tool shows all input and output in an interactive way, allowing usersto determine which inputs affect each output, and to trace all dependencies. The sheetcontains three columns:Inputs State Variables Composite VariablesFigure 3-2 Influent Advisor Columns6. Find the VSS variable in the right-hand column, and click on the value. You willnotice that a formula has been displayed in the formula box at the bottom of thesheet. This formula corresponds to the formula used in <strong>GPS</strong>-X to calculate thevalue clicked on. Values used in the calculation are highlighted as well. Click onother cells to see other formulas.Let’s proceed to make adjustments to the influent parameters (fractions and/orconcentrations) to reconcile the model predictions with the measured valuesfrom Error! Reference source not found..7. Note that the particulate COD to VSS ratio (XCOD/VSS) is used in the calculationof VSS. This is one of several important relationships can be calculated from theexisting data. For instance:VSS:TSS ratio (ivt) = 168/210 = 0.8particulate COD: VSS ratio (icv) = (365-42)/168= 1.928. Enter these values into the Inputs column under the Influent Fractionssub-heading. Note that doing this seemingly results in values further away fromwhat you are looking for. Further changes will be required.Page 48


INFLUENT DATA & INFLUENT ADVISOR9. Click on VSS to display the calculation formula. By continuing to click on the cellsin 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 afunction of frsi and frss, the fractions of total COD for soluble inert and solublesubstrate. It is these two fractions that we can adjust to control the relationshipbetween the measured variable (vss) and the model predictions that need to bereconciled.10. Adjust frsi (soluble inert fraction of total COD) to 0.02. Because we need toincrease VSS, we need to increase the particulate COD components. This can bedone by decreasing the amount of total COD that is assigned to the two solublecomponents (soluble inert si and soluble substrate ss). By decreasing the solubleinert component from 5% to 2% of total COD, the particulate substratecomponent xs has increased, thereby increasing VSS11. Adjust the frss value to bring the calculated soluble COD value in line with themeasured value. When entering a new frss value, press Enter to update all othercalculations.12. Lastly, adjust the soluble TKN (stkn) value. Click on the equation to determinethe appropriate input parameter to adjust, and make the necessary changes.NOTE: In reality you will characterize your influent and adjust theseunknown parameters based on the model behavior and how that modelbehavior relates to what has been observed or measured at the plant. Eachwastewater is different and each will require some adjustment of theseparameters to get a characterization that results in model behavior that isconsistent with your plant behavior.The final characterization should appear as shown in Figure 3-3.Page 49


<strong>GPS</strong>-X TUTORIAL GUIDEFigure 3-3 Completed Influent CharacterizationInfluent Advisor WarningsStrictly as an exercise to demonstrate a point, you will now change the influentcharacterization so that a warning message is generated as a result of an improperlycharacterized influent.13. Change the total TKN value (tkn) to 15 mgN/L. After clicking Enter, you willnotice that some output variables have been highlighted in red. This indicates anegative concentration, which sometimes can some from usual or poorcharacterization data. Negative influent concentrations can cause mass balanceerrors and convergence problems, so these values must be addressed beforeproceeding with a simulation. Note that if you Accept the characterization andclick on the Start button, a window will pop up to warn you of the negativeinfluent concentration.Page 50


INFLUENT DATA & INFLUENT ADVISORTUTORIAL 4Data Input & OutputProblem StatementYou are interested in testing your plant under more dynamic or stressful conditions suchas a storm. Unfortunately, you do not have access to real storm flow data. Therefore youwill generate a simulated storm loading to your plant and then input this data as a drivingfunction 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 responseof the model. However, in most modeling projects, it is desirable if not essential to inputreal forcing functions to examine how the model behaves under real conditions. Theforcing 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. Atypical set of time dynamic data would be the influent flowrate to the plant over a periodof time. <strong>GPS</strong>-X facilitates the input of this data so that the model will be used under realconditions.ObjectivesThis chapter covers an important and useful feature of <strong>GPS</strong>-X:Using a data file as an input to control simulationsPage 51


<strong>GPS</strong>-X TUTORIAL GUIDESetting up Dynamic Input1. Open the layout built in <strong>Tutorial</strong> 1 and save it as `tutorial4’ using the SaveAs... command from the File menu. After saving, recompile the model by clickingon the Simulation button on the tool bar.2. Right-click on the Influent Object Composition > Influent Characterization menuto bring up the Influent Advisor page. Drag total COD, total TKN and free andionized ammonia to the control window to create interactive sliders.The next step is set up the data in files to be read by <strong>GPS</strong>-X during a simulation. There aretwo different ways that data files can be prepared for the file input controllers:i. Manually preparing spreadsheets outside of <strong>GPS</strong>-X (best used for preparingdata for multiple variables), and selecting the data file with the <strong>GPS</strong>-XScenario Configuration… menu.orii.Using the Data File… tool in the <strong>GPS</strong>-X interface. (best used for preparingdata for a single variable)This tutorial will use both methods to illustrate their use. We have created a data file foryou to use during this tutorial. Locate and open the <strong>Tutorial</strong> 4 Example Data.xlsspreadsheet file in the following folder:c:\gpsx64\layouts\08tutorials\We will use data from this file as our dynamic dataset, and start by using the ScenarioConfiguration… menu to point <strong>GPS</strong>-X to the data to be used in the simulation.The <strong>Tutorial</strong> 4 Example Data.xls file should appear as shown below. It is a typical set ofinfluent input data that you might use to simulate a change in influent loading over time.Page 52


DATA INPUT & OUTPUTFigure 4-1 Data FileThe first column is labeled “t” for time, and is always in the units of days. The remainingcolumns contain data for each of the parameters being read from the file. The names atthe head of each column are the “cryptic variable name” (which is the internal “shortform” variable name within <strong>GPS</strong>-X calculations) for each variable. These names arespecific to the layout you have created, and are different for each variable and objectwithin the layout. When preparing new files, you will need to determine the crypticvariable 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 cursorover the variable name in the controller window. A pop-up will show the cryptic variablename, as shown in Figure 4-2Figure 4-2 Showing the <strong>GPS</strong>-X Cryptic Variable NamePage 53


<strong>GPS</strong>-X TUTORIAL GUIDEThe cryptic variable names for the 4 variables in this tutorial are:qconinf –influent flowcodconinf – influent CODtknconinf - influent TKNsnhconinf – influent free and ionized ammoniaNote that “inf” in the cryptic variable name above comes from the label the userdesignated for the influent stream (i.e. if the user labels the influent stream as“1”, the cryptic variable name for influent flow will show up as “qcon1”)3. The next step is to tell <strong>GPS</strong>-X where to find the file with the data to be read induring the simulation. Click in the Scenario Menu in the bottom task bar, andselect Default Scenario > Configuration… menu.Figure 4-3 Selecting the Scenario > Configuration Menu4. The configuration menu will show all of the scenarios available (which should bejust the Default Scenario). Click on the Data Files… button, to bring up the datafiles menu. Click on the Add… button to add the existing <strong>Tutorial</strong> 4 ExampleData.xls file to this simulation.Page 54


DATA INPUT & OUTPUTFigure 4-4 Adding a Data File5. Browse to the file, click Add. The Data File menu should appear as follows:Figure 4-5 Data File Added to Default Scenario6. Accept the changes and close the Scenario Configuration menu. Notice that theinteractive slider for the inputs have automatically changed to file input controlbar (Figure 4-6). Input controllers can also be manually changed by clicking on the‘Input Control Properties…’ button and changing the input type from a slider tofile input (Figure 4-7)Page 55


<strong>GPS</strong>-X TUTORIAL GUIDEFigure 4-6 Slider Changed to File Input ControllerFigure 4-7 Input Control Properties Menu7. Run a 5-days simulation with Steady-State click ON. As the simulation proceeds,the values of the influent flow and concentration will change in the inputcontroller. The model responds dynamically to the changing input, as shown inthe increasing effluent solids.The above methodology is useful for simulations where data for many parameters arebeing read in simultaneously, and it is easy to assemble that data externally in aspreadsheet. There is another option that is useful for simple simulations where just oneor two parameters are being read from a file, and you want to input those values directlyinto <strong>GPS</strong>-X. For this situation, you can use the <strong>GPS</strong>-X Data File… tool.8. Right-click on an open spot in the layout background, and select System > InputParameters > Physical, and drag liquid temperature to the input tab. This willcreate a new slider controller.9. Right-click on liquid temperature in the Control Window and select the DataFile… option. A data input menu will open, as shown in Figure 4-8.Page 56


USING AUTOMATIC CONTROLLERSFigure 4-8 Accessing the Data File... Menu10. Click on cell in the upper-left-hand corner of the table. The data field becomesactive, so that you can manually enter values by typing. Enter in values for thetime series as shown below in Table 4-1:Table 4-1 Example Data for Liquid Temperature in the SystemTime [d]12345temp [C]1718202224NOTE: If you wish to copy-and-paste data from another program, the twocolumns of data (timestamps and the variable values) have to be adjacentcolumns.Page 57


<strong>GPS</strong>-X TUTORIAL GUIDE11. Save the time-series data using the Save… button on the data file window (usethe default filename provided by <strong>GPS</strong>-X), and then click Close to return to themain <strong>GPS</strong>-X interface. Notice that the interactive slider for the liquid temperatureinput has automatically changed into a file input control bar.12. Run a 5-day simulation with Steady-State clicked ON. As the simulationproceeds, the value of the influent flow, concentrations and temperature willchange in the input controller as the simulation proceeds.Plotting Measured Data along with Simulated ResultsThe previous section described the method for importing input data to the simulation file.In this section, the method for importing and displaying the measured output data onto agraph alongside simulated results will be introduced. This is convenient for comparing themeasured value from a plant with the simulated results given in <strong>GPS</strong>-X. It also makes iteasier to calibrate and optimize the process (see <strong>Tutorial</strong> 8 for details regardingoptimization).13. Open a new Excel file and type in the numbers as shown below (Figure 4-9). Thisis the observed total suspended solids data for the final effluent from the plant.The cryptic variable name for the total suspended solids in the final effluent canbe found by right-clicking on the output graph and selecting Output Properties…from the drop-down menu. Hold the mouse cursor over the variable name underthe Variable Properties sub-section to determine the cryptic variable name (thisshould correspond to the name on the first row of the Excel file).Page 58


USING AUTOMATIC CONTROLLERSFigure 4-9 Example Data File for Effluent Total Suspended Solids14. Save the Excel file in .xls format (.xlsx format is not compatible with <strong>GPS</strong>-X) underthe directory where this simulation file is saved. Click in the Scenario Menu andselect Configuration…menu. Click on the Data Files… button and add the savedfile to this simulation. Accept and close the window.15. Run a 5-day simulation with Steady-State clicked ON. The data points from themeasured data should show up with the simulated result graph, as shown inFigure 4-10.Page 59


<strong>GPS</strong>-X TUTORIAL GUIDEFigure 4-10 Measured Data and Simulated ResultsCreating a Bar Chart for Steady-State ConditionThe measured data of distributions within a unit can also be plotted along with thesimulated result as a bar chart. The methodology for doing so is similar to the previoussection.16. Create a new blank output tab by clicking on the New Graph Tab button on thetoolbar above the output tabs.17. Create a graph of the readily biodegradable substrate within the plug-flow tankby right-clicking on the plug-flow tank and select Output Variables > StateVariables in Individual Reactors.18. Under the Organic Variables sub-section, drag the ‘readily biodegradablesubstrate in reactor’ variable to the blank output graph. Click Accept. Notice thatif you right-click on the output graph and select Output Graph Type item, the BarChart type will already be selected.Page 60


USING AUTOMATIC CONTROLLERS19. Open a new Excel file and type in the numbers as shown below (Figure 4-11).This is the measured readily biodegradable substrate concentration data withinthe plug-flow tank unit (the default number of reactors in the plug-flow tank isset to 4).The cryptic variable name for readily biodegradable substrate within the unit can befound by right-clicking on the output graph and selecting Output Properties… fromthe drop-down menu. Hold the mouse cursor over the variable name under theVariable Properties sub-section to determine the cryptic variable name (this shouldcorrespond to the name on the first row of the Excel file).Figure 4-11 Example Data for Readily Biodegradable Substrate for Four Reactors within a Plug-FlowUnit20. Save the Excel file in .xls format (.xlsx format is not compatible with <strong>GPS</strong>-X) underthe directory where this simulation file is saved. Click in the Scenario Menu andselect Configuration…menu. Click on the Data Files… button and add the savedfile to this simulation. Accept and close the window.Page 61


<strong>GPS</strong>-X TUTORIAL GUIDE21. Click on the ‘Output Properties…’ button and check the Autoscale button (Figure4-12).Figure 4-12 Output Graph Properties Menu for a Bar Chart22. Run a 0-day simulation with Steady-State clicked ON. The data from the Excelfile should show up with the simulated result as a bar chart, as shown in Figure 4-13. Notice that the simulated result is shown as a colored bar chart which isoverlapped by the measured data which is visualized as a meshed bar chart.Figure 4-13 Bar Chart for Simulated Results and Measured DataPage 62


USING AUTOMATIC CONTROLLERSTUTORIAL 5Using Automatic ControllersProblem StatementAutomatic process control is well established in many applications ranging from largerefineries using multivariate model-based control to climate control of buildings usingsimple on/off control. Wastewater treatment plants are no exception. Theimplementation of even basic automatic control should improve performance and savemoney. In <strong>GPS</strong>-X, the user can simulate the effects of automatic process control.To improve and stabilize operation, as well as realize energy savings, you decide toimplement MLSS and dissolved oxygen control. You will do this by incorporating MLSSand DO controllers into your system.ObjectivesThis tutorial will show you how to setup an MLSS controller to automatically adjust thebiosolids wastage rate in order to meet the specified MLSS set point. This tutorial alsowill show you how to setup a dissolved oxygen controller that automatically changes theaeration rate in order to meet the dissolved oxygen set point.Page 63


<strong>GPS</strong>-X TUTORIAL GUIDESetting up an Automatic MLSS Controller1. Open the layout completed in <strong>Tutorial</strong> 1 and save it as `tutorial5’ using theSave As... command from the File menu. If you no longer have a copy of thislayout you will need to recreate it. As we will be defining new variables for MLSScontrol, make sure that you DO NOT click on the Simulation button. If you havealready clicked on the Simulation button, simply click on the Modelling button sothat you can set up the MLSS controller.2. Access the plug-flow tank's Aeration Setup menu by opening theInput Parameters > Operational form. From the specify oxygen transfer by…drop-down menu, select Entering AirflowFigure 5-1 Setting up the MLSS Controller (a)3. Identify the manipulated variable for the MLSS controller. The most logicalvariable for this is the wastage flowrate, which in this case, is the pumped flowfrom the clarifier. Some of the pumped flow control parameters are found in thesecondary clarifier Input Parameters > Operational form. Turn the Pumped Flowcontroller ON. Additional pumped flow control parameters are found on asubsequent form displayed using the More... button found at the bottom of thePumped Flow sub-section. Initially your forms will appear slightly different thanthe ones shown in Figure 5-1 and Figure 5-2; however, you are going to modifyyour forms to resemble those shown.Page 64


USING AUTOMATIC CONTROLLERSFigure 5-2 Setting up the MLSS Controller (b)4. Define the control variable for the MLSS controller. In the secondary clarifierInput Parameters > Operational > More... form, type xmlss, (the variable whichcorresponds to the MLSS in the aeration basin effluent stream) in the text fieldnext to the control variable label. If this stream is not labelled as mlss in yourlayout then the variable name you will need to type is xwhere is the plug-flow tank effluent stream label.5. Set the controller tuning constants by entering 0.05 days as the controllersampling time (this represents the frequency with which the controller samplesthe control variable, or MLSS in this case). The controller effect on controlvariable - direct should be turned OFF. This means that the manipulatedvariable, the wastage flow rate, is increased in order to reduce the controlvariable, MLSS. (A different control loop such as air flow and DO concentrationwould require the controller effect on control variable - direct switch to beturned on as an increase in the manipulated variable, air, would result in anincrease in the control variable, DO.)6. Set the maximum pumped flow rate to 200 m 3 /d and Accept this form (Figure5-2)Page 65


<strong>GPS</strong>-X TUTORIAL GUIDE7. Set the setpoint for the control variable (in the Input Parameters > Operationalform, Figure 5-1) to 2000 mg/l. Accept this form, Save your layout and recompilethe model by clicking on the Simulation button.Tuning the Automatic MLSS Controller8. Create a new input control window as described in <strong>Tutorial</strong> 1 and set-up thewindow with the controller constants (proportional gain, integral time andderivative time), the MLSS setpoint and the controller switch (see Figure 5-3).Set the minimum and maximum for setpoint for control variable, proportionalgain, integral time and derivative time to 0-4000 g/m 3 , 0-50, 0-10 d and 0-10 d,respectively.9. Create a new output graph as described in <strong>Tutorial</strong> 1 and set-up the MLSS, theinfluent flowrate and the wastage flowrate on the same output graph. Theoutput variable (MLSS) can be found in the Output Variables > CompositeVariables form of the plug-flow tank effluent stream. Set the minimum andmaximum for MLSS concentration, influent flow and wastage flow to0-5000 g/m 3 , 0-5000 m 3 /d and 0-600 m 3 /d, respectively.Figure 5-3 MLSS Interactive Controls10. Run a 10-day dynamic simulation with a sinusoidal influent flow pattern(see <strong>Tutorial</strong> 2 if you have forgotten how to do this) and the controller turnedON.Page 66


USING AUTOMATIC CONTROLLERSInitially, you will find that the manipulated variable oscillates wildly between itsminimum and maximum values. This is a controller tuning problem. It is usuallypossible to obtain reasonable controller performance by trial and error. In thisexample, one may conclude that the controller gain is too large. One option fortuning 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 stablecontroller.Watch how the wastage rate changes to counteract the effect of adisturbance (e.g. influent flow rate). If it does not react quickly enough,try increasing the proportional gain. Continue to increase theproportional gain until you get a reasonably responsive control effect, butstill a stable response.If the wastage rate becomes unstable (wild oscillations) decrease theproportion gain.With the proportional effect stable, try decreasing the integral time toincrease the performance of your controller.If there is too much overshoot, try increasing the derivative timeA simplified understanding of the three elements of a PID controller is: fast, persistentand predictive for the P, I and D terms respectively. Remember that automatic processcontrol is not a simple subject and it may not be possible to achieve the level of controlthat you desire. Consider the process time constant of the MLSS in the aeration basin. Ittakes 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 effecton the MLSS can occur in a matter of hours or even minutes.There are several published approaches for finding good initial tuning constants for PIDcontrollers. One approach is to use the Ciancone correlations (Marlin, 1995 i ) which areincluded in <strong>GPS</strong>-X's PID tuning tool. The Ciancone correlations provide the tuningconstants given the gain, time constant, and dead time of the process, under theassumption that the process dynamics may be represented with reasonable accuracy by afirst-order plus dead time model. In <strong>GPS</strong>-X's PID tuning tool, the process response to astep change in the manipulated variable is fit to a first-order plus dead time model usingleast squares (in tuning mode). The Ciancone correlations are then used to determine theappropriate values for the tuning constants.Page 67


<strong>GPS</strong>-X TUTORIAL GUIDE11. Activate the pumped flow control tuning mode, by creating a new scenario fromthe Simulation Control tool bar as described in <strong>Tutorial</strong> 2. In the final clarifierInput Parameters > Operational form (under the Pumped Flow More... button,under Pumped Flow Control Tuning) turn the tuning switch ON. The fractionalstep size can be specified on that form and can be a positive or negative value. Inthis case, set the fractional step size to 0.5. Accept this form. Now turn theMLSS controller turned OFF set the pumped flow value to 100 m 3 /d. Thisfractional step size corresponds to a step in pumped flow rate from 100 m 3 /d to150 m 3 /d. Accept the operational forms.12. Turn the MLSS controller ON and run a 0-day steady state simulation with thenewly created scenario. Once this is complete, turn the MLSS controller OFFusing 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 essentialcharacteristics 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 normaloperating conditions.The simulation should last long enough to capture most of the processdynamics (i.e. the simulation should end at steady-state, or beapproaching steady-state), andThe step in the manipulated variable should be large enough to dominateother "noise" that affects the controlled variable (in this case thesinusoidal influent flow pattern).4For the tuning mode to operate properly, the controller sampling time must be set to areasonable value, e.g. the execution time of the controller to be implemented. This is why thecontroller sampling time was left as 0.05 daysPage 68


USING AUTOMATIC CONTROLLERSFigure 5-4 Tuning Mode SimulationAt the end of the simulation, PID tuning constants will be calculated (this may takeseveral seconds), and will appear in the Command window. A notification will appear onscreen when the calculation is complete (see Figure 5-5). The Command window can beopened by selecting this option from the Simulation Control drop-down menu on theSimulation Control tool bar.Figure 5-5 Calculated PID Tuning Constant13. Turn the MLSS controller ON and turn the tuning mode OFF (under InputParameters > Operational) and set the controller tuning constants to thesevalues. The simulation shown in Figure 5-6 was performed using these tuningparameters for the MLSS controller. The MLSS setpoint was 2000 mg/l and theaverage influent flow rate was decreased to test the performance of thecontroller under dynamic conditions.Page 69


<strong>GPS</strong>-X TUTORIAL GUIDEFigure 5-6 Simulation with MLSS ControllerUsing an Automatic DO Controller14. Create a new scenario named ‘DO Control’ as described in <strong>Tutorial</strong> 2.15. Access the plug flow tank’s Aeration Setup menu by opening theInput 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 DOController to activate the automatic DO controller. The other important item inthis form is the DO Setpoint Array button [(...)] found under the Aeration Controlmenu. By clicking on the Array button, another form will appear showing thesetpoints. The default setpoints are all set to 2.0. Accept all forms.Page 70


USING AUTOMATIC CONTROLLERSFigure 5-7 Setting up a DO Controller16. Create a new input control window as described in <strong>Tutorial</strong> 1 and set-up thewindow with the first and last DO setpoints (see Figure 5-8).Figure 5-8 DO Input Control Window17. Create a new output graph as described in <strong>Tutorial</strong> 1 and set-up the graph todisplay the dissolved oxygen concentration in the first and fourth tanks of theplug-flow tank and the effluent free and ionized ammonia. The dissolved oxygenvariables can be found in the Output Variables > State Variables > dissolvedoxygen > [(...)] form (Figure 5-9 and Figure 5-10) of the plug-flow tank (ensurethat you do not click on a connection point to or from the tank as in this case wewant variables internal to the object). Accept both forms. Find the free andionized ammonia variable in the Output Variables > State Variables form of theplug-flow tank effluent stream. Use similar min/max ranges as above for theDO setpoints and ammonia concentration.18. Auto Arrange the windows. Ensure that the MLSS controller is turned ON.Page 71


<strong>GPS</strong>-X TUTORIAL GUIDE19. Run a simulation, varying the influent flowrate and the DO setpoints. Theautomatic controller behaves quite well with the default tuning constants.Figure 5-9 DO Output VariablesFigure 5-10 Dragging to DO onto an Output GraphPage 72


THE DEFINE FUNCTIONTUTORIAL 6The Define FunctionProblem StatementSome important operational variables in a wastewater treatment plant are site specificand difficult to generalize. These variables include sludge residence time (SRT) and foodto-microorganismratio (F/M). In addition, other calculations, such as daily averages,moving averages, and mass flows are applied to most water quality parametersthroughout the plant. Consequently, it is desirable for any wastewater treatment plantmodel to contain these traditional process variables, and <strong>GPS</strong>-X provides you with thiscapabilityObjectivesThis 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 theDefine button located on the <strong>GPS</strong>-X toolbar).Page 73


<strong>GPS</strong>-X TUTORIAL GUIDESetting up the Layout1. Develop a new layout consisting of an influent object, control splitter, plug-flowtank, rectangular secondary clarifier and a combiner. Use CN library and thedefault model selections (codstates influent model, the mantis plug flow tankmodel and the simple1d rectangular clarifier model). The completed layout withthe stream labels is shown in Figure 6-1. You should edit the stream labels ofyour unit process so that they are the same as those in Figure 6-1. Labels can beedited via the Labels... item of the object's process menus. The control-splitterunit process will be used to simulate a bypass weir.Figure 6-1 The Define Function Layout2. Set the clarifier operational parameters by setting the recycle fraction as 80% ofthe influent flow rate. This is done through the clarifier's Input Parameters >Operational menu. Switch ON the proportional recycle switch and in the spacenext to location to which recycle is proportional replace `blank’ with thename 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 notnecessary for you to change it. These changes to the operational parameters aredepicted in Figure 6-2.Page 74


THE DEFINE FUNCTION3. Specify a value for the pumped flow (which will be used as the wastage rate) bychanging the default pumped flow value from 40 m 3 /d to 100 m 3 /d. Accept thisform.Figure 6-2 Proportional Recycle Set-upDefining Mass Flows1. Specify a mass flow on the effluent solids using the Define feature. This massflow is defined as the effluent suspended solids multiplied by the effluent flowrate. Click on the inverted triangle to the immediate right of the f(x) symbol onthe Define button to display the Define drop-down menu. Select Mass Flow fromthe list and a window will appear. (see Error! Reference source not found.)Page 75


<strong>GPS</strong>-X TUTORIAL GUIDEFigure 6-3 Selecting Define FunctionThe Status Bar at the bottom of the main window will indicate Mode: Define -Mass Flow.Select bypass, final clarifier (se label) and final effluent stream (finalefflabel) under stream choices. Then select TSS under variable choices. Click Accept.(See Figure 6-4)Page 76


THE DEFINE FUNCTIONFigure 6-4 Defining a Mass Flow2. Once the window is closed, the Status Bar message should revert to Mode: Edit.3. You should now Save the model and then recompile it by clicking on theSimulation button.4. Create a new output graph as described in <strong>Tutorial</strong> 1 and set-up the three massflows on a graph. Right-click on the clarifier se stream and select the OutputVariables > Defined Variables > Mass Flow menu item. Drag the Mass Flow.totalsuspended solids variable to an output graph and Accept this form. Repeat thisprocedure for the bypass and the finaleff streams so that all three massflows are displayed on the same output graph. Set the minimum and maximummass flows on that graph to 0 and 1,000 kg/d respectively (see Error! Referenceource not found.).Page 77


<strong>GPS</strong>-X TUTORIAL GUIDEFigure 6-5 Mass Flow Output Graph Set-up5. Place the influent flow rate on an input control window as described in<strong>Tutorial</strong> 1. Set the minimum flow to 0 m 3 /d and the maximum flow to10,000 m 3 /d.6. Auto Arrange the windows and run a 20-day dynamic simulation.7. Increase the influent flow rate and notice that when the influent flow rate isabove 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. Youcan try changing the bypass flow limit by increasing the pumped flow rate in theCONTROL SPLITTER object. To prevent having to recompile the model, this mustbe done either by defining a scenario or by placing the bypass pump flow on aninput control window.8. Re-run the simulation and try to reduce the total mass flow of solids dischargedto the receiving water.Defining an SRTIn this section you will learn how to calculate and display SRT, the solids residence time inthe system.9. Click on the Modelling button and click on the inverted triangle to the immediateright of the f(x) symbol on the Define button to display the Define drop-downmenu. Select Solids Retention Time from the list. The Status Bar at the bottomof the main window will indicate Mode: Define – Solids Retention Time, and theSRT Manager window will be displayed.Page 78


THE DEFINE FUNCTION10. Define a SRT calculation by clicking on the “+” button immediately below the lefthandwindow in the SRT Manager menu. You will be prompted for a uniquename for the SRT calculation. Enter srttank and click OK. A new blank SRTequation will be shown in the right-hand window (see Error! Reference sourceot found.).Figure 6-6 Defining the SRT Equation11. Click on the aeration basin in the drawing board to start defining the SRTequation. You may need to move the SRT Manager window out of the way toaccess the aeration basin on the drawing board. You will be prompted to selectwhich of the reactors within the plug-flow tank are to be included in the SRTequation. Leave all reactors selected and click Close.There are two parts to the SRT equation. The numerator is the mass section ofthe equation, and it includes the mass of solids held in each tank. Typically SRTcalculations only include the mass of solids held in the aeration basin, but it isalso possible to calculate SRT by summing the mass in the aeration basin and thefinal clarifier. While the SRT equation is shown, every time you click on a tank themass of solids in that unit process will be included in the SRT calculation. As youfirst pointed at the aeration basin, the mass of solids in the aeration basin isalready included in the calculation. If you click on the clarifier, its label (se) isadded to the numerator of the equation indicating that the mass of solidscontained in the clarifier is now part of the SRT calculation. If you click on theclarifier again, the label (se) will be removed from the equation and the mass ofsolids in the clarifier will not be included in the calculation.Page 79


<strong>GPS</strong>-X TUTORIAL GUIDEYou also need to define the denominator part of the equation, the excess solidsmass flow lines that are used to calculate SRT. This is done by pointing to theflow lines which convey solids out of the system. Typically this will only includethe waste flow. If you point to the waste flow line (the cursor will change to theblock 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 alsoinclude the solids flux in the effluent line by clicking on the clarifier effluentstream (labeled se). The SRT equation should now look like Error! Referenceource not found.:Figure 6-7 SRT Manager Window12. Close the SRT Manager window to accept the equation.13. Save the model and then recompile it by clicking on the Simulation button.14. While staying on the Simulation interface, display the new SRT variable on agraph by clicking on the inverted triangle to the immediate right of the f(x)symbol on the Define button to display the Define drop-down menu. SelectSolids Retention Time from the list to bring up the SRT Manager window.As described in <strong>Tutorial</strong> 1, drag the SRT variable directly from the SRT Managerwindow to a new output graph and assign it the appropriate max/min values inthe Output Graph Properties (e.g. 0 to 30 days).Page 80


THE DEFINE FUNCTIONFigure 6-8 Displaying SRT on an Output Graph15. Put the pumped flow rate on an input control window as described in <strong>Tutorial</strong> 1.It is located in the clarifier’s Input Parameters>Operational form.16. Try running a few simulations, observing the SRT as you change the amount ofsolids being wasted out of the system. After you are finished, click on theModelling button.Defining AveragesThe procedure for defining averages is similar to setting up mass flow calculations. Inaddition, averaging calculations can also be applied to a defined mass flow, SRT, or F/Mratio. Here, you will apply averaging calculations to the Mass Flow in the dischargestream defined above.17. Click on the inverted triangle to the immediate right of the f(x) symbol on theDefine button to display the Define drop-down menu. Select Daily Average fromthe list and a Daily Average window will appear. Select Define Variables in theVariable Type drop down menu. Tag the “Mass Flow. total suspended solids”variable under finaleff>Mass Flow and Accept the form. You have now set up adaily average calculation for the mass flow of suspended solids in the finaleffstream.Page 81


<strong>GPS</strong>-X TUTORIAL GUIDE18. Use the same procedure and define a moving average for the mass flow ofsuspended solids in the finaleff stream. . Click on the inverted triangle tothe immediate right of the f(x) symbol on the Define button to display the Definedrop-down menu. Select Moving Average from the list and a window willappear. Select Define Variables in the Variable Type drop down menu. Tag the“Mass Flow. total suspended solids” variable under finaleff>Mass Flow andAccept the form.19. Save the model and then recompile it by clicking on the Simulation button.20. Create a new output graph as described in <strong>Tutorial</strong> 1 and set-up the movingaverage and daily average for display. Use a maximum limit of 1,000 kg/d forboth variables. You will notice in the display menu for the moving average (fromthe finaleff stream, Output Variables > Defined Variables > MovingAverage) that a number will appear to the right of the variable name (see Error!eference source not found.). This number represents the number of days thatare used in each moving average calculation. Note that you must be in Modellingmode to edit this # of Days valueFigure 6-9 Moving Average21. Run the model and change the influent and wastage flow rates to observe themoving and daily averages.Controlling SRT with Waste Pump RateWhen 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 theSRT controller, click on the Define button (in Modelling Mode) to bring up the SRTManager window. Select a SRT to control (for this example select srttank), and clickon the “Estimate WAS using set SRT” option, as shown in Figure 6-10.Page 82


SENSITIVITY ANALYSISFigure 6-10 Controlling WAS using SRT SetpointEnter the desired SRT (in days) into the Set Point Value field, and select the desiredwastage flow to be manipulated by choosing the appropriate flow stream label from thedrop-down list “Controlled Flow”. Only one SRT can be controlled at a time via thismethod. If multiple SRT controllers are required (e.g. for plants in parallel) then a PIDcontrol loop can be used in the pump control section of the secondary clarifier or atoolbox object.Once complete, go to Simulation Mode, and the model will need to be rebuilt. Runsimulations at various SRT setpoints to observe required WAS flowrate to achieve thedesired SRT.Page 83


<strong>GPS</strong>-X TUTORIAL GUIDETUTORIAL 7Sensitivity AnalysisProblem StatementWith any model, one of the first exercises to carry out is a sensitivity analysis of themodel parameters. There are two reasons for doing so: 1) to validate the model resultsand 2) to identify parameters to be adjusted during calibration. The former reasonshould allow the modeler to develop some confidence in the model so that it behaves inan expected manner. For example, lowering the air flow rate to the aeration basin shouldresult in a lower dissolved oxygen concentration. The latter reason for performing asensitivity analysis, parameter identification, is useful because it helps determine theparameters that have the most impact on the model response. We do not want to adjustparameters during a calibration run that have little effect on the model behavior.After the model is calibrated and verified, sensitivity analyses are useful for otherreasons. Mathematical models can be revealing, sometimes allowing us to exploreoperational strategies that might never have been contemplated otherwise. In thischapter, you will explore the steady-state and dynamic sensitivity of a basic model.ObjectivesThe purpose of this tutorial is to see how we can extract as much information as possiblefrom a <strong>GPS</strong>-X model. By the end of this tutorial you should have developed a workingknowledge of the Analyze functions. This includes setting up and running steady state,phase dynamic, and time dynamic sensitivity analyses. By completing this tutorial, youwill also learn how to interpret the results from these simulations.Page 84


SENSITIVITY ANALYSISSetting up the LayoutBecause this <strong>GPS</strong>-X feature requires multiple simulations, for demonstration purposes thework will be carried out on a simple model consisting of an influent, a CSTR, and arectangular final clarifier. The layout should resemble that shown in Figure 7-1, with acodstates influent model, mantis CSTR model and simple1d clarifier model. Save themodel and then recompile it by clicking on the Simulation button.Setting up the Parameters for Analysis1. Create a new scenario and set up a sinusoidal influent flow and load pattern byspecifying Sinusoidal for both the influent Flow > Flow Data > flow typeparameter and the influent Composition > Load Type Options > load typeparameter.Figure 7-1 Layout for the <strong>Tutorial</strong>Page 85


<strong>GPS</strong>-X TUTORIAL GUIDE2. Right-click on the aeration tank and select Entering Airflow by navigating throughInput Parameters>Operational> specify oxygen transfer by… drop-down menu(found under the Aeration Setup menu). Also, set the air flow into aeration tankto 15,000 m 3 /d (found under the Diffused Aeration menu).3. Save the model with the name ‘tutorial 7’ and recompile it by clicking onthe Simulation button.4. Place the influent flow and the air flow into aeration tank on an input controlwindow. The influent flow variable can be found in the influent objectFlow >Flow Data form, and the air flow into aeration tank can be found in theCSTR object Input Parameters > Operational form. Put both parameters on thesame input control, with limits of 0-10,000 m 3 /d for the influent flow and 10,000-25,000 m 3 /d for the air flow.5. Create output graphs for the effluent ammonia, BOD 5 and total nitrogenconcentrations, as well as the DO concentration in the aeration tank. Placethese outputs on four separate graphs. The effluent free and ionized ammoniavariable is found on the clarifier effluent stream's Output Variables > StateVariables form. Similarly, the total carbonaceous BOD5 concentration is found inthe clarifier effluent stream's Output Variables > Composite Variables form. Thetotal nitrogen concentration is found in the clarifier effluent stream's OutputVariables > Composite Variables > More… form, while the dissolved oxygen inthe aeration basin can be found in the CSTR's Output Variables > State Variablesform. Use limits of 0-30 gN/m 3 for NH 3-N, 0-30 gO 2/m 3 for cBOD 5, 0-30 gN/m 3 fortotal nitrogen and 0-5 gO 2/m 3 for DO. Run a 1 day simulation (with Steady Statechecked) to verify that the model is working.Steady-State AnalysisYou will now carry out a steady state sensitivity analysis of the air flow into the aerationtank on the dependent variables that you have selected for display (NH 3-N, cBOD 5, totalnitrogen, DO).6. In order to carry out the analysis, set the air flow into aeration tank as anAnalyze type in the Input Control Properties form, ensuring that there is a deltavalue of 300 which sets the variable increment for the analysis (see Figure 7-2).Page 86


SENSITIVITY ANALYSISFigure 7-2 Setting up the Independent Variable7. Auto Arrange the windows. Select Steady State from the Analyze drop-downmenu (see Figure 7-3) and then click on the Analyze icon (in the <strong>GPS</strong>-X toolbar) toswitch to Analyze mode.8. Start a 0-day simulation (the steady state option will be checked automatically bythe software).Observe the effect of an increase in the air flow on DO and the effluent BOD 5, NH 3and total nitrogen. Typical results are shown in Figure 7-4. Note that an air flowof 20,200 m 3 /d results in a DO level of 2.0 gO 2/m 3 . Try the analysis using differentinfluent flows.Figure 7-3 Select Steady State AnalysisPage 87


<strong>GPS</strong>-X TUTORIAL GUIDETime Dynamic AnalysisFigure 7-4 Analysis ResultsYou will now carry out a time dynamic sensitivity analysis of the air flow into the aerationtank on the dependent variables that you have selected for display (NH 3-N, cBOD 5, totalnitrogen, DO).9. Select Options>Preferences>Input/Ouput and change the Number of Runsdisplayed (analyze/optimize) to 7.10. Select Time Dynamic from the Analyze drop-down menu.11. Set the simulation time to 1-day (with Steady State checked so that the initialconditions are at steady state) and Start the simulation. The results of thissimulation are shown in Figure 7-5.Each successive curve on the various graphs is the result of a dynamic simulationusing a specific air flow into the aeration tank. Notice in Figure 7-5 that forincreasing values of air flow, the DO concentration in the aeration tankincreases - it also fluctuates over time because of the sinusoidal influent flow andload patterns.Page 88


SENSITIVITY ANALYSISFigure 7-5 Typical Results from a Time Dynamic Analysis-SevenDynamic Runs for Air Flows Ranging between 22,900 and 25,000m 3 /d in Increments of 300 m 3 /d.Phase Dynamic AnalysisYou will now carry out a phase dynamic sensitivity analysis of the air flow into theaeration tank on the dependent variables that you have selected for display(NH 3-N, cBOD 5, total nitrogen, DO).12. Select Phase Dynamic from the Analyze drop-down menu.13. Set the Simulation time to 1-day (with Steady State checked so that the initialconditions are at steady state) and Start the simulation.Page 89


<strong>GPS</strong>-X TUTORIAL GUIDEThis type of analysis allows you to run the same dynamic simulation as in theprevious step. The only difference is in the graphical display. Here the results willbe plotted against the analyze variable and not against time. The length of thesimulations will set the phase. Typical results are shown in Figure 7-6 for asinusoidal influent. In this case, the results are very similar to the Steady Stateanalysis type since the simulation was not very dynamic. The graph shows theDO concentration after 1.0 day for an air flow of 10,000 to 25,000 m 3 /d (asopposed to showing the steady-state value at time t=0 when carrying out theSteady State analysis.)Figure 7-6 Typical Results from a Phase Dynamic AnalysisPage 90


PARAMETER OPTIMIZATIONTUTORIAL 8Parameter OptimizationProblem StatementModel calibration and verification is one of the most important components of anymodeling project. Model calibration, also known as parameter estimation, is defined asthe process of adjusting model parameters such that the difference between observedand simulated results is minimized. For example, if the difference between observed andsimulated effluent suspended solids is too large, it is likely that you will want to adjustsome of the model parameters.<strong>GPS</strong>-X provides a very convenient way of adjusting the model parameters, based on anon-linear dynamic multi-parameter optimization algorithm (Nelder-Mead simplexmethod).In this example, the estimation of two kinetic parameters (heterotrophic growth rate andhalf saturation constant) is carried out in order to fit the model-predicted solublesubstrate 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.ObjectivesThe purpose of this tutorial is to develop a basic understanding of parameter estimationusing <strong>GPS</strong>-X. After this tutorial you will be able to target variables that you are interestedin fitting to the data, select the model variables to be adjusted and specify the form of theobjective function. Other optimizer variables such as termination criteria and number ofdata points will be explained in this tutorial.Page 91


<strong>GPS</strong>-X TUTORIAL GUIDEInitial Manual Calibration1. Develop a simple layout (in the CN Library) consisting of a single CSTR using themantis process model.2. Set the initial readily biodegradable substrate concentration to 200 gCOD/m 3from the first page of the initial concentrations form(Initial Conditions>Initial Concentrations (see Figure 8-1)). Next, from the SpecifyOxygen Transfer by… drop-down menu, select Entering Airflow and set the airflow into aeration tank to 40,000 m 3 /d(found in the Input Parameters > Operational form)Figure 8-1 Initial Concentrations3. Change the Date & Time at t = 0 by selecting theOptions > General Data > System > Input Parameters > Simulation Setup form.Click on the date and time at t=0 array [(...)] and change the year to 2010, themonth 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 ProcessWarnings (found under the Consistency Check menu) to OFF and set the ApplyAeration Limits (airflow per diffuser, found under the Aeration Limit Settingsmenu) to OFF.Page 92


PARAMETER OPTIMIZATION4. Save the model with the name ‘tutorial 8’ and recompile it by clicking onthe Simulation button.5. Place the effluent readily biodegradable substrate on an output graph, whichcan be found in the CSTR effluent stream'sOutput Variables > State Variables form. Use limits of 0-200 gCOD/m 3 for theoutput 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 fitbetween effluent soluble substrate data and simulation results.7. Place the heterotrophic maximum specific growth rate and the readilybiodegradable substrate half saturation coefficient on an input control windowwith limits of 0.5-5 d -1 for the growth rate, and 0.5-10 gCOD/m 3 for the halfsaturation coefficient. These parameters can be found in the CSTR'sInput Parameters > Kinetic form.The observed data from the plant is saved in a file calledtutorial8_optimize_2010_6_15.xls. Make sure you have this file inthe directory where you are saving your layout. You can copy it from thec:\gps-x60\layouts\18tutorials\tutorial08 directory. Click inthe Scenario Menu and select Configuration…menu. Click on the Data Files…button and add tutorial8_optimize_2010_6_15.xls file to this simulation. Acceptand close the window (refer to <strong>Tutorial</strong> 4 for details on data input).Place the mouse cursor over the variable name in the control window and makesure that the cryptic variable name of the CSTR effluent stream is the same asthe one labeled on the first row of the excel sheet (ss2).8. Try re-running the simulation, manually changing the growth rate and halfsaturation parameters with the goal of minimizing the difference between thesimulated and measured data.Automatic Calibration Using the OptimizerAfter manually calibrating the model in the previous section (i.e. adjusting theheterotrophic maximum specific growth rate and readily biodegradable substrate halfsaturation coefficient parameters using the sliders and re-running the simulation), youwill now automate the calibration process of fine-tuning these parameters.Page 93


<strong>GPS</strong>-X TUTORIAL GUIDENOTE: It is always advisable to carry out a manual calibration first in order todetermine the effects of parameters on the simulated response before carrying outan optimization.9. Set up the independent variables (the two kinetic parameters) in the InputControl Properties form as Optimize types (see Figure 8-2). The Min and Maxvalues are used as bounds on the independent variable.Figure 8-2 Independent Variables Setup10. Click on the Modeling button, then Switch to Optimize Mode by clicking on theOptimize icon or by clicking on Optimize Mode in the Optimize drop-down menu.11. Select the Time Series menu item from the Type menu found in the Optimizedrop-down menu. (see Figure 8-3)Figure 8-3 Choosing Time Series Optimization12. Select the Maximum Likelihood option in the Objective Function sub-menu ofthe Optimize drop-down menu. See the <strong>GPS</strong>-X Technical Reference for details onthe Maximum Likelihood objective function.Page 94


PARAMETER OPTIMIZATION13. The Target Variables must now be identified by tagging them in the TargetVariables forms. The menu items which were labeled Output Variablespreviously (when in edit mode) are now labeled Target Variables. In this examplewe will use the effluent readily biodegradable substrate concentration as thetarget 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 anyother target variables by selecting the Target Variables... menu item from theOptimize drop-down menu (in this case you should see the form shown in Figure8-4). Switch back to Edit mode by clicking on the Optimize icon. The Status Barmessage should revert to Mode: Edit.Figure 8-4 Selected Target VariablesNOTE: While in optimize mode you cannot select Output Variables fordisplay on output graphs. To do so, first turn off the optimize mode byclicking on the Optimize icon or by clicking on Optimize Mode from theOptimize 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 andappropriate target variable specified (i.e. readily biodegradable substrate), youshould click on the Modelling button so that you can set some of the optimizerparameters in theOptions > General Data > System > Input Parameters > Optimizer form. You canalso access this form by right-clicking anywhere on the drawing board wherethere are no objects, as shown in Figure 8-5.Page 95


<strong>GPS</strong>-X TUTORIAL GUIDEFigure 8-5 Choosing Optimizer System Parameters15. In this form, you must specify the number of Optimized Parameters, in thiscase 2, followed by the Number of Data Points that you wish to use (typically youwould enter the number of rows in the data file). In this case, enter 26 for theNumber of Data Points.Four different optimizer termination criteria can also be set. For this example, thedefault termination criteria are sufficient. For an explanation of the terminationcriteria see the <strong>GPS</strong>-X Technical Reference.16. In the Optimizer form, switch the Detailed Statistical Report parameter ON sothat a statistical analysis is printed to the Command window.17. In the Maximum Likelihood sub-section of the Optimizer form, switch theHeteroscedasticity Model to ON. The Heteroscedasticity Model is a power-lawvariance model that accounts for non-constant measurement variance. Click onthe Heteroscedasticity Parameters (...) button and enter a value of 2 for theHeteroscedasticity Parameter. This value signifies that we are assuming that themeasurements have a constant relative error. The Heteroscedasticity Parameteris the exponent used in the power law.Page 96


PARAMETER OPTIMIZATION18. In the Confidence Limits sub-section of the Optimizer form, switch the Printingof Confidence Limits Parameter to ON. When this switch is ON, confidence limitsare provided for the parameter estimates in the Command window at the end ofthe optimization. The confidence level for the confidence limits is set by theConfidence Level for Confidence Limits Parameter. By default it is set to 0.95which corresponds to 95% confidence limits. Note that when the printing ofconfidence limits is switched ON, the variance-covariance and correlationmatrices are also reported in the Command window. The correlation matrixshows the correlation between the estimated parameters.19. In the Portmanteau sub-section of the Optimizer form, switch the Portmanteautest on weighted residuals parameter to ON. The Portmanteau test checks forserial correlation (i.e. trends) in the residuals. The residuals are the differencesbetween the measured values and the model predictions at each data point. Ifthere are trends in the residuals, then the fitted model does not account for allthe non-random variability in the data. The Portmanteau test is a type of modeladequacy 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 havereplicate 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 <strong>GPS</strong>-X Toolbar.22. You can display the Command window at this point if desired, but keep in mindthat it will slow down the optimization. The Command window can be opened byselecting this option from the Simulation Control drop-down menu on theSimulation Control tool bar.23. Set the Stop time to 0.25 days, the Communication Interval to 0.01 days, andStart the simulation. (Steady State should NOT be checked)Page 97


<strong>GPS</strong>-X TUTORIAL GUIDEAt each optimization iteration, <strong>GPS</strong>-X plots the simulation results (i.e. predictedvalues) that correspond to the current parameter values. It retains the 10 mostrecent simulations on the graph. The simulation results are shown by a black lineand the data are shown by red markers.Note that the initial parameter values used in the optimization are the defaultvalues found in <strong>GPS</strong>-X.The optimization is complete when the Simulation Time counter stops changingand the Solution Report is printed to the Command window. The solution reportincludes 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 OptimizationPage 98


BASIC CUSTOMIZATIONTUTORIAL 9Basic CustomizationProblem StatementNo wastewater treatment plant modeling/simulation tool can be general enough toautomatically handle ALL conceivable plant layouts or desired variables. So, <strong>GPS</strong>-Xfacilitates model layout customization. This is an advanced feature of <strong>GPS</strong>- X and requiresa basic understanding of ACSL, the simulation language upon which <strong>GPS</strong>-X is based. Thepotential 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 idealoxygen uptake rate (OUR) measurement and the second will simulate measurement noiseon the oxygen uptake rate measurement. This variable is often used for toxicity detectionand in process control strategies.ObjectivesThis tutorial is designed to introduce you to the steps required to input your own code fora specific plant layout. You will learn how to setup the <strong>GPS</strong>-X interface, allowing you toinput and output these customized variables as if they were part of the original layout.Page 99


<strong>GPS</strong>-X TUTORIAL GUIDESetting Up and Customizing a Layout1. Open the layout completed in <strong>Tutorial</strong> 1 and save it as `tutorial9’ using theSave As... command from the File menu. If you no longer have a copy of thislayout you will need to recreate it. The layout for this tutorial includes an influentobject, a plug-flow tank and a circular secondary clarifier and is shown below inFigure 9-1.Figure 9-1 Layout2. Change the influent flow type by selecting Flow Data from the Flow menu of theinfluent object. This will open a form entitled Flow Data. Click on the invertedtriangle and select Sinusoidal. Accept the form. Next, from the Specify OxygenTransfer by… drop-down menu, select Entering Airflow and set the air flow intoaeration tank to 30,000 m 3 /d (found in the Input Parameters > Operational formof the plug-flow tank unit).3. Save the model and then recompile it by clicking on the Simulation button.Page 100


BASIC CUSTOMIZATION4. Create a new output graph as described in <strong>Tutorial</strong> 1 and set-up the influent flowand the oxygen uptake rate in the first tank of the plug flow tank on the samegraph. The influent flow can be found in the Output Variables>Flow form of theinfluent object and the oxygen uptake rate in the first tank can be found in theOutput Variables>Internal Variables>Actual Oxygen Uptake Rate> [(…)] form ofthe plug flow tank (see Figure 9-2). In the Output Graph Properties window, setthe 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 m 3 /d and the maximum flow to 10,000 m 3 /d.Figure 9-2 Selecting the Oxygen Uptake Rate for Display5. Run a 10-day dynamic simulation (with the steady-state box checked) to ensurethat the model is correctly set-up. You should be able to produce a graph similarto Figure 9-3. Once this is complete, click on the Modelling button, so that youcan customize the layout code.Page 101


<strong>GPS</strong>-X TUTORIAL GUIDEFigure 9-3 Example Dynamic Simulation6. Open the ‘tutorial9.usr file by choosing theOptions>General Data>User Files>Macros… menu item. (see Figure 9-4).Figure 9-4 Macros… Menu ItemPage 102


BASIC CUSTOMIZATIONIn this file, which is generated when you save the layout for the first time, there are anumber of sections separated by asterisks. They correspond to the different sections ofthe ACSL program structure. In this example, you will add new code to the DERIVATIVESECTION as shown in Figure 9-5.Figure 9-5 The tutorial9.usr FilePage 103


<strong>GPS</strong>-X TUTORIAL GUIDEIn 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 ofthe plug-flow tank. The cryptic variable name for the actual oxygen uptake rate can befound 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 variablename 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 solidscan be found in the Output Variables > Composite Variables > mixed liquor volatilesuspended solids > [(...)] form of the plug-flow tank.Figure 9-6 Displaying the Cryptic Variable NameThe variable noise makes use of an ACSL command, GAUSS to simulate measurementnoise.The method by which user defined constants are setup for input into <strong>GPS</strong>-X requires theuse of another file named ‘tutorial9.con.’7. Open the ‘tutorial9.con’file by choosing theOptions>General Data>User Files>Constants… menu item. This file allows you tosetup the input variables on the same type of input control windows as the other<strong>GPS</strong>-X variables. For this example, the ‘tutorial9.con’file is shown belowin Figure 9-7.Page 104


BASIC CUSTOMIZATIONEdit the ‘tutorial9.con’ file, adding the code shown in Figure 9-7. In thisfile Noise Variables is the text string that will appear underOptions > General Data > User > Input Parameters, as shown in Figure 9-8. Theother important additions to the file are the keyword constant, signifying that thisvariable is an ACSL constant; the cryptic variable names mean and stdev, equalto assigned default values; a descriptive variable name for each withinexclamation marks before and after the name; and the units (if any) for thevariables.Figure 9-7 The tutorial9.con FileFigure 9-8 Selecting Noise Variables from User MenuPage 105


<strong>GPS</strong>-X TUTORIAL GUIDE8. Open the ‘tutorial9.var’by choosing theOptions>General Data>User Files>Output Variables… menu item. This file allowsyou to make new variables available for output. As shown in Figure 9-9, andsimilar to the ‘tutorial9.con’file, a Menu Item followed by a list ofvariables is included. The difference between this file and the‘tutorial9.con’ file is that here, the keyword display is used insteadof the keyword constant, and the variable is not assigned any default value asit will be calculated by <strong>GPS</strong>-X.Figure 9-9 The tutorial9.var File9. After modifying these three files, Save the layout. You will need to close thetutorial9 layout (use File>Close) and reopen the layout. (use File>Open). Thisprocess re-reads the custom code you’ve entered. Now you can recompile thelayout by clicking on the Simulation button.10. Place the Average Measurement Noise and the Measurement Noise StandardDeviation on an Input Control window. These variables can be found in theOptions>General Data>User>Input Parameters>Noise Variables form. In theInput Control Properties form, set the minimum average noise to 50 gO 2/(m 3 .d),the maximum average noise to __ gO 2/(m 3 .d), the minimum measurement noisestandard deviation to 0 gO 2/(m 3 .d), and the maximum measurement noisestandard deviation to 100 gO 2/(m 3 .d).Page 106


BASIC CUSTOMIZATION11. Create a new Output Graph as described in <strong>Tutorial</strong> 1 and set up the two newSOUR variables on this graph. The SOUR variables can be found in theOptions>General Data>User>Output Variables>Uptake Variables form. In theOutput Graph Properties form, set the minimum SOUR to 0 mgO2/(gVSS.d) andthe 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 noisevariable can be found in theOptions > General Data > User > Output Variables > Uptake Variables form. Inthe Output Graph Properties form, set the minimum OUR to 250 gO 2/(m 3 .d) andthe maximum OUR to 1,500 gO 2/(m 3 .d) for this variable.Running Simulations12. Auto Arrange the windows and run a 10-day dynamic simulation with thesteady-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 theimpact on the output. Try running several simulations using different settings.Figure 9-10 Running the SimulationPage 107


<strong>GPS</strong>-X TUTORIAL GUIDETUTORIAL 10Dynamic Parameter Estimator (DPE)Problem StatementWith many of the dynamic models used in <strong>GPS</strong>-X most of the model parameters areassumed to be constant over the entire calibration period. For example, the clarifier'sflocculent zone settling parameter is normally set to one specific value for the entiresimulation. One reason for doing so is that it is difficult to determine or identify thechanges in this parameter over time since it is difficult to measure on-line. The best themodeler 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 varyingthe parameter over the simulation period. This has two advantages: a better agreementbetween 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.ObjectivesAfter completing this chapter you should be able to setup and run the dynamic parameterestimator (DPE). The <strong>GPS</strong>-X Advanced Tools module is required to complete this tutorial.Page 108


DYNAMIC PARAMETER ESTIMATORSetting Up the Layout1. Go to File> Sample Layouts…> <strong>Tutorial</strong>s> <strong>Tutorial</strong> 10 and open the layout byclicking Accept.2. Click on the Modelling button. The layout should look like the one shown inFigure 10-1. Use the Locator as necessary to adjust the layout view.Figure 10-1 Layout for DPE3. Save the model and then recompile it by clicking on the Simulation button.4. Auto Arrange the windows. Select the Calibration scenario from the Scenariodrop-down menu on the Simulation Control tool bar.5. 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 realmeasured data but there is considerable room for improvement. These resultsare shown in Figure 10-.Page 109


<strong>GPS</strong>-X TUTORIAL GUIDEFigure 10-2 Primary Effluent TSSSetting Up the DPEAt this point, it is desirable to improve the fit between the primary effluent TSS and thedata by optimizing the flocculent zone settling parameter as it varies with time6. Click on the Modeling button and select the Optimize>Type>DPE mode. Thenclick on the Optimize icon to switch to optimize mode. The status bar at thebottom of the <strong>GPS</strong>-X window should display Optimize DPE on its right hand side.7. Specify the primary effluent TSS concentration as the target variable for theoptimization. To do this, simply tag the appropriate variable on the upperinfluent connection point of the combinerTarget Variables > Composite Variables form. Note that while the Optimizemode is on, the menu item that was formerly labeled Output Variables haschanged to Target Variables (see Figure 10-). Switch back to Edit mode byclicking on the Optimize icon. The Status Bar message should revert toMode: Edit.8. Under the Options>General Data>System>Input Parameters>Optimizer menu,set a DPE time window of 0.4 days. In addition, se the Parameter Tolerance to0.001.9. Save the model and then recompile it by clicking on the Simulation button.Page 110


DYNAMIC PARAMETER ESTIMATORFigure 10-3 Tagging the Target Variable10. Find the flocculent zone settling parameter, which is found on the "PumpControls" Input Control Window. In the Input Control Properties form, makesure that the range is set to Min: 0.0001 and the Max: 0.005 m 3 /gTSS. Lastly,check that the Optimize type of control is chosen for this parameter.11. Once the Optimize Control is setup, click on the Modelling button. Save themodel and then recompile it by clicking on Tools > Build. Once the model isrecompiled, click on the Simulation button to go into Simulation mode.Running the DPE12. Auto Arrange the windows. Select the Calibration scenario and check steadystateon the Simulation Control tool bar.13. Select Optimize>Type>DPE and then click on the Optimize icon to switch toOptimize Mode.14. Set the Simulation time to 4 days and Start the optimization.Page 111


<strong>GPS</strong>-X TUTORIAL GUIDEThe results are shown in Figure 10- and Figure 10-. Try repeating the simulationwith a shorter time window or tighter convergence criteria (parameters found intheOptions>General Data>System>Input Parameters>Optimizer form.)Figure 10-4 DPE ResultsFigure 10-5 Flocculent ParameterPage 112


MONTE CARLO ANALYSISTUTORIAL 11Monte Carlo AnalysisProblem StatementWhen developing a plant model we may wish to not only explore what loads a plant willfail under, but the frequency with which these failures might occur. While linear analysiscan tell us at which points the plant will fail Monte Carlo analysis allows us to determinethe frequency with which the plant will fail.Monte Carlo analysis is also useful in exploring plant performance under different designassumptions. For example, when designing a plant you need to choose a value for theautotrophic 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 therange in which these values will fall. We may know that the alpha factor for the wastewater will fall somewhere between 0.4 and 0.7 and that the probability of it being anyparticular number inside this range is uniform. By assigning probabilities to the range ofvalues we can use Monte Carlo analyses to not only investigate the plant’s performanceover the range but the probability of the observed performance characteristics.ObjectivesThe purpose of this tutorial is to develop a basic understanding of Monte Carlo analysis in<strong>GPS</strong>-X. Upon completion of this tutorial you will be able to carry out Monte Carlo analysisof model variables. In this tutorial we will be looking into how the D.O. in the tank reactorand free and ionized ammonia in the plant effluent are affected by various alpha factorsand autotrophic maximum specific growth rates.The <strong>GPS</strong>-X Advanced Tools module is required to complete this tutorial.Page 113


<strong>GPS</strong>-X TUTORIAL GUIDESetting Up the Layout1. Open a new <strong>GPS</strong>-X layout and set the library to CN Library. For this tutorial theplant 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 Layout2. Set the Influent Model to codstates, the CSTR model to mantis, and the clarifiermodel to simple1d.3. To simulate cold winter conditions, set the liquid temperature of the plant to10°C. Right click on an empty space on the layout and selectSystem>Input Parameters>Physical.4. Configure the CSTR so that oxygen transfer is controlled by entering airflow andNOT by a DO Controller. To do this, right click on theCSTR Input Parameters>Operational and setting specify oxygen transfer by… toentering airflow. Once entering airflow has been selected, change the airflowinto the aeration tank to 15000.0 m 3 /d.5. Change the wastage rate of the secondary clarifier to 70m 3 /d. To do this, rightclick on the secondary clarifier, under Input Parameters>Operational, change thepumped flow to 70 m 3 /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 onthe CSTR and selecting Input Parameters>Kinetic.Page 114


MONTE CARLO ANALYSIS8. Open the Input Control Properties and chance the control type for the growthrate from the Slider to Analyze – Monte Carlo. To the right of the drop-downmenu, a Distribution Settings button will appear. Click on the DistributionSettings button to open the Distribution Settings Panel. From this panel we canchange the type of distribution to Normal, the mean to 0.75 and the StandardDeviation to 0.1. Once the distribution has been set up, make the range from 0.5to 1.2.Figure 11-2 Input Control Properties9. Create an Input Control for the number of Monte Carlo Runs. Right click on thelayout and select System>Input Parameters>Analyzer. Set the control type toSlider.10. For this tutorial, we will need separate graphs of both the autotrophicmaximum specific growth rate and the free and ionized ammonia in the plant’seffluent. To create the autotrophic maximum specific growth rate graph, rightclick on the CSTR and select the Output Variables>Input Parameters>Kinetic. Tocreate the free and ionized ammonia graph, right click on the effluent stream ofthe secondary clarifier and select Output Variables>State Variables.Page 115


<strong>GPS</strong>-X TUTORIAL GUIDE11. Change the graphs’ properties to graph probabilistic Monte Carlo data. Forboth graphs change the type of graph to Probabilistic (Monte Carlo) and turn onauto scaling for all axes. This graph type will plot a histogram of our Monte Carloresults. With the Monte Carlo graph type selected you will notice that a numberof 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 offree and ionized ammonia. The greater than less than button beside the targetvalue allows you to specify whether you are interested in the percentage of runsthat are greater or less than the target value. The number of bins specifies thenumber of bins in to be used in the histogram. For the free and ionized ammoniagraph set the target value to 10 and the number of bins to 20.Figure 11-3 Monte Carlo Output Graph Properties12. Click on the arrow beside the Analyze button and select Monte Carlo from thelist. Click on the Analyze button to put <strong>GPS</strong>-X into Analyze Mode. To ensure thatyou are in the correct mode, the bottom right hand corner of the <strong>GPS</strong>-X windowshould display Mode: Analyze – Monte Carlo.Page 116


MONTE CARLO ANALYSIS13. Run the simulation. When the simulation completes you should see theautotrophic maximum specific growth rate following the normal distributionthat was defined. Each bar in the free and ionized ammonia graph displays theprobability of that specific concentration range occurring. Try rerunning thesimulation but this time vary the numbers of runs and see how the number ofruns impacts accuracy. A small number of runs will not be sufficient to find anaccurate result; while increasing the number of runs will increase the accuracy ofthe Monte Carlo results.Figure 11-4 Autotrophic Maximum Specific Growth Rate ResultsPage 117


<strong>GPS</strong>-X TUTORIAL GUIDE14. Place the Alpha Factor for the CSTR on an Input Control Tab, set its control typeto Analyze – Monte Carlo and its distribution to Uniform. Set the range of theAlpha Factor to 0.4 to 0.7.15. Place the Alpha Factor and D.O. of the CSTR on separate graphs on a newOutput Tab. To create the Alpha Factor graph, right click on the CSTR and selectOutput Variables > Input Parameters>Operational and click on the DiffusedAeration’s More button. Drag the Alpha Factor (fine bubble) onto a new OutputTab. D.O. can be found by right clicking on the CSTR and selectingOutput Variables > State Variables16. Set both graphs to Probabilistic (Monte Carlo) auto-scale both axis and set thenumber of bins to be displayed on the D.O. graph to 20. Auto Arrange bothgraphs.17. Set the number of Monte Carlo runs to 1000 and run the simulation. Both theAlpha Factor and the Autotrophic Maximum Specific Growth Rate will beassigned random values falling within the defined range and conforming to theprobabilities that have been assigned to them. When the simulation completesthe probabilities for various D.O. concentrations and free and ionized ammoniaconcentrations will be displayed.Page 118


MONTE CARLO ANALYSISFigure 11-5 Alpha Factor and Autotrophic Maximum Specific Growth Rate ResultsThe EndYou have finished all the tutorials and should now be comfortable in developing modellayouts, running simulations and displaying outputs. Additional details on <strong>GPS</strong>-X modelsare included in the <strong>GPS</strong>-X Technical Reference manual.iReference:Marlin T.E., Process Control: Designing Processes and Control Systems forDynamic Performance, McGraw-Hill, 1995Page 119

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!