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

Supercritical co2 example #69

Merged
merged 84 commits into from
Feb 19, 2024
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
84 commits
Select commit Hold shift + click to select a range
87fa04d
Updated the HDA example exercise and solution
Jul 10, 2023
f22d48e
Adding supercritical CO2 example
Aug 8, 2023
96ad891
Encorporated changes
Aug 21, 2023
1bd8a63
Cleaned up pdf plots and filenames
Aug 22, 2023
9a62890
Removed HDA examples
Aug 24, 2023
f84cc4d
Revert "Updated the HDA example exercise and solution"
Aug 25, 2023
a2dc179
Revert "Removed HDA examples"
Aug 25, 2023
33909f8
Trying with replacing files from latest clone.
Aug 25, 2023
af9312c
Revert "Trying with replacing files from latest clone."
Aug 25, 2023
7b4f943
Changing HDA files to forked version
Aug 25, 2023
9c40b5f
New notebook SCO2_alamo_surrogate in directory docs/surrogates/alamo
Sep 27, 2023
cc73e13
New notebook supercritical_CO2_flowsheet in directory docs/surrogates…
Sep 27, 2023
c7189fc
New notebook supercritical_CO2_surrogate in directory docs/surrogates…
Sep 27, 2023
a32d719
New notebook supercritical_CO2_surrogate in directory docs/surrogates…
Sep 27, 2023
f6cac7a
New notebook supercritical_CO2_surrogate in directory docs/surrogates…
Sep 27, 2023
ff2ca22
Merge branch 'supercritcial_CO2_example' of https://github.com/JavalV…
bpaul4 Oct 10, 2023
864306d
Incorporate review suggestions
bpaul4 Oct 10, 2023
a3b928b
Add new notebooks to TOC
bpaul4 Oct 10, 2023
31fcfab
Missed some references, add those as links
bpaul4 Oct 10, 2023
55618a5
Missed file endings in _toc file
bpaul4 Oct 10, 2023
729abba
Add files generated by build and run tests
bpaul4 Oct 10, 2023
eb9a006
Fix test failures from misnamed references to StateBlock
bpaul4 Oct 10, 2023
6f2fc30
Fix test failure by improving heater initializations
bpaul4 Oct 11, 2023
14644d9
Merge branch 'main' into supercritcial_CO2_example
bpaul4 Oct 11, 2023
76f4a12
Merge branch 'supercritcial_CO2_example' of https://github.com/JavalV…
bpaul4 Oct 11, 2023
f443189
Force check-in missing saved model files
bpaul4 Oct 11, 2023
d0d1140
Skip notebooks requiring ALAMO
bpaul4 Oct 11, 2023
040c9b6
Fix indent
bpaul4 Oct 11, 2023
b5d891a
Fix typos
bpaul4 Oct 11, 2023
652e20e
Try using actual notebooks from only ones that call training
bpaul4 Oct 11, 2023
463b97a
Merge branch 'supercritcial_CO2_example' of https://github.com/JavalV…
Jan 24, 2024
01f917c
updated _toc.yml
Jan 24, 2024
d979264
Skipping ALAMO files for testing
Jan 24, 2024
ad40491
Resolving conflict in _toc.yml
Jan 24, 2024
e2c6bd3
Skipping using paths-ignore
Jan 24, 2024
3957059
Resolving _toc conflict
Jan 24, 2024
4b27e5f
Fixed typo in _toc
Jan 24, 2024
28f444b
fixed paths in _toc
Jan 24, 2024
60668fd
Reverting to previous version of _ toc
Jan 24, 2024
5d58e1b
Reverting to previous core.yml
Jan 24, 2024
4e64e78
Merge branch 'main' into supercritcial_CO2_example
JavalVyas2000 Jan 24, 2024
2c37746
Skipping ALAMO files
Jan 24, 2024
08e6bff
Merge branch 'supercritcial_CO2_example' of https://github.com/JavalV…
Jan 24, 2024
47d11f6
Updating core.yml
Jan 24, 2024
12c8c24
Trying to resolve test failure
Jan 24, 2024
4e7a24f
Updating the _toc.yml
Jan 24, 2024
7463c9c
Skipping files with -k flag
Jan 24, 2024
b8ed3c5
Updating the _toc.yml
Jan 24, 2024
5b51417
Trying with ignore blob
Jan 24, 2024
346a8c5
Adding metadata
Jan 24, 2024
9ee5d85
Fixing .pb file
Jan 25, 2024
eb727de
Adding .gitattributes
Jan 25, 2024
33cd527
Create .gitattributes
JavalVyas2000 Jan 25, 2024
dbe0e3e
Removing .txt file
Jan 25, 2024
10c3200
Cleaning the comments
Jan 25, 2024
4cfd7eb
Adding the changes
Feb 9, 2024
63468d0
Fixing notebook name
Feb 9, 2024
027703f
Merge branch 'main' into supercritcial_CO2_example
lbianchi-lbl Feb 9, 2024
7c121a1
fixing image path
Feb 10, 2024
909ef7d
Merge branch 'supercritcial_CO2_example' of https://github.com/JavalV…
Feb 10, 2024
a8bc96b
Fixing path for image
Feb 12, 2024
3305035
Fixing path in all notebooks
Feb 12, 2024
831e1bd
Fixing surrogate paths for pysmo
Feb 13, 2024
e6a65e5
Trying to fix path
Feb 13, 2024
e2e34f6
fixing paths
Feb 13, 2024
d8d8f6a
fixing paths
Feb 13, 2024
61fe8ad
Reorganizing the files
Feb 13, 2024
a1ab28c
fixing paths
Feb 13, 2024
122a59a
Attempting to fix paths
Feb 13, 2024
11b50af
fixing pysmo path
Feb 15, 2024
04e514e
fixing path
Feb 15, 2024
234a503
adding dummy file to add folder
Feb 15, 2024
563707c
Adding sco2_keras_surr folder
JavalVyas2000 Feb 15, 2024
5e1449c
Adding pysmo_poly_surrogate.json
JavalVyas2000 Feb 15, 2024
5de98d9
fixing omlt path
Feb 15, 2024
0040b5e
Merge branch 'supercritcial_CO2_example' of https://github.com/JavalV…
Feb 15, 2024
dbee5cf
Adding files to sco2_keras_surr
JavalVyas2000 Feb 15, 2024
0d3198a
fixing paths
Feb 15, 2024
ed0f7b9
Create dummy_file
JavalVyas2000 Feb 15, 2024
c53ef9c
Adding variables folder
JavalVyas2000 Feb 15, 2024
5e594cf
fixing reference paths
Feb 15, 2024
fae5bac
fixing reference paths
Feb 15, 2024
2c29d6b
adding changes
Feb 16, 2024
4b0cb30
clean up
Feb 16, 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

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,241 @@
"""

SCO2 baseline cycle from the NETL baseline report

Case Baseline620 - Turbine inlet temperature 893.15 K (620 C).
Case Basleine760 - Turbine inlet temperature 1033.15 K (760 C).

"""
from pyomo.environ import (ConcreteModel,
Block,
Var,
Param,
Constraint,
SolverFactory,
TransformationFactory, TerminationCondition,
value, Expression, minimize, units)
from pyomo.network import Arc, SequentialDecomposition

# Import IDAES libraries
from idaes.core import FlowsheetBlock, UnitModelBlockData
from idaes.models.unit_models import (Mixer, MomentumMixingType,
PressureChanger, Heater,
Separator, HeatExchanger)
from idaes.models.unit_models.pressure_changer import ThermodynamicAssumption
from idaes.core.util.model_statistics import degrees_of_freedom
from idaes.core.util.initialization import propagate_state
from SCO2_properties_alamo_surrogate import SCO2ParameterBlock
import idaes.logger as idaeslog

def main():
# Setup solver and options
solver = SolverFactory('ipopt')
outlvl = 0
tee = True

# Set up concrete model
m = ConcreteModel()

# Create a flowsheet block
m.fs = FlowsheetBlock(dynamic=False)

# Create the properties param block
m.fs.properties = SCO2ParameterBlock()

# Add unit models to the flowsheet
m.fs.boiler = Heater(dynamic=False,property_package= m.fs.properties,has_pressure_change=True)

m.fs.turbine = PressureChanger(dynamic=False,
property_package= m.fs.properties,
compressor=False,
thermodynamic_assumption=ThermodynamicAssumption.isentropic)

m.fs.HTR_pseudo_shell = Heater(dynamic= False,
property_package= m.fs.properties,
has_pressure_change= True)

