Read Using an Excel-Based Model for Steady-State and Transient Simulation text version

Using an Excel-Based Model for Steady-State and Transient Simulation

Ian Cameron TransCanada Transmission

Using an Excel-Based Model for Steady-State and Transient Simulation

Ian Cameron TransCanada Transmission 111-5th Avenue S.W. Calgary, Alberta, Canada T2P 3Y6 Tel. 403-503-8274 Fax. 403-261-3501 Email: [email protected] Abstract At TransCanada Transmission, TFlow as a dry gas simulator has evolved over the last five years from a VMS-based batch application to a stand-alone PC application running under Microsoft Excel. TFlow is currently in production use to calculate daily linepack for TransCanada's eastern mainline, model the North Bay (Eastern Ontario) triangle, perform transient simulations and model pipelines for international projects. TFlow is popular because it is easy to use and modify. TFlow comprises a user interface written in Microsoft Excel's Visual Basic for Applications (VBA) and a dynamic linked library (DLL) written in C++. All information needed to model a pipeline system is contained in an Excel workbook, which also displays the simulation results. Recently a detailed station model with wheel maps was added. Also, forecasted, nominated and actual volumes can be downloaded from databases to a workbook. Some of the features of TFlow are: · The program runs on a PC under the Excel interface, using its own menu, toolbar and dialogs, but with all the usual Excel features available to the user. · TFlow handles both steady-state and transient simulations using the same equations. A steady-state simulation is just a transient simulation - with long time-steps and constant boundary conditions - which continues until linepack stabilizes. · Networks of any complexity can be modelled. Elements include pipe segments, valves and compressors. Compressor stations can be either simple blocks of power or sub-networks containing multiple compressors in series and/or parallel arrangements. · The program automatically sets up the equations and unknowns. Users do not have to determine which parameters are known or unknown in order to make the number of equations and unknowns balance. · A special steady-state feature is capability calculation to a given node, without violating any constraints (maximum power, maximum compression ratios, maximum discharge pressures, minimum delivery pressures, etc.) · Output can be written directly to Excel worksheets, displayed on schematics and in user-configurable reports.

1

The paper consists of a description of TFlow's equations, the program design, its interface, features and sample results. 1. Introduction The first version of TFlow was a batch application (with punched card I/O) written in Fortran for the IBM 1800 and put into production in 1975. It was used to model sections of the TransCanada Pipelines system downstream of storage which were subject to daily load patterns. TFlow was upgraded to run on IBM 370s in the early 1980s, and later VAX machines under VMS, but still under batch mode. In 1994 with the advent of desktop computers having the calculation power of the earlier mainframes, TFlow was rewritten in C to run on a Macintosh, including a custom Mac user interface of menus and dialogs. Input was in the form of tab-delineated text files prepared using Microsoft Excel or similar applications. Output was written to scrolling windows which could saved be saved as text files and subsequently opened by any word processor or spreadsheet program. In 1996 it became apparent that TransCanada was going to use Windows platforms, instead of the Macintosh, as the standard desktop environment, which would have meant converting the Mac user interface to Windows. However, a colleague suggested using Excel's Visual Basic for Applications (VBA) for the user interface with the core calculations handled by a Dynamic Linked Library (DLL) linked to Excel. This offered several advantages over a stand-alone desktop application: · · Easy development of menus and dialogs required for TFlow Using Excel's built-in menus and features for normal functions such as opening and closing files, editing data on worksheets, using results of worksheet formulae as data, etc. Ability to combine all input/output for a pipeline system into one workbook containing multiple worksheets. Spreadsheets are a natural environment for preparing input data for pipeline systems and for presenting pipeline simulation results, since they can retain up to 15 digits of precision while showing numbers rounded to a suitable accuracy for display. Easy porting between different computer platforms (Mac and Windows.)

· ·

·

The following sections describe the equations used by TFlow, program design, user interface, pipeline workbooks for input/output, compressor station modelling, and schematic display of conditions.

2

2.

Equations

2.1 Pipe Equations For modelling flow of gas in a pipe section TFlow uses the following equations of State, Continuity and Motion based on Streeter and Wylie (1970): P = Z R T = B 2 (Equation of state) B 2 M P + = 0 (Continuity equation) A x t B 2 M 2 P 2 g sin 1 - 2 2 + A P B2 (Motion equation) 2 M M B 2 B 2 M 2 P M + + 2 + =0 x A t F 2 D A2 A 1 P 2 2 x where: P lb f = pressure 2 or [Pa] ft slug kg = density 3 or 3 m ft = compressibility [dimensionless] = gas constant; R = R= G T B M x t A g 1545.36 32.174 ft lb f or 28.964 G slugº R (1)

(2)

(3)

Z R

8314.51 J 28.964 G kg K

= specific gravity of the gas relative to air [dimensionless] = temperature [ºR] or [K] ft m = isothermal wave speed or s s slug kg = flow or s s = distance along the pipe [ft] or [m] = time [s]

= cross-sectional area of pipe ft 2 or m 2

[ ] [ ]

ft m = gravitational acceleration 2 or 2 s s = pipe slope relative to horizontal [radians]

3

F D

= Fanning transmission factor [dimensionless] = pipe diameter [ft] or [m]

Equations (1) and (2) are identical to Streeter and Wylie, but Equation (3) contains two additional terms: B2 M 2 V 2 1 - 2 2 = 1 - 2 A P B and B 2 M 2 . A 2 x M M B2 ft m where V = gas velocity or = = A P A s s Terms (4) and (5) allow for full treatment of all the inertial effects in the motion equation. In particular (4) can be important when modelling low pressure-high velocity situations such as line breaks, or even steady-state conditions in lines experiencing significant pressure drop. M can be converted to volumetric flow, Qb, in millions of standard units per day using: Qb = 86400 M 1 = M 6 Cq 10 b (6) (4)

(5)

where:

b =

Cq =

gas density at base pressure Pb and temperature Tb slug/s volume-flow to mass flow conversion factor MMcfd kg/s or 6 3 10 m /d

TFlow solves Equations (2) and (3) by the implicit method where a finite difference scheme is used to represent the x-derivatives and the t-derivatives. Figure 1 shows an implicit cell on the x-t plane Fig. 1

t t+t PT , QT PXT , QXT

t P, Q x

PX , QX x+x x

4

Conditions P, Q, PX and QX are known at time t, while conditions PT, QT, PXT and QXT are to be determined at time t + t . Let: PAV = P PX 2 P + PX - 3 P + PX (7)

PTAV = Then:

P P 2 PT + PXT - T XT 3 PT + PXT

(8)

P PTAV - PAV = t t Q Q XT - QT = x x P 2 PXT - PT = x x

2 2

(9)

(10)

(11)

Q QT + Q XT - Q - Q X = t 2 t Q 2 Q XT - QT = x x

2 2

(12)

(13)

One significant difference from Streeter and Wylie is that the x-derivatives are expressed in terms of variables at (t + t ) only, rather than the average of (t , t + t ) . The reason is that using only the (t + t ) quantities gives more stable results for flows, particularly for steady-state calculations. When using the average of (t , t + t ) flows tend to zig-zag at successive time-steps, even when boundary conditions are held constant. Also, equations for the other system devices (nodes, compressors and valves) are written in terms of pressures and flows at (t + t ) , and it is more consistent to express the pipeline equations similarly. Equation (2) can be re-written: f continuity = C q B 2 Q XT - QT PTAV - PAV + A x t

C q B 2 t = (Q XT - QT ) + PTAV - PAV = 0 A x In order to ensure that the change in linepack over t exactly equals the rate of linepack change at t + t , the Z term in Equation (14) is evaluated as follows: 5

(14)

f continuity = where: ZT

C q R T t P P (Q XT - QT ) + TAV - AV = 0 A x ZT Z = compressibility at time t + t

(15)

Equation (3) becomes: f motion +

2 2 2 2 C B 2 (QT + Q XT ) PTAV 2 g sin PXT - PT 0.5 - q + = 2 x B2 8 A 2 PTAV 2

(QT + Q XT ) QT + Q XT C q B 2

2 F 2 D A2 C q P QT + Q XT - Q - Q X + =0 A 2 t

C q B 2 Q XT 2 - QT 2 + x A2

2

(16)

Since PAV and PTAV are functions of P, PX, PT or PXT, Equations (15) and (16) contain eight variables (P, PX, Q, QX, PT, PXT, QT and QXT) The first four of these are known, initial conditions at time t. Since only two of the remaining four variables at time t + t can be solved by Equations (15) and (16), the remaining two must be: a) Specified as boundary conditions, b) Shared with similar equations in adjacent pipe cells, or c) Shared with adjacent devices, such as compressors or valves (which have their own equations.) If a pipe is divided into N cells, there will be N pairs of equations in 2 N + 2 unknowns. Two of the unknowns, one at each end of the pipe, must be specified, either directly or in equation form. This leaves 2 N equations in 2 N unknowns. Note that x can be different for each pipe, but there can be only one t for all pipes in the system. TFlow solves for the unknowns using the standard Newton-Raphson technique based on the following linear equations: f continuity + f continuity PT PT + f continuity PXT PXT + f continuity QT QT + f continuity Q XT Q XT = 0 (17)

f motion +

f motion f f f PT + motion PXT + motion QT + motion Q XT = 0 PT PXT QT Q XT

(18)

The values of fcontinuity and fmotion (from Equations (15) and (16) ) and partial derivatives of fcontinuity and fmotion with respect to PT, PXT, QT and QXT are evaluated at the known values of the previous iteration. The delta quantities in Equations (17) and (18) represent the corrections to these pressures and flows. The new set of linear Equations (17) and (18) is solved iteratively, with delta corrections applied at each iteration until these corrections are reduced to acceptable magnitudes. 6

Equations (15) and (16) assume isothermal flow of gas in the term B. In TFlow temperature changes are decoupled from pressure and flow changes. To calculate pipe temperatures it uses the following steady-state equations: T= J (P - P1 ) T1 - T2 + Tg + t 2 a a

(19)

J (P2 - P1 ) - a J (P2 - P1 ) T2 = T1 - Tg - t e + Tg + t a a where: T1 T2 Tg a = upstream temperature [ºR] or [K] = downstream temperature [ºR] or [K] = ground temperature [ºR] or [K] = = L Q Cp U Jt 9.8555 × 10 -4 L. D U [English units] Q Cp G 2.2158 × 10 -4 L. D U [SI units] Q Cp G

(20)

= length of pipe section [ft] or [m] = flow [MMcfd] or [106m3/d] BTU kJ = specific heat of gas at constant pressure or kg K slugº R BTU W = heat transfer coefficient, pipe to soil 2 or m 2 K h ft º R º R K = Joule-Thomson coefficient of the gas, or kPa psi

TFlow calculates temperatures for a network by cycling repeatedly through all the nodes, updating the temperatures for any node meets the following criteria: · · The node's temperature has not been updated, and All elements with flow into the node have updated node temperatures at their upstream ends.

TFlow uses four, user-selectable, equations of state for calculating Z, Cp and Jt (Table 1):

7

Table 1 Equations of State (EOS) 1. 1 , where I and J are empirical functions of gas temperature for a pure I + J P hydrocarbon gas of 0.6 specific gravity, and adjusted for gas composition (i.e., actual specific gravity, mole % N2 and mole % CO2.) Cp and Jt are calculated using equations based on the Redlich-Kwong EOS. Z= Benedict-Webb-Rubin-Starling (BWRS) EOS for Z, Cp and Jt. AGA8 EOS for Z. Cp and Jt are calculated using the appropriate BWRS equations with gas density determined from the AGA8 EOS. (AGA8 refers to the "Detail Characterization Method" described in the American Gas Association's Transmission Measurement Committee Report No. 8 of November 1992.) Peng-Robinson EOS for Z, with Cp and Jt calculated using the appropriate BWRS equations with gas density determined by the Peng-Robinson EOS

2. 3.

4.

2.3 Node Equations Because TFlow uses a transient calculation method with finite time-steps, even for steady-state simulations, either the pressure or the flow at each node must be unknown. Pure steady-state simulators ­ which in effect have infinite time-steps ­ allow users to control both pressure and flow, or neither, at a node. Sometimes this can lead to difficulties in balancing the numbers of equations and unknowns. In TFlow each boundary node requires a node equation. Boundary nodes are defined as: · · · Any node where gas enters or leaves the system, Any node where three or more system elements meet, or Any node where two system elements meet and there is a change in sign for the flow (e.g., a positive flow out of one element means a negative flow into the next element.)

If a node joins two elements with no change in sign of the flow, then the two elements can share the common flow, and no node equation is required. For a pressure-controlled node the equation is: f node = PT - Pcontrol = 0 where: PT Pcontrol Since f node = 1, PT = node pressure at time t + t = specified node pressure (22) (21)

the Newton-Raphson equation is:

8

1 PT = 0 By setting PT = Pcontrol and using then Equation (21) the node pressure is held constant at its specified value, but can be shared by the equations of one or more elements connected at the node. For a node joining N elements, with the nodal flow specified then: f node = QT 1 + QT 2 + ... + QTN - Qcontrol = 0 where: Qcontrol = the specified flow in or out at the node (or zero if the node is a junction with no flow.)

(23)

(24)

In terms of the delta quantities: f node + where the f node f f QT 1 + node QT 2 + ... + node QTN = 0 QT 1 QT 2 QTN (25)

f node quantities are either +1 or -1 depending on whether the corresponding QTi element's flow is into (+) or out of (-) the node. 2.4 Valve Equations The control equation of a valve is a function of its upstream pressure Pu, downstream pressure Pd and flow Qd, all at time t + t . If the valve is fully open (no pressure drop): f valve = Pu - Pd + 0 Qd = 0 and the three derivatives are: f valve f valve f valve = 1, = -1, =0 Pu Pd Qd If the valve is closed: f valve = 0 Pu + 0 Pd + Qd = 0 and the three derivatives are: f valve f valve f valve = 0, = 0, =1 Pu Pd Qd If the valve is controlling its downstream pressure: f valve = Pcontrol - 0 Pu - 1 Pd - 0 Qd = 0 and the three derivatives are: f valve f valve f valve = 0, = -1, =0 Pu Pd Qd (31) (30) (29) (28) (27) (26)

9

The valve can also control Pu or Qd with equations similar to (30) and (31). In all three cases there is one restriction: Pu >= Pd ; i.e., the valve can do no work. Open valves can optionally have pressure drop as a function of flow as follows: f valve = Pu - Pd - K v

2

K M 2 Vu = Pu - Pd - v 2 2 2 2 Av

2 2 2

= Pu - Pd - where: Kv Vu Av

K v C q Qd Z u R T 2 Pu Av

(32)

=0

= valve loss coefficient [dimensionless] ft m = inlet gas velocity or s s 2 2 = valve area [ft ] or [m ]

2 2

K v C q Qd R T f valve = 1- 2 Pu 2 Pu Av f valve = -1 Pd K v C q Qd R T f valve =- 2 Qd Pu Av

2

Z Z u - P u Pu

(33)

(34)

(35)

2.5

Compressor Equations Fig. 2

Ps Pd Qs Qd

Fuel

Compressor units are similar to valves in that their control equations are functions of three variables: suction node pressure Ps, discharge node pressure Pd and discharge flow Qd. Between the nodes and the compressor flanges there may be piping pressure losses Ls and Ld. If the compressor is fuel-burning then it has an additional equation which is a function of Qs, as well as the other three variables. Compressor power is given by the equation:

10

W=

k -1 Qd Z sc C c k k r - 1 k -1

(36)

where: W Zsc Cc

= power [HP] or [MW] = gas compressibility at suction pressure and temperature of the compressor flange HP MW = compression constant or 10 6 m 3 /d MMcfd = compressor efficiency [dimensionless] = ratio of specific heats for the gas [dimensionless] P + Ld = compression ratio = d Ps - Ls

k r

If the compressor is controlling the discharge pressure then its control equation is the same as Equation (30) for a valve controlling downstream pressure. For suction pressure control the equation is similar. If the compressor is operating at its full power, Wmax then the control equation is f comp = Wmax - W = 0 from which the partial derivatives of fcomp with respect to Ps, Pd and Qd may be formed. If the compressor is fuel-burning then the following, additional equation is required: f fuel = Qs - Fa - Fb Qd (1 + W ) = 0 where: Fa Fb = fuel rate intercept [MMcfd] or [106m3/d] = fuel rate slope [MMcfd/HP] or [106m3/d/MW] (38) (37)

The suction and discharge pressure losses may either be fixed or functions of pressure and flow. In the latter case use equations similar to (32) with the terms Kv and Av are combined into yard loss coefficients Kls and Kld assuming 24" piping (23.5" internal diameter), as follows: Ls = C y K ls Z s R Ts Qs Ps C y K ld Z dc R Tdc Qd Pd + Ld

2 2

(39)

Ld =

(40)

where: Cy Zdc

= yard loss conversion constant = compressibility at compressor flange discharge pressure (Pd + Ld) and temperature Tdc.

If the compressor is reciprocating the following efficiency equation is used:

11

= C R1 + C R 2 r + C R 3 r 2

where CR1, CR2 and CR3 are efficiency coefficients. For a centrifugal compressor may be fixed, or with an aero-assembly (wheel) the fanlaw equations relating head, flow, speed and efficiency can be used: N N h = H1 q + H 2 q N + H3 N r r k -1 k k = Z sc R Tsc r - 1 k -1

2 2 2

(41)

2

(42)

N N = E1 q r + E 2 q r + E3 N N where: h ft lb f kJ = compressor head or kg lb m ft 3 m3 = inlet flow or at suction conditions Psc and Tsc min s = actual impeller speed [min-1] = rated impeller speed at which coefficients H1, H2, H3, E1, E2 and E3 were derived.

(43)

q N Nr

Through Equations (41 ­ 43), = f (Ps , , Pd , Qd ) and its derivatives with respect to these variables can be evaluated and used in Equations (37) and (38). 2.6 Sample Pipeline System Figure 3 shows a schematic for a sample pipeline system consisting of three pipe sections, two of which are in parallel, and a compressor station with two parallel units, one of which is fuel-burning . The number of unknowns is 4 pressures + 9 flows = 13. Balancing these are: 6 pipe equations + 2 compressor equations, + 1 fuel equation + 4 node equations = 13. For each node its equation can either specify its pressure (P1 in this example) or balance its flows (Nodes 2 to 4). Because of this provision the numbers of equations and unknowns always match. If the station is operating on discharge pressure control, then one of the units can control nodal pressure P3 and the other can operate at fixed power. Alternatively both can operate at fixed power.

12

Fig. 3

Q3 Q6 P1 1 Q1 Q2 P2 2 Q4 Q5 P3 3 Q7 P4 4 Delivery

Q8

Q9

Fuel

3. Program Design The program consists of two parts, an Excel workbook called TFlowVB.xls and TFlow.dll (the DLL). Users must supply another Excel workbook, the Pipeline Workbook (described further in Section 5) which contains worksheets with the data necessary to describe a complete pipeline system and worksheets to display calculation results. Figure 4 shows the flow of commands and data among the two workbooks and the DLL. (The two shaded boxes are hidden from the user.) Fig. 4

Data

User's Pipeline Workbook

Da ta

ds an m m Co

ta Da

gs alo Di

TFlowVB Workbook (VBA Code + Dialogs + 2 Worksheets)

Data

TFlow.DLL + Excel Application

Commands

TFlow's Command and Information Flow

13

The sequence of events is: · · · Users open TflowVB, which hides itself. TFlowVB loads the DLL, which attaches itself to the Excel Application and initializes. Users open one or more Pipeline Workbooks (PWB), any of which when active, enables a menu of 30 commands specific to TFlow, in addition to the usual Excel menus and toolbars. See Section 4, User Interface, for a description of the commands. Users can edit data in the PWB, issue commands that are handled by TFlowVB and passed on to the DLL if necessary, and communicate with TFlowVB via dialogs. Depending on the command, TFlowVB and the DLL may read data from, or write data to, the active PWB, as well as exchange data between each other.

·

TFlowVB is about 1.2 MB in size, manages the user interface (menus and dialogs), receives commands from the user and passes any that it can't handle itself to the DLL. TFlowVB contains: · · · · A worksheet named DataSheet containing about 60 cells of text values used in Popup controls by station and compressor dialogs. A worksheet named ScratchSheet used to exchange data between dialogs and the DLL. 16 dialog objects (called UserForms by Microsoft) each of which contains a dialog image and controls, together with associated VBA code. Nine modules of VBA code which are not associated with dialogs.

The DLL (TFlow.dll) is written in C++ and compiled using either Microsoft's Visual C++ or Metrowerk's CodeWarrior compilers. It is about 430 kB in size and contains 59 global functions which are called from TFlowVB. All but three of these global functions call a method for the PipelineSystem object corresponding to the active PWB. The DLL is compiled from 32,000 lines of code specific to TFlow, plus 9,000 lines of code for solving sparse systems of linear equations. The latter consists of the "Sparse 1.3" set of routines available from the Netlib Repository (www.netlib.org). Sparse 1.3 is copyrighted by the University of California, Berkeley. It was written in 1988 (in C) and requires some modification before being acceptable to current C++ compilers. The DLL code is very object-oriented and uses the following hierarchy of object classes to represent a pipeline system: PipelineSystem (contains arrays of pointers to the objects that it "owns," as well as parameters and state variables (e.g., arrays of pressures and flows) applicable to the system as a whole) PipeSection (a single pipe between two nodes)

14

