You are on page 1of 18

Oil Stabilization with Optimization

Oil Stabilization with


Optimization

2001 Hyprotech Ltd. - All Rights Reserved.


1.1.10 Oil Stabilization with Optimization_3.pdf

Oil Stabilization with Optimization

Workshop
Fast Track to page 9.

In this example, a poor-boy stabilization scheme is used to separate an


oil and gas mixture into a stabilized oil and a saleable gas. This
approach is used in many gas plants around Alberta where liquid
production is small and does not warrant a full distillation column. A
simple three-stage separation with heating between each stage is used
and the object of the exercise is to select the let-down pressure and
temperatures such that the products revenue less the utilities cost is
maximized. A special tool in HYSYS, the Optimizer will be used to find
the optimum operating conditions.

Learning Objectives
Once you have completed this section, you will be able to:

Use the Optimizer tool in HYSYS to optimize flowsheets


Use the Spreadsheet to perform calculations

Prerequisites
Adding Streams and Operations
Using the Spreadsheet

Process Overview

Oil Stabilization with Optimization

Building the Simulation


Defining the Simulation Basis
For this case you will be using the Peng Robinson EOS with the
following components: C1, C2, C3, i-C4, n-C4, i-C5, n-C5, C6, C7, C8, and
C9.

Modifying the Unit Set


For this case, the units for Molar Flow are in m3/d_gas, instead of the
default Molar Flow units, kgmole/h, and the units for Liquid Volume
Flow are m3/d, not the default, m3/h.
1.
2.

From the Tools menu select Preferences, and go to the Variables


tab, Units page.
Select the SI unit set as the default.

You cannot edit the default set, but you can make a copy of it by
pressing the Clone Unit Set button.

If you are working in Field


units, choose MMSCFD for the
Molar Flow and bbl/d for the
Liquid Volume Flow.

3.

Rename the cloned unit set to Optimizer.

4.

Move the cursor to the Flow cell.

5.

Select m3/d_gas from the drop down menu in the Edit Bar.

6.

Move the cursor to the Liq. Vol. Flow cell.

7.

Select m3/d from the drop down menu in the Edit Bar.

Oil Stabilization with Optimization

Starting the Simulation


1.

Add a Material stream with the following values:

In this cell...

Enter...

Name

Feed

Temperature

10C (50F)

Pressure

4125 kPa (600 psia)

Molar Flow

28 200 m3/d_gas (1 MMSCFD)

Component

Mole Fraction

C1

0.316

C2

0.158

C3

0.105

i-C4

0.105

n-C4

0.105

i-C5

0.053

n-C5

0.053

C6

0.027

C7

0.026

C8

0.026

C9

0.026

The simulation contains three separators for separation of vapour and


liquid. The first separator pressure will be fixed at the Inlet gas pressure.
The pressure of the downstream separators is set by specifying the
pressure of their outlet vapour streams. By default, the delta P on the
Separator is 0 so you will have to delete this default value on the
Parameters tab of Stage 2 and Stage 3 before you can specify the outlet
stream pressures.
Each stage of separation has a preheater.

Oil Stabilization with Optimization

2.

Add 3 Heaters to the simulation with the following information:

In this cell...

Enter...

Connections
Name

Heater1

Inlet

Feed

Outlet

HotFeed1

Energy

Steam 1

Parameters
Pressure Drop

0 kPa

Duty

4.25e+05 kJ/h (4.0e+05 Btu/hr)

In this cell...

Enter...

Connections
Name

Heater2

Inlet

Stage1 Liq

Outlet

HotFeed2

Energy

Steam 2

Parameters
Pressure Drop

0 kPa

Duty

3.15e+05 kJ/h (3.0e+05 Btu/hr)

In this cell...

Enter...

Connections
Name

Heater3

Inlet

Stage2 Liq

Outlet

HotFeed3

Energy

Steam 3

Connections

Pressure Drop

0 kPa

Duty

1.13e+05 kJ/h (1.0e+05 Btu/hr)

Oil Stabilization with Optimization

3.

Add 3 Separators with the following information:

In this cell...

Enter...

Connections
Name

Stage1

Feed

HotFeed1

Liquid Outlet

Stage1 Liq

Vapour Outlet

Stage1 Vap

