Skip to content

Commit

Permalink
rename and respect cost model is rerun before _every_ output command
Browse files Browse the repository at this point in the history
  • Loading branch information
je-cook authored and timothy-nunn committed Feb 8, 2024
1 parent 62e6e76 commit decf764
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion process/costs_2015.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ def run(self):
if (abs(cost_variables.concost) > 9.99e99) or (
cost_variables.concost != cost_variables.concost
):
self.write_costs_to_output()
self.output()

for i in range(100):
# noqa: E741
Expand Down
4 changes: 2 additions & 2 deletions process/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,7 @@ def __init__(self):
This also initialises module variables in the Fortran for that module.
"""
self._costs_custom = None
self._costs_old = Costs()
self._costs_1990 = Costs()
self._costs_2015 = Costs2015()
self.cs_fatigue = CsFatigue()
self.pfcoil = PFCoil(cs_fatigue=self.cs_fatigue)
Expand Down Expand Up @@ -623,7 +623,7 @@ def __init__(self):
@property
def costs(self) -> CostsProtocol:
if fortran.cost_variables.cost_model == 0:
return self._costs_old
return self._costs_1990
if fortran.cost_variables.cost_model == 1:
return self._costs_2015
if fortran.cost_variables.cost_model == 2:
Expand Down
1 change: 1 addition & 0 deletions process/output.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ def write(models, outfile):
# 0 | 1990 costs model
# 1 | 2015 Kovari model
# 2 | Custom model
models.costs.run()
models.costs.output()

# Availability model
Expand Down

0 comments on commit decf764

Please sign in to comment.