PVSC Improves PLC Programming Using Real-Time Dynamic Simulation Paul Cavanagh, P.E. Passaic Valley...

45
PVSC Improves PVSC Improves PLC Programming Using PLC Programming Using Real-Time Dynamic Real-Time Dynamic Simulation Simulation Paul Cavanagh, P.E. Passaic Valley Sewerage Commissioners ISA WWAC Symposium August 2009

Transcript of PVSC Improves PLC Programming Using Real-Time Dynamic Simulation Paul Cavanagh, P.E. Passaic Valley...

Page 1: PVSC Improves PLC Programming Using Real-Time Dynamic Simulation Paul Cavanagh, P.E. Passaic Valley Sewerage Commissioners ISA WWAC Symposium August 2009.

PVSC Improves PVSC Improves PLC Programming UsingPLC Programming Using

Real-Time Dynamic Real-Time Dynamic SimulationSimulation

Paul Cavanagh, P.E.Passaic Valley Sewerage Commissioners

ISA WWAC SymposiumAugust 2009

Page 2: PVSC Improves PLC Programming Using Real-Time Dynamic Simulation Paul Cavanagh, P.E. Passaic Valley Sewerage Commissioners ISA WWAC Symposium August 2009.

BackgroundBackground

Page 3: PVSC Improves PLC Programming Using Real-Time Dynamic Simulation Paul Cavanagh, P.E. Passaic Valley Sewerage Commissioners ISA WWAC Symposium August 2009.

Passaic Valley Sewerage Passaic Valley Sewerage CommissionersCommissioners

• Owns and Operates a 330 mgd wastewater treatment plant in Newark, NJ

– remove 93% of BOD

– remove 94% of TSS

– peak dry weather flows of 400 mgd

– peak wet weather flows of 550 mgd

• Treats about 25% of NJ’s Wastewater

– 15% industrial by volume

– 50% industrial by strength

Page 4: PVSC Improves PLC Programming Using Real-Time Dynamic Simulation Paul Cavanagh, P.E. Passaic Valley Sewerage Commissioners ISA WWAC Symposium August 2009.

PVSC’s Control System PVSC’s Control System RequirementsRequirements

• Balance plant flow between select units

• Maintain a Constant Upstream Channel Level

• Respond quickly to flow disturbances and rain events

Page 5: PVSC Improves PLC Programming Using Real-Time Dynamic Simulation Paul Cavanagh, P.E. Passaic Valley Sewerage Commissioners ISA WWAC Symposium August 2009.

Mixed Liquor Channel LevelMixed Liquor Channel Level

• Maintain a constant stable level for scum collector

• Quickly correct for disturbances and prevent overflows

Page 6: PVSC Improves PLC Programming Using Real-Time Dynamic Simulation Paul Cavanagh, P.E. Passaic Valley Sewerage Commissioners ISA WWAC Symposium August 2009.

Secondary Clarifier Settling Secondary Clarifier Settling TanksTanks

• Evenly Split the flow between the 12 units

• Ability to turn off control to select units

• Minimize the movements of the Flow Control Valves

Page 7: PVSC Improves PLC Programming Using Real-Time Dynamic Simulation Paul Cavanagh, P.E. Passaic Valley Sewerage Commissioners ISA WWAC Symposium August 2009.

The ProblemThe Problem

Page 8: PVSC Improves PLC Programming Using Real-Time Dynamic Simulation Paul Cavanagh, P.E. Passaic Valley Sewerage Commissioners ISA WWAC Symposium August 2009.

Existing PLC Flow Balance and Level Existing PLC Flow Balance and Level Control was not meeting its Control was not meeting its

RequirementsRequirements• The controls were slow to correct

for a disturbance such as a rain event

• Stability problems that got worse during peak plant flows

• Control to individual units could not be shut off

• Many Flow Control Valves were constantly opening and closing 1% to 3% every minute

• Tuning attempts only had a minimal effect