GasProperties (owner and interface for following equation-of-state classes) Unisim_Zcalc (calculates Z, Cp, and Jt as described in Row 1 of Table 1) BWRS (see Row 2 of Table 1) AGA8_Zcalc (see Row 3 of Table 1) PengRob_Zcalc (see Row 4 of Table 1) SimpleCompressor (a block of compression between two nodes) GasProperties (same as for PipeSection) CompressorStation (owner and controller for a group of CompressorUnits, CompressorPlants and StationValves) CompressorUnit (a detailed compressor between two nodes) GasProperties (same as for PipeSection) CompressorPlant (controller for a parallel compressor "leg" in a station, which may consist of a single CompressorUnit or two or more CompressorUnits in series) SeriesCompressorPlant (a class derived from CompressorPlant which acts as a controller for two or more CompressorUnits in series) StationValve (a valve or aftercooler that is part of a CompressorStation) Valve (a valve or aftercooler that is not part of a CompressorStation) GasProperties (same as for PipeSection) Node (a junction of one or more PipeSections, SimpleCompressors, CompressorUnits, StationValves, or Valves) STN_Node (a class derived from Node for nodes which form part of a CompressorStation's internal system of compressors and valves) PipelineRegion (a set of seasonal and monthly ambient and ground temperatures) Event (a set of changes, during the course of a simulation, to parameters for a PipeSection, SimpleCompressor, CompressorStation, CompressorUnit, Valve or Node) LoadProfile (time-varying load patterns used in transient calculations) The DLL contains an array of pointers to currently-active PipelineSystem objects, the 60 global functions called by TFlowVB and the routines for solving a sparse system of linear equations. To access Excel worksheets the DLL uses the "C API" which is included with Microsoft's Excel Developer's Toolkit, Version 8.0. The three toolkit functions that the DLL uses most are: xlCoerce (to read data from worksheet cells and, if necessary, change the data type, e.g., from a number to a string), xlSet (to write data to worksheet cells) and xlcFormatNumber (to format numbers displayed in worksheet cells).

15

4. User Interface Upon opening TFlowVB and a Pipeline workbook (PWB) a user has the following commands on the "TFlow" menu, some of which are dependent on others (e.g., the Simulation commands are disabled until the Read Data from This Workbook command has been successfully executed.) See Section 5 for a description of a PWB. Table 2 Menu Command Description Read Data from This Workbook Copy I/P Data to O/P Delete Read-in Data Calls the DLL to create a new PipelineSystem object and read its data from worksheets in the active PWB. Copies element and node data from the input worksheets of the PWB to the output worksheet. Destroys the PipelineSystem object created by the Read Data from This Workbook command.

Simulate Steady-State Loads a dialog to set parameters to begin a steady-state simulation. Simulate Fixed TimeStep Simulate Auto TimeStep Output Printing Print Selected Conditions Plot Aero Maps Delete Aero Maps Set Clock Clear O/P Window New O/P Window Start O/P Here Save Current System Conditions Restore Saved System Conditions Print Node Loads a dialog to set parameters to begin a transient simulation with fixed time-steps. Loads a dialog to set parameters to begin a transient simulation with variable time-steps, depending on the rate of pressure change. Loads a dialog to print current system conditions to the output worksheet of the active PWB. Prints current system conditions designated rows on the "Selected Output" worksheet of the active PWB. Plots, on the output worksheet, head-flow maps and current operating point for selected centrifugal compressors. Deletes the last set of aero maps, together with supporting data, from the output worksheet. Loads a dialog to set the simulator "clock" for transient simulations. Clears the output worksheet. Renames the existing output worksheet and opens a new output worksheet. Uses the selected cell of the output worksheet to indicate on which row future output will begin. Saves the current state (pressures, flows, temperatures, operating modes of compressors and valves) for the pipeline system. Restores the saved pipeline system state. Prints the internal number and name of each node in the pipeline

16

Connections Save Node Pressures

system followed by the names of the adjacent nodes. Writes the current node pressures (usually following a steadystate simulation) to the Nodes worksheet of the active PWB. Also writes temperatures of the elements to the NCEs worksheet. The new pressures and temperatures result in better initial conditions, and thus faster convergence for the first time-step, the next time the PWB is used. Removes leading and trailing blanks and multiple embedded blanks from node names. Loads a dialog to select a pipe section and then display a dialog to create an "event" changing a pipe's operating mode (normal operation, closed or restricted to a maximum outlet velocity for pigging.) Loads a dialog to select a simple compressor and then display a dialog to create an "event" changing a simple compressor's parameters. Loads a dialog to select a station, or a compressor at a station, and then display a dialog to create an "event" changing the station's or compressor's parameters. Loads a dialog to select a valve and then display a dialog to create an "event" changing a valve's parameters. Loads a dialog to select a node and then display a dialog to create an "event" changing a node's parameters. Displays a dialog with a scrolling list of current events for review and editing. Reads a list of events from the active worksheet. If a transient simulation has saved conditions, these can be selected and written to the output worksheet. Deletes the file used to save the transient conditions. Loads a dialog to transfer volume or energy data for nodes on another worksheet to the Nodes worksheet of the active PWB. Displays version information.

Trim Node Names Post Events Pipe Section

Post Events Simple Compressor Post Events Compressor Station Post Events Valve Post Events Node List Posted Events Read Selected Events Print Saved Trends Delete Trend File Load Forecast About TFlow

4.1 Steady-State Simulation Fig. 5 shows the dialog for a steady-state simulation, which is just a special type of transient simulation during which TFlow: · Uses large time-steps (1 day in this example.) · Ignores time-varying parameters such as load profiles. · Iterates until the rate of linepack change is within a specified tolerance (0.005 in this example.)

17

Fig. 5

The "Season" pop-up menu selects the season (used to determine ambient and ground temperatures.) Three check boxes allow users to: · Print changes in compressor/valve operation (for debugging purposes), · Use fixed or calculated temperatures, · Model the aero-assembly operation for centrifugal compressors - see Equations (42) and (43). This feature doesn't always work well with systems containing many stations subject to large variations in flow during a "capability" simulation such as the one described below; often it is preferable to do detailed aero-modelling of individual stations, such as the calculations described in Section 6.2. Option buttons allow users to select one of four equations-of-state for calculating gas properties (see Table 1.) There are four types of steady-state simulation:

18

a) Capability. This maximizes the flow to a selected delivery node (as shown in the dialog's Capability Node pop-up control) without violating any minimum pressure constraints anywhere in the system. The capability is determined by a trial-and-error process between user-specified minimum and maximum flows (see Table 3 below for an example of the process) b) Match Flow-in. Because TFlow uses differential equations to model pipe sections, it is impossible to simultaneously control pressure and flow at a node (also true with real pipelines.) However, sometimes engineers are given a fixed supply and pressure at a node and asked to model the network with the excess flow going to another node. TFlow handles this by trial-and-error adjustments to the excess flow node until the required flow-in at the pressure-controlled inlet node is met. c) Match Flow-out - Single. This is the simplest type of steady-state simulation as TFlow balances the deliveries throughout the network. d) Match Flow-out - Multiple. TFlow does multiple simulations reducing the delivery at the excess flow node by a specified increment and printing the marginal fuel rates. Table 3 below shows the output from reading-in data and then doing a trial-and-error capability calculation for TransCanada's Eastern Ontario Triangle downstream of Station 112 (see Figure 16 for a map of the complete TCPL Mainline.) Figure 15 in Section 7 displays the results of this simulation schematically. The Parkway node used as the capability point is a hub on TransCanada's system linked, via connecting pipeline systems, to storage fields in southwestern Ontario and eastern Michigan. Table 3

*** System Summary *** Pressures in kPa Flows in 10^6m^3/d Pressure base = 101.325 kPa Temperature base = 15.0°C Barometric pressure = 100.000 kPa Max. cell length for pipes = 100.0 km Gas Composition (mole %): N2 = 1.76, CO2 = 0.52, C1 = 96.09, C2 = 1.59, C3 = 0.04 iC4 = 0.00, nC4 = 0.00, iC5 = 0.00, nC5 = 0.00 265 pipe sections, with 265 cells in total 0 simple compressors, 14 valves 0 fuel-burning, simple compressors 18 stations, containing: 37 compressors 25 fuel-burning compressors 38 valves 191 boundary nodes 835 equations 2934 non-zero matrix elements, 3.56 average per row 301 pressures 534 flows, total = 835 Successfully read all input data. Season used for steady-state simulation: Summer Avg. Day Start steady-state capability to node: Parkway (Unisim Z, live temperatures) at 02:25:16 PM

19

Min. flow = 40.000 Max. flow = 50.000 Capability tolerance = = 0.005 Time-step size (days) = 1.00 Q= Q= Q= Q= Q= Q= Q= Q= Q= Q= Q= Q= 40.000 OK 45.000 OK 47.500 OK 48.750 failed 48.125 OK 48.438 failed 48.281 OK 48.359 OK 48.398 OK 48.418 OK 48.428 OK 48.433 OK

0.005 Linepack change tolerance

Finish steady-state simulation. Step No. = 273. Time finished = 02:25:29 PM. Time required (sec) = 13.1 No. of time-steps = 273. No. of iterations = 654. No. of times matrix was ordered & factored = 21. Total time for ordering & factoring (sec) = 6.8 Total linepack and packing rate: 85.702 -0.005 Capability flow = 48.433 was limited by the minimum pressure at the following node: Bracebridge

The above capability converged within the 0.005 106m3/d (0.18 MMcfd) tolerance using 12 trials in 13.1 seconds on a 400 MHz PC. During such a simulation there are five nested sets of iterations: a) Newton-Raphson iterations to solve the pipe, compressor, valve and node equations (as described in Sections 2.1 to 2.5). The above example had 654 of these iterations. b) Check all compressors and valves for violation of operating constraints (e.g., exceeding pressure or power limits) and repeat Step (a) if any occur. Successful completion of Steps (a) and (b) constitutes a Time-Step, of which there were 273 in the above example. c) Calculate rate of linepack change* for the whole system and repeat Steps (a) and (b) if it is greater than the tolerance, or there have been less than two consecutive TimeSteps with declining rates of linepack change (packing or drafting.) This test is to check whether quasi steady-state conditions have been achieved. d) Calculate steady-state temperatures and recalculate the rate of linepack change. If outside the tolerance repeat Steps (a) to (c). e) The fifth level of iteration is the capability trial-and-error as shown in Table 3. * TFlow calculates the rate of linepack change by accumulating the differences in flows at the ends of each pipe segment. Table 3 includes a message that the matrix was ordered and factored 21 times. The sparse matrix routines order the rows and columns of Newton-Raphson coefficients to choose pivot elements so as to minimize fill-in and round-off error during the factoring process. Ordering and factoring is required for the first iteration following data read-in and whenever a pivot element becomes zero. This can occur whenever compressors or valves

