Subject: PID Control in SWMM 5 for an Orifice
The blog http://swmm5.blogspot.com/2010/12/pid-control-in-swmm-5-for-type-3-pump.htmldescribes the Function getPIDSetting which returns the PID setting at each time step. The PID parameter set contains three values -- a proportional gain coefficient, an integral time (in minutes), and a derivative time (in minutes) which are kp, ki and kd, respectively. More about the theory of PID controllers can be found at http://en.wikipedia.org/wiki/PID_controller.
Here is an example PID Rule that will keep the node depth at 5 feet in a SWMM 5 model by changing the Orifice Setting. The Orifice setting opens and closes the orifice over time. The example file is attached in this blog. In this particular example, you can reduce the oscillations about the 5 foot rule level by lowering the integral time and derivative time coefficients in the PID control rule. An important note is that for Weirs and Orifices the setting is bounded to be between 0 and 1. If the Orifice or Weir cannot handle the upstream node inflow then the PID control will not be able to meet the depth goal in the node. For example, in the example file, an orifice depth of 2 feet is not enough to meet the upstream node depth goal of 5 feet but a 3 foot orifice is large enough for the PID control to meet its stated goal of 5 feet. The PID control will only work if the link doing the controller has enough flow and depth flexibility.
; the PID controller adjusts the orifice opening to have a
; depth of 3 feet in Node 82309b
IF NODE 82309b DEPTH 5
THEN ORIFICE OR1@82309b-15009b SETTING = PID 10 -0.01 -0.01
; kp ki kd