Running the HDA flowsheet

Running the HDA flowsheet#

[1]:
from pyomo.environ import TerminationCondition, value
from hda_flowsheet import FS
from idaes.core.solvers import get_solver

solver = None
try:
    solver = get_solver()
except:
    pass
[2]:
# run up to, but not including, optimization
if solver:
    FS.run_steps(before="solve_optimization")
    # print degrees of freedom
    print(FS.dof)
    # run rest of steps
    FS.run_steps(first="solve_optimization")
    # print degrees of freedom again
    print(FS.dof)
[3]:
# examine results

m = FS.model

if m:
    # What is the total operating cost?
    print("operating cost = $", value(m.fs.operating_cost))

    # For this operating cost, what is the amount of benzene we are able to produce and what purity we are able to achieve?
    m.fs.F102.report()
    print()
    print("benzene purity = ", value(m.fs.purity))


    # How much benzene are we losing in the F101 vapor outlet stream?
    from idaes.core.util.tables import (
        create_stream_table_dataframe,
        stream_table_dataframe_to_string,
    )
    st = create_stream_table_dataframe({"Reactor": m.fs.s05, "Light Gases": m.fs.s06})
    print(stream_table_dataframe_to_string(st))
[4]:
# Uncomment to show diagram
# FS.show_diagram()
[ ]: