Skip to content

Commit

Permalink
Merge branch 'main' into keras_file_format_updates
Browse files Browse the repository at this point in the history
  • Loading branch information
bpaul4 authored Aug 16, 2024
2 parents fb7f1d3 + 9d87c17 commit 78bccea
Show file tree
Hide file tree
Showing 47 changed files with 9,003 additions and 4,826 deletions.
21 changes: 11 additions & 10 deletions idaes_examples/mod/power_gen/gas_turbine.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ def _add_models(self):
support_isentropic_performance_curves=True,
)

def _add_performance_curves_gts1(self, flow_scale=0.896):
def _add_performance_curves_gts1(self, flow_scale=0.896*pyo.units.s/pyo.units.m**3):
"""Add isentropic head and efficiency curves for gas turbine stage 1"""

@self.gts1.performance_curve.Constraint(
Expand Down Expand Up @@ -262,9 +262,9 @@ def head_isen_eqn(b, t):
)
return b.head_isentropic[t] == -(
-2085.1 * f**3 + 38433 * f**2 - 150764 * f + 422313
)
)*pyo.units.m**2/pyo.units.s**2

def _add_performance_curves_gts2(self, flow_scale=0.896):
def _add_performance_curves_gts2(self, flow_scale=0.896*pyo.units.s/pyo.units.m**3):
"""Add isentropic head and efficiency curves for gas turbine stage 2"""

@self.gts2.performance_curve.Constraint(
Expand All @@ -290,9 +290,9 @@ def head_isen_eqn(b, t):
)
return b.head_isentropic[t] == -(
-1676.3 * f**3 + 34916 * f**2 - 173801 * f + 456957
)
)*pyo.units.m**2/pyo.units.s**2

def _add_performance_curves_gts3(self, flow_scale=0.896):
def _add_performance_curves_gts3(self, flow_scale=0.896*pyo.units.s/pyo.units.m**3):
"""Add isentropic head and efficiency curves for gas turbine stage 3"""

@self.gts3.performance_curve.Constraint(
Expand Down Expand Up @@ -320,7 +320,7 @@ def head_isen_eqn(b, t):
)
return b.head_isentropic[t] == -(
-1373.6 * f**3 + 31759 * f**2 - 188528 * f + 500520
)
)*pyo.units.m**2/pyo.units.s**2

def _add_constraints(self):
"""Add additional flowsheet constraints and expressions"""
Expand Down Expand Up @@ -759,10 +759,10 @@ def _set_scaling(self):
for i in ["air05", "air07", "air09"]:
iscale.set_scaling_factor(self.splt1.split_fraction[0.0, i], 100)

