# Dynamics by 8S5943EH

VIEWS: 13 PAGES: 19

• pg 1
```									                         Dynamics Add-On
User‟s Manual
For
WinGEMS 5.3

Pacific Simulation
121 Sweet Ave, Moscow, ID 83843 USA
T: +1 208 882-0322 F: +1 208 882-8143
1. Dynamics

1.1.     Introduction

An optional feature of WinGEMS is the ability to simulate the transient response of a model with
respect to time. The key dynamic blocks, TANK and PLUGF are used to model a perfectly mixed tank
and a plug flow vessel, respectively. Nearly all other WinGEMS blocks function the same in both
dynamics mode and steady state mode.

1.2.     Dynamic Theory

Dynamic mathematical models of processes include an accumulation term, as shown in the equations
below. The TANK and PLUGF blocks in WinGEMS are specifically designed to account for this term.
In steady state models, the accumulation term goes to zero.

1.2.1.1. Conservation of Mass
(Rate of mass accumulation) = (Rate of mass in) – (Rate of mass out)

d (V )
 wi  w
dt

1.2.1.2. Conservation of Energy
(Rate of energy accumulation) = (Rate of energy in) – (Rate of energy out) + (net rate of heat addition
to the system from surroundings)

dT
V       wi C p (Ti  Tref )  wC p (T  Tref )  Q
dt

1.2.1.3. Solving Dynamic Models
There are two methods for solving dynamic mathematical models: explicit solution of the ordinary
differential equations and numerical approximation. For complicated systems involving multiple
differential equations, explicit solutions are difficult at best. Numerical approximations are an
extremely powerful tool for modeling transient behavior.

WinGEMS uses numerical approximation to model transient behavior in a process. There are two
methods of numerical approximation: simultaneous and sequential. WinGEMS performs sequential
numerical approximations to model transient behavior.

A dynamic simulation usually begins with a good steady state simulation and is useful as a steady state
simulation. Dynamic simulations are run to a steady state converged solution before a transition to
dynamics mode.
1.2.2.2. When are dynamic models useful?
    Batch systems (Steady state batch systems are useful, however time averaged batch => steady state)
    Storage analysis
    Short time periods
    Developing control strategies
    Tracking component flow through a system

1.2.2.3. When are steady state models useful?
    Economic studies
    Feasibility studies
    Long time periods
    Capital planning and de-bottlenecking

1.3.     Dynamic Blocks

A dynamic simulation will execute the same as a steady-state simulation if there are no dynamic blocks.
There are three blocks unique to dynamic simulation: PLUGF, TANK, and PID. The WAIT block has
unique features for dynamics, but may also be used in steady state. Some blocks that function in both
the dynamics and steady state modes are particularly useful in dynamic simulations: INDICATOR,
GRAPH, and SLIDER. These blocks allow the user to easily interface with a dynamics simulation and
view the results of disturbances or controller set point changes while the simulation is running.

The two key dynamic blocks, TANK and PLUGF, have much in common. Both blocks have capacity,
a current volume, and output a level. Both blocks have similar block options:
1. Perfectly controlled level (option 1). The flow out of TANK or PLUGF is set equal to the flow in, so
that the volume always remains constant.

2. User controlled (option 2). The user specifies the flow out of the tank typically using computed
parameters or controllers. Using this option it is possible for the vessels to go empty or overflow.

1.3.1.1. PLUGF Block
PLUGF stands for Plug flow. In a Plug flow block, the first mass into the tank is the first mass out of
the tank. Each element (or plug) of mass moves through the plug flow block without mixing with the
plug on either side. The user must define the number of plugs (termed slugs in the block dialog box)
that are used in calculation; the default is 10. The number of slugs selected to represent the volume of
the vessel is important. The output response from the block will more closely represent perfect plug
flow behavior if more slugs are used. A maximum of 200 slugs may be used in a single project.

1.3.1.2. TANK Block
The TANK block models a perfectly mixed tank. Any mass into the tank is perfectly mixed
instantaneously with the entire tank contents. Consequently, the temperature and composition of the
flow out at a given time is the same as the tank contents.

1.3.1.3. Combining TANK and PLUGF
No vessel exhibits perfect plug flow or perfectly mixed behavior. A more accurate model may be
implemented by using both PLUGF and TANK in series. Each block takes up a portion of the total tank
volume. It is often convenient to use a compound block for this modeling technique.
1.3.1.4.          PID
The PID block provides Proportional, Integral, and Derivative control to dynamic simulations. Tuning
constants as well as a set point, monitored variable, and controlled variable are entered into this block to
model process controllers and their effects.

1.3.1.5.          Wait block
The WAIT block creates a delay in the simulation. Using Option 1 in the WAIT block, a delay can be
created between the calculation of two blocks. The WAIT block can be inserted in the calculation order
where the delay is desired. Option 2 allows for a fixed delay in every iteration. This allows for the
simulation of real time on fast computers.

1.3.1.6.          Indicators
These blocks are available in both steady state and dynamics, but are very important to dynamic
simulations. Indicators show the instantaneous value of a model parameter and can be used to monitor
the behavior of that parameter in response to a disturbance or change in controller set point.

1.3.1.7.          Graphs
Graphs can also be used to monitor the behavior of a model parameter and are useful for showing the
time-lapse response of a parameter to a disturbance or change in controller set point.

1.3.1.8.          Sliders
Sliders can be used to change model parameters “on the fly”. This is useful for introducing a
disturbance, turning a controller on or off, tuning a controller, or changing the set point of a controller.

1.4.     Dynamic Scripts

Dynamic simulations require that the user make additions to the default WinGEMS scripts. The scripts
set up the length and the fidelity of the simulation.

1.4.1. Repeat loops
Each dynamic simulation should begin with the convergence of a steady-state solution. Use a repeat
until converged loop, or read in a steady-state solution from a current value file. The dynamic repeat
loop, repeat with time, follows the steady state repeat loop. The repeat with time script requires that the
total simulation time and time step be specified.

The total simulation time is the length of time to be simulated once WinGEMS is in Dynamics mode.
The maximum simulation time is about 594 hours.

The time step is the interval at which the values in the simulation are calculated. The time step is an
important factor in determining the accuracy of a dynamic simulation. The time step in a dynamic
simulation should be at most one third of the residence time of the smallest vessel in the project. A
smaller time step will increase the accuracy of the simulation. The trade off is the smaller the time step
the more iterations the simulation will run. A good way to determine if the time step is small enough is
to reduce it by an order of magnitude. Then, run the dynamic simulation again and compare the results
to the previous run. If they are the same, the previous time step is valid. If not, repeat the process until
an appropriate time step is found. The minimum time step in WinGEMS is 0.1 seconds.
1.4.2. Time tags
Time tags allow a script to be called only once at a particular simulation time.

1.4.3. Using “offset” to write data out to Excel
script to increment the cell to which the parameter is written down one row.

Reads in a column of values to an input stream

1.5.     Disturbances

Disturbances may be introduced into a project using a variety of techniques.

1.5.1. Set command
One useful script command to use in dynamics is the set command. This sets a block parameter or
stream component to a designated value. In dynamics, the set command may be programmed to act at a
particular time.

1.5.2. Slider blocks
Another way to introduce a disturbance is to use a slider block. A parameter in the model may be
referenced to the slider block, allowing this value to be changed “on the fly”.

Disturbance values could also be read in from Excel spreadsheets at a particular time in the simulation.
This is accomplished using a read script with a time tag.

1.5.4. User intervention via block or stream dialog
A stream or block value may be changed while the simulation is running by opening the dialog box of
the desired stream or block object and manually typing the new value into the appropriate field in the
initial values tab of the block dialog box.

1.6.     Calculation Order

Steady state simulations converge faster with proper calculation order. A proper calculation order is
crucial to dynamic simulations as well! In most cases, use the same calculation order for the both steady
state and dynamic portions of the simulation. As a rule, it is best to calculate blocks in the same order as
pulp or another primary stream encounters them.
1.7.   Real-time Dynamics

In real-time dynamics, each iteration takes exactly the same time as the dynamic time step. This is often
used for advanced application such as trainers. “Real time” dynamics is accomplished using the WAIT
block. The use of this feature is limited by computer speed. For example, a large simulation running on
a PC with a 20-megahertz processor may already run slower than “real time” without a WAIT block.
2. Dynamic Examples Summaries
(For details, see the Examples Section of the WinGEMS Manual.)

2.1.   Step change into a perfectly mixed tank

This is a small example demonstrating the outlet concentration response to an inlet concentration step
change in a perfectly mixed tank. The model is run to steady state convergence with a dissolved solids
d (V )
 wi  w
dt
inlet concentration of zero, and then, dynamic mode begins with a time step of 1 minute. The dissolved
solids concentration is set to 100% at the start of dynamics mode using a set command in the scripts.
The simulation is run for a length of 480 minutes. The response data, along with the simulation time, is
written out to Excel every iteration using a write script with the offset command. These data are then
compared with the response predicted by the solved differential equation describing the process, which
appears below. Both sets of data appear in a graph in the Excel sheet.

See the file CSTR.wg.

2.2.   Three perfectly mixed tank in series

This is an example of three perfectly mixed tanks in series. The temperature of the inlet to the first tank
is varied and the temperature responses are graphed versus time. The tanks are held at constant level.
The model is first run to steady state convergence to initialize the streams and tanks. Then it is run in
dynamic mode for the equivalent of 3 hours. The time step is 1 minute. After 10 minutes in dynamic
mode, the inlet temperature is dropped from 100 °C to 80 °C. The graph block is used to display the
results.

See the file MIXEDTANK.wg.

2.3.   A more complicated example

The steam injection heater consists of a tank with a water inlet and a constant overflow outlet. This
ensures the volume of water in the tank is constant. Steam is injected into the tank and is used to control
the outlet temperature. The tank is well mixed. The tank is represented by the STHEATER block,
which is a compound block consisting of a MIX block and a TANK block. To see the contents of the
STHEATER block, double click the block while holding the „Alt‟ key. The model is first run to steady
state convergence, and then dynamic mode begins with a time step of 10 seconds. After 5 minutes in
dynamic mode, the steam input is increased by 1 pound per minute using a set command in the scripts.
The GRAPH block displays the outlet temperature response to the steam input increase. The WAIT
block is used to ensure the simulation runs at a reasonable speed for viewing the response.

See the file SteamInj.wg.

2.4.   A Paper Machine Dynamic Example

The project file DYN_DEMO.WG illustrates how a dynamic simulation is constructed. The example
project is set up to pass values to an Excel spreadsheet. Both the example project and the spreadsheet
will be located in the “examples” sub-directory of the directory where WinGEMS is installed. Open the
spreadsheet entitled DYN_DEMO.XLS in Excel, and then open and run DYN_DEMO.WG in WinGEMS.
2.4.1. The process
DYN_DEMO.WG represents a paper machine with several large, well-mixed tanks. During start-up, broke
is recycled to one of two places in the wet-end feed. The goal of this simulation is to examine the effect of
the two possible recycle routes on the amount of time it takes the system to reach equilibrium when dye is

2.4.2. Running the simulation
The program first solves for steady state flow rates, and then begins the first dynamic case as a jet of dye is
injected into the system. The current phase of the simulation is reported in the lower left-hand corner of the
diagram. Dye concentrations in a recycled pulp stream are reported on the screen and sent to the
spreadsheet. The model then re-solves for steady state values and begins a second dynamic case with the
diluted, recycled pulp redirected through an additional tank.

2.4.3. Script Structure
The steady state solution, dynamic cases, and data exchange with Excel are all set up in the execution
scripts, which can be examined by selecting Scripts... from the Diagram pull-down menu. The script
marked with the double greater-than and less-than symbols is the top-level script, in this case <<Master
Script>>, and calls the other scripts to be executed. Double click on Master Script or click Open to
examine it.
Dynamic Example – Concentration Step Change to a Mixed
Tank

Outlet Concentration Response to a Inlet Concentration Step Increase (TANK,
SLIDER, GRAPH)

Example Description

This is an example demonstrating the outlet concentration response to an inlet concentration step
change in a perfectly mixed tank. The model is run to steady state convergence with a dissolved
solids inlet concentration of zero, and then, dynamic mode begins with a time step of 1 minute.
The dissolved solids concentration is set to 100% at the start of dynamics mode using a set
command in the scripts. The simulation is run for a length of 480 minutes. The response data,
along with the simulation time, are written out to an Excel spreadsheet every iteration using a write
script with the offset command. These data are then compared with the response predicted by the
solved differential equation describing the process, which appears below. Both sets of data appear
in a graph in the Excel sheet.

      t

C A,out (t )  C A,in 1  e

   

          
This equation holds assuming that the inlet concentration and density are constant. The two
responses vary by less than 1%, and the variation grows smaller as the simulation progresses.

In the simulation, the GRAPH block displays the outlet concentration response curve, and the
SLIDER block displays the inlet concentration. In this simulation, the slider block conveys
information rather than acting as a method for changing simulation parameters.

See the file CSTR.wg.

Block Description

Block                  Block

Number          Type                       Description
1             TANK                       Perfectly controller to a constant level of 100% with a
capacity of 5000 gallons.

2             GRAPH                       Displays the outlet concentration of the tank versus time.

3             SLIDER                      Displays the concentration of the inlet stream.
Input Stream Description

Stream
Number            Description
1               10 gallons per minute of liquor at 0% consistency with zero dissolved solids initially.
The dissolved solids concentration is changed to 100% at the start of dynamics mode.

Simulation Results

The first order concentration increase in the tank outlet stream varies by less than 1 percent from
the solved ordinary differential equation predicted response. The results can be viewed in the
Excel file where WinGEMS writes the response data. The two response curves on the graph are
nearly indistinguishable.
_____________
Dissolved Solids Input                                   This example shows the outlet dissolved solids concentration response of
Control/Indicator                                        a perfectly mixed tank to a step increase in inlet dissolved solids concentration.
The model runs to a steady state solution. Then dynamics mode begins and
the dissolved wood solids concentration of the input stream is set to 100%.
100% diss. solids                                    This is done using a set command in the script to change the SLIDER block
value, which is referenced in the input stream. A write command in the script
is also used to write out the simulation time and outlet concentration to Excel
_____________________                                     where the simulation response data is compared to the prediction of the
solved differential equation. The variation is less than 1%.
S

Dissolved Solids = 100                      Dissolved Solids = 99.3
1                                         2

Dissolved Solids vs. Time
100.00

Concentration Step Change Example

Updated by:   1187 Alturas Dr.
Created by:                 Moscow, ID 83843
Loren Euhus   Devin Cole
6/10/99       Office: 208-882-0322
Web: www.pacsim.com

Pacific Simulatoin
0.00
0                                               500
DYNAMIC EXAMPLE - MIXED TANK
Perfectly Mixed Tanks in Series (TANK, GRAPH)
Example Description

This is an example of three perfectly mixed tanks in series. The temperature of the inlet to the
first tank is varied and the temperature responses are graphed versus time. The tanks are held at
constant level. The model is first run to steady state convergence to initialize the streams and
tanks. Then it is run in dynamic mode for the equivalent of 3 hours. The time step is 1 minute.
After 10 minutes in dynamic mode, the inlet temperature is dropped from 100 °C to 80 °C. The
graph block is used to display the results.

See the file MixedTank.wg.
Block Description

Block           Block
Number          Type                       Description
1               TANK                       Perfectly controlled to constant level of 50%. Total tank
volume is 100 m3.
2               GRAPH                      Graphs the temperature of streams into and out of the tanks.
3               TANK                       Perfectly controlled to constant level of 50%. Total tank
volume is 100 m3.
4               TANK                       Perfectly controlled to constant level of 50%. Total tank
volume is 100 m3.
Input Stream Description

Stream
Number            Description

1               125 mt/hr of liquor and pulp at 10% consistency and 10% dissolved wood solids. It is
initially 100 °C. During the dynamic phase, the temperature is dropped to 80 °C.

Simulation Results

The model results show a first order response for the first tank. Three tanks in series show a
delayed response, which is a characteristic of plug flow. Adding more tanks to the series increases
the plug flow characteristic of the model, but it would never have the sharp step at the end of the
change, which would be seen with true plug flow due to the perfectly mixed nature of the tanks.
DYNAMIC EXAMPLE – STEAM INJECTION WATER HEATER
A perfectly mixed tank with steam injection heating. (STHEATER-Compound. Block,
STMIX, TANK, WAIT, GRAPH)

Example Description

The steam injection heater consists of a tank with a water inlet and a constant overflow outlet. This
ensures the volume of water in the tank is constant. Steam is injected into the tank and is used to control
the outlet temperature. The tank is well mixed. The tank is represented by the STHEATER block,
which is a compound block consisting of a MIX block and a TANK block. To see the contents of the
STHEATER block, double click the block while holding the „Alt‟ key. The model is first run to steady
state convergence, and then dynamic mode begins with a time step of 10 seconds. After 5 minutes in
dynamic mode, the steam input is increased by 1 pound per minute using a set command in the scripts.
The GRAPH block displays the outlet temperature response to the steam input increase. The WAIT
block is used to ensure the simulation runs at a reasonable speed for viewing the response.

See the file SteamInj.wg.

Block Description

Toplevel Diagram

Block         Block

Number        Type                        Description
1             STHEATER                    Compound block containing a STMIX and a TANK block.
2             GRAPH                       Displays the outlet temperature of the tank versus time.

3             WAIT                        Creates a delay in each iteration to show the dynamic
response at a reasonable speed for viewing.

Diagram STHEATER1

Block         Block

Number        Type                        Description
1             STMIX                       Mixes a steam stream with a pulp/liquor stream.

2             TANK                        Perfectly controlled level at 5.5 gallons. Total volume is 13.5
gallons.

Input Stream Description
Stream
Number           Description
2              15 pounds per minute of liquor at 0% consistency with no dissolved wood solids.

3               0.2 pounds per minute of steam at 66.4 psig. During the dynamic phase, the flow rate is
increased to 1.2 pounds per minute.

Simulation Results

The results show a first order increase in the outlet temperature. The outlet temperature response
for similar step changes in process variables in this model have been compared to the response
predicted by an ordinary differential equation solver. The process gains and characteristic times
varied by at most 4.4% and in all but 2 cases less than 1.5%. The final steady state conditions
predicted by WinGEMS varied by 0.3% or less.

Alternative Step Tests
The outlet temperature response for step changes in other process variables can be generated.
Other variables of interest might be the steam pressure, the inlet liquor flow, and the inlet liquor
temperature. These variables are potential process disturbances which effect the outlet temperature
and knowing their effect could be useful in developing a process control strategy.
Temperature vs. Time

1
212.00

15 lb total/min 1.8 gal total/min 68 °F
WAIT
Wait3                                                                                                              Outlet Temperature = 153 °F
3

55.00
0                                     1000
1

1

Steam: 1.2 lb/min / 66.4 psig / 313 °F       2                                                 1
16.2 lb total/min 1.9 gal total/min 153 °F
2                                      2                                                         3                                                  3

1187 Alturas Dr.

Steam Injection Heating Example
Updated by:
Devin Cole
Date: 6/9/99
Moscow, ID 83843
Office: 208-882-0322
Pacific Simulation
Web: www.pacsim.com
DYNAMIC EXAMPLE - PM DYE
Paper Machine Dye Addition (DILUTE, EVAPS, GRAPH, MIX, REACT,
SPLIT, TANK)
Example Description

This example is a simplified version of a project examining the dynamic response of dye addition
on a paper machine. See PMDye.wg.
The model includes the major tanks and white water loops on the wet end of a paper machine.
Dye is added into the trim chest pump suction (1 gpm for 10 minutes). The dye concentration
coming off of the paper machine is graphed to show the system response to the dye addition.
There are two piping options for recycling the trim chest flow. In the default case the trim chest is
pumped back to the feed chest. The slider block allows the flow to be pumped directly to the
machine chest. It is also possible to split between the two tanks.
Simulation Results

When the trim chest stock and dye are pumped to the machine chest, the dye concentration spikes
high and then trails down to zero over time. When the trim chest stock and dye are pumped back
to the feed chest, the dye concentration has a much lower and rounded peak.

Simulation Alternatives

The basic model shows the system response to a batch addition of dye. But how long would it take
for the system to come to equilibrium with a constant dye addition?

By modifying the execution script, we can see how fast the dye concentration comes to
equilibrium. Modify the SET command which sets the dye flow from 1 to 0.2 to keep the dye
concentration on the graph. Also disable the SET command which shuts off the dye after 10
minutes. When the model is run the dye concentration increases quickly at first and then gradually
levels out. In this case, the dye concentration reaches 95% of the maximum value in about 10
hours when the trim chest is pumped to the machine chest. It takes about 15 hours to reach the
same level when pumping to the feed chest. In the latter case the additional tank in the loop
increases the time required to reach equilibrium.

What if we add a batch of dye and then follow it up with a steady flow? Modify the execution
script to inject dye at 0.3 gpm for 30 minutes, then drop to 0.12 gpm. The dye concentration
comes up quickly (30 min) to slightly above equilibrium, then sags down for about 4 hours before
gradually increasing to the equilibrium value. Depending on the quality specs, this might be good
enough. If not, the model could evaluate a stepped flow arrangement such as 0.3 gpm for 30
minutes, then 0.14 gpm for 3 hours, then 0.12 gpm for 5 hours, etc. In this way, an acceptable
policy could be developed to add dye to the paper machine while maintaining quality standards
throughout the process.

Another possible scenario would be to recycle the sheet off the couch until the system reached
equilibrium. This would take some additional changes to the execution to change the flows at the
correct times.

```
To top