Page 9: PVSC Improves PLC Programming Using Real-Time Dynamic Simulation Paul Cavanagh, P.E. Passaic Valley Sewerage Commissioners ISA WWAC Symposium August 2009.

The Channel Level ControlThe Channel Level ControlResponds Slowly and is UnstableResponds Slowly and is Unstable

WorseDuring

High Flows

Page 10: PVSC Improves PLC Programming Using Real-Time Dynamic Simulation Paul Cavanagh, P.E. Passaic Valley Sewerage Commissioners ISA WWAC Symposium August 2009.

Many Flow Control Valves WereMany Flow Control Valves WereConstantly Hunting Back and ForthConstantly Hunting Back and Forth

Page 11: PVSC Improves PLC Programming Using Real-Time Dynamic Simulation Paul Cavanagh, P.E. Passaic Valley Sewerage Commissioners ISA WWAC Symposium August 2009.

As a Result of the Problems …As a Result of the Problems …

• … the System was kept in manual most of the time– Distribution of solids was uneven making

blanket levels more difficult to control– The Scum Collector weir level would need to

be frequently adjusted– The risk of overflow into an empty tank was

always present

Page 12: PVSC Improves PLC Programming Using Real-Time Dynamic Simulation Paul Cavanagh, P.E. Passaic Valley Sewerage Commissioners ISA WWAC Symposium August 2009.

But Modifying the Control Program on But Modifying the Control Program on the Running System is Problematicthe Running System is Problematic

• Need to wait for a rain event to test the changes– Uncertainty would remain as not all rain

events are exactly alike

• The new program could fail when no one is looking– A units settling could be disturbed and solids

would be discharged– The channel could overflow

Page 13: PVSC Improves PLC Programming Using Real-Time Dynamic Simulation Paul Cavanagh, P.E. Passaic Valley Sewerage Commissioners ISA WWAC Symposium August 2009.

So PVSC chooses to try…So PVSC chooses to try…

Real-Time Dynamic SimulationReal-Time Dynamic Simulation

• Build a model of that captures most of the real-time dynamic interaction between the channel level and the flow control valves and test the PLC program on the model

• Make changes to the PLC Program and after proving the program against simulated disturbances install the changes in the field

Page 14: PVSC Improves PLC Programming Using Real-Time Dynamic Simulation Paul Cavanagh, P.E. Passaic Valley Sewerage Commissioners ISA WWAC Symposium August 2009.

Developing the Dynamic Developing the Dynamic ModelModel

of the Channel and Valvesof the Channel and Valves

Page 15: PVSC Improves PLC Programming Using Real-Time Dynamic Simulation Paul Cavanagh, P.E. Passaic Valley Sewerage Commissioners ISA WWAC Symposium August 2009.

How Do You Build How Do You Build a Dynamic Simulator?a Dynamic Simulator?

Identify the Dynamic Components Blocks• Resistors

– Valves, Orifice, Restrictions– Line Equation

• Capacitors (Integrators)– Tanks, Reservoirs, Valve Actuators– Integrates the flow

• Inductors (Differentiator)– Pipes, Conduits, – Differentiates the flow

• Transfer Function– A convenient way of representing a dynamic system

Page 16: PVSC Improves PLC Programming Using Real-Time Dynamic Simulation Paul Cavanagh, P.E. Passaic Valley Sewerage Commissioners ISA WWAC Symposium August 2009.

Fluid ResistorsFluid Resistors• A Fluid Resistors are like

Electrical Resistors except …– For Electrical Resistors the

Electric Current changes linearly with Electric Voltage (Ohm’s Law)

– For Fluid Resistors the Fluid Current typically changes non-linearly with Fluid Pressure (Bernoulli’s Equation)

• Flow Control Valves behave like variable fluid resistors

• Use a straight line equation for an ideal flow control valve

Page 17: PVSC Improves PLC Programming Using Real-Time Dynamic Simulation Paul Cavanagh, P.E. Passaic Valley Sewerage Commissioners ISA WWAC Symposium August 2009.

