© 2024 Jasper van Baten, AmsterCHEM

Example 1: counter-current heat exchanger

This example will set up a counter current heat exchanger. A cold and hot stream are entering, and a cold and hot stream are leaving the model. The example will be set up in the COCO simulator, using one of the example thermodynamic property packages.

Step 1: Setting up the flowsheet

First a flowsheet is set up. Start the COFE flowsheeting environment. Choose Configure from the Flowsheet menu. On the Property packs page, click Add. Select TEA (CAPE-OPEN 1.1), click OK. Select the package C1_C2 (EOS), click OK. When asked to set this package for the default material, click yes. Close the flowsheet configuration dialog. The thermo system set up is now complete.

Step 2: Insert the Excel Unit Operation, and configure the streams

Insert an Excel unit operation: click the Insert Unit Operation button on the toolbar. Select the Excel Unit Operation (in the Custom section), click OK. Position the unit operation in the flowsheet using the mouse. Right click the unit operation, click Rename. Enter "My Heat Exchanger", click OK.

Inserting the unit operation

Now, double click the unit operation, click Edit. Excel will open, showing the default, empty, unit operation definition. Go to the feeds worksheet. Change the default feed name in A3 to "Cold inlet". Add another feed in A4 by typing "Hot inlet", or by clicking the Add Feed Add Feed button on the Unit Operation ribbon.

Inserting the unit operation

Then go to the products worksheet. Change the default product name in A3 to "Cold outlet". Add a second product in A4 by typing "Hot outlet", or by clicking the Add Product Add Product button on the Unit Operation ribbon. Close Excel.

The Ports tab on the unit operation dialog will now show our newly created feeds and products:

Ports tab in COFE

Step 3: Setting up and connecting the streams

Change the icon of the unit operation to resemble a heat exchanger. Right-click on the unit operation, choose "Select Unit Icon" from the icon menu. In the "Heaters and Coolers" section, select heat_exchanger_3. Click OK.

Define the cold feed. Insert a stream in the COFE flowsheet. Right click the stream, rename to "Cold feed". Connect the product side of the stream to the unit operation. Select "Cold inlet" when asked which port to connect it to. Insert a second stream, name it "Hot feed". Connect it to the unit operation. As there is only one feed port left, you are not asked anymore which port to connect it to. Select the unit operation. Click the Edit Streams button on the toolbar. For the cold feed, enter 1e5 Pa, 300 K, 0.5 mole fraction Methane and a flow of 100 mol/s. For the hot feed, enter 1e5 Pa, 800 K, 0.1 mole fraction Methane, and a flow of 200 mol/s:

Define feed properties

Close the stream dialog. Insert another stream. Rename it to "Cold product" and connect it to the "Cold outlet" port. Insert a 4th stream, rename it to "Hot product" and connect it to the unit operation:

Connected streams

The Ports tab when you double click the unit operation will now show which streams are connected to which port:

Ports tab in COFE

Step 4: Setting up the Excel model equations

On the Edit tab when you double-click the unit operation, click Edit. Excel will open. Notice how the feeds worksheet now shows the compounds, as well as the feed properties.

Connected streams

The products worksheet shows the compounds as well, but no properties. Defining the product properties is the next task.

Go to the calculations worksheet. Enter the following column headers: T/[K] in B1, f/[mol/s] in C1, h/[j/mol] in D1 and H/[j/s] in E1. In A2, enter =feeds!A3. In B2, enter =feeds!B3. In C2, enter =feeds!E3. In D2, enter =feeds!D3. In E2, enter =C2*D2. Then copy A2:E2 to A3:E3:

Initial setup

Calculate the heat required to heat up the cold feed to the hot feed temperature, and the heat released when cooling down the hot feed to the cold feed temperature. One of these two cases will be the limiting case.

In A4, enter Heat up cold feed. In B4, enter =B3. In C4, enter =C2. We will calculate the heat of the resulting stream in D4:

Insert Enthalpy

Similarly, the the hot feed enthalpty at cold feed temperature is calculated. In A5, enter Cool down hot feed. In B5, enter =B2. In C5, enter =C3. For D5, follow the above procedure to end up with formula =capeOverallProperty("enthalpy","temperature",B5,"pressure",feeds!C4,feeds!F4:G4). Copy E4 to E5.

Define the limiting case: in A7, enter Heat transfer cold stream limit. In E7, enter =E4-E2. In A8, enter Heat transfer hot stream limit. In E8, enter =E3-E5 (mind that this has opposite sign). The actual heat transfer limit is the minimum of these two. In A9, enter Heat transfer limit. In E9, enter =MIN(E7:E8):

Model equations

Step 5: Adding a parameter

