Skip to content

Commit

Permalink
reformatted
Browse files Browse the repository at this point in the history
  • Loading branch information
liuly12 committed Sep 14, 2024
1 parent 7f0063d commit 6d90a97
Showing 1 changed file with 23 additions and 22 deletions.
45 changes: 23 additions & 22 deletions wsimod/orchestration/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,22 +139,23 @@ def __init__(self):
# self.arcs_type = {} #not sure that this would be necessary
self.nodes = {}
self.nodes_type = {}

# Default orchestration
self.orchestration = [{'FWTW' : 'treat_water'},
{'Demand' : 'create_demand'},
{'Land' : 'run'},
{'Groundwater' : 'infiltrate'},
{'Sewer' : 'make_discharge'},
{'Foul' : 'make_discharge'},
{'WWTW' : 'calculate_discharge'},
{'Groundwater' : 'distribute'},
{'River' : 'calculate_discharge'},
{'Reservoir' : 'make_abstractions'},
{'Land' : 'apply_irrigation'},
{'WWTW' : 'make_discharge'},
{'Catchment' : 'route'}]

self.orchestration = [
{"FWTW": "treat_water"},
{"Demand": "create_demand"},
{"Land": "run"},
{"Groundwater": "infiltrate"},
{"Sewer": "make_discharge"},
{"Foul": "make_discharge"},
{"WWTW": "calculate_discharge"},
{"Groundwater": "distribute"},
{"River": "calculate_discharge"},
{"Reservoir": "make_abstractions"},
{"Land": "apply_irrigation"},
{"WWTW": "make_discharge"},
{"Catchment": "route"},
]

def get_init_args(self, cls):
"""Get the arguments of the __init__ method for a class and its superclasses."""
Expand Down Expand Up @@ -186,16 +187,16 @@ def load(self, address, config_name="config.yml", overrides={}):
constants.NON_ADDITIVE_POLLUTANTS = data["non_additive_pollutants"]
constants.FLOAT_ACCURACY = float(data["float_accuracy"])
self.__dict__.update(Model().__dict__)

"""
FLAG:
E.G. ADDITION FOR NEW ORCHESTRATION
"""
if 'orchestration' in data.keys():

if "orchestration" in data.keys():
# Update orchestration
self.orchestration = data['orchestration']
self.orchestration = data["orchestration"]

nodes = data["nodes"]

for name, node in nodes.items():
Expand Down Expand Up @@ -313,7 +314,7 @@ def save(self, address, config_name="config.yml", compress=False):
data = {
"nodes": nodes,
"arcs": arcs,
"orchestration" : self.orchestration,
"orchestration": self.orchestration,
"pollutants": constants.POLLUTANTS,
"additive_pollutants": constants.ADDITIVE_POLLUTANTS,
"non_additive_pollutants": constants.NON_ADDITIVE_POLLUTANTS,
Expand Down Expand Up @@ -750,7 +751,7 @@ def enablePrint(stdout):
if node_type in self.nodes_type.keys():
for node in self.nodes_type[node_type].values():
getattr(node, function)()

# river
for node_name in self.river_discharge_order:
self.nodes[node_name].distribute()
Expand Down

0 comments on commit 6d90a97

Please sign in to comment.