Fluid CapacitorsFluid Capacitors• A Fluid Capacitor is like

and an Electrical Capacitor except …– An Electrical Capacitor

stores electric energy– A Fluid Capacitor stores

fluid mass

• An open tank or reservoir is a fluid capacitor

• Integration of the flow entering/exiting the capacitor + an initial valve produces a pressure or head

Page 18: PVSC Improves PLC Programming Using Real-Time Dynamic Simulation Paul Cavanagh, P.E. Passaic Valley Sewerage Commissioners ISA WWAC Symposium August 2009.

Fluid InductorsFluid Inductors

• A Fluid Inductor is like an Electrical Inductor except …– An electric current through

an electric inductor is sustained by its magnetic field.

– A fluid current through a fluid inductor is sustained by the inertia of the mass of fluid in motion.

• Long pipes or conduits are examples of fluid inductors.

• Differentiate the change in flow through the inductor to find the change in pressure across the inductor.

Page 19: PVSC Improves PLC Programming Using Real-Time Dynamic Simulation Paul Cavanagh, P.E. Passaic Valley Sewerage Commissioners ISA WWAC Symposium August 2009.

Transfer FunctionsTransfer Functions

• Laplace Transform Transfer Function– 1st Order– 2nd Order– nth Order

• Captures the input/output dynamics in one block

Page 20: PVSC Improves PLC Programming Using Real-Time Dynamic Simulation Paul Cavanagh, P.E. Passaic Valley Sewerage Commissioners ISA WWAC Symposium August 2009.

Using VisSim/OPCUsing VisSim/OPC

• PVSC staff used VisSim software to build and run its dynamic simulations.

• VisSim is a computer software application that provides a visual block diagram language for modeling and simulation of complex nonlinear dynamic systems. Its fast execution lets you run models in real-time.

• The OPC (OLE for Process Control) is an add-on to VisSim. The VisSim model use OPC to read and write data on the PLC.

• With VisSim/OPC you can run a virtual plant for testing and developing the PLC code.

Page 21: PVSC Improves PLC Programming Using Real-Time Dynamic Simulation Paul Cavanagh, P.E. Passaic Valley Sewerage Commissioners ISA WWAC Symposium August 2009.

Modeling the Mixed Liquor Modeling the Mixed Liquor ChannelChannel

• Modeled it like a fluid capacitor – it integrates the difference between the flow in and flow out of the channel into the gallons in the channel.

• The surface area of the channel is used to convert the volume of gallons in the channel into an elevation level.

• Limit the Integration for the real world boundaries

• The Elevation of the Upstream Weirs (104 feet)

• The Elevation of the Downstream Weirs (99 feet)

• Use the channel level to supply the pressure across the valves

• 0 to 5 feet of water

Page 22: PVSC Improves PLC Programming Using Real-Time Dynamic Simulation Paul Cavanagh, P.E. Passaic Valley Sewerage Commissioners ISA WWAC Symposium August 2009.

PVSC’s Channel Level Model in PVSC’s Channel Level Model in VisSimVisSim

Page 23: PVSC Improves PLC Programming Using Real-Time Dynamic Simulation Paul Cavanagh, P.E. Passaic Valley Sewerage Commissioners ISA WWAC Symposium August 2009.

Modeling a Flow Control Modeling a Flow Control ValveValve

3 Steps Were Used• Determined the dynamic valve

position by integrating the open and close signals and adding the result to the initial position

• Treated the valve like a variable fluid resistor that is effected linearly by the position and by the square root of the level

– Used straight line equation for steady state flows response to position

– Biased that equation by the square-root of the head pressure across the valve (creates the observed non-linear effect)

• Used a transfer function to capture the lag response

Page 24: PVSC Improves PLC Programming Using Real-Time Dynamic Simulation Paul Cavanagh, P.E. Passaic Valley Sewerage Commissioners ISA WWAC Symposium August 2009.

