Skip to content

Commit

Permalink
reformatting
Browse files Browse the repository at this point in the history
  • Loading branch information
parkyr committed May 30, 2024
1 parent 67eafc3 commit e1fbb81
Showing 1 changed file with 23 additions and 29 deletions.
52 changes: 23 additions & 29 deletions gdplib/hda/HDA_GDP_gdpopt.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,10 +213,7 @@ def strset(i):
Heatvap = {}
Heatvap["tol"] = 30890.00
m.heatvap = Param(
m.compon,
initialize=Heatvap,
default=0,
doc="heat of vaporization [kJ/kg-mol]",
m.compon, initialize=Heatvap, default=0, doc="heat of vaporization [kJ/kg-mol]"
)
Cppure = {}
# h2 'hydrogen', ch4 'methane', ben 'benzene', tol 'toluene', dip 'diphenyl'
Expand Down Expand Up @@ -716,10 +713,7 @@ def Permset(m, compon):
m.flsh, within=NonNegativeReals, initialize=1, doc="flash temperature [100 K]"
)
m.flshp = Var(
m.flsh,
within=NonNegativeReals,
initialize=1,
doc="flash pressure [MPa]",
m.flsh, within=NonNegativeReals, initialize=1, doc="flash pressure [MPa]"
)
m.eflsh = Var(
m.flsh,
Expand Down Expand Up @@ -814,10 +808,7 @@ def Permset(m, compon):
doc="reactor pressure [MPa]",
)
m.rctvol = Var(
m.rct,
within=NonNegativeReals,
bounds=(None, 200),
doc="reactor volume [m**3]",
m.rct, within=NonNegativeReals, bounds=(None, 200), doc="reactor volume [m**3]"
)
m.krct = Var(
m.rct,
Expand Down Expand Up @@ -861,15 +852,10 @@ def Permset(m, compon):
doc="splitter temperature [100 K]",
)
m.spl1p = Var(
m.spl1,
within=PositiveReals,
bounds=(0.1, 4.0),
doc="splitter pressure [MPa]",
m.spl1, within=PositiveReals, bounds=(0.1, 4.0), doc="splitter pressure [MPa]"
)
# splitter
m.splp = Var(
m.spl, within=Reals, bounds=(0.1, 4.0), doc="splitter pressure [MPa]"
)
m.splp = Var(m.spl, within=Reals, bounds=(0.1, 4.0), doc="splitter pressure [MPa]")
m.splt = Var(
m.spl, within=Reals, bounds=(3.0, 10.0), doc="splitter temperature [100 K]"
)
Expand Down Expand Up @@ -1957,7 +1943,9 @@ def Flshti(_m, flsh_, stream):
return m.flsht[flsh_] == m.t[stream]
return Constraint.Skip

b.flshti = Constraint([flsh], m.str, rule=Flshti, doc="inlet temperature relation")
b.flshti = Constraint(
[flsh], m.str, rule=Flshti, doc="inlet temperature relation"
)

def Flshtl(_m, flsh_, stream):
if (flsh_, stream) in m.lflsh and flsh_ == flsh:
Expand All @@ -1978,7 +1966,8 @@ def Flshtv(_m, flsh_, stream):
)

m.heat_unit_match = Param(
initialize=3600.0 * 8500.0 * 1.0e-12 / 60.0, doc="unit change on heat balance from [kJ/min] to [1e12kJ/yr]"
initialize=3600.0 * 8500.0 * 1.0e-12 / 60.0,
doc="unit change on heat balance from [kJ/min] to [1e12kJ/yr]",
)

def build_furnace(b, furnace):
Expand Down Expand Up @@ -2737,7 +2726,11 @@ def rctcns(_m, rct, stream, compon):
return Constraint.Skip

b.Rctcns = Constraint(
[rct], m.str, m.compon, rule=rctcns, doc="consumption rate of key components"
[rct],
m.str,
m.compon,
rule=rctcns,
doc="consumption rate of key components",
)

def rctmbtol(_m, rct):
Expand Down Expand Up @@ -2855,7 +2848,9 @@ def Rcthbiso(_m, rct):
)
return Constraint.Skip

b.rcthbiso = Constraint([rct], rule=Rcthbiso, doc="temperature relation (isothermal)")
b.rcthbiso = Constraint(
[rct], rule=Rcthbiso, doc="temperature relation (isothermal)"
)

def Rctisot(_m, rct):
if rct == 2:
Expand All @@ -2864,7 +2859,9 @@ def Rctisot(_m, rct):
) == sum(m.t[stream] for (rct_, stream) in m.orct if rct_ == rct)
return Constraint.Skip

b.rctisot = Constraint([rct], rule=Rctisot, doc="temperature relation (isothermal)")
b.rctisot = Constraint(
[rct], rule=Rctisot, doc="temperature relation (isothermal)"
)

def build_single_mixer(b, mixer):
"""
Expand Down Expand Up @@ -3149,9 +3146,7 @@ def toluene_selection(m):
initialize=0.04 * 24 * 365 / 1000,
doc="electricity cost, value is 0.04 with the unit of [kW/h], now is [kW/yr/$1e3]",
)
m.methane_purge_value = Param(
initialize=3.37, doc="heating value of methane purge"
)
m.methane_purge_value = Param(initialize=3.37, doc="heating value of methane purge")
m.heating_cost = Param(
initialize=8000.0, doc="heating cost (steam) with unit [1e6 kJ]"
)
Expand Down Expand Up @@ -3203,8 +3198,7 @@ def toluene_selection(m):
initialize=6.20, doc="toluene column fixed cost [$1e3/yr]"
)
m.furnace_linear_coefficient = Param(
initialize=1171.7,
doc="furnace column linear coefficient [$1e3/(1e12 kJ/yr)]",
initialize=1171.7, doc="furnace column linear coefficient [$1e3/(1e12 kJ/yr)]"
)
m.membrane_separator_fixed_cost = Param(
initialize=43.24, doc="membrane separator fixed cost [$1e3/yr]"
Expand Down

0 comments on commit e1fbb81

Please sign in to comment.