20

change their operating modes (e.g., a compressor running at full power exceeds its discharge pressure limit and switches to discharge pressure control. Such a change means that two of the three coefficients in the compressor's control equation become zero, and it often happens that one of them previously had been chosen as a pivot element.) The ordering and factoring process is quite slow ­ the 21 order-and-factors took up 6.8 seconds of the 13.1 seconds required for the above simulation. The remaining 6.3 seconds were required to calculate and solve the equations 654 times, factor them 635 times (without ordering the matrix rows and columns) and perform the above Steps (b) to (e). Table 4 shows the results of a similar capability for a system consisting of the above 265 pipe section ­ 18 station example, plus the upstream connecting pipelines downstream of Station 41 (see Figure 16.) Between Stations 41 and 112 there are 287 pipe sections and 30 stations. In this simulation the linepack change tolerance is increased to 0.02 106m3/d (0.71 MMcfd) to reduce run time and prevent capability trials from ending prematurely because of slowly changing linepack. Unlike the Table 3 example, where capability was limited by a minimum node pressure, in Table 4 there is a message that the capability flow of 33.984 106m3/d (1200 MMcfd) at Parkway Union was limited by unstable linepack. (The corresponding flow-in at the system's inlet node was 122.395 106m3/d or 4320 MMcfd.) The unstable linepack message indicates that the last failed capability flow of 33.989 106m3/d could not converge to a steady-state solution because there were five consecutive time-steps with increasing rates of draft (i.e., increasing negative rates of linepack change.) This type of result is typical when simulating long pipeline systems ­ in this case with 1632 km (1014 mi.) of 30" pipe with 36" and 42" loops, and 24 compressor stations, upstream of the Eastern Ontario Triangle. The flow-match (multiple) simulation following the capability shows the sensitivity of marginal fuel rates to flow, an indication that the calculated capacity flow of 33.984 106m3/d is too "tight." In the list of fuels, equivalent gas fuel is calculated for electricpowered units. Table 4

*** System Summary *** Pressures in kPa Flows in 10^6m^3/d Pressure base = 101.325 kPa Temperature base = 15.0°C Barometric pressure = 100.000 kPa Max. cell length for pipes = 100.0 km Gas Composition (mole %): N2 = 1.76, CO2 = 0.64, C1 = 94.78, C2 = 2.50, C3 = 0.30 iC4 = 0.01, nC4 = 0.01, iC5 = 0.00, nC5 = 0.00 552 pipe sections, with 552 cells in total 0 simple compressors, 64 valves 0 fuel-burning, simple compressors 48 stations, containing: 117 compressors 104 fuel-burning compressors

21

166 valves 450 boundary nodes 2005 equations 6978 non-zero matrix elements, 3.56 average per row 711 pressures 1294 flows, total = 2005 Successfully read all input data. Season used for steady-state simulation: Summer Avg. Day Start steady-state capability to node: Parkway Union (Unisim Z, live temperatures) at 01:51:15 PM Min. flow = 20.000 Max. flow = 40.000 Capability tolerance = 0.005 Linepack change tolerance = 0.020 Time-step size (days) = 1.00 Q= Q= Q= Q= Q= Q= Q= Q= Q= Q= Q= Q= Q= 20.000 OK 30.000 OK 35.000 failed 32.500 OK 33.750 OK 34.375 failed 34.062 failed 33.906 OK 33.984 OK 34.023 failed 34.004 failed 33.994 failed 33.989 failed

Finish steady-state simulation. Step No. = 336. Time finished = 01:52:46 PM. Time required (sec) = 91.7 No. of time-steps = 336. No. of iterations = 1106. No. of times matrix was ordered & factored = 21. Total time for ordering & factoring (sec) = 29.2 Total linepack and packing rate: 321.595 -0.025 Capability flow = 33.984 was limited by unstable (declining) linepack Try running a multiple flow-match to check the marginal fuel rates. Season used for steady-state simulation: Summer Avg. Day Start steady-state flow match (multiple) to node Parkway Union (Unisim Z, live temperatures) at 01:53:01 PM Base nodal flow = 33.984 Flow increment = -0.050 Linepack change tolerance = 0.020 Timestep size (days) = 1.00 Flow 33.984 33.934 33.884 33.834 33.784 33.734 33.684 33.634 33.584 33.534 33.484 33.434 33.384 33.334 33.284 33.234 Gas 8.462 8.349 8.315 8.284 8.263 8.246 8.229 8.212 8.196 8.179 8.163 8.148 8.059 8.045 8.031 8.017 Elect. 0.289 0.288 0.287 0.286 0.286 0.285 0.284 0.283 0.282 0.282 0.281 0.280 0.329 0.328 0.327 0.326 Total 8.751 8.637 8.602 8.570 8.548 8.530 8.513 8.495 8.478 8.461 8.444 8.429 8.388 8.373 8.358 8.343 Rate 227.0% 70.2% 63.7% 44.0% 35.5% 35.2% 35.0% 34.8% 34.6% 34.4% 29.7% 82.2% 29.6% 29.6% 29.5%

22

33.184 33.134 33.084 33.034 32.984

8.003 7.990 7.976 7.963 7.950

0.325 0.325 0.324 0.323 0.322

8.329 8.314 8.300 8.286 8.272

29.4% 28.9% 28.8% 27.7% 26.7%

Finish steady-state simulation. Step No. = 479. Time finished = 01:53:48 PM. Time required (sec) = 46.5 No. of time-steps = 143. No. of iterations = 380. No. of times matrix was ordered & factored = 12. Total time for ordering & factoring (sec) = 16.8 Total linepack and packing rate: 326.278 0.010