iscale.set_scaling_factor(self.valve01.control_volume.work, 1e-8)
iscale.set_scaling_factor(self.valve02.control_volume.work, 1e-8)
iscale.set_scaling_factor(self.valve03.control_volume.work, 1e-8)
iscale.set_scaling_factor(self.vsv.control_volume.work, 1e-8)
iscale.set_scaling_factor(self.valve01.control_volume.work, 1)
iscale.set_scaling_factor(self.valve02.control_volume.work, 1)
iscale.set_scaling_factor(self.valve03.control_volume.work, 1)
iscale.set_scaling_factor(self.vsv.control_volume.work, 1)
iscale.set_scaling_factor(self.cmp1.control_volume.work, 1e-8)
iscale.set_scaling_factor(self.gts1.control_volume.work, 1e-8)
iscale.set_scaling_factor(self.gts2.control_volume.work, 1e-8)
Expand Down Expand Up @@ -889,6 +889,7 @@ def initialize(
self.feed_fuel1.initialize(outlvl=outlvl, solver=solver, optarg=optarg)
# compressor
propagate_state(self.air01)
self.vsv.valve_opening.fix(1-1e-6)
self.vsv.initialize(outlvl=outlvl, solver=solver, optarg=optarg)
propagate_state(self.air02)
self.cmp1.initialize(outlvl=outlvl, solver=solver, optarg=optarg)
Expand Down
44 changes: 32 additions & 12 deletions idaes_examples/mod/power_gen/hrsg.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,16 +93,19 @@ def _add_unit_models(self):
prop_water = self.prop_water
prop_gas = self.prop_gas


######### LP Section ###########
self.econ_lp = BoilerHeatExchanger(
doc="LP Economizer",
delta_temperature_callback=delta_temp_cb,
cold_side_name="tube",
hot_side_name="shell",
tube={"property_package": prop_water,
"has_pressure_change": False,},
"has_pressure_change": False,
},
shell={"property_package": prop_gas,
"has_pressure_change": False,},
"has_pressure_change": False,
},
has_holdup=False,
flow_pattern=HeatExchangerFlowPattern.countercurrent,
tube_arrangement=TubeArrangement.inLine,
Expand All @@ -115,10 +118,12 @@ def _add_unit_models(self):
property_package=prop_water,
momentum_mixing_type=MomentumMixingType.none,
inlet_list=["econ_lp", "Preheater"],
property_package_args={'has_phase_equilibrium':False}
)
self.drum_lp = HelmPhaseSeparator(
doc="Phase separator for LP evaporator (partial evaporator)",
property_package=prop_water,
property_package_args={'has_phase_equilibrium':False}
)
self.evap_lp = HeatExchanger(
doc="LP evaporator heat exchanger section",
Expand All @@ -135,6 +140,7 @@ def _add_unit_models(self):
property_package=prop_water,
momentum_mixing_type=MomentumMixingType.none,
inlet_list=["main", "soec_makeup"],
property_package_args={'has_phase_equilibrium':False}
)
self.split_fg_lp = Splitter(
doc="LP superheater flue bypass gas splitter",
Expand Down Expand Up @@ -166,14 +172,19 @@ def _add_unit_models(self):
doc="LP liquid split to IP and HP pumps",
property_package=prop_water,
outlet_list=["toIP", "toHP"],
property_package_args={'has_phase_equilibrium':False}
)
self.pump_ip = WaterPump(
doc="Intermediate pressure pump",
property_package=prop_water,
has_phase_equilibrium=False,
property_package_args={'has_phase_equilibrium':False}
)
self.pump_hp = WaterPump(
doc="High pressure pump",
property_package=prop_water,
has_phase_equilibrium=False,
property_package_args={'has_phase_equilibrium':False}
)
######### IP Section ###########
self.econ_ip1 = BoilerHeatExchanger(
Expand All @@ -182,9 +193,9 @@ def _add_unit_models(self):
hot_side_name="shell",
cold_side_name="tube",
tube={"property_package": prop_water,
"has_pressure_change": True,},
"has_pressure_change": True},
shell={"property_package": prop_gas,
"has_pressure_change": True,},
"has_pressure_change": True},
has_holdup=False,
flow_pattern=HeatExchangerFlowPattern.countercurrent,
tube_arrangement=TubeArrangement.inLine,
Expand All @@ -195,21 +206,23 @@ def _add_unit_models(self):
doc="IP economizer hot water split for natural gas preheater",
property_package=prop_water,
outlet_list=["toIP_ECON2", "toNGPH"],
property_package_args={'has_phase_equilibrium':False}
)
self.econ_ip2 = BoilerHeatExchanger(
doc="IP ecomonmizer part 2",
delta_temperature_callback=delta_temp_cb,
hot_side_name="shell",
cold_side_name="tube",
tube={"property_package": prop_water,
"has_pressure_change": True,},
"has_pressure_change": True},
shell={"property_package": prop_gas,
"has_pressure_change": True,},
"has_pressure_change": True},
has_holdup=False,
flow_pattern=HeatExchangerFlowPattern.countercurrent,
tube_arrangement=TubeArrangement.inLine,
cold_side_water_phase="Liq",
has_radiation=False,
# has_phase_equilibrium=False,
)
self.evap_ip = HeatExchanger(
doc="IP evaporator (total evaporator)",
Expand All @@ -219,16 +232,17 @@ def _add_unit_models(self):
tube={"property_package": prop_water},
delta_temperature_callback=delta_temperature_lmtd_callback,
flow_pattern=HeatExchangerFlowPattern.countercurrent,

)
self.sh_ip1 = BoilerHeatExchanger(
doc="IP superheater 1",
delta_temperature_callback=delta_temp_cb,
hot_side_name="shell",
cold_side_name="tube",
tube={"property_package": prop_water,
"has_pressure_change": True,},
"has_pressure_change": True},
shell={"property_package": prop_gas,
"has_pressure_change": True,},
"has_pressure_change": True},
has_holdup=False,
flow_pattern=HeatExchangerFlowPattern.countercurrent,
tube_arrangement=TubeArrangement.inLine,
Expand All @@ -241,21 +255,24 @@ def _add_unit_models(self):
property_package=prop_water,
momentum_mixing_type=MomentumMixingType.none,
inlet_list=["sh_ip1", "Cold_reheat"],
property_package_args={'has_phase_equilibrium':False}
)
self.splitter_ip2 = HelmSplitter(
doc="IP Splitter 2, for ejector, reclaimer and dryer",
property_package=prop_water,
outlet_list=["Cold_reheat", "toEjector", "toReclaimer", "toDryer"],
# has_phase_equilibrium=False,
property_package_args={'has_phase_equilibrium':False}
)
self.sh_ip2 = BoilerHeatExchanger(
doc="IP superheater 2",
delta_temperature_callback=delta_temp_cb,
hot_side_name="shell",
cold_side_name="tube",
tube={"property_package": prop_water,
"has_pressure_change": True,},
"has_pressure_change": True},
shell={"property_package": prop_gas,
"has_pressure_change": True,},
"has_pressure_change": True},
has_holdup=False,
flow_pattern=HeatExchangerFlowPattern.countercurrent,
tube_arrangement=TubeArrangement.inLine,
Expand Down Expand Up @@ -355,6 +372,7 @@ def _add_unit_models(self):
self.evap_hp_valve = HelmValve(
doc="HP evaporator valve",
property_package=prop_water,
property_package_args={'has_phase_equilibrium':False}
)
self.evap_hp_valve.pressure_flow_equation.deactivate()
self.evap_hp = HeatExchanger(
Expand Down Expand Up @@ -436,7 +454,7 @@ def _add_flowsheet_constraints(self):
def ip_sat_vap_eqn(b, t):
return (
b.tube.properties_out[t].enth_mol / 1e4
== (b.tube.properties_out[t].enth_mol_sat_phase["Vap"] + 30) / 1e4
== (b.tube.properties_out[t].enth_mol_sat_phase["Vap"] + 30*pyo.units.J/pyo.units.mol) / 1e4
)

@self.evap_hp.Constraint(
Expand All @@ -445,7 +463,7 @@ def ip_sat_vap_eqn(b, t):
def hp_sat_vap_eqn(b, t):
return (
b.tube.properties_out[t].enth_mol / 1e4
== (b.tube.properties_out[t].enth_mol_sat_phase["Vap"] + 30) / 1e4
== (b.tube.properties_out[t].enth_mol_sat_phase["Vap"] + 30*pyo.units.J/pyo.units.mol) / 1e4
)

@self.mixer1.Constraint(self.config.time, doc="Mixed state pressure eqn.")
Expand Down Expand Up @@ -1020,6 +1038,8 @@ def _set_scaling_factors(self):
if hasattr(unit, "deltaP_tube_uturn"):
iscale.set_scaling_factor(unit.deltaP_tube_uturn, 1e-2)

# iscale.set_scaling_factor(self.sh_ip2.N_Pr_tube_eqn, 1e9)
# iscale.set_scaling_factor(self.sh_hp4.N_Pr_tube_eqn, 1e9)
iscale.set_scaling_factor(self.evap_lp.shell.heat, 1e-8)
iscale.set_scaling_factor(self.evap_lp.tube.heat, 1e-8)
iscale.set_scaling_factor(self.evap_lp.tube.heat, 1e-8)
Expand Down
3 changes: 1 addition & 2 deletions idaes_examples/mod/power_gen/ngcc.py
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ def reboiler_duty_eqn(b, t):

@self.Constraint(self.config.time)
def net_power_constraint(b, t):
return b.net_power_mw[t] / 100.0 == -b.net_power[t] / 1e6 / 100.0
return b.net_power_mw[t] / 100.0 == pyo.units.convert(-b.net_power[t] / 100.0,to_units=pyo.units.MW)

@self.Constraint(self.config.time)
def lp_steam_temperature_eqn(b, t):
Expand Down Expand Up @@ -438,7 +438,6 @@ def initialize(
self.cap_additional_reboiler_duty.fix()
self.fuel_lhv.fix()
self.fuel_hhv.fix()

self.gt.initialize(
load_from="gas_turbine_init.json.gz",
save_to="gas_turbine_init.json.gz",
Expand Down
20 changes: 15 additions & 5 deletions idaes_examples/mod/power_gen/steam_turbine.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,51 +68,61 @@ def _add_models(self):
num_lp=11, # full load ave P ratio about 0.7194 with outlet
hp_disconnect=[7], # disconnected for reheater
ip_disconnect=[10], # disconnected for HRSG LP steam mix
property_package_args={'has_phase_equilibrium':False}
)
self.steam_turbine_lp_mix = helm.HelmMixer(
doc="Mix LP steam from HRSG into turbine LP steam.",
property_package=self.prop_water,
momentum_mixing_type=helm.MomentumMixingType.none,
inlet_list=["turbine", "hrsg"],
property_package_args={'has_phase_equilibrium':False}
)
self.steam_turbine_lp_split = helm.HelmSplitter(
doc="Split off carbon capture steam.",
property_package=self.prop_water,
outlet_list=["turbine", "reboiler", "soec"],
property_package_args={'has_phase_equilibrium':False}
)
self.dummy_reheat = gum.Heater(
doc="Dummy reheater, can be deactivated to couple with HRSG.",
property_package=self.prop_water,
property_package_args={'has_phase_equilibrium':False}
)
self.main_condenser = helm.HelmNtuCondenser(
doc="Main steam turbine condenser.",
shell={
"has_pressure_change": False,
"property_package": self.prop_water,
'has_phase_equilibrium':False
},
tube={
"has_pressure_change": False,
"property_package": self.prop_water,
'has_phase_equilibrium':False
},
)
self.hotwell = helm.HelmMixer(
doc="Hotwell is a mixer to add makeup water.",
momentum_mixing_type=helm.MomentumMixingType.none,
inlet_list=["condensate", "makeup"],
property_package=self.prop_water,
property_package_args={'has_phase_equilibrium':False}
)
self.cond_pump = helm.HelmIsentropicCompressor(
doc="Hotwell condensate pump", property_package=self.prop_water
doc="Hotwell condensate pump", property_package=self.prop_water,
property_package_args={'has_phase_equilibrium':False}
)
self.return_mix = helm.HelmMixer(
doc="Mixer for steam streams returning to HRSG.",
property_package=self.prop_water,
property_package_args={'has_phase_equilibrium':False},
momentum_mixing_type=helm.MomentumMixingType.none,
inlet_list=["pump", "reboiler", "dryer", "reclaimer"],
)
self.reboiler = gum.Heater(
doc="Carbon capture system reboiler",
property_package=self.prop_water,
property_package_args={'has_phase_equilibrium':False}
)

def _add_constraints(self):
Expand All @@ -123,7 +133,7 @@ def lp_mixer_pressure_constraint(b, t):
1e-6 * b.turbine_state[t].pressure == 1e-6 * b.mixed_state[t].pressure
)

self.dummy_reheat.temperature_out = pyo.Var(self.time, initialize=850)
self.dummy_reheat.temperature_out = pyo.Var(self.time, initialize=850, units=pyo.units.K)

@self.dummy_reheat.Constraint(self.time)
def temperature_eqn(b, t):
Expand All @@ -146,8 +156,8 @@ def return_mixer_pressure_constraint(b, t):
return 1e-6 * b.pump_state[t].pressure == 1e-6 * b.mixed_state[t].pressure

# A few more variables and constraints
self.hp_steam_temperature = pyo.Var(self.time, initialize=855)
self.hot_reheat_temperature = pyo.Var(self.time, initialize=855)
self.hp_steam_temperature = pyo.Var(self.time, initialize=855, units=pyo.units.K)
self.hot_reheat_temperature = pyo.Var(self.time, initialize=855, units=pyo.units.K)

@self.Constraint(self.time)
def main_steam_temperature_eqn(b, t):
Expand All @@ -169,7 +179,7 @@ def reheat_steam_temperature_eqn(b, t):
def reboiler_condense_eqn(b, t):
return (
b.control_volume.properties_out[t].enth_mol
== b.control_volume.properties_out[t].enth_mol_sat_phase["Liq"] - 100
== b.control_volume.properties_out[t].enth_mol_sat_phase["Liq"] - 100*pyo.units.J/pyo.units.mol
)

def _add_arcs(self):
Expand Down
9 changes: 4 additions & 5 deletions idaes_examples/notebooks/_toc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@ parts:
sections:
- file: docs/power_gen/supercritical/supercritical_power_plant_doc
- file: docs/power_gen/supercritical/supercritical_steam_cycle_doc
- file: docs/power_gen/ngcc/index
sections:
- file: docs/power_gen/ngcc/ngcc_doc
- file: docs/power_gen/solid_oxide_cell/index
sections:
- file: docs/power_gen/solid_oxide_cell/soc_pid_control_doc
Expand All @@ -113,9 +116,5 @@ parts:
# note: directory active/ will not be included in the docs, but
# it is kept here so it is visible to the 'idaesx' command (e.g. for preprocessing or browsing)
# The 'file' entry generates a warning, but it is required by the TOC format
- file: active/power_gen/ngcc/index
sections:
# Moved this one to 'held'
# - file: active/power_gen/ngcc/ngcc_soec_doc
- file: active/power_gen/ngcc/ngcc_doc
root: index

This file was deleted.

Loading

0 comments on commit 78bccea

Please sign in to comment.