Skip to content

Commit

Permalink
clean up and black
Browse files Browse the repository at this point in the history
  • Loading branch information
MuktaHardikar committed Nov 28, 2024
1 parent fef6e97 commit 67ce1d3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -157,17 +157,6 @@ def add_constraints(m):
# m.fs.disposal.properties[0].conc_mass_phase_comp


# TODO: Add fraction of heat as solar
def add_energy_constraints(m):

@m.Constraint()
def eq_thermal_req(b):
return (
b.fs.energy.costing.aggregate_flow_heat
== -1 * b.fs.treatment.costing.aggregate_flow_heat * 0.5
)


def add_costing(m, treatment_costing_block, energy_costing_block):
# Solving the system before adding costing
solver = SolverFactory("ipopt")
Expand Down Expand Up @@ -635,7 +624,7 @@ def save_results(m):
water_recovery=0.8,
heat_price=0.08,
electricity_price=0.07,
frac_heat_from_grid=0.2,
frac_heat_from_grid=0.5,
hours_storage=6,
run_optimization=False,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
__all__ = [
"build_fpc",
"init_fpc",
"add_fpc_scaling",
"set_fpc_op_conditions",
"add_fpc_costing",
"report_fpc",
Expand Down Expand Up @@ -108,9 +109,10 @@ def set_system_op_conditions(m):


def add_fpc_scaling(m, blk):
iscale.set_scaling_factor(blk.unit.hours_storage, 10)
iscale.set_scaling_factor(blk.unit.electricity, 100)
iscale.set_scaling_factor(blk.unit.heat_load, 1e4)
iscale.set_scaling_factor(blk.unit.hours_storage, 1)
iscale.set_scaling_factor(blk.unit.electricity, 1e3)
iscale.set_scaling_factor(blk.unit.heat_load, 10)
iscale.get_scaling_factor(blk.unit.heat, 1e3)


def set_fpc_op_conditions(blk, hours_storage=6, temperature_hot=80):
Expand All @@ -120,15 +122,15 @@ def set_fpc_op_conditions(blk, hours_storage=6, temperature_hot=80):
blk.unit.temperature_hot.fix(temperature_hot)
# Assumes the cold temperature from the outlet temperature of a 'MD HX'
blk.unit.temperature_cold.set_value(20)
blk.unit.heat_load.fix(10)
# blk.unit.heat_load.fix(10)


def add_fpc_costing(blk, costing_block):
blk.unit.costing = UnitModelCostingBlock(flowsheet_costing_block=costing_block)


def calc_costing(m, blk):
blk.costing.heat_cost.set_value(0)
blk.costing.heat_cost.fix(0)
blk.costing.electricity_cost.fix(0.07)
blk.costing.cost_process()
blk.costing.initialize()
Expand Down Expand Up @@ -275,7 +277,7 @@ def main():
add_fpc_costing(m.fs.fpc, costing_block=m.fs.costing)
calc_costing(m, m.fs)
m.fs.fpc.unit.heat_load.unfix()
m.fs.costing.aggregate_flow_heat.fix(-20067.44)
m.fs.costing.aggregate_flow_heat.fix(-5000)

print(
"\nDegrees of Freedom after fixing aggregate heat flow:", degrees_of_freedom(m)
Expand Down

0 comments on commit 67ce1d3

Please sign in to comment.