Aspen HYSYS SQP Optimization A Practical Guide TM
Aspen HYSYS SQP optimizer uses a steady state simulation of the process built using HYSYS software. There are a number of optimization algorithms in Aspen HYSYS. This document only focuses on the Hyprotech SQP method. This document provides information for the following: −
Those wishing to gain basic information about SQP optimization using Aspen HYSYS.
−
Those requiring in depth knowledge in analysing the results from the optimization.
This guide covers the following main aspects of optimization: −
Configuring a derivative utility for a SQP optimi zer, running the optimizer and viewing the results.
−
Configuring a HYSYS spreadsheet to organize optimizer inputs and results.
−
Performing derivative analysis and noise calculation to diagnose the optimizer setup.
−
Analyzing the results to ensure that the optimizer recommendations are justifiable.
−
Improving the optimizer predictions through analysis of derivative and reducing noise in the simulation.
−
Using optimizer as a tool to perform What-If case studies exploring new strategies in design and process operation.
A simple Aspen HYSYS simulation is used to cover the topics li sted above. It is assumed that the readers are familiar with the necessary steps required to build the optimizer in Aspen HYSYS. For further details please refer the following documents. documents. 1. Aspen HYSYS Operations Guide - AspenHYSYSV7_0-Ops.pdf 2. Aspen HYSYS Real Time Optimization Reference Reference Guide Guide - AspenRTOV7_0-Ref.pdf These documents are supplied with the installation disks; alternatively the registered user can download these documents from AspenTech Support Centre at support.aspentech.com http:// support.aspentech.com
--------------------------------------------------------------------------------------------------------------------------------------------------------------Aspen HYSYS SQP Optimization - A Practical Guide V1.0.doc
1
1.0 Overview 1.1 Optimizer Configuration The configuration of a SQP Optimizer is done via the Derivative Utilit y available within Aspen HYSYS. It is assumed that the readers are already familiar familiar with the necessary steps require to build an optimizer using the derivative utility. Here it is intended to outline the main steps to refresh your understanding in this area. The m ains steps are listed with relevant screenshots from the flowsheet. 1. Create a Derivative Utility and and give an appropriate appropriate name for this utility (e.g., NGL Optimizer).
Figure 1.1: Derivative utility setup screen.
2. Define the scope scope of the optimizer. The scope can be selected as “FlowSheet Wide” if a generalized optimizer for the whole simulation is to be considered.
Figure 1.2: Selection of optimizer scope. --------------------------------------------------------------------------------------------------------------------------------------------------------------Aspen HYSYS SQP Optimization - A Practical Guide V1.0.doc
2
An optimizer has three main elements: •
Variable – decision variables for the optimization that must be linked with inputs in the flowsheet. The variables can be included or excluded in an optimization by selecting the “Optimize Flag”. The values of the variables are manipulated in order to minimize or maximize the objective function. Each variable has maximum and minimum limits which are used to set the search range. The range can be user specified. If this is not given then optimizer calculate this as Range
•
=
Maximum − Minimum
Constraint – the constraints are linked with the calculated results in the flowsheet. A constraint can be included or excluded in an optimization by selecting the “Use Flag”. Similar to variables, the constraints have minimum and maximum limits but these can be one-sided (i.e. having either minimum or maximum limit). The optimizer must meet the constraints defined by the user. Each constraint has a scale parameter which must be specified. In general a constraint is considered to be feasible if:
( Minimum − Scale)
≤
Current Value
≤
( Maximum + Scale) o
The scale can be used as the accuracy of measurement, for example a scale of 1 C o can be used for a process temperature of 100 C. Typical range is 1-5% of maximum limit. Sometimes a larger scale helps solving problems with non-linear relationships as the feasible region is expanded by the amount of the scale. However, one drawback is a non-feasible problem can give a false convergence. An optimization using a well constructed simulation should always give an optimum within the specified limits of the constraints. •
Objective function – this is the function which is to be minimized or maximized. Individual objective function can be added separately and price of each specified. Alternatively, this can be built in a spreadsheet, with a single cell representing the results. By default the SQP optimizer works as a minimization algorithm. For a maximization problem the price term should b e negative.
3. Add variables and specify their limits (minimum and maximum values). Give meaningful names for the variables.
Figure 1.3: Optimizer variable setup screen.
-------------------------------------------------------------------------------------------------------------------------------------------------------------Aspen HYSYS SQP Optimization - A Practical Guide V1.0.doc
3
4. Add constraints and specify their limits and scale. Give meaningful names for the constraints.
Figure 1.4: Optimizer constraint setup screen.
5. Add objective function terms and specify the prices.
Figure 1.5: Optimizer objective f unction setup screen.
6. Close the Derivative Utility page.
--------------------------------------------------------------------------------------------------------------------------------------------------------------Aspen HYSYS SQP Optimization - A Practical Guide V1.0.doc
4
7. Open the optimizer page following the Menu bar, Simulation and Optimizer or simply using shortcut F5. The Hyprotech SQP a nd other optimization methods available in Aspen HYSYS are shown in the optimizer page (Figure 1.6).
Figure 1.6: Optimizer screen showing the options available in HYSYS. We wi ll only consider the Hyprotech SQP method.
8. Select Hyprotech SQP. This will add a new tab named Hyprotech SQP. Select this tab and then click on “Select Utilities to Run”. The available Derivative Utilities will be li sted here. Select the utility to run with this SQP optimizer.
Figure 1.7: Optimizer page giving selection of a configured derivative utility.
-------------------------------------------------------------------------------------------------------------------------------------------------------------Aspen HYSYS SQP Optimization - A Practical Guide V1.0.doc
5
9. Close the “Select Utilities to Run” window. Now the optimizer page with all the default parameters will be visible. The optimizer is now ready to start.
Figure 1.8: Optimizer main screen.
--------------------------------------------------------------------------------------------------------------------------------------------------------------Aspen HYSYS SQP Optimization - A Practical Guide V1.0.doc
6
1.2 Optimizer Results The optimizer can be run by selecting the “Start” button in the optimizer page. There are some parameters with default values which should be carefully reviewed before optimization is performed. Maximum Iterations : Default value 50. In most cases this is sufficient. A simulation involving significant noise usually requires a large number of iterations. Objective Scale : Default value 1. The objective function value is multiplied by the scale factor. This is used for scaling the objective function and its gradients. This gives a relative weight between the objective function and feasible search when performing an optimization search. A smaller value in objective scale sometimes helps in solving the non-linear problems. Accuracy Tolerance : Default value 1e-04. This is the relative accuracy tolerance of objective function improvement used as the convergence tolerance of the optimizer. This is not scale dependent. Typical range is 1e-04 to 1e-06. Step Reduction : Default value 0.2. Perturbation : Default value 1e-03. This is the step size of the scaled variables used in gradient calculations. Typical range is 1e-02 to 1e-03. A smaller value gives f aster gradient calculation, however this may not give accurate gradient if there is a significant noise in the si mulation.
An optimizer can be run by selecting the “Start” button located in the optimizer screen.
Figure 1.8: Overall results shown in the main optimizer screen.
The optimizer results are displayed in “ Running Results” section of the screen. A successful optimization displays one of the following messages in the “Termination Reason” field. •
OK – This is based on the feasibility point search indicating that a feasible termination of this phase.
•
Step convergence – During the optimization search the stepping back procedure resulted in a step collapse to below the step tolerance.
-------------------------------------------------------------------------------------------------------------------------------------------------------------Aspen HYSYS SQP Optimization - A Practical Guide V1.0.doc
7
•
Cost convergence – Two successive iterations resulted in objective function value difference in less than the accuracy tolerance.
The benefits from the optimizer can be calculated from values shown in “Starting Objective” and “Objective Value” fields as Optimizer benefits = - (Objective Value – Starting Objective) The results of the optimizer variables and constraints can be found in the Derivative Utility. This utility can also be accessed from the optimizer page by a mouse double-click on the optimizer item (in this case “NGL Optimizer”) located under “Derivative Utilit y”.
Figure 1.9: Result screen of optimizer variables.
Figure 1.10: Result screen of optimizer variables.
--------------------------------------------------------------------------------------------------------------------------------------------------------------Aspen HYSYS SQP Optimization - A Practical Guide V1.0.doc
8
2.0 Spreadsheet Configuration The Spreadsheet functionality within Aspen HYSYS provides a flexible approach in organizing the optimizer data. This allows gathering ON/OFF flags, limits and results. The optimizer can be run using the selected variables and constraints. In this way the operation can be restricted within a certain section of the flowsheet. Note that the operation scope in the Derivative Utility is always exclusive which restricts the users to share a variable or constraint by more than one optimizer. The spreadsheet approach provides the flexibility of selecting the required variables and constraints out of the global configuration (i.e., selecting the “FlowSheetWide” scope). The flowsheet shown below (Figure 2.1) is constructed with a number of spreadsheets each containing specific type of information. The f ollowing spreadsheets are used. Power & Utilities – This is used to gather power consumption by compressors and reboilers. The power is then converted to costs using appropriate unit price (Figure 2.2). Products – All the products are accounted here and sales value is calculated based on unit sale price for each product (Figure 2.3). Marginal Benefits – This is calculated as the difference between sales and costs (Figure2.4). Variables & Constraints – This spreadsheet links all the optimizer v ariables and constraints including the initial and final objective values (Figure 2.5). For a larger problem it would be ideal to have separate spreadsheets for variables, constraints and benefits.
Figure 2.1: Aspen HYSYS flowsheet.
-------------------------------------------------------------------------------------------------------------------------------------------------------------Aspen HYSYS SQP Optimization - A Practical Guide V1.0.doc
9
Figure 2.2: Spreadsheet containing power & utilities and their costs.
Figure 2.3: Spreadsheet containing the products and their prices.
Figure 2.4: Spreadsheet showing calculation of optimizer benefits. --------------------------------------------------------------------------------------------------------------------------------------------------------------Aspen HYSYS SQP Optimization - A Practical Guide V1.0.doc 10
The variables and constraints can be imported from the optimizer objects to a spreadsheet. This provides a convenient method in performing benefits analysis using multiple what-if scenarios, for example -
The statuses of the variables can be switched ON or OFF
-
The limits can be changed
-
The current values for the variables can be specified
-
The recommended values for variables and constraints are readily available
-
Calculated benefits can be obtained
The screenshot given below (Figure 2.5) illustrates how an Aspen HYSYS spreadsheet can be put together with optimizer variables, constraints and objective function values.
Figure 2.5: Spreadsheet showing optimizer variables, constraints and benefits.
Importing/Exporting data to a Spreadsheet To import/export a parameter of a variable (e.g., Minimum Limit) to a spreadsheet follow steps listed below. (1) Select a cell in the spreadsheet (2) Apply the right mouse click on a cell (3) Select Import Variable or Export Formula Result
-------------------------------------------------------------------------------------------------------------------------------------------------------------Aspen HYSYS SQP Optimization - A Practical Guide V1.0.doc 11
Figure 2.6: Object navigation page for importing or exporting values in a spreadsheet.
(4) Select the option Custom from the Object Filter (5) Select Optimization Object from the available list of Select Type
Figure 2.7: Screen showing optimization objects.
--------------------------------------------------------------------------------------------------------------------------------------------------------------Aspen HYSYS SQP Optimization - A Practical Guide V1.0.doc 12
(6) There will be a list of all the optimization parameters. Now if, for example, you want the minimum limit value of a variable then select “Optimizer Variable” from the list, select the variable, Variable Property Value and “min” from Variable specific column.
Figure 2.8: List of optimization variables and their properties.
-------------------------------------------------------------------------------------------------------------------------------------------------------------Aspen HYSYS SQP Optimization - A Practical Guide V1.0.doc 13
3.0 Optimizer Analysis This section provides some important tips to identify any mismatch in the optimizer setup and analyse the results for consistency.
3.1 Derivative Analysis A numerical perturbation is performed to the optimization variables and the resulting effects on the objective function and optimizer constraints are presented in a table within the derivative utility. The derivative analysis helps if t he optimizer has been configured correctly, for e xample •
•
The variables with zero derivative values indicate −
Either the variables are not linked to the simulation input conditions.
−
Or the variable does not have any influence in the simulation. In this case this variable can be deleted or ignored by de-selecting the “Optimize Flag” from the variable setup page (see Figure 1.9).
The sign and size of the objective function gradient indicates the direction the variable should move during optimization. For maximization problem with a negative derivative value the optimizer variable favours a higher value and with a positive derivative value it favours a lower value.
The screenshot for derivative analysis inside the optimizer is shown in Figure 3.1.
Figure 3.1: Derivative analysis page in HYSYS optimizer.
--------------------------------------------------------------------------------------------------------------------------------------------------------------Aspen HYSYS SQP Optimization - A Practical Guide V1.0.doc 14
There are two modes available for derivative calculation. 1-sided (forward):
2-sided (centered):
dc dv dc dv
=
=
c(v + ∆v) − c(v) ∆v
c(v + 0.5∆v ) − c (v − 0.5∆v) ∆v
Where v is an optimizer variable, and c is the objective function or constraint.
3.1 Noise Analysis The noise in the objective function and constraints are calculated during derivative analysis. One-side forward derivative calculations follow the sequences listed below. (1) Record the starting values of objective function and constraints (2) Perform a perturbation to the optimizer variables using a step size ∆v (3) Record the new values of objective function and constraints (4) Return the variable to their starting values (5) Record the values of objective function and constraints The noise is calculated as the difference of values recorded in sequences (1) and (5). See Figure 3.2 for a screenshot of absolute noise data.
Figure 3.2: Screenshot showing absolute noise in derivative calculation.
-------------------------------------------------------------------------------------------------------------------------------------------------------------Aspen HYSYS SQP Optimization - A Practical Guide V1.0.doc 15
The noise can propagate throughout the flowsheet and convolute the gradient values. Inaccurate gradient produces erroneous optimizer results. In Aspen HYSYS simulation noise is attributed to the solver convergence tolerances in heat exchanger, recycle operation, column, adjust operation etc. The noise level can be reduced by tightening the convergence tolerance in these unit operations. This will be demonstrated in the following section.
--------------------------------------------------------------------------------------------------------------------------------------------------------------Aspen HYSYS SQP Optimization - A Practical Guide V1.0.doc 16
4.0 Result Analysis The section provides tips on how to analyse the results from an optimization run. The flowsheet used in this study contains an LNG exchanger and three columns. These units are calculated by solvers consisting of default error tolerance. The optimizer results with the default error tolerances will be investigated first. We will then examine improvements following tightening the tolerances from their default values.
4.1 Results with Default Tolerances The optimizer results will be explored with the default error tolerance values. The optimizer setup parameters used are those shown in the optimizer page (Figure 4.1). To run the optimizer select “Start” button available in the optimizer screen. The screenshot in Figure 4.1 shows that the optimizer is solved successfully giving the starting and final values of the objective function. The screen also shows t he CPU time, termination reason and various iteration counts.
Figure 4.1: Optimizer overall results with default tolerances for columns and LNG exchanger.
The detailed results can be found in the spreadsheet shown in Figure 4.2. This screenshot shows the values of the optimizer variables, constraints and the calculated benefits by the optimizer. The calculated benefits is shown as 1.321e05 $/day.
-------------------------------------------------------------------------------------------------------------------------------------------------------------Aspen HYSYS SQP Optimization - A Practical Guide V1.0.doc 17
Figure 4.2: Optimizer results with default error tolerances for columns and LNG exchanger.
Now we see how the optimizer results can be explained in conjunction with the derivative values. A screenshot for the derivative values are shown below (Figure 4.3).
Figure 4.3: Derivative values with default error tolerances for columns and LNG exchanger.
--------------------------------------------------------------------------------------------------------------------------------------------------------------Aspen HYSYS SQP Optimization - A Practical Guide V1.0.doc 18
How does the optimizer accomplish the benefit? The sign of the derivative values indicates the direction the variable should move to give a higher objective function value. For a maximization problem and with a negative derivative value, the variable favours a higher value subject to limits of the constraints imposed in the optimization problem. The opposite is expected for variables with positive derivative values. The move of variables can be compared with the sign of derivative values for the objective function (Daily Benefits). The expected and actual move in optimizer variables are presented in a table below. See Figures 4.2 and 4.3 for optimizer results and derivative values respectively.
Variable
Derivative Value (Figure 4.3)
Expected Value
Actual Value (Figure 4.2)
Chiller temperature
+ve
decrease
decreased
Expander pressure
-ve
increase
increased
DePropanizer feed pressure
+ve
decrease
decreased
DeMethanizer C1 purity
+ve
decrease
increased
DeEthanizer C2 purity
+ve
decrease
decreased
DeEthanizer reflux ratio
+ve
decrease
decreased
DePropanizer C3 purity
+ve
decrease
decreased
DePropanizer reflux ratio
-ve
increase
increased
This table shows that the variable, de-methanizer purity, did not move in the direction following the sign of the derivative value. The screenshot shown in Figure 4.4 shows the calculated noise associated with derivative calculations for this optimization. The noise level is possibly the contributing factor giving this inconsistent result.
Figure 4.4: Noise in derivative calculations using default tolerances for columns and LNG exchanger.
-------------------------------------------------------------------------------------------------------------------------------------------------------------Aspen HYSYS SQP Optimization - A Practical Guide V1.0.doc 19
4.2 Results with Improved Tolerances The error tolerances for the three columns and an LNG exchanger in the simulation were tightened from their default values. The default and new values are shown in the table below.
Tolerance terms
Default Value
New Value
LNG exchanger error
1e-04
1e-06
HYSYS column default equilibrium error
1e-05
1e-06
HYSYS column default Heat / Spec error
5e-05
1e-06
The optimiser was run with improved error tolerances and the overall results from the optimizer are shown in Figure 4.5. The optimizer setup parameters were unchanged.
Figure 4.5: Optimizer overall results with improved error tolerances for columns and LNG exchanger.
The results for the variables, constraints and objective function values are in the spreadsheet in Figure 4.6. The calculated benefits is shown as 1.377e05 $/day.
--------------------------------------------------------------------------------------------------------------------------------------------------------------Aspen HYSYS SQP Optimization - A Practical Guide V1.0.doc 20
Figure 4.6: Optimizer results w ith improved error tolerances for columns and LNG exchanger.
The derivative values obtained with improved error t olerances are shown in Figure 4.7.
Figure 4.7: Derivative values with improved error tolerances for columns and LNG exchanger.
-------------------------------------------------------------------------------------------------------------------------------------------------------------Aspen HYSYS SQP Optimization - A Practical Guide V1.0.doc 21
The move of optimizer variables are compared with the derivative values for the objective function (Daily Benefits). This is presented in a table below.
Variable
Derivative Value (Figure 4.7)
Expected Value
Actual Value (Figure 4.6)
Chiller temperature
+ve
decrease
decreased
Expander pressure
-ve
increase
increased
DePropanizer feed pressure
+ve
decrease
decreased
DeMethanizer C1 purity
+ve
decrease
decreased
DeEthanizer C2 purity
+ve
decrease
decreased
DeEthanizer reflux ratio
+ve
decrease
decreased
DePropanizer C3 purity
-ve
increase
increased
DePropanizer reflux ratio
-ve
increase
increased
This table shows that all the variables moved in the direction consistent with their derivative values. The absolute error in the derivative calculation is shown in Figure 4.8. Comparing this with Figure 4.4 (using defaults error tolerances) it can be seen that errors are significantly less when the tolerances are tightened.
Figure 4.8: Noise in derivative calculations using improved error tolerances for columns and LNG exchanger.
--------------------------------------------------------------------------------------------------------------------------------------------------------------Aspen HYSYS SQP Optimization - A Practical Guide V1.0.doc 22
4.3 Case Study The optimizer can be used by the process development engineer to perform What-If case studies and explore potentials for process improvement. The lim its of variables and constraints can be relaxed from the current operating guideline and the resulting improvement in benefits can be studied. This section illustrates this feature using two examples. From the optimizer results presented in Figure 4.8 shows that chiller temperature decreased o o o from the starting value of -62.0 C to -62.45 C but it did not reach the lower limit of -65 C. One possible reason for this would be the duty limit in t he de-methanizer reboiler as this constraint is currently on the high limit. We can verify this b y running the optimizer with a higher duty limit. The optimizer results presented in Figure 4.9 is a rerun from the previous results but the reboiler duty limit was increased by 50% from 2400 to 3600 kW. o
With the increase of duty limit the chiller t emperature decreased from -62.45 C until it reaches o the lower limit of -65 C. The additional benefit calculated by the optimizer is $4528/day.
Figure 4.9: Optimizer case study results with higher duty limit for the de-methanizer reboiler.
Now suppose the design engineer is interested to know the additional benefits by setting the o chiller temperature minimum limit of -75 C and maximum duty limit for the de-methanizer reboiler of 3600 kW. To calculate the additional benefits the optimizer was run from the base case (Figure 4.6). The results for this run are shown in Figure 4.10.
-------------------------------------------------------------------------------------------------------------------------------------------------------------Aspen HYSYS SQP Optimization - A Practical Guide V1.0.doc 23
Figure 4.10: Optimizer case study results with higher duty limit for the de-methanizer reboiler and reduced lower limit for the chiller. o
With this new strategy the optimizer pushed the chiller temperature as low as -71.09 C and this is again constrained by de-methanizer reboiler duty. The additional benefit calculated by the optimizer with this new proposed operating scenario is $1.353e+04/day. These two examples illustrate how the optimizer can be used to perform What-If case studies. The design engineer can use this as a tool to study beyond current guidelines in place for process operation and undertake strategies for process improvement.
--------------------------------------------------------------------------------------------------------------------------------------------------------------Aspen HYSYS SQP Optimization - A Practical Guide V1.0.doc 24