Giter Club home page Giter Club logo

comphens.jl's People

Contributors

avinashresearch1 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

fholtorf

comphens.jl's Issues

Benchmarking

This involves running several cases ideally including a number of edge cases for Heat Exchanger Network Synthesis. A good paper to start working on is: https://doi.org/10.1016/j.applthermaleng.2012.10.022. It is useful to use the BenchmarkTools.jl tool. Benchmark SeqHENS (solve multiple and large literature problems). HT to work on this.

In Streams/streams

  1. Runs sanity checks on construction of the stream. The easiest way is through a new function inside the struct.

NaN values when generating intervals in stream match generator

Occurs when e.g. a hot utility stream is provided in the stream data but not used. Quick fix is not considering that utility stream.

CompHENS_interface_MWE.xlsx

@time using CompHENS
using Plots
using JuMP
using HiGHS
using Test

file_path_xlsx = joinpath(@DIR, "CompHENS_interface_MWE.xlsx")
prob = ClassicHENSProblem(file_path_xlsx; ΔT_min = 45.0, verbose = true)
@time solve_minimum_utilities_subproblem!(prob; verbose = true)
model::AbstractModel, overall_network::Dict{String, AbstractSuperstructure}, file_name; digits = 1)
@time solve_minimum_units_subproblem!(prob)
EMAT = 2.5
prob.results_dict[:add_units] = 1
@time generate_stream_matches!(prob, EMAT; digits = 8, verbose = true)

Minor refactor ideas

  • Switch the initialization of utility.Q to undef from Inf. Also requires changing logic that checks utility.Q == Inf and is_infinite
  • For the subproblems with intervals, does it make sense to set the Q[i,j,k] to 0.0 when either i or j does not participate in the interval? May lower the computational cost for more expensive problems? May not matter if taken care of in preprocessing.
  • For MultiperiodHENS ensure that any specified streams in any period are copied to all periods with a 0.0 mcp. This ensures no logic issues. Note that this needs to be done after solving min. utilities SP1 because some utilities may not be available in all periods.

Infeasible Stream Match Generation

The network generation subproblem is infeasible:

  • changing mcp of process stream H1 makes problem feasible again
  • I suspect its the mass flow balance of the internal nodes of the superstructure that is somehow the problem
# Workflow using XLSX input:
# 1. Import necessary packages:
@time using CompHENS

using Plots
using JuMP
using HiGHS
using Test

using BARON
using XLSX
using DataFrames


# 2. Specify path to xlsx file
file_path_xlsx = joinpath(@__DIR__, "CompHENS_interface_KangLiu_Period1.xlsx")
prob = ClassicHENSProblem(file_path_xlsx; ΔT_min = 10, verbose = true)
@time solve_minimum_utilities_subproblem!(prob; verbose = true)

@time solve_minimum_units_subproblem!(prob; verbose = true)

EMAT = 2.5
prob.results_dict[:add_units] = 1

@time generate_stream_matches!(prob, EMAT; digits = 8, verbose = true)


# Network generation:
# Specify which superstructure to use for each stream
# Default is below: 
overall_network = construct_superstructure(prob.all_names, FloudasCiricGrossmann(), prob)
obj_func = CostScaledPaterson()
base_cost, cost_coeff, scaling_coeff =  8333.3,  641.7, 1

optimizer = optimizer_with_attributes(BARON.Optimizer, "MaxTime" => -1, "AbsConFeasTol" => 1)
results_df = generate_network!(prob, EMAT; optimizer = optimizer, obj_func = obj_func, verbose = true, cost_coeff = cost_coeff, scaling_coeff = scaling_coeff, base_cost = base_cost, save_model = true)

CompHENS_interface_KangLiu_Period1.xlsx

Code Organization

Overview of type hierarchy and code flow:

Goal: To provide an extensible toolkit that is agnostic to synthesis algorithm.

  1. The user may want to solve many kinds of problem:
  • AbstractHENSProblem: The classical Heat Exchanger Network Synthesis (HENS) problem. All other processes are fixed, so mass flows and temperatures are fixed. Output: The designed HEN as well as other useful data such as the GCC etc. Only simple utility configurations are considered.
  • AbstractUtilityHENSProblem: Synthesis of both the utility system and the HEN. See: Martelli_Marechal_2017.
  • AbstractProcessHENSProblem: Synthesis of generalized process and HEN. See Duran_Grossmann_1986. One may also want to implement a generalized background process superstructure that may alternately that may take in organic rankine cycles, steam cycles, heat pump systems and so on. This is reach goal, may be more feasible to start with sub-systems e.g. AbstractSteamCycleHENSProblem, AbstractHeatPumpHENSProblem.
  1. The overall AbstractSynthesisAlgorithm holds types for the techniques to solve one or more of the above problems. As much as possible, these algorithms are named according to the first and last author of the published paper. For instance, one may use the Papoulias_Grossmann_1983() algorithm or the Anantharaman_Gundersen_2010() algorithm for a relevant problem.

  2. The above algorithms involve subproblems usually held within an AbstractSubProblem type. One reach goal could be to also allow multiple AbstractSubProblemAlgorithm that solve certain subproblems. Each of these may make use of different AbstractSuperstructures.

In general, _Problem holds the problem data, _Algorithm works on the sub-problem. A listing of appropriate algorithms for appropriate sub-problems will be documented in the Read-Me (with appropriate checks).

  1. A return type under AbstractSolution will generally be used to hold return types. For subproblems, AbstractSubProblemSolution may be used while AbstractFullSolution may be used for overall problems.

  2. As much as possible, the style conventions and guide provided generally by the SciML Organization and specifically followed in SciMLBase will be followed. An attempt at documenting the code design decisions with issues is also made.

Development of a difficulty index for the problem.

“Difficulty index” to qualify the problem. Most relevant for MILPs (min units and HLD generator). Basically, the idea is to figure out how difficult the SP2 and SP3 MILPs will be prior to actually solving them. RA and FH to provide inputs.

Formulate optimization models without using macros

If the speed to construct the optimization problem in JuMP becomes a barrier, consider removing macros. Avoiding that is a lot of work and takes a lot of learning about JuMP (or ideally MathOptInterface) though. Depending on how big the problems become, the inefficiency of macro usage can actually become very noticeable (especially when you start thinking about the nonlinear problems). For now I think this is fine but something to keep in mind.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.