Skip to content

EnergyIntegration/EnergyIntegration.jl

Repository files navigation

EnergyIntegration

Stable Dev Build Status ColPrac: Contributor's Guide on Collaborative Practices for Community Packages

EnergyIntegration is a Julia package for heat exchanger network (HEN) synthesis. It focuses on common and isothermal streams and provides an end-to-end workflow from temperature grids and problem tables to transportation-model optimization.

Installation

julia> ] add EnergyIntegration

Quick Start: 4SP1 (Papoulias & Grossmann, 1983)

This example is in test/testproblem/General/4SP1.jl and is exercised in the testset test/runtests.jl.

using EnergyIntegration # re-exports Unitful
using Unitful: °C
using HiGHS

stream_data = [
    Cold(:C1, F=1u"kmol/s", Tin=60°C, Tout=160°C, Tcont=5°C,
        Hcoeff=(0, 7.62, 0, 0, 0, 0), HTC=100u"kW/(K*m^2)"
    ),
    Hot(:H2, F=1u"kmol/s", Tin=160°C, Tout=93°C, Tcont=5°C,
        Hcoeff=(0, 8.791, 0, 0, 0, 0), HTC=100u"kW/(K*m^2)"
    ),
    Cold(:C3, F=1u"kmol/s", Tin=116°C, Tout=260°C, Tcont=5°C,
        Hcoeff=(0, 6.0833, 0, 0, 0, 0), HTC=100u"kW/(K*m^2)"
    ),
    Hot(:H4, F=1u"kmol/s", Tin=249°C, Tout=138°C, Tcont=5°C,
        Hcoeff=(0, 10.54954, 0, 0, 0, 0), HTC=100u"kW/(K*m^2)"
    ),
    Hot(:HU1, F=(0u"kmol/s", 1000u"kmol/s"), Tin=270°C, Tout=270°C, Tcont=5°C,
        Hvap=100u"kJ/kmol", HTC=100u"kW/(K*m^2)",
        cost=200u"(kJ*yr)^-1", pricing_basis=:energy
    ),
    Cold(:CU1, F=(0u"kmol/s", 1000u"kmol/s"), Tin=38°C, Tout=82°C, Tcont=5°C,
        Hcoeff=(0, 1.0, 0, 0, 0, 0), HTC=100u"kW/(K*m^2)",
        cost=20u"(kJ*yr)^-1", pricing_basis=:energy
    )
]

config = IntervalsConfig()
opt_config = OptimizationConfig(cost=CostModelConfig(annual_operating_time=1u"yr"))
prob = build_hen(stream_data; config)

# Inspectable fields
prob.table
prob.composite
prob.intervals_cfg.forbidden_match
plot_composite_curve(prob.composite) |> display

hen_model = solve_transp!(prob, HiGHS.Optimizer, opt_config);
load_solution!(prob, hen_model);
#=
───────────────────────────────────────────────────────────
                            Usage    Units  Costs (US$/yr) 
───────────────────────────────────────────────────────────
 Stream expenditure                                 30,545
   HU1                     127749.3  J/s            25,550
   CU1                     249750.0  J/s             4,995
 Total capital investment                            2,402
   Number of exchangers           5  -               2,374
   Total area                  1.68  m²                 28
 Total                                              32,947
───────────────────────────────────────────────────────────
=#

# Results: total cost, optimal flowrates, etc.
prob.result.obj_value # 32946.74510224574
prob.result.edges #=
            C1        C3       CU1 
  H2  339247.0      -0.0  249750.0
  H4  422753.0  748245.9         -
 HU1         -  127749.3         -
=#
prob.result.edges[:H2,:C1].q #=
    4  5        6        7  8         9 
 5  -  -  91440.0  80167.0  -   21795.0
 6  -  -        -        -  -  105492.0
 7  -  -        -        -  -   40353.0 
=#
prob.result.table #=
───────────────────────────────────────────────────────────────────────────────────
 Row        H2        H4       HU1        C1        C3       CU1  T_upper  T_lower 
───────────────────────────────────────────────────────────────────────────────────
   1         -         -  127750.0         -         -         -   538.15   538.15
   2         -         -         -         -  127750.0         -   538.15   517.15
   3         -  833410.0         -         -  480580.0         -   517.15   438.15
   4         -  105500.0         -   76200.0   60833.0         -   438.15   428.15
   5  193400.0  232090.0         -  167640.0  133830.0         -   428.15   406.15
   6  105490.0         -         -   91440.0   73000.0         -   406.15   394.15
   7  290100.0         -         -  251460.0         -         -   394.15   361.15
   8         -         -         -    7620.0         -         -   361.15   360.15
   9         -         -         -  167640.0         -  124880.0   360.15   338.15
  10         -         -         -         -         -  124880.0   338.15   316.15
───────────────────────────────────────────────────────────────────────────────────
=#
prob.result.composite #=
────────────────────────────────────────
 Row      hot    cold  feasible_hc    T 
────────────────────────────────────────
   1  -127749       0            0  538
   2        0  127749       127749  538
   3  -833414  480581            0  517
   4  -105495  137033       352833  438
   5  -425492  301473       321295  428
   6  -105492  164440       445315  406
   7  -290103  251460       386367  394
   8        0    7620       425010  361
   9        0  292515       417390  360
  10        0  124875       124875  338
  11        0       0            0  316
────────────────────────────────────────
=#

Notes

  • Supports Common and Isothermal stream kinds only.
  • Hcoeff uses a 6-term polynomial; the second coefficient is the constant‑pressure molar heat capacity, Cp

License

Apache License 2.0

About

Heat exchanger network synthesis.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages