Skip to content
Merged
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
3 changes: 3 additions & 0 deletions CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ authors:
- family-names: "Rao"
given-names: "Akshay K."
orcid: "https://orcid.org/0000-0002-9054-476X"
- family-names: "Dudchenko"
given-names: "Alexander V."
orcid: "https://orcid.org/0000-0002-4808-6195"
- family-names: "Mauter"
given-names: "Meagan S."
orcid: "https://orcid.org/0000-0002-4932-890X"
Expand Down
2 changes: 1 addition & 1 deletion docs/json_rep.rst
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ Below are two tables: first is all the ``Node`` subclasses and the second the at
+---------------+--------------------+----------------------+---------------------------------+----------------------------------+-----------------------+-----------------------------+---------------------------+----------------------------+----------------------------+------------------------+----------------------------+----------------------------+----------------+-------------+--------------------------+-------------------------+-------------------------------+--------------------------+------------------+-----------+--------------------------+-----------------+---------+--------------+--------------+-----------------+---------+---------+--------------+-------------+----------------+
| Reactor | |check| | |check| | |check| | |check| | | | |check| | | | |check| | | | | | | | | | | | | | | |check| | | |check| | |check| | | | | |
+---------------+--------------------+----------------------+---------------------------------+----------------------------------+-----------------------+-----------------------------+---------------------------+----------------------------+----------------------------+------------------------+----------------------------+----------------------------+----------------+-------------+--------------------------+-------------------------+-------------------------------+--------------------------+------------------+-----------+--------------------------+-----------------+---------+--------------+--------------+-----------------+---------+---------+--------------+-------------+----------------+
| StaticMixer | |check| | |check| | |check| | |check| | | | | |check| | |check| | | | | | | | | | | | | | | | |check| | | |check| | |check| | | | | |
| StaticMixing | |check| | |check| | |check| | |check| | | | | |check| | |check| | | | | | | | | | | | | | | | |check| | | |check| | |check| | | | | |
+---------------+--------------------+----------------------+---------------------------------+----------------------------------+-----------------------+-----------------------------+---------------------------+----------------------------+----------------------------+------------------------+----------------------------+----------------------------+----------------+-------------+--------------------------+-------------------------+-------------------------------+--------------------------+------------------+-----------+--------------------------+-----------------+---------+--------------+--------------+-----------------+---------+---------+--------------+-------------+----------------+
| Reservoir | |check| | |check| | |check| | |check| | | | |check| | | | |check| | | | | | | | | | | | | | | | | | | | | | |
+---------------+--------------------+----------------------+---------------------------------+----------------------------------+-----------------------+-----------------------------+---------------------------+----------------------------+----------------------------+------------------------+----------------------------+----------------------------+----------------+-------------+--------------------------+-------------------------+-------------------------------+--------------------------+------------------+-----------+--------------------------+-----------------+---------+--------------+--------------+-----------------+---------+---------+--------------+-------------+----------------+
Expand Down
9 changes: 8 additions & 1 deletion pype_schema/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -1097,6 +1097,7 @@ def __init__(
contents,
source,
destination,
frequency=None,
tags={},
bidirectional=False,
exit_point=None,
Expand All @@ -1106,6 +1107,7 @@ def __init__(
self.contents = contents
self.source = source
self.destination = destination
self.frequency = frequency
self.tags = tags
self.bidirectional = bidirectional
self.exit_point = exit_point
Expand All @@ -1122,10 +1124,15 @@ def __repr__(self):
else:
entry_point_id = self.entry_point.id

if self.frequency is None:
frequency_txt = "None"
else:
frequency_txt = str(self.frequency)

return (
f"<pype_schema.connection.Delivery id:{self.id} "
f"contents:{self.contents} source:{self.source.id} "
f"destination:{self.destination.id} "
f"destination:{self.destination.id} frequency:{frequency_txt} "
f"tags:{self.tags} bidirectional:{self.bidirectional} "
f"exit_point:{exit_point_id} entry_point:{entry_point_id}>\n"
)
Expand Down
2 changes: 1 addition & 1 deletion pype_schema/data/desal_sample.json
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@
"tags": {}
},
"StaticMixer": {
"type": "StaticMixer",
"type": "StaticMixing",
"elevation (meters)": null,
"volume (cubic meters)": null,
"input_contents": "ChlorinatedSeawater",
Expand Down
2 changes: 1 addition & 1 deletion pype_schema/data/wrrf_sample.json
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@
}
},
"OxygenPlant": {
"type": "Separator",
"type": "Separation",
"input_contents": "Air",
"output_contents": ["Oxygen", "IdealGas"],
"num_units": 1,
Expand Down
19 changes: 11 additions & 8 deletions pype_schema/node.py
Original file line number Diff line number Diff line change
Expand Up @@ -2071,14 +2071,14 @@ def del_dosing_rate(self):
dosing_rate = property(get_dosing_rate, set_dosing_rate, del_dosing_rate)


class StaticMixer(Reactor):
class StaticMixing(Reactor):
"""A tank containing a static mixer,
typically used for coagulation in water treatment.

Parameters
----------
id : str
StaticMixer ID
Static mixer ID

input_contents : ContentsType or list of ContentsType
Contents entering the mixer
Expand Down Expand Up @@ -2116,7 +2116,7 @@ class StaticMixer(Reactor):
Attributes
----------
id : str
StaticMixer ID
Static mixer ID

input_contents : list of ContentsType
Contents entering the mixer
Expand Down Expand Up @@ -2183,7 +2183,7 @@ def __init__(

def __repr__(self):
return (
f"<pype_schema.node.StaticMixer id:{self.id} "
f"<pype_schema.node.StaticMixing id:{self.id} "
f"input_contents:{self.input_contents} num_units:{self.num_units}"
f"output_contents:{self.output_contents} "
f"dosing_rate:{self.dosing_rate} pH:{self.pH} "
Expand Down Expand Up @@ -4129,7 +4129,8 @@ def __eq__(self, other):


class UVSystem(Disinfection):
"""
"""An ultraviolet light disinfection system.

Parameters
----------
id : str
Expand Down Expand Up @@ -4270,7 +4271,9 @@ def del_dosing_area(self):


class Flaring(Node):
"""
"""The process of combusting biogas to convert the methane to carbon dioxide
before venting it to the atmosphere.

Parameters
----------
id : str
Expand Down Expand Up @@ -4348,7 +4351,7 @@ def __eq__(self, other):
)


class Separator(Node):
class Separation(Node):
"""A class representing a separator that divides a mixture into its components,
such as air separation units that produce high purity oxygen and nitrogen.

Expand Down Expand Up @@ -4451,7 +4454,7 @@ def __init__(

def __repr__(self):
return (
f"<pype_schema.node.Separator id:{self.id} "
f"<pype_schema.node.Separation id:{self.id} "
f"input_contents:{self.input_contents} "
f"output_contents:{self.output_contents} num_units:{self.num_units} "
f"min_flow:{self.min_flow} max_flow:{self.max_flow} "
Expand Down
20 changes: 13 additions & 7 deletions pype_schema/parse_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ def create_node(self, node_id, verbose=False):
"""
if verbose:
print("Creating node:", node_id)
(input_contents, output_contents) = self.parse_contents(node_id)
input_contents, output_contents = self.parse_contents(node_id)
elevation = self.parse_unit_val_dict(self.config[node_id].get("elevation"))
# strings like `elevation (meters)` and `volume (cubic meters)`
# are included for backwards compatability
Expand Down Expand Up @@ -691,6 +691,8 @@ def efficiency_curve(arg):
)
electrical_efficiency = None
thermal_efficiency = self.config[node_id].get("thermal efficiency")
if thermal_efficiency is None:
thermal_efficiency = self.config[node_id].get("thermal_efficiency")

if electrical_efficiency:

Expand Down Expand Up @@ -887,12 +889,12 @@ def efficiency_curve(arg):
pH=pH,
tags={},
)
elif self.config[node_id]["type"] == "StaticMixer":
elif self.config[node_id]["type"] == "StaticMixing":
pH = self.config[node_id].get("pH")
residence_time = self.parse_unit_val_dict(
self.config[node_id].get("residence_time")
)
node_obj = node.StaticMixer(
node_obj = node.StaticMixing(
node_id,
input_contents,
output_contents,
Expand Down Expand Up @@ -933,11 +935,11 @@ def efficiency_curve(arg):
pressure_setting=pressure_setting,
tags={},
)
elif self.config[node_id]["type"] == "Separator":
elif self.config[node_id]["type"] == "Separation":
power_rating = self.parse_unit_val_dict(
self.config[node_id].get("power_rating")
)
node_obj = node.Separator(
node_obj = node.Separation(
node_id,
input_contents,
output_contents,
Expand Down Expand Up @@ -1110,11 +1112,15 @@ def create_connection(self, connection_id, node_obj, verbose=False):
entry_point=entry_point,
)
elif self.config[connection_id]["type"] == "Delivery":
frequency = self.parse_unit_val_dict(
self.config[connection_id].get("frequency")
)
connection_obj = connection.Delivery(
connection_id,
contents,
source,
destination,
frequency=frequency,
tags={},
bidirectional=bidirectional,
exit_point=exit_point,
Expand Down Expand Up @@ -2079,7 +2085,7 @@ def node_to_dict(node_obj):
node_dict["permeability"] = JSONParser.unit_val_to_dict(
node_obj.permeability
)
elif isinstance(node_obj, (node.Reactor, node.StaticMixer)):
elif isinstance(node_obj, (node.Reactor, node.StaticMixing)):
if node_obj.volume is not None:
node_dict["volume"] = JSONParser.unit_val_to_dict(node_obj.volume)

Expand All @@ -2105,7 +2111,7 @@ def node_to_dict(node_obj):
node_obj, "flow_rate"
)
node_dict["num_units"] = node_obj.num_units
elif isinstance(node_obj, node.Separator):
elif isinstance(node_obj, node.Separation):
if node_obj.volume is not None:
node_dict["volume"] = JSONParser.unit_val_to_dict(node_obj.volume)
if node_obj.power_rating is not None:
Expand Down
1 change: 0 additions & 1 deletion pype_schema/tag.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
from .logbook import Logbook
from .operations import Constant


UNARY_OPS = ["noop", "delta", "<<", ">>", "~", "-"]
BINARY_OPS = ["+", "-", "*", "/"]

Expand Down
6 changes: 5 additions & 1 deletion pype_schema/tests/data/connection_less_than.json
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@
}
},
"OxygenPlant": {
"type": "Separator",
"type": "Separation",
"input_contents": "Air",
"output_contents": ["Oxygen", "IdealGas"],
"num_units": 1,
Expand Down Expand Up @@ -1061,6 +1061,10 @@
"avg": null,
"units": "tons / day"
},
"frequency": {
"value": "1",
"units": "day"
},
"tags": {}
},
"SolidsDisposal": {
Expand Down
2 changes: 1 addition & 1 deletion pype_schema/tests/data/merged.json
Original file line number Diff line number Diff line change
Expand Up @@ -1276,7 +1276,7 @@
"num_units": 8
},
"OxygenPlant": {
"type": "Separator",
"type": "Separation",
"input_contents": "Air",
"output_contents": [
"Oxygen",
Expand Down
2 changes: 1 addition & 1 deletion pype_schema/tests/data/merged_wwtp.json
Original file line number Diff line number Diff line change
Expand Up @@ -772,7 +772,7 @@
"num_units": 8
},
"OxygenPlant": {
"type": "Separator",
"type": "Separation",
"input_contents": "Air",
"output_contents": [
"Oxygen",
Expand Down
Binary file modified pype_schema/tests/data/sample.pkl
Binary file not shown.
7 changes: 6 additions & 1 deletion pype_schema/tests/test_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,12 @@ def test_get_fallback_error(json_path, conn_id):
(
"../data/desal_sample.json",
"AntiscalantDelivery",
"<pype_schema.connection.Delivery id:AntiscalantDelivery contents:ContentsType.Antiscalant source:ChemicalFactory destination:DesalPlant tags:{} bidirectional:False exit_point:None entry_point:None>\n", # noqa: E501
"<pype_schema.connection.Delivery id:AntiscalantDelivery contents:ContentsType.Antiscalant source:ChemicalFactory destination:DesalPlant frequency:None tags:{} bidirectional:False exit_point:None entry_point:None>\n", # noqa: E501
),
(
"data/connection_less_than.json",
"BiosolidsDelivery",
"<pype_schema.connection.Delivery id:BiosolidsDelivery contents:ContentsType.WFBS source:ChemicalFactory destination:WWTP frequency:1 day tags:{} bidirectional:False exit_point:None entry_point:None>\n", # noqa: E501
),
],
)
Expand Down
2 changes: 1 addition & 1 deletion pype_schema/units.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@
# default formatting includes 4 significant digits.
# This can be overridden on a per-print basis with
# print('{:.3f}'.format(3 * ureg.m / 9)).
u.default_format = ".4g"
u.default_format = ".4"

units_path = os.path.join(os.path.dirname(__file__), "data", "unit_definitions.txt")
u.load_definitions(units_path)
Expand Down
Loading