Step 1 - Valve Position Step 1 - Valve Position CalculationCalculation

Page 25: PVSC Improves PLC Programming Using Real-Time Dynamic Simulation Paul Cavanagh, P.E. Passaic Valley Sewerage Commissioners ISA WWAC Symposium August 2009.

Step 2 - Steady State Flow Step 2 - Steady State Flow CalculationCalculation

Page 26: PVSC Improves PLC Programming Using Real-Time Dynamic Simulation Paul Cavanagh, P.E. Passaic Valley Sewerage Commissioners ISA WWAC Symposium August 2009.

Valve Flow Increases With Valve Flow Increases With Channel LevelChannel Level

Page 27: PVSC Improves PLC Programming Using Real-Time Dynamic Simulation Paul Cavanagh, P.E. Passaic Valley Sewerage Commissioners ISA WWAC Symposium August 2009.

Step 3 - Lag Response Step 3 - Lag Response CalculationCalculation

Page 28: PVSC Improves PLC Programming Using Real-Time Dynamic Simulation Paul Cavanagh, P.E. Passaic Valley Sewerage Commissioners ISA WWAC Symposium August 2009.

PVSC’s Complete Flow Control Valve PVSC’s Complete Flow Control Valve ModelModel

Page 29: PVSC Improves PLC Programming Using Real-Time Dynamic Simulation Paul Cavanagh, P.E. Passaic Valley Sewerage Commissioners ISA WWAC Symposium August 2009.

The Complete Plant ModelThe Complete Plant Model

Page 30: PVSC Improves PLC Programming Using Real-Time Dynamic Simulation Paul Cavanagh, P.E. Passaic Valley Sewerage Commissioners ISA WWAC Symposium August 2009.

The OPC InterfaceThe OPC Interface

Page 31: PVSC Improves PLC Programming Using Real-Time Dynamic Simulation Paul Cavanagh, P.E. Passaic Valley Sewerage Commissioners ISA WWAC Symposium August 2009.

Human Machine Interface to the Human Machine Interface to the ModelModel

Page 32: PVSC Improves PLC Programming Using Real-Time Dynamic Simulation Paul Cavanagh, P.E. Passaic Valley Sewerage Commissioners ISA WWAC Symposium August 2009.

Improvements Made From Testing Improvements Made From Testing PLC Program with the Dynamic PLC Program with the Dynamic

SimulatorSimulator

Page 33: PVSC Improves PLC Programming Using Real-Time Dynamic Simulation Paul Cavanagh, P.E. Passaic Valley Sewerage Commissioners ISA WWAC Symposium August 2009.

Changes in Channel Level Changes in Channel Level Control ProgramControl Program

Old ProgramOld Program• Moving Average Filter of

Channel Level• Channel Level Control

Bias Multiplied Flow Set Point

• Proportional – Integral Control for of channel level

New ProgramNew Program• Exponential Average

Filter of Channel Level• Channel Level Control

Bias Added to Flow Set Point

• Proportional Only Control of channel level (system is self integrating)

Page 34: PVSC Improves PLC Programming Using Real-Time Dynamic Simulation Paul Cavanagh, P.E. Passaic Valley Sewerage Commissioners ISA WWAC Symposium August 2009.

Changes to Flow Balance Changes to Flow Balance Control ProgramControl Program

Old ProgramOld Program• PID block calculates

Position• Manipulates valve to a

calculated position• Large 2% position deadband• Proportional-Integral Control

of each Tank’s Flow• All operating tanks needed to

operate• Cannot Balance without level

meter

New ProgramNew Program• PID block calculates

Change of Position• Manipulates valve for a

calculated time• Small 1 second deadband • Proportional Only Control of

each Tanks’ Flow• Any combination of tanks

can be put in manual• Can Balance without level

meter

Page 35: PVSC Improves PLC Programming Using Real-Time Dynamic Simulation Paul Cavanagh, P.E. Passaic Valley Sewerage Commissioners ISA WWAC Symposium August 2009.