Parameters
Pressure Drop

0 kPa (default)

In this cell...

Enter...

Connections
Name

Stage2

Feed

HotFeed2

Liquid Outlet

Stage2 Liq

Vapour Outlet

Stage2 Vap

Parameters
Pressure Drop

<empty> (delete default value)

In this cell...

Enter...

Connections
Name

Stage3

Feed

HotFeed3

Liquid Outlet

Liquid Product

Vapour Outlet

Stage3 Vap

Parameters
Pressure Drop

<empty> (delete default value)

Oil Stabilization with Optimization

4.

Add 2 Compressors with the values shown in the following tables:

In this cell...

Enter...

Connections
Name

Comp1

Inlet

Stage2 Vap

Outlet

Comp1 Out

Energy

Comp1-hp

Parameters
Adiabatic Efficiency

75% (default)

In this cell...

Enter...

Connections
Name

Comp2

Inlet

Stage3 Vap

Outlet

Comp2 Out

Energy

Comp2-hp

Parameters
Adiabatic Efficiency

5.

75% (default)

Add a Mixer with the information provided below:

In this cell...

Enter...

Connections
Name

Gas Mixer

Inlets

Stage1 Vap
Comp1 Out
Comp2 Out

Outlet

Gas Product

Parameters
Pressure Assignment

Set Outlet to Lowest Inlet (default)

Oil Stabilization with Optimization

6.

Make the necessary stream specifications

In this cell...

Enter...

Stage2 Vap, Pressure

2050 kPa (300 psia)

Open the case Optional10.hsc

Stage3 Vap, Pressure

350 kPa (50 psia)

Complete the following


questions and then continue
the Module.

Comp1 Out, Pressure

4125 kPa (600 psia)

Comp2 Out, Pressure

4125 kPa (600 psia)

What is the volumetric Liquid Product Flow?


__________
What is the molar Gas Product Flow? __________

Checking the Liquid RVP


HYSYS treats Utilities as
stream properties and so will
recalculate the Utility every
time the stream is
recalculated.

The RVP of the Liquid Product stream should be about 96.5 kPa (14
psia) to satisfy the pipeline criterion.
The RVP for a stream is located in the Cold Properties Utility.
The Utility can be added by selecting Utilities from the Tools menu or
from the Utility page of the Attachments tab of the Liquid Product
stream property view.

What is the current RVP of Liquid Product? __________

10

Oil Stabilization with Optimization

The Optimizer
HYSYS contains a multi-variable Steady State Optimizer. Once your
Flowsheet has been built and a converged solution has been obtained,
you can use the Optimizer to find the operating conditions which
minimize or maximize an Objective Function. The Optimizer owns its
own Spreadsheet for defining the Objective Functions as well as any
constraint expressions to be used. This allows you to construct
Objective Functions which maximize profit, minimize utilities or
minimize exchanger UA.

Only user-specified process


variables can be used as
Primary Variables

Restrictions on the Optimizer


only available for SteadyState calculations
it cannot be used in
Templates.

Primary Variables - these are flowsheet variables whose


values are manipulated in order to minimize (or maximize) the
objective function. You set the upper and lower bound for the
primary variables, which are used to set the search range.
Objective Function - this is the function which is to be
minimized or maximized. The function has to be defined within
the Spreadsheet. This allows the user a great deal of flexibility
in defining the function.
Constraint Functions - inequality and equality functions are
defined in the Spreadsheet. In solving the Objective Function,
the Optimizer must also meet any constraints that are defined
by the user.
In our case, we want to maximize the total profit while achieving an
RVP of Liquid Product less than 96.5 kPa.
The Revenues from the Plant are the Gas Product and the Liquid
Product. The associated costs are the Steam Costs for each Heater plus
the Compression Cost for each Compressor.
Profit = Revenue - Cost
Profit = Gas Product + Liquid Product - Steam Costs - Compression Cost
Which Variables can we change to affect the Steam
Cost? _________
How is the Compression Cost measured? __________
Which Variables can we change to affect the
Compression Cost (remember the Compressor outlet
pressure is fixed)? __________
What should the Process (Adjusted) Variables be to
maximize profit (there are five)? __________,
__________, __________, __________, __________

10

Oil Stabilization with Optimization