Comparing Tables 3 and 4, the run times for each time-step or matrix order-and-factor are roughly proportional to the square of the number of equations. The capabilities were repeated using the AGA8 equation-of-state, instead of the simple Unisim Z. This resulted in run times of 28.5 seconds (2.2 times) and 130.3 seconds (1.4 times), respectively. The corresponding capabilities differed by +0.058 106m3/d ( 2.0 MMcfd) and +0.176 106m3/d ( 6.2 MMcfd). 4.2 Transient Simulation with Fixed Time-Steps Fig. 6 shows the dialog for a transient simulation with fixed time-steps. Fig. 6

Fixed time-step simulations are generally used to model systems with daily load patterns over one or more days. Users can choose whether or not to use load profiles and write

23

transient conditions to a file for subsequent printing to the Output worksheet (using the Print Saved Trends command.) In the above case the system modelled was a 229 mile-long 20" pipeline with a single compressor near its inlet and a 5.6 mile-12" lateral near its end, feeding a power plant requiring two-hour peak deliveries between 5 and 7 AM and between 4 and 6 PM. Using a maximum cell length of 3 miles, the system required 196 equations (94 pressures and 102 flows.) The 96-hour simulation with 5-minute time-steps (1153 time-steps and 4086 iterations) took 8.4 seconds. Its purpose was to get rid of the initial steady-state conditions and thus obtain a repeating daily pattern, which was then repeated in a second simulation for 24 hours with the "Save Flagged O/P to Disk" flag set so that the transient conditions can be printed using the "Print Saved Trends" command. Figure 7 shows the pressure and flow conditions at the power plant delivery node calculated during the second, 24-hour simulation. Fig. 7

Conditions at Power Plant

730 710 690 100 80 60 40 590 570 550 0 2 4 6 8 10 12 Hour 14 16 18 20 22 24 20 0 Delivery (MMcfd) 670 Pressure (psig) 650 630 610 140 120

4.3 Posting Events Users can post events to change parameters for the items listed in Table 5 by executing the appropriate menu command (see Table 2) which brings up a dialog with a scrolling list of items for selection and then editing (see examples in Figures 8, 9 and 10.) Each event has an Event Time (in days, hours and minutes) which can be used in transient

24

simulations to set a chronological sequence of events. For steady-state simulations the Event Time is the default time of Day 1, Hour 1, Minute 0.0. Table 5 Item Pipe Section Simple Compressor Parameter Types Affected by Post Event · Operating mode: normal, closed (zero flow) or pigging (with specified maximum outlet velocity) · Control mode: discharge pressure, suction pressure, discharge flow, reciprocating with minimum fixed clearance and maximum swept volume, open or closed · Fuel rate data · Maximum power · Maximum compression ratio · Maximum discharge pressure · Minimum suction pressure (suction pressure operating mode) · Maximum discharge flow (discharge flow operating mode) · Efficiency · Suction temperature · Yard piping pressure losses · Swept volume · Control mode: discharge pressure, suction pressure, discharge flow, open or closed · Ambient temperature · Maximum discharge pressure · Minimum suction pressure (suction pressure operating mode) · Maximum discharge flow (discharge flow operating mode) · Available (true or false) · Loading sequence (to determine priority of operation) · No. of units · Suction temperature · Maximum discharge temperature · Yard piping pressure losses (or coefficients if losses vary with flow, pressure and temperature) · Fuel rate data · Maximum compression ratio · Inlet capacity · Compressor efficiency · Label for aero assembly (wheel) for centrifugal compressors · Control mode: open, closed, downstream pressure, upstream pressure or flow. · Control parameter (pressure or flow) · Diameter · Pressure loss coefficient · Temperature · Control type: pressure or flow 25

Compressor Station

Compressor Unit (part of Compressor Station)

Valve

Node

· ·

Control value (pressure or flow) Inlet temperature Fig. 8

Fig. 9

26

Fig. 10

5. Pipeline Workbooks (PWB) A PWB must contain at least 5 worksheets with the following names: a) Options - contains 45 user options (e.g., switch for either English or SI units, base pressure and temperature, atmospheric pressure, calculation tolerances, flow unit size) and default values for various dialogs. b) Gas Comp - Molar composition of the gas. At present TFlow uses only one composition for a pipeline system. c) NCEs - The Node Connecting Elements represent the physical elements (pipes, valves and/or compressors) that make up a pipeline system. Each row of data contains the names of an element's "from" and "to" node names (in Columns A and B) and all data associated with the NCE, which can take up to Column AO for some compressors. TFlow reads from Row 1 to the first blank row, so users can use the area below the blank row for other data or worksheet formulae. In fact any cells of data read by TFlow may contain either pure data or Excel formulas which produce the required data. Node names may consist of up to 16 characters. d) Nodes - Users must supply a node record for each different node name that appears in the NCEs worksheet. Each record contains the node name (in Col. A) its control type (pressure or flow, with a blank meaning zero flow), elevation, initial pressure (used to calculate initial conditions for pipes), control value (i.e., pressure or flow), load profile reference. 27

e) Output - TFlow writes all output messages and data to this worksheet, including pipeline system conditions (using the Output Printing command.) Users can insert new Output sheets into the PWB by using the New O/P Window command (which adds a numbered suffix to the previous Output sheet, e.g., Output 1, Output 2, etc.) In addition PWBs may contain the following named worksheets: f) Load Profiles - Contains load profiles to specify time-varying nodal pressures or flows, maximum powers at compressors or valve set-points. g) Aeros - Contains coefficients and speeds of aero-assemblies (wheels) for centrifugal compressors. h) Region Temps - Contains seasonal and monthly ambient and ground temperatures. i) Selected Output - Used to display simulation results to fixed rows and columns on the worksheet so that they can be linked to a schematic display on the same or another worksheet. 6. Detailed Station Model TFlow uses two types of compressor station models: a) A single element between its suction and discharge node with fixed efficiency, maximum power, maximum discharge pressure, fixed yard losses and one of three control modes (maximum discharge pressure, minimum suction pressure or maximum flow.) This is represented by the SimpleCompressor object in Section 3. b) A detailed station consisting of a CompressorStation object which "owns" one or more CompressorUnit objects and zero or more StationValve objects. The compressor units may be one of: engine-powered reciprocating, electric-powered reciprocating, turbine-powered centrifugal or electric-powered centrifugal. The centrifugal types may have aero (wheel) data or fixed efficiencies, or both. 6.1 Separate vs Common Nodes A detailed station may have common suction and discharge nodes, as shown in Figure 3. If there are more than one pipelines on either side of the station, it is possible to have multiple suction and/or discharge nodes. Figure 11 shows such models for Stations 13 and 34 on the Western Section of the TransCanada system. Apart from the numbers of compressors, the two stations are similar, except that Station 13 has plant-dedicated aftercoolers downstream of each unit, and Station 34's A plant consists of two units in series. Also Station 13 has seven lines on its downstream side. The valves between each pair of lines represents cross-overs to equalize pressures. The Western Section (Stations 2 to 41 on Figure 16) consists of a 585-mile (942-km) system with six complete lines and portions of a seventh, extending from the AlbertaSaskatchewan border to Winnipeg, Manitoba. There are 10 compressor stations, of which Stations 13 and 34 are two. Power data for these stations are as follows:

28

Table 6

Station 13 Unit 13B 13C 13D 13E 13F ISO Power 13,900 HP (10.4 MW) 13,900 HP (10.4 MW) 30,600 HP (22.8 MW) 37,900 HP (28.3 MW) 37,900 HP (28.3 MW) Unit 34A1 34A2 34B 34C 34D Station 34 ISO Power 9,100 HP (6.8 MW) 10,300 HP (7.7 MW) 14,700 HP (11.0 MW) 14,900 HP (11.1 MW) 34,000 HP (25.4 MW)

Station 13 used to have an A plant consisting of five, 3400 HP (2.5 MW) reciprocating units, but these have been retired. Fig. 11

Station 13

34" 34" 34" 34A1 34A2

Station 34

34"

34" 13B 13B-AC

34"

34" 34B

34"

36" 13C 13C-AC

36"

36" 34C

36"

42" 13D 13D-AC

42"

42" 34D

42"

48" 13E 13E-AC

48"

48"

48"

48" 13F 13F-AC

48"

48"

48"

48"

As the Western Section expanded it was TransCanada's practice to manifold compressors to two lines at a time (e.g., the A plants to the 34" lines 1 and 2, the B plants to lines 2 and 3, etc.) with cross-overs between each pair of lines on either side of the station's

29

mainline valves. The effect of this manifolding practice is that there is limited mixing of gas among the different lines, so that gas in the 34" lines 1 and 2 tends to stay in those lines, while the gas in the 48" lines tends to stay in those lines. This affects temperature calculations because with large diameter lines run "hotter" than small ones (due to the ratio of surface area to internal volume.) Figure 12 shows this effect for the Western Section for a 1999-2000 summer simulation with the stations with the plants connected to individual lines as in Figure 11. The flow out of Station 41 is 7,345 MMcfd (208.8 106m3/d.) Figure 13, for the same flow, shows the temperatures with all the plants at each station connected to common suction and discharge nodes - which means that the gas temperatures are "mixed" to a common value at each of these nodes. (The aftercoolers at Station 13 result in a common discharge temperature of 79ºF (26ºC) at that station.) Despite the temperature differences shown in Figures 12 and 13, the total amounts of compression power required are very close: 1,045,600 HP (779.7 MW) for the separate nodes, compared to 1,044,400 HP (778.7 MW) for the common node case, a surprisingly small variance of only 0.1%. Fig. 12

Line Temperatures - Separate S&D Nodes for Each Compressor Plant 110

48" Line 6 34" Line 1

100

Temperature (deg. F)

90

80

70

60

Stn 2 Stn 5 Stn 9 Stn 13 Stn 17 Stn 21 Stn 25 Stn 30 Stn 34 Stn 41

50 0 100 200 300 Distance (mi.) 400 500 600

30

Fig. 13

Line Temperatures - Common S&D Nodes for All Compressor Plants

110 48" Line 6 34" Line 1 100

Temperature (deg. F)

90

80

70

60

Stn 2 50 0

Stn 5

Stn 9 100

Stn 13 200

Stn 17

Stn 21 300

Stn 25 400

Stn 30

Stn 34 500

Stn 41 600

Distance (m i.)

6.2 Display of Compressor Output TFlow allows users to display, to the Output worksheet, compressor conditions as text, followed by aero maps for the centrifugal compressors with the operating points plotted. The following the table and figures shows such a display for Station 13. In this example, unit 13E is running at maximum speed and is operating on the surge control line while recycling 25.6% of its flow; the other four units are running at 100% power. Because of the recycling 13E's suction temperature is 31.7°C (89°F) compared to 25°C (77°F) for rest of the station. Table 7

247 248 249 250 251 252 253 254 255 A C (Aero) R S C*1 (259) C*1 (282) C*1 (253) C*1 (299) C*1 (411) S B Name Name Name 13B 13C 13D 13E 13F 13 C D E Control S Loss D Loss Control S Loss D Loss Control FixPwr 82 28 FixPwr 25 18 FixPwr 17 37 MaxSpeed 28 13 FixPwr 57 27 PD LT F Psuc Psuc Psuc 4418 4475 4483 4472 4443 4500 G Pdis Pdis Pdis 6046 6036 6056 6032 6045 6018 H Tsuc Tsuc Tamb 25.0 25.0 25.0 31.7 25.0 -9.0 I Tdis Tdis 51.0 50.0 48.8 55.8 49.9 J Tcool Tcool 11.0 11.0 11.0 11.0 11.0

31

247 248 249 250 251 252 253 254 255

K Ratio Ratio 1.360 1.341 1.343 1.341 1.353

L M N O Fuel Qdis MaxPwr Req'd Fuel Qdis MaxPwr Req'd Fuel Qdis MaxPwr Req'd 0.111 28.013 12.06 12.06 0.111 29.214 12.06 12.06 0.158 58.436 22.97 22.97 0.203 53.194 29.58 28.81 0.197 76.144 31.33 31.33 0.781 245.000 120.60 107.24

P % Pwr % Pwr % Pwr 100.0% 100.0% 100.0% 97.4% 100.0% 88.9%

Q Eff'y Eff'y 83.4% 82.8% 87.4% 87.3% 85.6%

R Inlet Inlet 6.96 7.16 14.29 18.05 18.80

S Head Clear 43.94 41.81 42.04 43.07 43.09

T U Speed Recycle

5013 5029 5293 5200 6339

0.0% 0.0% 0.0% 25.6% 0.0%

Station 13 Aero Maps Fig. 14A, B

Unit: 13B Aero: 259 70 81% 83% 60 50 40 30 20 10 2 4 6 8 10 12 14 83% 81% 79% 75% 70% 5775 5500 5170 4840 4510 4180 3850 60 50 40 30 20 10 2 4 6 8 10 12 14 70 80%82% 82% 80% 78% 74% 70% 5775 5500 5170 4840 4510 4180 3850 Unit: 13C Aero: 282

32

Fig. 14 C, D

Unit: 13D Aero: 253 60 55 50 45 40 35 30 25 20 15 10 5 10 15 20 25 87% 85% 83% 77% 70% 5775 5500 5170 4840 4510 4180 3850 50 45 40 35 30 25 20 15 10 10 15 3750 3450 20 25 30 4350 4050 86%88% 88% 86% 84% 77% 70% 5200 4950 4650 Unit: 13E Aero: 299

Fig. 14 E

Unit: 13F Aero: 411 50 45 40 76% 35 30 25 20 15 10 5 10 15 70% 6380 6080 5654 5228 4802 4376 3950 20 25 30 86% 86% 84% 82%

7.

Schematic Display of Conditions

Often it is useful to display the results of hydraulic simulations on schematics of the pipeline system. TFlow uses one of the features of Excel that allows cells on different worksheets to be linked by formulae. The Print Selected Conditions command writes current conditions for selected pipes, compressors, valves or nodes the Selected Output worksheet. Table 8 shows examples of this output for: a) A compressor station consisting of four reciprocating units (rows 19 and 20), a turbine-driven centrifugal unit (row 21) with row 22 showing the station summary. b) A node in row 85. c) Two parallel sections of pipe in rows 108 and 109. Table 8 shows SI units for pressures (kPa), flows (106m3/d), temperatures (ºC), power (MW) and gas velocities in pipes (m/s).

33

Table 8

1 2 19 20 21 22 79 85 A Unit Stn. RR RR TC STN B Name Name 130A1-3 130A4 130P 130 C Control Control FixPwr MaxClear FixPwr PD LT D Sloss 7 4 39 E Dloss 10 6 49 F Psuc Psuc 5461 5464 5430 5468 Temp 30.7 P(out) 6161 6163 P Effy 73.2% 83.1% 74.0% T(in) 42.5 42.5 T(out) 39.8 40.4 Flow 20.945 33.683 Pack 0.217 0.316 G Pdis Pdis 6381 6377 6420 6371 H Tsuc Tamb 25.5 25.5 27.6 17.0 I Tdis 40.0 38.2 43.1 J Tcool

Node Name N Parkway

Press. Flow 4413 48.433 No. 1 1 P(in) 6273 6273 O Req'd Req'd 1.12 2.21 6.00 11.57

91 Pipe Node 1 Node 2 108 P MLV 116-1D MLV 116A-1 109 P MLV 116-2D MLV 116A-2 K Ratio 1.165 1.164 1.179 L Fuel Fuel 0.008 0.017 0.050 0.091 M Qdis Qdis 4.746 10.718 23.614 48.569

1 2 19 20 21 22 79 85 91 108 109

N MaxPwr MaxPwr 1.12 3.14 6.00 12.50

Q R Inlet Head/Clear 0.94 2.13 4.77 1.44 0.49 23.02

Vin 9.0 9.9

Vout 9.0 10.0

Upon executing the Print Selected Conditions command the DLL reads column A of this worksheet looking for valid element types (e.g., RR for a reciprocating compressor, TC for a turbine driven compressor, STN for station summary, N for a node and P for a pipe). Any non-valid data in column A, such as blanks or the headers in rows 1, 2, 79 and 91 are ignored. Upon encountering a valid element the DLL reads its name in column B (and also column C for pipes) and writes the current conditions for that element in the remainder of the row. This means that conditions for a given element are always written to specific cells of the worksheet; e.g., the suction and discharge pressures for Station 130 appear in cells F22 and G22; the pressure and flow for the Parkway node appear in cells D85 and E85, etc. In order to display (schematically on another worksheet) the conditions for Station 130, the Parkway node's pressure and flow, and the total flow through the two pipes, the following formulae were placed in cells V22, V85 and V108 (column V being chosen because it is well to the right of anything that might be overwritten by the DLL.)

34

a) V22: =B22&CHAR(10)&TEXT(F22,"0")&CHAR(10)&TEXT(G22,"0")&CHAR(10)&

TEXT(L22,"0.000")&CHAR(10)&TEXT(M22,"0.000")&CHAR(10)&TEXT(N22,"0.00") &CHAR(10)&TEXT(O22,"0.00")

b) V85: =B85&CHAR(10)&TEXT(D85,"0")&CHAR(10)&TEXT(E85,"0.000") c) V108: =TEXT(SUM(I108:I109),"0.000") The CHAR(10) symbol means carriage return. TEXT(L22,"0.000") converts the number in cell L22 to text rounded to three decimal places. Typing such formulae the first time can be tedious, but subsequent cells can be done quickly using copy-and-paste or fill-down editing. The results of the above formulae are linked to text boxes forming part of a schematic display in another worksheet of the same PWB. Figures 15A and 15B show such a display for the Eastern Ontario Triangle of TransCanada's system. (This system was described in Section 4.1.) In Figure 15A the boxes with 112, 116E, 116S, etc. represent compressor stations. All the lines and arrows were drawn using the standard Excel drawing tools. Station 116 has a common suction and split discharge (116S and 116E.) Between Stations 116 and 130 are 194 mi. (313 km) of 30" and 36" pipe. The Station 130-148 section consists of 300 mi. (483 km) of 20" and 24" pipe with some 30" and 36" loop. The negative flows for non-operating Stations 134, 136 and 139 in Figure 15B reflect the fact that these stations normally pump in an easterly direction. Stations 142 and 144 have been configured to pump backwards, so that their positive flow direction is westerly (towards Station 130.) The null flow point occurs between Stations 130 and 134. In Figure 15A the text box below Station 116S displaying the flow of 54.631 contains the formula: ='Selected Output'!V108, so that the text box gets updated whenever cell V108 changes. Similarly in Figure 15B the text box displaying the Station 130 conditions contains the formula: ='Selected Output'!V22. This example shows how the Excel's built-in tools can be used to create pipeline schematics to show any amount of detail. These schematics can be updated instantly following a new simulation. Users can also link cells in the Selected Output worksheet to cells in the schematic worksheet to display summaries of the simulation results (e.g., total flows-in and deliveries, excess deliveries, fuels, percent utilization, etc.)

35

Fig. 15A

MLV 112-D 6895 -115.130

Eastern Ontario Triangle 99/00 Summer Average Day

112 58.475 1206 1211 56.709 1217 119 147 Napierville 5953 1.730 Ottawa 4775 1.770 Les Cedres 7068 13.304 148 802 Philipsburg 6125 0.442 Excess 0.000

116E 116S 54.631

144 123 139 127 134 130 Excess 8.096 Parkway 4413 48.433 144 0.166 136 56.709 1217 24.778 142

1401

3.379

147

52.922

19.613

48.569

31.931 -3.022

23.522

-3.036 3.566

1401

-5.197

Iroquois Export 9867 22.961

Fig. 15B

Eastern Ontario Mainline ­ Compressor Station Summary

Station Psuc Pdis Fuel Qdis Max Pwr Reqd Pwr 116 East 5646 6814 0.128 59.015 24.12 16.89 116 South 5646 6273 0.073 54.631 8.84 8.83 119 4444 6076 0.177 54.376 26.39 24.69 123 3928 6450 0.111 54.193 41.86 38.68 127 5039 6895 0.170 53.816 27.41 23.12 130 5468 6371 0.091 48.569 12.50 11.57

Station Psuc Pdis Fuel Qdis Max Pwr Reqd Pwr

134 5497 5497 0.000 -3.423 4.40 0.00

136 5568 5568 0.000 -3.937 6.60 0.00

139 5673 5673 0.000 -4.437 4.40 0.00

142 4296 5800 0.000 6.199 6.60 2.76

144 4525 4525 0.000 7.371 4.40 0.00

1401 4710 9930 0.208 22.961 36.32 26.39

147 4469 6426 0.097 21.762 12.87 11.73

148 5797 7070 0.056 21.016 18.65 5.80

802 6484 6484 0.000 4.388 3.28 0.00

Station Psuc Pdis Fuel Qdis Max Pwr Reqd Pwr

1206 4700 5938 0.165 58.305 22.03 22.02

1211 4826 6512 0.177 58.123 23.86 23.83

1217 4071 5499 0.178 57.633 23.90 23.88

36

Fig. 16

Map of TransCanada Mainline System Showing Four of 56 Stations

2 41 112

130

8. Conclusions The development of TFlow has shown that it is possible to combine both transient and steady-state simulation into one program with the same equations. Using Excel as the interface to the pipeline simulator DLL has turned to be a benefit in two ways, compared to a stand-alone application: · · For the program designer, developing the user interface is easy, and there is only one file structure required (to save and then write back transient conditions.) With Excel workbooks users are able to employ Excel's built-in tools to prepare and edit data and to customize their output.

At TransCanada TFlow has proven popular because of its ease of use, speed and flexible output of results. It produces similar steady-state results as other simulators used by the company. TFlow, despite being in production use, is still a work in progress. Planned enchancements include multiple gas composition, improvements to the detailed station modelling and inclusion of dynamic temperature calculation in transient simulations.

37

References Streeter, V.L. and Wylie, E.B. "Natural Gas Pipeline Transients." Society of Petroleum Engineers Journal, December, 1970. Starling, K.E., and Savage, J.L. "Compressibility Factors of Natural Gas and Other Related Hydrocarbon Gases" (American Gas Association, Transmission Measurement Committee Report No. 8), November, 1992 Kundert, K.S., and Sangiovanni-Vincentelli, A. "Sparse User's Guide Version 1.3a", Department of Electrical Engineering and Computer Sciences, University of California, Berkeley, June 1998. (The source code and documentation can be downloaded from www.netlib.org.)

38

Information

Using an Excel-Based Model for Steady-State and Transient Simulation

39 pages

Report File (DMCA)

Our content is added by our users. We aim to remove reported files within 1 working day. Please use this link to notify us:

Report this file as copyright or inappropriate

869916