|Excel Thermo Import|
|Excel Unit Operation|
|Matlab Unit Operation|
|Matlab Thermo Import|
|OO Calc Thermo Import|
|SciLab Unit Operation|
|SciLab Thermo Import|
|Python Thermo Import|
This example is much like the counter-current heat exchanger example 1. As opposed to the counter-current heat-exchanger, for which all equations are written explicitly, the co-current heat exchanger requires an iterative solution. For this, the Excel Solver Add-in is used.
A cold and hot stream are entering, and a cold and hot stream are leaving the model. The maximum heat duty is given by the temperature for which the heat duty to cool down the cold stream and heat up the hot stream are equal. This temperature must be solved for.
The example will be set up in the COCO simulator, using one of the example thermodynamic property packages.
First we need to set up a flowsheet. 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. We have now set up our thermo system.
Insert an Excel unit operation: click the Insert Unit Operation button on the toolbar. Select the Excel Unit Operation, 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.
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". Then go to the products page. Change the default product name in A3 to "Cold outlet". Add a second product in A4 by typing "Hot outlet". Close Excel.
The Ports tab on the unit operation dialog will now show our newly created feeds and products:
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 button on the Unit Operation ribbon.
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 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:
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:
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:
The Ports tab when you double click the unit operation will now show which streams are connected to which port:
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:
The products page shows the compounds as well, but no properties. It is our task to define the product properties.
Let's set up the calculations. 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:
Next, the heat required to cool down the hot stream and heat up the cold stream to the same temperature is calculated. The temperature for which these heats are the same, is the limiting temperature.
In A6, enter limiting temperature. In B6, enter 500; this will be our very first initial guess. In A7, enter Cold outlet limit. In B7, enter =B6. In C7, enter =C2. To calculate the heat of the inlet stream at these conditions, place the cursor in D7, and click Overall Property on the Unit Operation ribbon. For Composition, click the Pick button, and select composition in the feeds workheet, at feeds!$F$3:$G$3. Click OK. Leave the default "temperature" and "pressure" as the equilibrium conditions. For the value of temperature, click the Pick button, and select B7. Click OK. For the value of temperature, click the Pick button, and select pressure in the feeds workheet, at feeds!$C$3. Click OK. The overall property to calculate is "enthalpy", select it, and click OK:
Now, D7 reads: =capeOverallProperty("enthalpy","temperature",$B$7,"pressure",feeds!$C$3,feeds!$F$3:$G$3).
Copy E3 to E7 for the total enthalpy.
On to the hot stream. Enter Hot outlet limit in A8. In B8, enter =B6. In C8, enter =C3.
Follow the same procedure as outlined above for the calculation of enthalpy in D8, using the hot stream composition and pressure: =capeOverallProperty("enthalpy","temperature",$B$8,"pressure",feeds!$C$4,feeds!$F$4:$G$4).
Copy E7 to E8 for the total enthalpy:
In A10, enter Heat duty cold. In E10, enter =E7-E2. In A11, enter Heat duty hot. In E11, enter =E3-E8 (notice that this has the opposite sign). In A12, enter Difference, and in E12, enter =E10-E11. The limiting temperature is that for which the value in E12 is zero.
To calculate the limiting temperature, we will use the Excel solver. At this point, make sure that the Excel solver is available.
Select Solver from the Data ribbon. Set the target cell to E12, and choose equal to a value of zero. In "By changing cells", select B6 (this is the limiting temperature we are solving for):
When clicking OK, the model solves, and we see the limiting temperature. Keep the solver solution.
The current solution is only valid at the current feed conditions. The solver must run this scenario each time the unit operation is calculated. Go to a suitable cell to store the solver model, e.g. cell H7. Click the Solver Scenario button on the Unit Operation ribbon. Call the solver scenario TemperatureLimit and click OK:
The solver scenario itself is now defined in cells H7 and below. To clarify, put Solver Scenario in H6.
In addition, the name TemperatureLimit identifies the saved solver scenario range, and this name is added to the control worksheet in the Solver Model section.
Now the heat transferred for the limiting case is known, and will be calculated each time the unit operation itself is calculated. The limiting case heat transfer will be in cells E10 and E11 on the calculations worksheet (these cells will contain the same values at a successful solution).
An efficiency parameters is created that relates the actual amount of heat transfered to the limiting case. Click on the 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:
Go back to the calculations worksheet and calculate the actual amount of heat transferred. In A14, enter "Efficiency". In E14, enter =efficiency. In A15, enter Heat transferred. In E15, enter =E10*E14.
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!E15/E3. Similarly, change D4 to =feeds!D4-calculations!E15/E4.
The model set up is now complete. Close Excel. The parameter that was added is now shown at the Edit tab of the unit operation dialog:
Close the Edit dialog, and hit Run. The unit is now solved, and the products are defined.
The stream dialog shows that the cold and hot streams exit with the same temperature:
If you set the cold feed to 500 mol/s, we notice that the resulting temperature is colder:
If you double click the unit operation, and on the Edit tab change the efficiency value to 0.95, you see that the output streams no longer have the same temperature, as we are not transferring the heat calculated as the limit anymore:
The value that is in B6 after the last solution, will remain in B6 for the next time the unit operation is calculated. So by default, the initial guess results from the last run. This may in many cases be efficient and convenient, but in some cases this might cause convergence trouble.
For the current problem, a reasonable initial guess can be constructed. Under the assumption that the molar heat capacities of the holt and cold stream are nearly independent of temperature, and under the additional assumption that they are reasonably close to each other, the limiting temperature is the mass-flow weighed avarage of the hot and cold stream temperatures.
In the calculations worksheet, at cell A5, type Temperature guess. In B5, type our guess value of =B2+(B3-B2)*C3/(C2+C3).
In order to tell the Excel unit operation which values to copy as initial guess, a name must be defined for the initial guess range, and for the range it needs to be copied to prior to invoking the solver. You can either delete the existing solver scenario, and recreate it specying initial guess source and target ranges directly in the Define Solver Scenario dialog, or manually add them:
For either scenario, each time the unit operation is calculated, the initial guess will be used as specified.