This chapter discusses the models found in the Tools and Process Control objects. The toolbox object is found in the Tools section of the unit process table. The Process Control section of the unit process table contains several objects. Each model is described in separate sections below.

Figure 12‑1 - Sampler Object
The sampler model is found in the toolbox object, and will sample any stream either at regular time intervals (i.e., take a sample every `x' hours) or in proportion to the flow rate of that stream (take a sample every `x' m3 of flow). It reports either daily or total simulation run average values.
The sampling tool parameters are accessed by selecting Parameters > Set up in the Process Data menu. These parameters are detailed below:
Label of sample stream: This is the label of the stream being sampled. All of the state and composite variables in this stream are sampled.
Sampling mode (Off / Flow Proportional / Regular Time Intervals): This switch controls how the stream is sampled. The stream can be sampled in proportion to the flow or at regular time intervals.
Sampling period (Daily / Total Run): This is the time period used when calculating the averages of the sampled values. The averages can be calculated on a daily basis or for the entire run.
Take a sample every (m3): This parameter controls how often the stream is sampled when the sampling mode is set to Flow Proportional.
Take a sample every (hour): This parameter controls how often the stream is sampled when the sampling mode is set to Regular Time Intervals.

Figure 12‑2 - Modeling Toolbox Object
The lowpass model is found in the toolbox object, and can be used for analog or digital filtering, or a combination of both. The input signal is fed to a first-order analog filter, a first-order digital filter, and a zero-order sample-and-hold. Any of these components may be used or bypassed. This is done by setting the filter type as Analog, Digital, or Analog+Digital, and by setting sample and hold to either ON or OFF. When the filter type is set to OFF, both filters are bypassed and the final output is either the input signal or the sampled input signal, depending on the state of the sample and hold setting. A signal flow diagram is shown in Figure 12‑3. In this figure, the switches are set for a digital filter with sampling.
First-order linear filters have one tuning parameter, the cutoff frequency ωc, which corresponds to the corner frequency, i.e. the reciprocal of the filter time constant. The amplitude ratio of a first-order system at the corner frequency is 1/√2, with corresponding phase lag φ=45 degrees’
With u(t) and y(t) representing the input and output of a first-order filter respectively, the filter models are:
Analog:
Equation 12‑1

Digital:
Equation 12‑2
![]()

Figure 12‑3 – Signal Flow Diagram for the lowpass Model
One menu of parameters is defined for the lowpass model. It is accessed from the Tools Process Data menu by selecting Parameters > Filter Settings. The available parameters are detailed below:
Input signal: The cryptic name of the variable to be filtered.
Filter type (Analog / Digital / Analog+Digital / Off): The value of this parameter determines whether the signal flows through the analog or the digital filter, or both.
Analog filter cutoff frequency: The corner frequency of the first-order analog filter, or the reciprocal of its time constant.
Digital filter time step: The value of the time interval used in the digital filter model. It is also used as the sampling time when Sample and hold is set to ON.
Digital filter cutoff frequency: The corner frequency of the first-order digital filter, or the reciprocal of its time constant.
Sample and hold (ON - OFF): The value of this parameter determines if the digital filter output is sampled and held for the sampling period specified above.
Digital filtering without sampling is useful if the filtered signal is to be used in a unit that already implements a sample-and-hold on its input.
The multivar model is used in conjunction with the Advanced Control Module. See the Advanced Control Module Manual for details on using multivariable controllers in GPS X.
The sigtrack model is found in the toolbox object, provides low level signal tracking to identify and report outliers, noisy or missing data and excessive rate of change, and can be used to set up alarms if the data, simulation, or the error between them goes beyond certain limits.

Figure 12‑4 - ON/OFF Controller Object
The ON/OFF controller object is found in the Process Control panel. On/off controllers are simple forms of feedback control. This type of controller is used in a wide variety of common applications. For example, household heating and cooling systems operate using on/off control.
The ON/OFF controller parameters are divided into two groups: control variable parameters, and manipulated variable parameters. The control variable parameters are accessed by selecting Parameters > Control Variable from the Tools Process Data menu. The manipulated variable parameters are accessed by selecting Parameters > Manipulated Variable from the Tools Process Data menu.
Controller (ON – OFF): A value of ON indicates that the controller is active; a value of OFFindicates that the controller is not active (i.e., not adjusting the manipulated variable). This should not be confused with the `on' and `off' states of the on/off controller.
Controller sampling time: This parameter determines the length of time between controller executions. A high value (corresponding to a long interval between executions) may be appropriate for slower processes (e.g., MLSS control using the sludge wastage rate), while other processes may require faster sampling frequencies.
Control variable (CV) with label: The cryptic name of the variable to be controlled.
Upper bound: The upper bound on the controlled variable. If the value of the controlled variable exceeds this value, then the value of the manipulated variable will be set to its low setting.
Lower bound: The lower bound on the controlled variable. If the value of the controlled variable is less than this value, then the value of the manipulated variable will be set to its high setting.
Manipulated variable (MV) with label: The cryptic name of the manipulated variable.
MV setting when CV is at low limit: The value of the manipulated variable is set to this value when the value of the controlled variable is less than its lower bound.
MV setting when CV is at high limit: The value of the manipulated variable is set to this value when the value of the controlled variable exceeds its upper bound.
MV initial value: The value to assign to the manipulated variable until the controlled variable crosses either its upper or lower bound.

Figure 12‑5 - PID Controller Object
The PID object contains two models: PID and PIDforward. Regular PID controllers are widely used in industrial applications because of their simplicity and good performance. PID is an acronym for Proportional, Integral, Derivative, which are the three modes of the PID controller. In continuous form, the PID controller algorithm is given by:
With derivative kick protection OFF:
Equation 12‑3

With derivative kick protection ON:
Equation 12‑4

where:
MV = manipulated variable
E = error (setpoint-controlled variable)
Kc = proportional gain, a controller tuning constant
TI = integral time, a controller tuning constant
TD = derivative time, a controller tuning constant
I = initialization constant
The individual modes of the PID controller can be used individually or in pairs; common combinations include P-only and PI control, in addition to full PID control. The output of the PI controller, for example, includes the first two terms in the PID controller expression above; the output of any combination can be calculated similarly. The proportional mode is given by:
Equation 12‑5
![]()
The integral mode is given by:
Equation 12‑6

The derivative mode is given by:
Derivative kick protection OFF
Equation 12‑7

Derivative kick protection ON
Equation 12‑8

Since the vast majority of PID controllers are now implemented using digital computers, the discrete form of the PID algorithm is used more frequently than its continuous form. Accordingly, all controllers in GPS-X are modelled in discrete form. Bounds on the manipulated variable are frequently used to reflect limitations due to physical equipment or safety. Therefore, the PID algorithms implemented in GPS-X have the following forms, where Dt represents the controller execution interval.
With derivative kick protection OFF:
Equation 12‑9
![]()
With derivative kick protection ON:
Equation 12‑10

Equation 12‑11

With derivative kick protection OFF:
Equation 12‑12

With derivative kick protection ON
Equation 12‑13

Equation 12‑14
![]()
The velocity form is obtained by differencing the position form of the PID controller. When using the velocity form, one calculates the change in the value of the manipulated variable that is to be implemented, as opposed to the absolute value calculated by the position form of the algorithm. The velocity form has certain advantages over the position form; in particular, it is naturally protected against reset or integral windup. This condition occurs when a persistent, nonzero setpoint error results in a large value of the integral mode of the PID, forcing the control action to `saturate' (i.e. to maintain the manipulated variable at its minimum or maximum value). Even when the setpoint error returns to zero, the control action remains saturated when the position form of the PID algorithm is used. When using the velocity form, the control action can return within the control range after one sampling period.
Derivative kick protection is a commonly used modification to the standard PID algorithm. The modification, which affects the derivative mode only, prevents large `jumps' from occurring in the manipulated variable as the result of setpoint changes. These jumps occur because a discrete setpoint change introduces a discontinuity into the error signal, resulting in an "infinite" derivative (in the continuous case), or a large value in the difference error signal (in the discrete case). Therefore, it is recommended that derivative kick protection be used for all PID controllers, unless the behaviour described above is specifically desired.
Derivative filtering is another strategy by which large jumps in the manipulated variable can be prevented. Filtering reduces the effect of sudden setpoint changes and high frequency noise present in the error signal, which may produce large values of the error derivative. When derivative filtering is selected, the signal fed to the derivative mode of the PID (error or controlled variable) is passed through a discrete first-order filter before being used in the calculation of the derivative mode. The filter is tuned by a single parameter, the cutoff frequency, which corresponds to the filter's `corner frequency'. (i.e.‑the reciprocal of its time constant)
The parameters available for PID controllers are listed below. These parameters are divided into two groups: control variable parameters, and manipulated variable parameters. The control variable parameters are accessed by selecting Parameters > Control Variable from the Tools Process Data menu. The manipulated variable parameters are accessed by selecting Parameters > Manipulated Variable from the Tools Process Data menu.
In addition to the PID controller in the tools object, PID controllers for common variable pairings are built into many of GPS-X's process objects. For example, a PID controller for controlling the dissolved oxygen concentration is available in the plug flow tank object. These controllers have essentially the same parameters as the PID controller in the tools object except that the manipulated variable and possibly the controlled variable have already been defined.
Controller (ON - OFF): This parameter determines whether or not the PID controller is active.
Setpoint for control variable: This is the value of the setpoint for the controlled variable. The controller acts to keep the controlled variable at the setpoint.
The following parameters are accessed by clicking on the More... button in the Control Variable form. Only the parameters in the Controller Set up sub-section are discussed here. For a discussion on the Controller Tuning sub-section see Tuning PID Controllers.
Controller form (Full Position / Velocity): This parameter is used to specify which form of the PID controller equation is used (position or velocity). The default velocity form is recommended because it has built-in protection against integral windup.
Controller type (P / PI / PID): This parameter specifies the modes to be used in the PID controller. Using the PI option is recommended in most cases. When using the P option, the offset between the controlled variable and the setpoint cannot be completely eliminated.
Control variable with label: This is the cryptic variable name for the controlled variable including the appended stream label.
Controller sampling time: This is the length of time between controller executions. If this parameter is too large the control performance will be poor and possibly unstable.
Proportional gain: This is the controller tuning constant, Kc.
Integral time: This is the controller tuning constant, TI.
Derivative time: This is the controller tuning constant, TD.
Controller effect on controlled var - direct (ON - OFF): Since the value of the proportional gain in GPS-X must be positive, this parameter controls the `direction' of the controller. If a positive step in the manipulated variable results in a positive change in the controlled variable (at steady-state), i.e. the process gain is positive, then this parameter should be ON(e.g. an increase in air flow causes an increase in DO). Otherwise, it should be OFF(e.g. an increase in wastage rate causes a decrease in MLSS concentration).
Derivative kick protection (ON - OFF): When this setting is ON the manipulated variable is prevented from making large jumps in response to setpoint changes. This parameter is only applicable when the controller type is set to PID.
Derivative filtering (ON - OFF): The derivative filter is used to filter the signal fed to the derivative mode of the PID controller.
Cutoff frequency: This is the derivative filter's corner frequency (i.e. reciprocal of its time constant).
Manipulated variable w/o label: This is the manipulated variable name without the stream label.
Label of manipulated variable: This is the stream label of the manipulated variable.
Value of manipulated variable: This is the initial value of the manipulated variable.
Minimum value: This is the lower bound on the manipulated variable.
Maximum value: This is the upper bound on the manipulated variable.
Many different techniques exist for tuning PID controllers. While an in-depth discussion of these techniques is beyond the scope of this manual, some general guidelines are provided below.
A simple and conservative approach to controller tuning is as follows:
· Start with a small proportional gain and a large integral time; set the derivative time to zero (0). As a rough rule of thumb:
o Use a value of 0.5/Kp as a starting value for the proportional gain (Kp is the steady-state process gain, defined as the change in the controlled variable at steady-state for a one-unit change in the manipulated variable).
o Use a value of 1.5t as a starting point for the integral time (t is the time constant of the first-order response that most closely approximates the controlled variable response to a step in the manipulated variable).
· Gradually increase the proportional gain until further increases result in deterioration in control performance.
· Gradually decrease the integral time until further decreases result in deterioration in control performance.
· Gradually increase the derivative time.
· Fine-tune the parameters as needed.
A facility for tuning PID controllers based on the Ciancone correlations for setpoint changes is available for all PID controllers in GPS-X. The PID tuning parameters calculated using the Ciancone correlations are based on estimates of the process gain, dead time, and time constant, obtained by a least-squares fit of the time series data collected under tuning mode.
The controller tuning parameters for the PID controller are accessed by selecting Parameters > Control Variable > More... in the Process Data menu of the tools object. Setting tuning to ON starts the tuning mode. The controller sampling time must be set to an appropriate value. The process should have been brought to steady-state, or reasonably close to steady-state, prior to the activation of the tuning mode. This may be done with or without a PID controller currently ON. While this mode is active, a step input is applied to the manipulated variable, forcing the controlled variable to be perturbed.
This mode may be deactivated by manually setting Tuning to OFF, at which point suggested PID tuning parameters will be displayed in the simulation Log window, based on an analysis of the time series data collected during the tuning operation. It is not necessary to wait for a new steady-state before turning off the tuning operation, but it may be desirable to do so. Tuning parameters will also be suggested if the simulation terminates while the tuning mode is ON.
The estimates of the process parameters (i.e. process gain, dead time, and time constant) may be tagged for display in the Output Variables menu of the object or stream associated with the controller.
The other settings which affect the operation of the tuning mode are:
Fractional step size: The size of the step to be applied in the manipulated variable, specified as a fraction of its initial value.
Time of step: The interval of time that will elapse between the activation of the tuning mode and the application of a step in the manipulated variable.
Maximum possible dead time: Upper bound on admissible values of dead time in the first-order plus dead time model. This may be used to reduce the time required to compute tuning constants, or may be used to force a dead time of zero in the model used to derive the tuning constants.
While operating in tuning mode, time series data of the manipulated and controlled variables are sampled (at each controller sampling time) and stored in arrays of fixed maximum size. Data for 3000 sampling times can be stored. If that capacity is to be exceeded, a warning will be displayed, and a scrolling time window that will retain data for the last 3000 sampling times will be initialized. This should not be a limitation in most cases, as this storage capacity is enough for data sampled every 10 minutes over 20 days. The storage capacity is a global setting labeled controller tuning array size, found in General Data > System > Parameters > miscellaneous. If this value is increased, the layout must be recompiled for the change to take effect, i.e., this value may not be changed inside a scenario. For more information on tuning PID controllers, consult Marlin (1995) or Perry and Chilton (1973). The Ciancone correlations are presented and discussed in Marlin (1995).

Figure 12‑6 - PID Controller Object Feedforward-Feedback Model
Users can select the PIDforward model in this PID controller object, by right-clicking on the object and selecting Models > pidforward. With a feedforward controller, an input disturbance is measured and the controller adjusts the manipulated variable to compensate for the disturbance before the controlled variable deviates from its setpoint. Feedforward control is usually combined with feedback control to retain the beneficial properties of feedback.
The pidforward model of the Tools object combines a PID controller for feedback and a lead/lag algorithm for feedforward control. Lead/lag feedforward control is a simple feedforward strategy that provides enough flexibility for most applications. The PID controller algorithm is presented in the section entitled PID Controllers above. In this section we present the lead/lag algorithm.
A feedforward term may be added to the feedback control action of the PID controller when measurement of a process disturbance is available. The lead/lag feedforward controller is represented in transfer function form as:
Equation 12‑15

Its time-domain representation is given by:
Equation 12‑16

where:
MVFF = additional control action provided by feedforward control
KFF = the feedforward gain, a controller tuning parameter
q = the feedforward dead time, a controller tuning parameter
tld = the feedforward lead time, a controller tuning parameter
tlg = the feedforward lag time, a controller tuning parameter
IFF = the initialization constant of the feedforward controller
When both the process and disturbance dynamics are represented by first-order plus dead time models, perfect feedforward control can in principle be achieved if one:
· Sets the feedforward gain KFFto the disturbance-to-process gain ratio;
· The dead time q to the difference between disturbance and process dead times (possible only when the process dead time is less than the disturbance dead time);
· tld the lead time to the process time constant; and,
· The lag time tlg to the disturbance time constant.
The feedback control action is calculated from a PID control algorithm as described above, and the feedforward control action is added to it as follows:
Feedforward/Feedback (PID in velocity form):
Equation 12‑17
![]()
Feedforward/Feedback (PID in position form):
Equation 12‑18
![]()
where:
ΔMVNFF = the change in feedforward control action obtained from discretizing the lead/lag algorithm and the superscript FF refers to the feedback controller.
The parameters of the pidforward model are presented in three menus: Manipulated Variable, Controlled Variable, and Disturbance Variable. Feedback control parameters are located in the Controlled Variable menu and feedforward control parameters in the Disturbance Variable menu.
The feedforward controller parameters found in the Disturbance Variable form are detailed as:
Feedforward controller (ON - OFF): The feedforward component of the controller is activated by this switch.
Disturbance variable with label: The cryptic name of the disturbance variable including the stream label.
Controller sampling time: The length of time between controller executions.
Feedforward gain: The feedforward controller tuning parameter, KFF.
Lead time: The feedforward controller tuning parameter, tld.
Lag time: The feedforward controller tuning parameter, tlg. The ratio of lead to lag times should usually be kept below 2:1 to minimize the effects of noise.
Dead time: The feedforward controller tuning parameter, q.
Negative feedforward gain (ON - OFF): This parameter controls the `direction' of the controller. The `normal' sign of the feedforward gain is negative. This occurs when both the process and disturbance gains have the same sign, in which case this setting should be ON (the default value). Otherwise, it should be OFF.
For information on tuning Feedforward/Feedback controllers, consult Marlin (1995).

Figure 12‑7 - Timer Controller Object
The timer is used to schedule and control intermittent plant operations. For example the timer control can be used to implement intermittent aeration in an activated sludge tank. Another application is the desludging of a primary settler.
The timer works in cycles. At the start of each cycle the timer sets its manipulated variable to a pre-defined ‘on’ value. The manipulated variable is kept at this value for a user-defined fraction of the cycle. For the remainder of the cycle, the manipulated variable is set to a pre-defined ‘off’ value. This is ideally suited for intermittent aeration because the controller can turn on the air flow at regular intervals for a user defined length of time.
The timer control parameters are accessed by selecting Parameters > Set up in the Process Data menu. These parameters are detailed below:
Controller (ON - OFF): This switch activates the timer.
Manipulated variable with label: The cryptic name of the manipulated variable including the appended stream label.
Cycletime: The length of one cycle.
Ontime in one cycle: The length of time (starting at the beginning of the cycle) that manipulated variable value is set to the `on' value during a cycle.
Value of manipulated variable when on: The `on' value of manipulated variable.
Value of manipulated variable when off: The `off' value of manipulated variable.

Figure 12‑8 - Modelling Toolbox Multivar Model
The multivar model is used in conjunction with the Advanced Control Module. See the Advanced Control Module Manual for details on using multivariable controllers in GPS‑X.

Figure 12‑9 - Flow Time Controller Object
The Flow Timer Model is a modification of the regular Timer model GPS-X. The Flow Timer Model is developed to address the specific needs to define daily intermittent flows using average daily flow rates. The main difference between the timer and flow timer model is in the choice of input variable. In the timer model, the input values of the variables are instantaneous values while in the Flow Timer Model, the flow variables are the average value in the cycle.
The input form for the Flow Timer Model is as shown in Figure 12‑10.

Figure 12‑10 - Flow Timer Menu
Controller – The controller switch is used to turn the flow timer model ON/OFF. Flow will be controlled, only when the controller is switched ON.
Manipulated variable with label – This input variable is used to specify the cryptic variable name of the flow variable that needs to be controlled.
Cycletime – This input variable is used to specify the total duration of the cycle including the ON and OFF time.
Start time for ON cycle – This input variable controls the start time of the cycle.
Ontime in one cycle – This input variable defines the duration of ON cycle.
Average value of manipulated variable during cycle – This input variable defines the average flow rate during the whole cycle.
The default setup of the flow controller defines a cycle of total length of 0.05d; the cycle remains OFF for 0.01d, gets ON at 0.01d and remains ON until 0.04d. The flow is OFF from 0.4d-0.5d. This cycle then repeats itself.

Figure 12‑11 - Scheduler Controller
Some of the operations at wastewater treatment plant follow a repeating schedule. For example, the sludge wasting schedule may require wasting on the weekdays and no wastage on weekends. Until now, these repeating schedules were modeled by inputting the scheduled inputs through a file input. This approach requires preparation of file inputs for the duration of dynamic simulation. To simplify modelling a repeating schedule, a new scheduler model is implemented in the toolbox object of the GPS-X. The structure of the scheduler model is generic and can be used to model cyclic schedules of operation in a treatment plant. The scheduler model can control flow rates, split ration and any other model input variable.
The scheduler model can be selected by right-clicking on the tool box object and selecting scheduler. The scheduler model is useful when the treatment plant is operated in a well-defined cycle containing many different phases and in each phase a set of model variables is manipulated in a well-defined manner. In the current scheduler model, a set of 15 model variables can be manipulated to define complex operational schedules in treatment plants.
The Scheduler model requires the following information:
1. Number of phases in a cycle
2. Time duration of each phase
3. Cryptic names of model variables which are manipulated in a cycle
4. Value of each model variable in each phase of the cycle
The input data to the model is set by using the input form of the scheduler model. The input data form is as shown in Figure 12‑12. A brief explanation of each input variable is given below.
Number of phase in sequence: This variable defines the number of distinctive phases in a cyclic-sequence. The default value is set to 8.
Duration of each phase: This variable defines the time duration of each phase. The sum of the time duration of each phase is equal to the total sequence (cycle) time. Figure 12‑13 shows the input form for setting the duration of each phase.
Cycle start phase: This defines the phase at which the cycle starts. The value of the variable can be between 1 to number of phases defined above.
Cryptic name of model variables– This defines the cryptic names of the model variables which are manipulated in each phase. By default, a maximum of 10 model variables can be used to set the sequence. All the variables are set to blank (nothing is manipulated in the sequence). To include a model variable in the scheduler set-up, the blank should be replaced by the full cryptic name of the variable available in the layout. For example, to set the influent flow rate for an influent object in the sequence, the blank variable can be replaced by qconinf (qcon is the cryptic for influent flow rate and inf is the stream id). If there are more than one variable, they can be similarly defined.
TIP: To see the cryptic name of a variable, you may point the cursor over the variable description name in the data input window. The cryptic variable name is displayed for few seconds in a small window.
Value of model variable in each phase: The value of a model variable during each phase can be set here. For example, to set the values of control variable in each phase, click on the (…) button to the right of the control variable to open the input value form for model variables.

Figure 12‑12 - Input Form for the Scheduler Model

Figure 12‑13 - Input Form for Setting Duration of Each Phase

Figure 12‑14 - Input Form for Setting the Value of Control Variable in Each Phase of a Sequence