Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
source=m.fs.turb.lp_split[11].outlet_2, destination=m.fs.fwh1.drain_mix.steam
)
m.fs.COND_03 = Arc(
source=m.fs.cond_pump.outlet, destination=m.fs.fwh1.condense.inlet_2
)
m.fs.FWH1_DRN1 = Arc(
source=m.fs.fwh1.condense.outlet_1, destination=m.fs.fwh1_pump.inlet
)
m.fs.FWH1_DRN2 = Arc(
source=m.fs.fwh1_pump.outlet, destination=m.fs.fwh1_return.fwh1_drain
)
m.fs.FW01A = Arc(
source=m.fs.fwh1.condense.outlet_2, destination=m.fs.fwh1_return.feedwater
)
# fwh2
m.fs.FW01B = Arc(
source=m.fs.fwh1_return.outlet, destination=m.fs.fwh2.cooling.inlet_2
)
m.fs.FWH2_DRN = Arc(
source=m.fs.fwh2.cooling.outlet_1, destination=m.fs.fwh1.drain_mix.drain
)
m.fs.EXTR_LP10 = Arc(
source=m.fs.turb.lp_split[10].outlet_2,
destination=m.fs.fwh2.desuperheat.inlet_1,
)
# fwh3
m.fs.FW02 = Arc(
source=m.fs.fwh2.desuperheat.outlet_2, destination=m.fs.fwh3.cooling.inlet_2
)
m.fs.FWH3_DRN = Arc(
source=m.fs.fwh3.cooling.outlet_1, destination=m.fs.fwh2.drain_mix.drain
)
############################################################################
# High-pressure feedwater heaters #
############################################################################
# fwh6
m.fs.FW05B = Arc(source=m.fs.bfp.outlet, destination=m.fs.fwh6.cooling.inlet_2)
m.fs.FWH6_DRN = Arc(
source=m.fs.fwh6.cooling.outlet_1, destination=m.fs.fwh5_da.drain
)
m.fs.EXTR_IP5 = Arc(
source=m.fs.turb.ip_split[5].outlet_2, destination=m.fs.fwh6.desuperheat.inlet_1
)
# fwh7
m.fs.FW06 = Arc(
source=m.fs.fwh6.desuperheat.outlet_2, destination=m.fs.fwh7.cooling.inlet_2
)
m.fs.FWH7_DRN = Arc(
source=m.fs.fwh7.cooling.outlet_1, destination=m.fs.fwh6.drain_mix.drain
)
m.fs.EXTR_HP7 = Arc(
source=m.fs.turb.hp_split[7].outlet_2, destination=m.fs.fwh7.desuperheat.inlet_1
)
# fwh8
m.fs.FW07 = Arc(
source=m.fs.fwh7.desuperheat.outlet_2, destination=m.fs.fwh8.cooling.inlet_2
)
m.fs.FWH8_DRN = Arc(
source=m.fs.fwh8.cooling.outlet_1, destination=m.fs.fwh7.drain_mix.drain
)
m.fs.EXTR_HP4 = Arc(
source=m.fs.turb.hp_split[4].outlet_2, destination=m.fs.fwh8.desuperheat.inlet_1
)
m.fs.FW03 = Arc(
source=m.fs.fwh3.desuperheat.outlet_2, destination=m.fs.fwh4.cooling.inlet_2
)
m.fs.FWH4_DRN = Arc(
source=m.fs.fwh4.cooling.outlet_1, destination=m.fs.fwh3.drain_mix.drain
)
m.fs.EXTR_LP4 = Arc(
source=m.fs.turb.lp_split[4].outlet_2, destination=m.fs.fwh4.desuperheat.inlet_1
)
############################################################################
# FWH5 (Deaerator) and boiler feed pump (BFP) #
############################################################################
m.fs.FW04 = Arc(
source=m.fs.fwh4.desuperheat.outlet_2, destination=m.fs.fwh5_da.feedwater
)
m.fs.EXTR_IP10 = Arc(
source=m.fs.turb.ip_split[10].outlet_2, destination=m.fs.fwh5_da.steam
)
m.fs.FW05A = Arc(source=m.fs.fwh5_da.outlet, destination=m.fs.bfp.inlet)
m.fs.EXTR_BFPT_A = Arc(
source=m.fs.turb.ip_split[10].outlet_3, destination=m.fs.bfpt.inlet
)
m.fs.EXHST_BFPT = Arc(source=m.fs.bfpt.outlet, destination=m.fs.condenser_mix.bfpt)
############################################################################
# High-pressure feedwater heaters #
############################################################################
# fwh6
m.fs.FW05B = Arc(source=m.fs.bfp.outlet, destination=m.fs.fwh6.cooling.inlet_2)
m.fs.FWH6_DRN = Arc(
source=m.fs.fwh6.cooling.outlet_1, destination=m.fs.fwh5_da.drain
)
m.fs.EXTR_IP5 = Arc(
# heat loss in the boiler, so actual plant efficiency would be lower.
@m.fs.Expression(m.fs.time)
def steam_cycle_eff(b, t):
return -100 * b.turb.power[t] / b.boiler_heat[t]
############################################################################
## Create the stream Arcs ##
############################################################################
############################################################################
# Connect turbine and condenser units #
############################################################################
m.fs.EXHST_MAIN = Arc(
source=m.fs.turb.outlet_stage.outlet, destination=m.fs.condenser_mix.main
)
m.fs.condenser_mix_to_condenser = Arc(
source=m.fs.condenser_mix.outlet_tpx, destination=m.fs.condenser.inlet_1
)
m.fs.COND_01 = Arc(
source=m.fs.condenser.outlet_1_ph, destination=m.fs.hotwell.condensate
)
m.fs.COND_02 = Arc(source=m.fs.hotwell.outlet, destination=m.fs.cond_pump.inlet)
############################################################################
# Low pressure FWHs #
############################################################################
m.fs.EXTR_LP11 = Arc(
source=m.fs.turb.lp_split[11].outlet_2, destination=m.fs.fwh1.drain_mix.steam
)
m.fs.COND_03 = Arc(
source=m.fs.cond_pump.outlet, destination=m.fs.fwh1.condense.inlet_2
)
m.fs.FWH1_DRN1 = Arc(
source=m.fs.fwh6.desuperheat.outlet_2, destination=m.fs.fwh7.cooling.inlet_2
)
m.fs.FWH7_DRN = Arc(
source=m.fs.fwh7.cooling.outlet_1, destination=m.fs.fwh6.drain_mix.drain
)
m.fs.EXTR_HP7 = Arc(
source=m.fs.turb.hp_split[7].outlet_2, destination=m.fs.fwh7.desuperheat.inlet_1
)
# fwh8
m.fs.FW07 = Arc(
source=m.fs.fwh7.desuperheat.outlet_2, destination=m.fs.fwh8.cooling.inlet_2
)
m.fs.FWH8_DRN = Arc(
source=m.fs.fwh8.cooling.outlet_1, destination=m.fs.fwh7.drain_mix.drain
)
m.fs.EXTR_HP4 = Arc(
source=m.fs.turb.hp_split[4].outlet_2, destination=m.fs.fwh8.desuperheat.inlet_1
)
############################################################################
# Turn the Arcs into constraints and return the model #
############################################################################
pyo.TransformationFactory("network.expand_arcs").apply_to(m.fs)
return m
# deactivate constraints linking the FWH8 to HP turbine
m.fs.boiler_pressure_drop.deactivate()
m.fs.close_flow.deactivate()
m.fs.turb.constraint_reheat_flow.deactivate()
m.fs.turb.constraint_reheat_press.deactivate()
m.fs.turb.constraint_reheat_temp.deactivate()
m.fs.turb.inlet_split.inlet.enth_mol.unfix()
m.fs.turb.inlet_split.inlet.pressure.unfix()
# user can fix the boiler feed water pump pressure (uncomenting next line)
# m.fs.bfp.outlet.pressure[:].fix(26922222.222))
m.fs.FHWtoECON = Arc(source=m.fs.fwh8.desuperheat.outlet_2,
destination=m.fs.ECON.side_1_inlet)
m.fs.Att2HP = Arc(source=m.fs.ATMP1.outlet,
destination=m.fs.turb.inlet_split.inlet)
m.fs.HPout2RH = Arc(source=m.fs.turb.hp_split[7].outlet_1,
destination=m.fs.RH.side_1_inlet)
m.fs.RHtoIP = Arc(source=m.fs.RH.side_1_outlet,
destination=m.fs.turb.ip_stages[1].inlet)
pyo.TransformationFactory("network.expand_arcs").apply_to(m)
# unfix boiler connections
m.fs.ECON.side_1_inlet.flow_mol.unfix()
m.fs.ECON.side_1_inlet.enth_mol[0].unfix()
m.fs.ECON.side_1_inlet.pressure[0].unfix()
m.fs.RH.side_1_inlet.flow_mol.unfix()
m.fs.RH.side_1_inlet.enth_mol[0].unfix()
source=m.fs.fwh4.cooling.outlet_1, destination=m.fs.fwh3.drain_mix.drain
)
m.fs.EXTR_LP4 = Arc(
source=m.fs.turb.lp_split[4].outlet_2, destination=m.fs.fwh4.desuperheat.inlet_1
)
############################################################################
# FWH5 (Deaerator) and boiler feed pump (BFP) #
############################################################################
m.fs.FW04 = Arc(
source=m.fs.fwh4.desuperheat.outlet_2, destination=m.fs.fwh5_da.feedwater
)
m.fs.EXTR_IP10 = Arc(
source=m.fs.turb.ip_split[10].outlet_2, destination=m.fs.fwh5_da.steam
)
m.fs.FW05A = Arc(source=m.fs.fwh5_da.outlet, destination=m.fs.bfp.inlet)
m.fs.EXTR_BFPT_A = Arc(
source=m.fs.turb.ip_split[10].outlet_3, destination=m.fs.bfpt.inlet
)
m.fs.EXHST_BFPT = Arc(source=m.fs.bfpt.outlet, destination=m.fs.condenser_mix.bfpt)
############################################################################
# High-pressure feedwater heaters #
############################################################################
# fwh6
m.fs.FW05B = Arc(source=m.fs.bfp.outlet, destination=m.fs.fwh6.cooling.inlet_2)
m.fs.FWH6_DRN = Arc(
source=m.fs.fwh6.cooling.outlet_1, destination=m.fs.fwh5_da.drain
)
m.fs.EXTR_IP5 = Arc(
source=m.fs.turb.ip_split[5].outlet_2, destination=m.fs.fwh6.desuperheat.inlet_1
)
# fwh7
m.fs.FW06 = Arc(
# fwh2
m.fs.FW01B = Arc(
source=m.fs.fwh1_return.outlet, destination=m.fs.fwh2.cooling.inlet_2
)
m.fs.FWH2_DRN = Arc(
source=m.fs.fwh2.cooling.outlet_1, destination=m.fs.fwh1.drain_mix.drain
)
m.fs.EXTR_LP10 = Arc(
source=m.fs.turb.lp_split[10].outlet_2,
destination=m.fs.fwh2.desuperheat.inlet_1,
)
# fwh3
m.fs.FW02 = Arc(
source=m.fs.fwh2.desuperheat.outlet_2, destination=m.fs.fwh3.cooling.inlet_2
)
m.fs.FWH3_DRN = Arc(
source=m.fs.fwh3.cooling.outlet_1, destination=m.fs.fwh2.drain_mix.drain
)
m.fs.EXTR_LP8 = Arc(
source=m.fs.turb.lp_split[8].outlet_2, destination=m.fs.fwh3.desuperheat.inlet_1
)
# fwh4
m.fs.FW03 = Arc(
source=m.fs.fwh3.desuperheat.outlet_2, destination=m.fs.fwh4.cooling.inlet_2
)
m.fs.FWH4_DRN = Arc(
source=m.fs.fwh4.cooling.outlet_1, destination=m.fs.fwh3.drain_mix.drain
)
m.fs.EXTR_LP4 = Arc(
source=m.fs.turb.lp_split[4].outlet_2, destination=m.fs.fwh4.desuperheat.inlet_1
)
############################################################################
def build_flowsheet():
m = ConcreteModel()
m.fs = FlowsheetBlock(default={"dynamic": False})
m.fs.BT_props = BTXParameterBlock()
m.fs.M01 = Mixer(default={"property_package": m.fs.BT_props})
m.fs.H02 = Heater(default={"property_package": m.fs.BT_props})
m.fs.F03 = Flash(default={"property_package": m.fs.BT_props})
m.fs.s01 = Arc(source=m.fs.M01.outlet, destination=m.fs.H02.inlet)
m.fs.s02 = Arc(source=m.fs.H02.outlet, destination=m.fs.F03.inlet)
TransformationFactory("network.expand_arcs").apply_to(m.fs)
return m
# Create connections internal to each turbine section (hp, ip, and lp)
self.hp_stream = Arc(
self.hp_stream_idx, rule=_arc_rule(self.hp_stages, self.hp_split)
)
self.ip_stream = Arc(
self.ip_stream_idx, rule=_arc_rule(self.ip_stages, self.ip_split)
)
self.lp_stream = Arc(
self.lp_stream_idx, rule=_arc_rule(self.lp_stages, self.lp_split)
)
# Connect hp section to ip section unless its a disconnect location
last_hp = config.num_hp
if 0 not in config.ip_disconnect and last_hp not in config.hp_disconnect:
if last_hp in config.hp_split_locations: # connect splitter to ip
self.hp_to_ip_stream = Arc(
source=self.hp_split[last_hp].outlet_1,
destination=self.ip_stages[1].inlet,
)
else: # connect last hp to ip
self.hp_to_ip_stream = Arc(
source=self.hp_stages[last_hp].outlet,
destination=self.ip_stages[1].inlet,
)
# Connect ip section to lp section unless its a disconnect location
last_ip = config.num_ip
if 0 not in config.lp_disconnect and last_ip not in config.ip_disconnect:
if last_ip in config.ip_split_locations: # connect splitter to ip
self.ip_to_lp_stream = Arc(
source=self.ip_split[last_ip].outlet_1,
destination=self.lp_stages[1].inlet,
)