m.fs.HTR_pseudo_tube = Heater(dynamic=False,
property_package= m.fs.properties,
has_pressure_change= True)

m.fs.LTR_pseudo_shell = Heater(dynamic= False,
property_package= m.fs.properties,
has_pressure_change=True)

m.fs.LTR_pseudo_tube = Heater(dynamic= False,
property_package= m.fs.properties,
has_pressure_change=True)

m.fs.splitter_1 = Separator(property_package= m.fs.properties,
outlet_list= ["bypass", "to_cooler"])

m.fs.co2_cooler = Heater(dynamic= False,
property_package=m.fs.properties,
has_pressure_change= True)

m.fs.main_compressor = PressureChanger(dynamic= False,
property_package= m.fs.properties,
compressor= True,
thermodynamic_assumption= ThermodynamicAssumption.isentropic)

m.fs.bypass_compressor = PressureChanger(dynamic= False,
property_package= m.fs.properties,
compressor= True,
thermodynamic_assumption= ThermodynamicAssumption.isentropic)

m.fs.splitter_2 = Separator(property_package= m.fs.properties,
ideal_separation= False,
outlet_list= ["to_FG_cooler",
"to_LTR"])

m.fs.FG_cooler = Heater(dynamic= False,
property_package= m.fs.properties,
has_pressure_change= True)

m.fs.mixer = Mixer(property_package= m.fs.properties,
inlet_list=["FG_out", "LTR_out", "bypass"])

# # Connect the flowsheet
m.fs.s01 = Arc(source=m.fs.boiler.outlet,
destination=m.fs.turbine.inlet)
m.fs.s02 = Arc(source=m.fs.turbine.outlet,
destination=m.fs.HTR_pseudo_shell.inlet)
m.fs.s03 = Arc(source=m.fs.HTR_pseudo_shell.outlet,
destination=m.fs.LTR_pseudo_shell.inlet)
m.fs.s04 = Arc(source=m.fs.LTR_pseudo_shell.outlet,
destination=m.fs.splitter_1.inlet)
m.fs.s05 = Arc(source=m.fs.splitter_1.to_cooler,
destination=m.fs.co2_cooler.inlet)
m.fs.s06 = Arc(source=m.fs.splitter_1.bypass,
destination=m.fs.bypass_compressor.inlet)
m.fs.s07 = Arc(source=m.fs.co2_cooler.outlet,
destination=m.fs.main_compressor.inlet)
m.fs.s08 = Arc(source=m.fs.bypass_compressor.outlet,
destination=m.fs.mixer.bypass)
m.fs.s09 = Arc(source=m.fs.main_compressor.outlet,
destination=m.fs.splitter_2.inlet)
m.fs.s10 = Arc(source=m.fs.splitter_2.to_FG_cooler,
destination=m.fs.FG_cooler.inlet)
m.fs.s11 = Arc(source=m.fs.splitter_2.to_LTR,
destination=m.fs.LTR_pseudo_tube.inlet)
m.fs.s12 = Arc(source=m.fs.LTR_pseudo_tube.outlet,
destination=m.fs.mixer.LTR_out)
m.fs.s13 = Arc(source=m.fs.FG_cooler.outlet,
destination=m.fs.mixer.FG_out)
m.fs.s14 = Arc(source=m.fs.mixer.outlet,
destination=m.fs.HTR_pseudo_tube.inlet)

# NETL Baseline
m.fs.boiler.inlet.flow_mol.fix(121.1)
m.fs.boiler.inlet.temperature.fix(685.15)
m.fs.boiler.inlet.pressure.fix(34.51)

m.fs.boiler.outlet.temperature.fix(893.15) # Turbine inlet T = 620 C
m.fs.boiler.deltaP.fix(-0.21)

m.fs.boiler.initialize(outlvl=outlvl)

propagate_state(m.fs.s01)

m.fs.turbine.ratioP.fix(1/3.68)
m.fs.turbine.efficiency_isentropic.fix(0.927)
m.fs.turbine.initialize(outlvl=outlvl)