To invoke the Optimizer, select Optimizer under Simulation in the


Menu Bar, or press <F5>.

Variables Tab
The Optimizer is not an
operation block and it will not
show up in the PFD.

Reasonable upper and lower


bounds are important. Set
values which can be achieved
in your actual design, i.e.,
dont set a high bound for a
Steam Heat Flow that is more
than what is available at your
plant.

When you invoke the Optimizer for the first time, you are placed on the
Configuration tab. Select the Default model. Then move to the
Variables tab. On the Variables tab you define the Process (Adjusted)
Variables to be used in the Optimization.
1.
2.

Press the Add button to add the first variable, Steam1, Heat Flow.
Set the Low Bound at 0 and the High Bound at 1.0e6 kJ/h (1.0e6
Btu/hr).

3.

The complete list of Process Variables are shown in the table


below.

Object

Variable
Description

Units

Low
Bound

High
Bound

Steam 1

Heat Flow

kJ/h (Btu/hr)

0.0 (0.0)

1.0e+6
(1.0e+6)

Steam 2

Heat Flow

kJ/h (Btu/hr)

0.0 (0.0)

1.0e+6
(1.0e+6)

Steam 3

Heat Flow

kJ/h (Btu/hr)

0.0 (0.0)

1.0e+6
(1.0e+6)

Stage2 Vap

Pressure

kPa (psia)

650 (95)

3500 (510)

Stage3 Vap

Pressure

kPa (psia)

70 (10)

1000 (145)

11

11

12

Oil Stabilization with Optimization

Defining the Spreadsheet

The Spreadsheet is an
operation and thus the
Spreadsheet cells get updated
when Flowsheet variables
change.

The Optimizer has its own Spreadsheet for defining the Objective and
Constraint functions. Primary Variables may be imported and
functions defined within the Optimizer Spreadsheet, which possesses
the same capabilities as the Main Flowsheet Spreadsheet.
1.
2.
3.

Press the Spreadsheet button on the Optimizer view to open the


Spreadsheet.
On the Parameters tab of the Spreadsheet view, increase the
Number of Rows from 10 to 15.
Move to the Spreadsheet tab.

Importing and Exporting Variables


You may import virtually any variable in the simulation into the
Spreadsheet and you can export a cells value to any specific field in
your simulation.

Object Inspection - object inspect (secondary mouse button)


the cell which you want to Import into, or Export from. From the
Menu that appears, select Import Variable or Export Formula
Result. Then, using the Variable Navigator, select the variable
you wish to import or export.
Connections page tab - select the Add Import or Add Export
button. Then, using the Variable Navigator, select the variable
you wish to import or export.
Drag n Drop - using the secondary mouse button, click the
variable value (from the WorkBook or Property View) you wish
to import, and drag it to the desired location in the
Spreadsheet. If you are exporting the variable, drag it from the
Spreadsheet to the exported location.

Adding Formulas
Complex mathematical formulas can be created, using syntax that is
similar to conventional Spreadsheets. Arithmetic, logarithmic and
trigonometric functions can be performed in the Spreadsheet.
All normal functions must be preceded by a + or = symbol. Special
Functions must be preceded by the @ symbol.
Some of the functions available are:

Addition (+): +A1+A2


Subtraction (-): +A1-A2

12

Oil Stabilization with Optimization

Press the Function Help


button to view the Available
Spreadsheet Functions and
Expressions.

In order to have access to the


Utility variable needed in cell
B1. The Utility radio button in
the Navigator Scope box must
be selected.

Multiplication (*): +A1*A2


Division (/): +A1/A2
Power (^): +A1^3
Absolute Value (@ABS): @ABS(A1)
Square Root (@SQRT): @SQRT(A1)
Natural Log (@ln): @ln(A1)
Exponential (@exp): @exp(A1)

The following variables need to be imported into the Spreadsheet.


Cell...

Object...

Variable...

B1

Cold Properties-1

Reid VP

B4

Liquid Product

Liquid Volume Flow

B8

Comp1-hp

Heat Flow

B9

Comp2-hp

Heat Flow

B12

Steam 1

Heat Flow

B13

Steam 2

Heat Flow

B14

Steam 3

Heat Flow

D4

Gas Product

Molar Flow

The following constants should be added to the spreadsheet


Cell...

Value...

Comment...

B2

96.5 kPa (14 psia)

RVP spec

B6

157.25$/m3 (25$/bbl)

Oil Price

B10

0.1 $/kw-h

Compression Cost

(2.9e-5 $/Btu)
B15

1.819$/kw-h
(0.0005$/Btu)

Steam Cost

D6

0.283 $/m3_gas
(8 $/MSCF)

Gas Price

Conversion factors you may need:


1 kw-h = 3412 Btu
1 kw-h = 3600 kJ

13

13

14

Oil Stabilization with Optimization

Additional comments can be added, though they are not necessary.


After all of the necessary variables have been imported and the
formulas have been entered the spreadsheet should look something
like the following.
You can change the Variable
Type to Unitless for dollar
value variables.

Which Spreadsheet Cell defines the Objective Function


(i.e., which cell do we want to maximize)? __________
Define the Constraint Function (RVP < 96.5 kPa) with
reference to Spreadsheet cells. __________

14

Oil Stabilization with Optimization

Functions tab
The Functions tab contains two groups, the Objective Function and
the Constraint Functions.
1.
The Constraint Function is
multiplied by the Penalty
Value; the higher the Penalty
Value, the more weight that is
given to that constraint.

2.
3.

In the Cell area of the Objective Function group, specify the


Spreadsheet cell that defines the Objective Function. Use the
drop down menu in the Edit Bar to select the appropriate cell.
The Current Value of the Objective Function will be provided.
Select the Maximize radio button
In the Constraint Functions group, press the Add button to
define the constraint.

Parameters tab
The Parameters tab is used for selecting the Optimization Scheme.

For more information on the


Optimization Schemes, refer
to the manual section 17.2 or
the on-line Help.

Box - Handles inequality constraints but not equality


constraints. It generally requires a large number of iterations to
converge on the solution.
SQP - Sequential Quadratic Programming, handles inequality
and equality constraints. Considered by many to be the most
efficient method for minimization.
Mixed - Handles inequality constraints only. It is a combination
of the Box and SQP methods. It starts the minimization with the
Box method using a very loose convergence tolerance. After
convergence, the SQP method is used to locate the final
solution.

15

15

16

Oil Stabilization with Optimization

Fletcher Reeves - Does not handle constraints. Efficient


method for general minimization.
Quasi-Newton - Does not handle constraints. Similar method
to Fletcher Reeves.
1.
2.

Select the SQP method as the Scheme


Use the defaults for Tolerance and Number of Iterations

3.

Change Shift A and Shift B to 1.0

Monitor tab

The constraint values are


positive if inequality
constraints are satisfied and
negative if inequality
constraints are not satisfied.

The Monitor tab displays the values of the Objective Function, Primary
Variables and Constraint Functions during the Optimizer calculations.
1.

Move to the Monitor tab and press the Start button to begin the
optimization.

Save your case!

16

Oil Stabilization with Optimization

Analyzing the Results


Once the Optimization is complete, examine the results and fill in the
following Table.
Base Case
Gas Product Flow,
m3/d_gas (MMSCFD)

25343 (0.8950)

Liquid Product Flow,


m3/d (bbl/d)

17.247 (108.5)

Total Profit, $/d

-534

Steam1 Heat Flow, kJ/h


(Btu/hr)

425 000 (400,000)

Steam2 Heat Flow, kJ/h


(Btu/hr)

315 000 (300,000)

Steam3 Heat Flow, kJ/h


(Btu/hr)

113 000 (100,000)

Stage2 Vap Pressure,


kPa (psia)

2050 (300)

Stage3 Vap Pressure,


kPa (psia)

350 (50)

RVP of Liquid Product,


kPa (psia)

97.85 (14.19)

Optimized Case

17

17

18

Oil Stabilization with Optimization

Exploring with the Simulation


Exercise 1
One thing you may notice with the Optimized solution is that the
Pressure of Stage3 Vap has been decreased to 70 kPa (10 psia) which is
less than atmospheric. This is not a desired condition for the inlet of a
compressor. The inlet of the second compressor, Comp2, cannot be less
than 125 kPa (19 psia). What is the maximum profit if you adhere to this
guideline?

18

You might also like