Comparison of Channel Level Program Comparison of Channel Level Program ResponseResponse

Total Flow Changed from 360 to 600 mgd

Page 36: PVSC Improves PLC Programming Using Real-Time Dynamic Simulation Paul Cavanagh, P.E. Passaic Valley Sewerage Commissioners ISA WWAC Symposium August 2009.

Comparison of Flow Balance Level Comparison of Flow Balance Level ResponseResponse

Total Flow Changed from 360 to 600 mgd

Page 37: PVSC Improves PLC Programming Using Real-Time Dynamic Simulation Paul Cavanagh, P.E. Passaic Valley Sewerage Commissioners ISA WWAC Symposium August 2009.

Comparison of Valve Position Comparison of Valve Position ManipulationManipulation

Total Flow Changed from 360 to 600 mgd

Page 38: PVSC Improves PLC Programming Using Real-Time Dynamic Simulation Paul Cavanagh, P.E. Passaic Valley Sewerage Commissioners ISA WWAC Symposium August 2009.

The Simulation Shows thatThe Simulation Shows thatthe New Program Provides:the New Program Provides:

• Much Faster and Very Stable Level Control – prevents overflows of upstream weirs– helps the operation of the channels scum collector

• Much Faster and Very Precise Flow Splitting– produces more even solids distribution

• A Significant Reduction in Valve Movements – saves on valve maintenance and repair

Page 39: PVSC Improves PLC Programming Using Real-Time Dynamic Simulation Paul Cavanagh, P.E. Passaic Valley Sewerage Commissioners ISA WWAC Symposium August 2009.

Running New PLC Program Running New PLC Program

On the Real SystemOn the Real System

Page 40: PVSC Improves PLC Programming Using Real-Time Dynamic Simulation Paul Cavanagh, P.E. Passaic Valley Sewerage Commissioners ISA WWAC Symposium August 2009.

New PLC Program Worked New PLC Program Worked Immediately!Immediately!

Page 41: PVSC Improves PLC Programming Using Real-Time Dynamic Simulation Paul Cavanagh, P.E. Passaic Valley Sewerage Commissioners ISA WWAC Symposium August 2009.

Conclusions about Conclusions about Using Dynamic SimulationUsing Dynamic Simulation

• Dramatically improves PLC programming

• Can be faster in the long run than waiting for real disturbances

• Much Safer than Testing code on the actual system

• Provides new insight into the mechanics of the process which can lead to further improvements

Page 42: PVSC Improves PLC Programming Using Real-Time Dynamic Simulation Paul Cavanagh, P.E. Passaic Valley Sewerage Commissioners ISA WWAC Symposium August 2009.

Special Thanks to:Special Thanks to:

• The Commissioners• Bryan Christiansen• Sheldon Lipke• Phil Habrukowich• Tom Wasilewski• Jerry Oselador• Loukas Koufodontes

Page 43: PVSC Improves PLC Programming Using Real-Time Dynamic Simulation Paul Cavanagh, P.E. Passaic Valley Sewerage Commissioners ISA WWAC Symposium August 2009.

ResourcesResources

• BooksBooks– Modeling Engineering Systems by Jack W. Lewis– Instrument Engineers' Handbook: Process control and

optimization  by Béla G. Lipták– Engineer In Training Reference Manual by Michael R.

Lindberg, PE

• Web SitesWeb Sites– http://www.vissim.com/– http://blog.prosig.com/

Page 44: PVSC Improves PLC Programming Using Real-Time Dynamic Simulation Paul Cavanagh, P.E. Passaic Valley Sewerage Commissioners ISA WWAC Symposium August 2009.

DemonstrationDemonstration

Page 45: PVSC Improves PLC Programming Using Real-Time Dynamic Simulation Paul Cavanagh, P.E. Passaic Valley Sewerage Commissioners ISA WWAC Symposium August 2009.

The EndThe End

Paul Cavanagh, PE

[email protected]

http://www.pvsc.com/