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

add crystallizer flowsheet #1482

Draft
wants to merge 9 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
92 changes: 1 addition & 91 deletions watertap/costing/unit_models/crystallizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def build_crystallizer_cost_param_block(blk):
)

costing = blk.parent_block()
costing.register_flow_type("steam", blk.steam_cost)
#costing.register_flow_type("steam", blk.steam_cost)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

delete commented code

costing.register_flow_type("NaCl", blk.NaCl_recovery_value)


Expand All @@ -120,27 +120,6 @@ def cost_crystallizer(blk, cost_type=CrystallizerCostType.default):


def _cost_crystallizer_flows(blk):
blk.costing_package.cost_flow(
pyo.units.convert(
(
blk.unit_model.magma_circulation_flow_vol
* blk.unit_model.dens_mass_slurry
* Constants.acceleration_gravity
* blk.costing_package.crystallizer.pump_head_height
/ blk.costing_package.crystallizer.efficiency_pump
),
to_units=pyo.units.kW,
),
"electricity",
)

blk.costing_package.cost_flow(
pyo.units.convert(
(blk.unit_model.work_mechanical[0] / _compute_steam_properties(blk)),
to_units=pyo.units.m**3 / pyo.units.s,
),
"steam",
)
Comment on lines -123 to -143
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Curious about why these lines are being deleted. I probably didn't look closely enough, but have they been moved elsewhere or completely removed? And why?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@adam-a-a They are removed as we integrate the steam heater, pump, and other essential components into the full FC crystallizer flowsheet. Therefore, the flow rates of the steam and recycle streams, along with their associated costs, are incorporated within the cost calculations of the steam heater and pump unit models.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ElmiraShamlou but removing this hinders whoever wants to use the combined unit we had previously.

Maybe what we need is a configuration argument that determines the mode the user wants (broken down or combined), and then adds the necessary equations for each case?


blk.costing_package.cost_flow(
blk.unit_model.solids.flow_mass_phase_comp[0, "Sol", "NaCl"],
Expand Down Expand Up @@ -215,72 +194,3 @@ def cost_crystallizer_by_volume(blk):
)
)
_cost_crystallizer_flows(blk)


def _compute_steam_properties(blk):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same question here, except it makes more sense immediately as to why we wouldn't want/need this in a costing module

"""
Function for computing saturated steam properties for thermal heating estimation.

Args:
pressure_sat: Steam gauge pressure in bar

Out:
Steam thermal capacity (latent heat of condensation * density) in kJ/m3
"""
pressure_sat = blk.costing_package.crystallizer.steam_pressure
# 1. Compute saturation temperature of steam: computed from El-Dessouky expression
tsat_constants = [
42.6776 * pyo.units.K,
-3892.7 * pyo.units.K,
1000 * pyo.units.kPa,
-9.48654 * pyo.units.dimensionless,
]
psat = (
pyo.units.convert(pressure_sat, to_units=pyo.units.kPa)
+ 101.325 * pyo.units.kPa
)
temperature_sat = tsat_constants[0] + tsat_constants[1] / (
pyo.log(psat / tsat_constants[2]) + tsat_constants[3]
)

# 2. Compute latent heat of condensation/vaporization: computed from Sharqawy expression
t = temperature_sat - 273.15 * pyo.units.K
enth_mass_units = pyo.units.J / pyo.units.kg
t_inv_units = pyo.units.K**-1
dh_constants = [
2.501e6 * enth_mass_units,
-2.369e3 * enth_mass_units * t_inv_units**1,
2.678e-1 * enth_mass_units * t_inv_units**2,
-8.103e-3 * enth_mass_units * t_inv_units**3,
-2.079e-5 * enth_mass_units * t_inv_units**4,
]
dh_vap = (
dh_constants[0]
+ dh_constants[1] * t
+ dh_constants[2] * t**2
+ dh_constants[3] * t**3
+ dh_constants[4] * t**4
)
dh_vap = pyo.units.convert(dh_vap, to_units=pyo.units.kJ / pyo.units.kg)

# 3. Compute specific volume: computed from Affandi expression (Eq 5)
t_critical = 647.096 * pyo.units.K
t_red = temperature_sat / t_critical # Reduced temperature
sp_vol_constants = [
-7.75883 * pyo.units.dimensionless,
3.23753 * pyo.units.dimensionless,
2.05755 * pyo.units.dimensionless,
-0.06052 * pyo.units.dimensionless,
0.00529 * pyo.units.dimensionless,
]
log_sp_vol = (
sp_vol_constants[0]
+ sp_vol_constants[1] * (pyo.log(1 / t_red)) ** 0.4
+ sp_vol_constants[2] / (t_red**2)
+ sp_vol_constants[3] / (t_red**4)
+ sp_vol_constants[4] / (t_red**5)
)
sp_vol = pyo.exp(log_sp_vol) * pyo.units.m**3 / pyo.units.kg

# 4. Return specific energy: density * latent heat
return dh_vap / sp_vol
3 changes: 2 additions & 1 deletion watertap/costing/unit_models/heat_exchanger.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ def build_heat_exchanger_cost_param_block(blk):
doc="steam cost per kg",
)

blk.parent_block().register_flow_type("steam", blk.steam_cost)
costing = blk.parent_block()
costing.register_flow_type("steam", blk.steam_cost)


@register_costing_parameter_block(
Expand Down
Loading
Loading