Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating NGCC Flowsheet #98

Merged
merged 38 commits into from
Aug 1, 2024
Merged
Show file tree
Hide file tree
Changes from 31 commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
6361e96
Updating NGCC example
Mar 29, 2024
9ae006b
Updating _toc.yml
Mar 29, 2024
49d95ed
Updating _toc.yml
Mar 29, 2024
5132015
Resolving conflicts
Mar 29, 2024
f86a11e
Updating files
Mar 29, 2024
7fba982
fixing paths
Mar 29, 2024
75da48a
Updated files
Apr 2, 2024
2d26cb3
checking numerical issues
JavalVyas2000 Apr 22, 2024
2da772a
Merge branch 'main' into ngcc
lbianchi-lbl Apr 23, 2024
4610b74
fixing numerical issues
JavalVyas2000 Apr 24, 2024
82d079d
fixing numerical issues
JavalVyas2000 Apr 24, 2024
9ccd36b
updating for tests to run
May 23, 2024
8e35271
resolving merge conflicts
May 23, 2024
9dd2bf4
resolving conflicts
May 23, 2024
c368fbf
removing unnecessary files
May 23, 2024
8bd2a55
resolving spell errors
May 23, 2024
94c0a64
resolving all spell errors
May 23, 2024
bc21346
trying to resolve the numerical error
May 23, 2024
a090701
updating ngcc
May 23, 2024
5e7b113
trying to debug
May 23, 2024
5847a92
trying to run few tests
May 23, 2024
bb1f253
trying to debug
May 23, 2024
2d45890
trying initialize without presolved models
May 23, 2024
fda69e4
not saving solutions
May 24, 2024
de79b69
Merge branch 'main' of https://github.com/IDAES/examples into ngcc
May 30, 2024
2074ff8
adding ignore_parallel_components
May 30, 2024
9f296ba
clearing output
May 30, 2024
262ecfa
trying to add the presaved solutions
May 30, 2024
4fae594
adding back ignore_parallel_components
May 30, 2024
1ffdf5a
removing presaved solutions
May 30, 2024
14eb53d
commenting save options
May 30, 2024
d83b8d2
Delete idaes_examples/notebooks/docs/flowsheets/results.txt
JavalVyas2000 May 30, 2024
fa94cab
Merge branch 'main' into ngcc
JavalVyas2000 Jun 27, 2024
ce228f2
Merge branch 'main' into ngcc
JavalVyas2000 Jul 25, 2024
348a528
resolving windows error locally
Jul 25, 2024
8a2c8b9
Merge branch 'ngcc' of https://github.com/JavalVyas2000/IDAES-example…
Jul 25, 2024
e4c05f7
updating maintainer date
Jul 25, 2024
ba783c3
updating maintainer date
Jul 25, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 15 additions & 12 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 @@ -852,8 +852,10 @@ def initialize(
outlvl=idaeslog.NOTSET,
solver=None,
optarg=None,
load_from="gas_turbine_init.json.gz",
save_to="gas_turbine_init.json.gz",
# load_from="gas_turbine_init.json.gz",
# save_to="gas_turbine_init.json.gz",
load_from=None,
save_to=None,
):
"""Initialize the gas turbine flowsheet

Expand Down Expand Up @@ -889,6 +891,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
50 changes: 36 additions & 14 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 Expand Up @@ -1058,8 +1078,10 @@ def initialize(
outlvl=idaeslog.NOTSET,
solver=None,
optarg=None,
load_from="hrsg_init.json.gz",
save_to="hrsg_init.json.gz",
# load_from="hrsg_init.json.gz",
# save_to="hrsg_init.json.gz",
load_from=None,
save_to=None,
):
"""Initialize the HRSG flowsheet

Expand Down
23 changes: 13 additions & 10 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 @@ -418,8 +418,10 @@ def initialize(
outlvl=idaeslog.NOTSET,
solver=None,
optarg=None,
load_from="ngcc_init.json.gz",
save_to="ngcc_init.json.gz",
# load_from="ngcc_init.json.gz",
# save_to="ngcc_init.json.gz",
load_from=None,
save_to=None,
):

init_log = idaeslog.getInitLogger(self.name, outlvl, tag="flowsheet")
Expand All @@ -438,23 +440,24 @@ 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",
# load_from="gas_turbine_init.json.gz",
# save_to="gas_turbine_init.json.gz",
load_from=None,
save_to=None
)
propagate_state(self.g08a)
self.fg_translate.initialize()
propagate_state(self.g08b, overwrite_fixed=True)
self.hrsg.initialize(
load_from="hrsg_init.json.gz",
save_to="hrsg_init.json.gz",
load_from=None,
save_to=None
)
self.hrsg.sh_hp4.shell_inlet.unfix()
propagate_state(self.t05a, overwrite_fixed=True)
self.st.initialize(
load_from="steam_turbine_init.json.gz",
save_to="steam_turbine_init.json.gz",
load_from=None,
save_to=None
)

init_log.info(f"Open tears")
Expand Down
Loading
Loading