propagate_state(m.fs.s02)
m.fs.HTR_pseudo_shell.outlet.temperature.fix(489.15)
m.fs.HTR_pseudo_shell.deltaP.fix(-0.07)

m.fs.HTR_pseudo_shell.initialize(outlvl=outlvl)


propagate_state(m.fs.s03)

m.fs.LTR_pseudo_shell.outlet.temperature.fix(354.15)
m.fs.LTR_pseudo_shell.deltaP.fix(-0.07)
m.fs.LTR_pseudo_shell.initialize(outlvl=outlvl)


propagate_state(m.fs.s04)
m.fs.splitter_1.split_fraction[0, "bypass"].fix(0.25)

m.fs.splitter_1.initialize(outlvl=outlvl)

propagate_state(m.fs.s05)
m.fs.co2_cooler.outlet.temperature.fix(308.15)
m.fs.co2_cooler.deltaP.fix(-0.07)
m.fs.co2_cooler.initialize(outlvl=outlvl)


propagate_state(m.fs.s06)
m.fs.bypass_compressor.efficiency_isentropic.fix(0.85)
m.fs.bypass_compressor.ratioP.fix(3.8)
m.fs.bypass_compressor.initialize(outlvl=outlvl)

propagate_state(m.fs.s07)
m.fs.main_compressor.efficiency_isentropic.fix(0.85)
m.fs.main_compressor.ratioP.fix(3.8)
m.fs.main_compressor.initialize(outlvl=outlvl)

propagate_state(m.fs.s09)

m.fs.splitter_2.split_fraction[0, "to_FG_cooler"].fix(0.046)
m.fs.splitter_2.initialize(outlvl=outlvl)

propagate_state(m.fs.s10)
m.fs.FG_cooler.outlet.temperature.fix(483.15)
m.fs.FG_cooler.deltaP.fix(-0.06)
m.fs.FG_cooler.initialize(outlvl=outlvl)


propagate_state(m.fs.s11)

m.fs.LTR_pseudo_tube.deltaP.fix(0)
m.fs.LTR_pseudo_tube.heat_duty[0].\
fix(-value(m.fs.LTR_pseudo_shell.heat_duty[0]))
m.fs.LTR_pseudo_tube.initialize(outlvl=outlvl)

# Add constraint heats of the LTR_pseudo shell and tube
m.fs.LTR_pseudo_tube.heat_duty[0].unfix()
m.fs.c1 = Constraint(expr=m.fs.LTR_pseudo_shell.heat_duty[0] ==
-m.fs.LTR_pseudo_tube.heat_duty[0])

propagate_state(m.fs.s08)
propagate_state(m.fs.s12)
propagate_state(m.fs.s13)

m.fs.mixer.initialize(outlvl=outlvl)

propagate_state(m.fs.s14)

m.fs.HTR_pseudo_tube.heat_duty[0].\
fix(-value(m.fs.HTR_pseudo_shell.heat_duty[0]))
m.fs.HTR_pseudo_tube.deltaP.fix(-0.07)
m.fs.HTR_pseudo_tube.initialize(outlvl=outlvl)

m.fs.HTR_pseudo_tube.heat_duty[0].unfix()
m.fs.c2 = Constraint(expr=m.fs.HTR_pseudo_shell.heat_duty[0] ==
-m.fs.HTR_pseudo_tube.heat_duty[0])

TransformationFactory("network.expand_arcs").apply_to(m.fs)

print("--------------------------------------------------------------------")
print("The degrees of freedom for the flowsheet is ", degrees_of_freedom(m))
print("--------------------------------------------------------------------")

solver.solve(m, tee=tee)

#
from idaes.core.util.units_of_measurement import convert_quantity_to_reporting_units,report_quantity
# Print reports
for i in m.fs.component_objects(Block):
if isinstance(i, UnitModelBlockData):
i.report()

# Converting units for readability
print(-1*value(units.convert(m.fs.turbine.work_mechanical[0],units.kW))\
-1*value(units.convert(m.fs.main_compressor.work_mechanical[0],units.kW))\
-1*value(units.convert(m.fs.bypass_compressor.work_mechanical[0],units.kW)),units.kW)
return m

if __name__ == "__main__":
m = main()

Large diffs are not rendered by default.

Loading