The heat transfer limit is the maximum heat that can be transferred. This amount of heat is not transferred. Instead, a parameter for the efficiency of the heat exchanger is defined, relative to maximum possible heat exchange.

Click on the Add Input Parameter Add Input Parameter button on the Unit Operation ribbon. For the parameter name, specify Efficiency. Enter an initial value of 1, a minimum value 0 and maximum value of 1. This parameter is dimensionless, so do not enter any units of measure. In "Value Range Name" enter "efficiency"; after that this name can be used in Excel formulas:

Add efficiency parameter

Now go back to the calculations worksheet and calculate the actual amount of heat transferred. In A10, enter "Efficiency". In E10, enter =efficiency. In A11, enter Heat transferred. In E11, enter =E10*E9.

Step 6: Defining the product streams

Define the values of our product streams. For each product composition and flow rate must be specified, plus 2 out of 3 of pressure, temperature and enthalpy.

Pressure, composition and flow can be copied from the feeds. Go to the products worksheet, and in C3 enter =feeds!C3. Now copy C3 to C3:G4. This also copied enthalpy, which must be modified to take into account the heat exchange. D3 now says =feeds!D3, but we need to change this to =feeds!D3+calculations!E11/E3. Similarly, change D4 to =feeds!D4-calculations!E11/E4.

Step 7: Defining a report

A report of the calculated values is exported to the simulation environment. Dress up the calculation worksheet a bit to include the units of measure for rows 7 through 11. In F7:F11, enter W. Clear the value of F10, as it has no unit of measure.

Select A7:F11, and click the Define Report Report button on the Unit Operation ribbon. Enter "Calculations" for the report name.

Add report

Click OK. The report name is now defined, and added to the control worksheet.

Another way to report a value is to define an output parameter. Click the Add Output Parameter Add Output Parameter button on the Unit Operation ribbon. Then enter "Heat transferred" for the parameter name, and W for the unit of measure. The unit of measure is subsequently translated to powers to indices of SI base units as required for CAPE-OPEN:

Add output parameter

Focus shifts automatically to B2 on the output parameters worksheet, where the formula for the parameter's value is entered: =calculations!E11.

Step 8: Run and verify

The model set up is now complete. Close Excel. At the Edit tab of the unit operation dialog, you will find the parameters that was added:

Parameters in COFE

Close the Edit dialog, and hit Run. The unit is now solved, and the products are defined. The stream shows that the cold stream has been heated to the hot stream's inlet temperature, and the hot stream has been cooled:

Stream dialog

Double-click the unit, and check the enthalpy balance on the Balance tab:

Enthalpy balance

The Reports tab will show our calculation report:

Report

If you set the cold feed to 500 mol/s, the situation is different: the hot stream has not been cooled down to the cold feed temperature:

Stream dialog

No special case is implemented for zero flow, so if you set the cold feed flow to zero, Excel will find a division by zero on the products worksheet:

Error

This can be prevented this using an Excel IF statement, e.g. the formula for enthalpy of the cold product can be written as =IF(E3=0,feeds!D3,feeds!D3+calculations!E11/E3).

Go back to our original flow rates, and can check the efficiency parameter. Notice that setting the efficiency to 2 does not work, as its maximum value is defined as 1. Set the efficiency to 0.95 in the Edit tab when you double click the unit operation. Now, the unit no longer operates at the heat transfer limit:

Stream dialog

Example inputs

To run the example, you must have COCO Simulator installed. Then, click on the example1.fsd file.

Next step

The Co-current Heat Exchanger example demonstrates how to set up calculations using the Excel Solver Add-in.
INDEX
add-In
aggregation state
available properties
capeCompoundConstant
capePropertyUnit
capeFlash
capeFlashedFeed
capeOverallFeedProperty
capeOverallProperty
capePDependentProperty
capeSinglePhaseProperty
capeCompoundNames
compound names
unit of measure
capeStateOfAggregation
capeTDependentProperty
capeTwoPhaseProperty
capeUnitOperationName
compound constants
control sheet
defined phases
Disclaimer
equilibrium calculations
examples
Excel solver
Export Model
feeds
flash calculations
getting started
Import Model
input parameters
Loading and storing models
macros
output parameters
overall properties
parameters
ports
pressure dependent properties
products
property calculations
quick reference
reports
requirements
run-time error
security
single phase properties
solver
state of aggregation
streams
temperature dependent properties
thermodynamic equilibrium calculations
thermodynamic property calculations
two-phase properties
unit operation name
Update links
validation
VBA
welcome
CONTENT
 Introduction
 Ports and streams
 Parameters
 Function reference
 The control sheet
 Using the Excel solver
 Using Macros
 Loading and storing models
 Persistence in AspenPlus
 Examples
 Example 1: counter current heat exchanger
 Example 2: co-current heat exchanger
 Disclaimer