diff --git a/process/core/init.py b/process/core/init.py index 139e8be09..9dce55691 100644 --- a/process/core/init.py +++ b/process/core/init.py @@ -22,7 +22,6 @@ from process.data_structure.buildings_variables import init_buildings_variables from process.data_structure.ccfe_hcpb_module import init_ccfe_hcpb_module from process.data_structure.constraint_variables import init_constraint_variables -from process.data_structure.cost_2015_variables import init_cost_2015_variables from process.data_structure.cost_variables import init_cost_variables from process.data_structure.cs_fatigue_variables import init_cs_fatigue_variables from process.data_structure.current_drive_variables import init_current_drive_variables @@ -302,7 +301,6 @@ def init_all_module_vars(): init_cs_fatigue_variables() init_blanket_library() init_dcll_module() - init_cost_2015_variables() init_power_variables() init_neoclassics_variables() diff --git a/process/core/model.py b/process/core/model.py index 4cfa60747..5b6dc659b 100644 --- a/process/core/model.py +++ b/process/core/model.py @@ -1,6 +1,7 @@ import abc from dataclasses import dataclass, fields +from process.data_structure.cost_2015_variables import Cost2015Data from process.data_structure.water_usage_variables import WaterUseData initialise_later = object() @@ -9,6 +10,7 @@ @dataclass(kw_only=True) class DataStructure: water_use: WaterUseData = initialise_later + costs_2015: Cost2015Data = initialise_later def __post_init__(self): for f in fields(self): diff --git a/process/data_structure/cost_2015_variables.py b/process/data_structure/cost_2015_variables.py index 2e6c82a16..eedb2c130 100644 --- a/process/data_structure/cost_2015_variables.py +++ b/process/data_structure/cost_2015_variables.py @@ -1,53 +1,33 @@ -import numpy as np - -mean_electric_output: float = None - -annual_electric_output: float = None - -maintenance: float = None - -total_costs: float = None +from dataclasses import dataclass, field -s_label: list[str] = None - -s_kref: list[float] = None - -s_k: list[float] = None - -s_cref: list[float] = None +import numpy as np -s_cost: list[float] = None -s_cost_factor: list[float] = None +@dataclass +class Cost2015Data: + mean_electric_output: float = 0.0 + annual_electric_output: float = 0.0 -def init_cost_2015_variables(): - global mean_electric_output - mean_electric_output = 0.0 + maintenance: float = 0.0 - global annual_electric_output - annual_electric_output = 0.0 + total_costs: float = 0.0 - global maintenance - maintenance = 0.0 + s_label: list[str] = field( + default_factory=lambda: np.array(["not used"] * 100, dtype=object) + ) - global total_costs - total_costs = 0.0 + s_kref: list[float] = field(default_factory=lambda: np.zeros(100, dtype=np.float64)) - global s_label - s_label = np.array(["not used"] * 100, dtype=object) + s_k: list[float] = field(default_factory=lambda: np.zeros(100, dtype=np.float64)) - global s_kref - s_kref = np.zeros(100, dtype=np.float64) + s_cref: list[float] = field(default_factory=lambda: np.zeros(100, dtype=np.float64)) - global s_k - s_k = np.zeros(100, dtype=np.float64) + s_cost: list[float] = field(default_factory=lambda: np.zeros(100, dtype=np.float64)) - global s_cref - s_cref = np.zeros(100, dtype=np.float64) + s_cost_factor: list[float] = field( + default_factory=lambda: np.zeros(100, dtype=np.float64) + ) - global s_cost - s_cost = np.zeros(100, dtype=np.float64) - global s_cost_factor - s_cost_factor = np.zeros(100, dtype=np.float64) +CREATE_DICTS_FROM_DATACLASS = Cost2015Data diff --git a/process/main.py b/process/main.py index 0e6fd1551..da4f94a76 100644 --- a/process/main.py +++ b/process/main.py @@ -776,7 +776,7 @@ def costs(self, value: CostsProtocol): def models(self) -> tuple[Model, ...]: # At the moment, this property just returns models that implement the Model interface. # Eventually every Model will comply and then this method can be used as the caller/outputter! - return (self.water_use,) + return (self.water_use, self._costs_2015) def setup_data_structure(self): # This Models class should be replaced with a dataclass so we can diff --git a/process/models/costs/costs_2015.py b/process/models/costs/costs_2015.py index f832d933c..eb4316cbc 100644 --- a/process/models/costs/costs_2015.py +++ b/process/models/costs/costs_2015.py @@ -7,7 +7,6 @@ from process.core.model import Model from process.data_structure import ( build_variables, - cost_2015_variables, cost_variables, current_drive_variables, first_wall_variables, @@ -60,55 +59,57 @@ def run(self): self.calc_remaining_subsystems() # Calculate total capital cost - cost_2015_variables.total_costs = ( - cost_2015_variables.s_cost[8] - + cost_2015_variables.s_cost[12] - + cost_2015_variables.s_cost[20] - + cost_2015_variables.s_cost[26] - + cost_2015_variables.s_cost[30] - + cost_2015_variables.s_cost[33] - + cost_2015_variables.s_cost[34] - + cost_2015_variables.s_cost[60] + self.data.costs_2015.total_costs = ( + self.data.costs_2015.s_cost[8] + + self.data.costs_2015.s_cost[12] + + self.data.costs_2015.s_cost[20] + + self.data.costs_2015.s_cost[26] + + self.data.costs_2015.s_cost[30] + + self.data.costs_2015.s_cost[33] + + self.data.costs_2015.s_cost[34] + + self.data.costs_2015.s_cost[60] ) # Save as concost, the variable used as a Figure of Merit (M$) - cost_variables.concost = cost_2015_variables.total_costs / 1.0e6 + cost_variables.concost = self.data.costs_2015.total_costs / 1.0e6 # Electrical output (given availability) for a whole year - cost_2015_variables.mean_electric_output = ( + self.data.costs_2015.mean_electric_output = ( heat_transport_variables.p_plant_electric_net_mw * cost_variables.cpfact ) - cost_2015_variables.annual_electric_output = ( - cost_2015_variables.mean_electric_output * 24.0e0 * 365.25e0 + self.data.costs_2015.annual_electric_output = ( + self.data.costs_2015.mean_electric_output * 24.0e0 * 365.25e0 ) # Annual maintenance cost. - cost_2015_variables.maintenance = ( - cost_2015_variables.s_cost[26] + cost_2015_variables.s_cost[37] + self.data.costs_2015.maintenance = ( + self.data.costs_2015.s_cost[26] + self.data.costs_2015.s_cost[37] ) * cost_variables.maintenance_fwbs + ( - cost_2015_variables.s_cost[8] - + cost_2015_variables.s_cost[30] - + cost_2015_variables.s_cost[33] - + cost_2015_variables.s_cost[34] - + cost_2015_variables.s_cost[40] - + cost_2015_variables.s_cost[42] - + cost_2015_variables.s_cost[44] - + cost_2015_variables.s_cost[46] - + cost_2015_variables.s_cost[47] - + cost_2015_variables.s_cost[48] - + cost_2015_variables.s_cost[49] - + cost_2015_variables.s_cost[50] - + cost_2015_variables.s_cost[51] - + cost_2015_variables.s_cost[52] - + cost_2015_variables.s_cost[53] - + cost_2015_variables.s_cost[57] + self.data.costs_2015.s_cost[8] + + self.data.costs_2015.s_cost[30] + + self.data.costs_2015.s_cost[33] + + self.data.costs_2015.s_cost[34] + + self.data.costs_2015.s_cost[40] + + self.data.costs_2015.s_cost[42] + + self.data.costs_2015.s_cost[44] + + self.data.costs_2015.s_cost[46] + + self.data.costs_2015.s_cost[47] + + self.data.costs_2015.s_cost[48] + + self.data.costs_2015.s_cost[49] + + self.data.costs_2015.s_cost[50] + + self.data.costs_2015.s_cost[51] + + self.data.costs_2015.s_cost[52] + + self.data.costs_2015.s_cost[53] + + self.data.costs_2015.s_cost[57] ) * cost_variables.maintenance_gen # Levelized cost of electricity (LCOE) ($/MWh) - if cost_2015_variables.annual_electric_output > 0.00001: - cost_variables.coe = (1.0e0 / cost_2015_variables.annual_electric_output) * ( - cost_2015_variables.total_costs / cost_variables.amortization - + cost_2015_variables.maintenance + if self.data.costs_2015.annual_electric_output > 0.00001: + cost_variables.coe = ( + 1.0e0 / self.data.costs_2015.annual_electric_output + ) * ( + self.data.costs_2015.total_costs / cost_variables.amortization + + self.data.costs_2015.maintenance ) # Switch on output if there is a NaN error @@ -119,12 +120,12 @@ def run(self): for i in range(100): nan_diags = [ - cost_2015_variables.s_label[i], - cost_2015_variables.s_kref[i], - cost_2015_variables.s_k[i], - cost_2015_variables.s_cref[i], - cost_2015_variables.s_cost[i], - cost_2015_variables.s_cost_factor[i], + self.data.costs_2015.s_label[i], + self.data.costs_2015.s_kref[i], + self.data.costs_2015.s_k[i], + self.data.costs_2015.s_cref[i], + self.data.costs_2015.s_cost[i], + self.data.costs_2015.s_cost_factor[i], ] nan_diags_str = ",".join(str(x) for x in nan_diags) @@ -142,7 +143,7 @@ def calc_fwbs_costs(self): """ for i in range(21, 27): - cost_2015_variables.s_cost_factor[i] = cost_variables.cost_factor_fwbs + self.data.costs_2015.s_cost_factor[i] = cost_variables.cost_factor_fwbs # Enrichment # Costs based on the number of separative work units (SWU) required @@ -181,27 +182,27 @@ def calc_fwbs_costs(self): ) # Reference cost - cost_2015_variables.s_label[21] = "Lithium enrichment" - cost_2015_variables.s_cref[21] = 0.1e6 - cost_2015_variables.s_k[21] = 64.7e0 - cost_2015_variables.s_kref[21] = 64.7e0 - cost_2015_variables.s_cost[21] = ( - cost_2015_variables.s_cost_factor[21] - * cost_2015_variables.s_cref[21] - * (cost_2015_variables.s_k[21] / cost_2015_variables.s_kref[21]) + self.data.costs_2015.s_label[21] = "Lithium enrichment" + self.data.costs_2015.s_cref[21] = 0.1e6 + self.data.costs_2015.s_k[21] = 64.7e0 + self.data.costs_2015.s_kref[21] = 64.7e0 + self.data.costs_2015.s_cost[21] = ( + self.data.costs_2015.s_cost_factor[21] + * self.data.costs_2015.s_cref[21] + * (self.data.costs_2015.s_k[21] / self.data.costs_2015.s_kref[21]) ** cost_variables.costexp ) - if abs(cost_2015_variables.s_cost[21] - 0.1e6) / 0.1e6 < 1.0e-3: + if abs(self.data.costs_2015.s_cost[21] - 0.1e6) / 0.1e6 < 1.0e-3: po.ocmmnt(self.outfile, "Reference cost for enrichment CORRECT") else: po.ocmmnt(self.outfile, "Reference cost for enrichment ERROR") # Lithium 6 enrichment cost ($) - cost_2015_variables.s_label[21] = "Lithium enrichment" + self.data.costs_2015.s_label[21] = "Lithium enrichment" # Zero cost for natural enrichment if fwbs_variables.f_blkt_li6_enrichment <= 7.42e0: - cost_2015_variables.s_cost[21] = 0.0e0 + self.data.costs_2015.s_cost[21] = 0.0e0 else: # Percentage of lithium 6 in the product product_li6 = min(fwbs_variables.f_blkt_li6_enrichment, 99.99e0) / 100.0e0 @@ -230,84 +231,84 @@ def calc_fwbs_costs(self): total_swu = swu * mass_li # Reference cost for lithium enrichment (2014 $) - cost_2015_variables.s_cref[21] = 0.1e6 + self.data.costs_2015.s_cref[21] = 0.1e6 # Reference case of lithium SWU - cost_2015_variables.s_k[21] = total_swu - cost_2015_variables.s_kref[21] = 64.7e0 - cost_2015_variables.s_cost[21] = ( - cost_2015_variables.s_cost_factor[21] - * cost_2015_variables.s_cref[21] - * (cost_2015_variables.s_k[21] / cost_2015_variables.s_kref[21]) + self.data.costs_2015.s_k[21] = total_swu + self.data.costs_2015.s_kref[21] = 64.7e0 + self.data.costs_2015.s_cost[21] = ( + self.data.costs_2015.s_cost_factor[21] + * self.data.costs_2015.s_cref[21] + * (self.data.costs_2015.s_k[21] / self.data.costs_2015.s_kref[21]) ** cost_variables.costexp ) - cost_2015_variables.s_label[22] = "Lithium orthosilicate pebble manufacturing" + self.data.costs_2015.s_label[22] = "Lithium orthosilicate pebble manufacturing" # Reference cost of lithium pebble manufacture (2014 $) - cost_2015_variables.s_cref[22] = 6.5e4 + self.data.costs_2015.s_cref[22] = 6.5e4 # Scale with mass of pebbles (kg) - cost_2015_variables.s_k[22] = fwbs_variables.m_blkt_li2o - cost_2015_variables.s_kref[22] = 10.0e0 - cost_2015_variables.s_cost[22] = ( - cost_2015_variables.s_cost_factor[22] - * cost_2015_variables.s_cref[22] - * (cost_2015_variables.s_k[22] / cost_2015_variables.s_kref[22]) + self.data.costs_2015.s_k[22] = fwbs_variables.m_blkt_li2o + self.data.costs_2015.s_kref[22] = 10.0e0 + self.data.costs_2015.s_cost[22] = ( + self.data.costs_2015.s_cost_factor[22] + * self.data.costs_2015.s_cref[22] + * (self.data.costs_2015.s_k[22] / self.data.costs_2015.s_kref[22]) ** cost_variables.costexp_pebbles ) - cost_2015_variables.s_label[23] = "Titanium beryllide pebble manufacturing" + self.data.costs_2015.s_label[23] = "Titanium beryllide pebble manufacturing" # Reference cost of titanium beryllide pebble manufacture (2014 $) - cost_2015_variables.s_cref[23] = 450.0e6 + self.data.costs_2015.s_cref[23] = 450.0e6 # Scale with mass of titanium beryllide pebbles (kg) - cost_2015_variables.s_k[23] = fwbs_variables.m_blkt_beryllium - cost_2015_variables.s_kref[23] = 1.0e5 - cost_2015_variables.s_cost[23] = ( - cost_2015_variables.s_cost_factor[23] - * cost_2015_variables.s_cref[23] - * (cost_2015_variables.s_k[23] / cost_2015_variables.s_kref[23]) + self.data.costs_2015.s_k[23] = fwbs_variables.m_blkt_beryllium + self.data.costs_2015.s_kref[23] = 1.0e5 + self.data.costs_2015.s_cost[23] = ( + self.data.costs_2015.s_cost_factor[23] + * self.data.costs_2015.s_cref[23] + * (self.data.costs_2015.s_k[23] / self.data.costs_2015.s_kref[23]) ** cost_variables.costexp_pebbles ) - cost_2015_variables.s_label[24] = "First wall W coating manufacturing" + self.data.costs_2015.s_label[24] = "First wall W coating manufacturing" # Reference (PPCS A) first wall W coating cost (2014 $) - cost_2015_variables.s_cref[24] = 25.0e6 + self.data.costs_2015.s_cref[24] = 25.0e6 # First wall W coating mass (kg) - cost_2015_variables.s_k[24] = ( + self.data.costs_2015.s_k[24] = ( first_wall_variables.a_fw_total * fwbs_variables.fw_armour_thickness * constants.DEN_TUNGSTEN ) - cost_2015_variables.s_kref[24] = 29000.0e0 - cost_2015_variables.s_cost[24] = ( - cost_2015_variables.s_cost_factor[24] - * cost_2015_variables.s_cref[24] - * (cost_2015_variables.s_k[24] / cost_2015_variables.s_kref[24]) + self.data.costs_2015.s_kref[24] = 29000.0e0 + self.data.costs_2015.s_cost[24] = ( + self.data.costs_2015.s_cost_factor[24] + * self.data.costs_2015.s_cref[24] + * (self.data.costs_2015.s_k[24] / self.data.costs_2015.s_kref[24]) ** cost_variables.costexp ) - cost_2015_variables.s_label[25] = ( + self.data.costs_2015.s_label[25] = ( "Blanket and shield materials and manufacturing" ) # The cost of making the blanket was estimated for PPCS A. # This cost includes only manufacturing - not R&D, transport, or assembly in the reactor. # It includes the first wall, blanket and shield, but excludes the breeder and multiplier materials. - cost_2015_variables.s_cref[25] = 317.0e6 + self.data.costs_2015.s_cref[25] = 317.0e6 # Scale with steel mass in blanket + shield mass - cost_2015_variables.s_k[25] = ( + self.data.costs_2015.s_k[25] = ( fwbs_variables.m_blkt_steel_total + fwbs_variables.whtshld ) - cost_2015_variables.s_kref[25] = 4.07e6 - cost_2015_variables.s_cost[25] = ( - cost_2015_variables.s_cost_factor[25] - * cost_2015_variables.s_cref[25] - * (cost_2015_variables.s_k[25] / cost_2015_variables.s_kref[25]) + self.data.costs_2015.s_kref[25] = 4.07e6 + self.data.costs_2015.s_cost[25] = ( + self.data.costs_2015.s_cost_factor[25] + * self.data.costs_2015.s_cref[25] + * (self.data.costs_2015.s_k[25] / self.data.costs_2015.s_kref[25]) ** cost_variables.costexp ) - cost_2015_variables.s_label[26] = "Total first wall and blanket cost" - cost_2015_variables.s_cost[26] = 0.0e0 + self.data.costs_2015.s_label[26] = "Total first wall and blanket cost" + self.data.costs_2015.s_cost[26] = 0.0e0 for j in range(21, 26): - cost_2015_variables.s_cost[26] = ( - cost_2015_variables.s_cost[26] + cost_2015_variables.s_cost[j] + self.data.costs_2015.s_cost[26] = ( + self.data.costs_2015.s_cost[26] + self.data.costs_2015.s_cost[j] ) def output(self): @@ -324,9 +325,9 @@ def output(self): for i in range(9): self.ocost( self.outfile, - cost_2015_variables.s_label[i], + self.data.costs_2015.s_label[i], i + 1, - cost_2015_variables.s_cost[i] / 1.0e6, + self.data.costs_2015.s_cost[i] / 1.0e6, ) po.oshead(self.outfile, "Land (M$)") @@ -334,9 +335,9 @@ def output(self): for j in range(9, 13): self.ocost( self.outfile, - cost_2015_variables.s_label[j], + self.data.costs_2015.s_label[j], j + 1, - cost_2015_variables.s_cost[j] / 1.0e6, + self.data.costs_2015.s_cost[j] / 1.0e6, ) po.oshead(self.outfile, "TF Coils (M$)") @@ -344,64 +345,64 @@ def output(self): for k in range(13, 21): self.ocost( self.outfile, - cost_2015_variables.s_label[k], + self.data.costs_2015.s_label[k], k + 1, - cost_2015_variables.s_cost[k] / 1.0e6, + self.data.costs_2015.s_cost[k] / 1.0e6, ) po.oshead(self.outfile, "First wall and blanket (M$)") for l in range(21, 27): # noqa: E741 self.ocost( self.outfile, - cost_2015_variables.s_label[l], + self.data.costs_2015.s_label[l], l + 1, - cost_2015_variables.s_cost[l] / 1.0e6, + self.data.costs_2015.s_cost[l] / 1.0e6, ) po.oshead(self.outfile, "Active maintenance and remote handling (M$)") self.ocost( self.outfile, - cost_2015_variables.s_label[27], + self.data.costs_2015.s_label[27], 28, - cost_2015_variables.s_cost[27] / 1.0e6, + self.data.costs_2015.s_cost[27] / 1.0e6, ) self.ocost( self.outfile, - cost_2015_variables.s_label[28], + self.data.costs_2015.s_label[28], 29, - cost_2015_variables.s_cost[28] / 1.0e6, + self.data.costs_2015.s_cost[28] / 1.0e6, ) self.ocost( self.outfile, - cost_2015_variables.s_label[30], + self.data.costs_2015.s_label[30], 31, - cost_2015_variables.s_cost[30] / 1.0e6, + self.data.costs_2015.s_cost[30] / 1.0e6, ) po.oshead(self.outfile, "Vacuum vessel and liquid nitrogen plant (M$)") for n in range(31, 34): self.ocost( self.outfile, - cost_2015_variables.s_label[n], + self.data.costs_2015.s_label[n], n + 1, - cost_2015_variables.s_cost[n] / 1.0e6, + self.data.costs_2015.s_cost[n] / 1.0e6, ) po.oshead(self.outfile, "System for converting heat to electricity (M$)") self.ocost( self.outfile, - cost_2015_variables.s_label[34], + self.data.costs_2015.s_label[34], 35, - cost_2015_variables.s_cost[34] / 1.0e6, + self.data.costs_2015.s_cost[34] / 1.0e6, ) po.oshead(self.outfile, "Remaining subsystems (M$)") for q in range(35, 61): self.ocost( self.outfile, - cost_2015_variables.s_label[q], + self.data.costs_2015.s_label[q], q + 1, - cost_2015_variables.s_cost[q] / 1.0e6, + self.data.costs_2015.s_cost[q] / 1.0e6, ) po.oblnkl(self.outfile) @@ -409,13 +410,13 @@ def output(self): self.outfile, "TOTAL OVERNIGHT CAPITAL COST (M$)", "(total_costs)", - cost_2015_variables.total_costs / 1.0e6, + self.data.costs_2015.total_costs / 1.0e6, ) self.ocost( self.outfile, "Annual maintenance cost (M$)", "(maintenance)", - cost_2015_variables.maintenance / 1.0e6, + self.data.costs_2015.maintenance / 1.0e6, ) po.oblnkl(self.outfile) po.ovarrf( @@ -432,15 +433,15 @@ def output(self): self.outfile, "Mean electric output (MW)", "(mean_electric_output)", - cost_2015_variables.mean_electric_output, + self.data.costs_2015.mean_electric_output, "OP ", ) po.ovarrf( self.outfile, "Capital cost / mean electric output ($/W)", "", - cost_2015_variables.total_costs - / cost_2015_variables.mean_electric_output + self.data.costs_2015.total_costs + / self.data.costs_2015.mean_electric_output / 1.0e6, "OP ", ) @@ -465,131 +466,131 @@ def calc_building_costs(self): PROCESS Costs Paper (M. Kovari, J. Morris) """ for i in range(9): - cost_2015_variables.s_cost_factor[i] = cost_variables.cost_factor_buildings + self.data.costs_2015.s_cost_factor[i] = cost_variables.cost_factor_buildings # Power plant admin buildings cost ($) - cost_2015_variables.s_label[0] = "Admin Buildings" - cost_2015_variables.s_cref[0] = ( + self.data.costs_2015.s_label[0] = "Admin Buildings" + self.data.costs_2015.s_cref[0] = ( 129000.0e0 * cost_variables.light_build_cost_per_vol ) - cost_2015_variables.s_cost[0] = ( - cost_2015_variables.s_cost_factor[0] * cost_2015_variables.s_cref[0] + self.data.costs_2015.s_cost[0] = ( + self.data.costs_2015.s_cost_factor[0] * self.data.costs_2015.s_cref[0] ) # Tokamak complex excluding hot cell cost ($) - cost_2015_variables.s_label[1] = "Tokamak Complex (excluding hot cell)" - cost_2015_variables.s_cref[1] = ( + self.data.costs_2015.s_label[1] = "Tokamak Complex (excluding hot cell)" + self.data.costs_2015.s_cref[1] = ( 1100000.0e0 * cost_variables.tok_build_cost_per_vol ) # ITER cryostat volume (m^3) - cost_2015_variables.s_k[1] = ( + self.data.costs_2015.s_k[1] = ( (np.pi * fwbs_variables.r_cryostat_inboard**2) * 2.0e0 * fwbs_variables.z_cryostat_half_inside ) - cost_2015_variables.s_kref[1] = 18712.0e0 - cost_2015_variables.s_cost[1] = ( - cost_2015_variables.s_cost_factor[1] - * cost_2015_variables.s_cref[1] - * (cost_2015_variables.s_k[1] / cost_2015_variables.s_kref[1]) + self.data.costs_2015.s_kref[1] = 18712.0e0 + self.data.costs_2015.s_cost[1] = ( + self.data.costs_2015.s_cost_factor[1] + * self.data.costs_2015.s_cref[1] + * (self.data.costs_2015.s_k[1] / self.data.costs_2015.s_kref[1]) ) # Neutral beam buildings cost ($) - cost_2015_variables.s_label[2] = "Neutral beam buildings" - cost_2015_variables.s_cref[2] = ( + self.data.costs_2015.s_label[2] = "Neutral beam buildings" + self.data.costs_2015.s_cref[2] = ( 28000.0e0 * cost_variables.light_build_cost_per_vol ) # Scale with neutral beam wall plug power (MW) - cost_2015_variables.s_k[2] = current_drive_variables.pwpnb - cost_2015_variables.s_kref[2] = 120.0e0 - cost_2015_variables.s_cost[2] = ( - cost_2015_variables.s_cost_factor[2] - * cost_2015_variables.s_cref[2] - * (cost_2015_variables.s_k[2] / cost_2015_variables.s_kref[2]) + self.data.costs_2015.s_k[2] = current_drive_variables.pwpnb + self.data.costs_2015.s_kref[2] = 120.0e0 + self.data.costs_2015.s_cost[2] = ( + self.data.costs_2015.s_cost_factor[2] + * self.data.costs_2015.s_cref[2] + * (self.data.costs_2015.s_k[2] / self.data.costs_2015.s_kref[2]) ) # Cryoplant buildings cost ($) - cost_2015_variables.s_label[3] = "Cryoplant buildings" - cost_2015_variables.s_cref[3] = ( + self.data.costs_2015.s_label[3] = "Cryoplant buildings" + self.data.costs_2015.s_cref[3] = ( 130000.0e0 * cost_variables.light_build_cost_per_vol ) # Scale with the total heat load on the cryoplant at ~4.5K (kW) - cost_2015_variables.s_k[3] = heat_transport_variables.helpow / 1.0e3 - cost_2015_variables.s_kref[3] = 61.0e0 - cost_2015_variables.s_cost[3] = ( - cost_2015_variables.s_cost_factor[3] - * cost_2015_variables.s_cref[3] - * (cost_2015_variables.s_k[3] / cost_2015_variables.s_kref[3]) + self.data.costs_2015.s_k[3] = heat_transport_variables.helpow / 1.0e3 + self.data.costs_2015.s_kref[3] = 61.0e0 + self.data.costs_2015.s_cost[3] = ( + self.data.costs_2015.s_cost_factor[3] + * self.data.costs_2015.s_cref[3] + * (self.data.costs_2015.s_k[3] / self.data.costs_2015.s_kref[3]) ) # PF Coil winding building cost ($) - cost_2015_variables.s_label[4] = "PF Coil winding building" - cost_2015_variables.s_cref[4] = ( + self.data.costs_2015.s_label[4] = "PF Coil winding building" + self.data.costs_2015.s_cref[4] = ( 190000.0e0 * cost_variables.light_build_cost_per_vol ) # Scale with the radius of the largest PF coil squared (m^2) - cost_2015_variables.s_k[4] = pfcoil_variables.r_pf_coil_outer_max**2 - cost_2015_variables.s_kref[4] = 12.4e0**2 - cost_2015_variables.s_cost[4] = ( - cost_2015_variables.s_cost_factor[4] - * cost_2015_variables.s_cref[4] - * (cost_2015_variables.s_k[4] / cost_2015_variables.s_kref[4]) + self.data.costs_2015.s_k[4] = pfcoil_variables.r_pf_coil_outer_max**2 + self.data.costs_2015.s_kref[4] = 12.4e0**2 + self.data.costs_2015.s_cost[4] = ( + self.data.costs_2015.s_cost_factor[4] + * self.data.costs_2015.s_cref[4] + * (self.data.costs_2015.s_k[4] / self.data.costs_2015.s_kref[4]) ) # Magnet power supplies and related buildings cost ($) - cost_2015_variables.s_label[5] = "Magnet power supplies and related buildings" - cost_2015_variables.s_cref[5] = ( + self.data.costs_2015.s_label[5] = "Magnet power supplies and related buildings" + self.data.costs_2015.s_cref[5] = ( 110000.0e0 * cost_variables.light_build_cost_per_vol ) # Scale with TF current per coil (MA) - cost_2015_variables.s_k[5] = ( + self.data.costs_2015.s_k[5] = ( tfcoil_variables.c_tf_total / tfcoil_variables.n_tf_coils ) / 1.0e6 - cost_2015_variables.s_kref[5] = 9.1e0 - cost_2015_variables.s_cost[5] = ( - cost_2015_variables.s_cost_factor[5] - * cost_2015_variables.s_cref[5] - * (cost_2015_variables.s_k[5] / cost_2015_variables.s_kref[5]) + self.data.costs_2015.s_kref[5] = 9.1e0 + self.data.costs_2015.s_cost[5] = ( + self.data.costs_2015.s_cost_factor[5] + * self.data.costs_2015.s_cref[5] + * (self.data.costs_2015.s_k[5] / self.data.costs_2015.s_kref[5]) ) # Magnet discharge buildings cost ($) - cost_2015_variables.s_label[6] = "Magnet discharge buildings" - cost_2015_variables.s_cref[6] = ( + self.data.costs_2015.s_label[6] = "Magnet discharge buildings" + self.data.costs_2015.s_cref[6] = ( 35000.0e0 * cost_variables.light_build_cost_per_vol ) # Scale with total stored energy in TF coils (GJ) - cost_2015_variables.s_k[6] = tfcoil_variables.e_tf_magnetic_stored_total_gj - cost_2015_variables.s_kref[6] = 41.0e0 - cost_2015_variables.s_cost[6] = ( - cost_2015_variables.s_cost_factor[6] - * cost_2015_variables.s_cref[6] - * (cost_2015_variables.s_k[6] / cost_2015_variables.s_kref[6]) + self.data.costs_2015.s_k[6] = tfcoil_variables.e_tf_magnetic_stored_total_gj + self.data.costs_2015.s_kref[6] = 41.0e0 + self.data.costs_2015.s_cost[6] = ( + self.data.costs_2015.s_cost_factor[6] + * self.data.costs_2015.s_cref[6] + * (self.data.costs_2015.s_k[6] / self.data.costs_2015.s_kref[6]) ) # Heat removal system buildings cost ($) - cost_2015_variables.s_label[7] = "Heat removal system buildings" + self.data.costs_2015.s_label[7] = "Heat removal system buildings" # ITER volume of cooling water buildings (m^3) - cost_2015_variables.s_cref[7] = ( + self.data.costs_2015.s_cref[7] = ( 51000.0e0 * cost_variables.light_build_cost_per_vol ) # Scale with total thermal power removed from the core (MW) - cost_2015_variables.s_k[7] = ( + self.data.costs_2015.s_k[7] = ( heat_transport_variables.p_plant_primary_heat_mw + heat_transport_variables.p_plant_secondary_heat_mw ) - cost_2015_variables.s_kref[7] = 880.0e0 - cost_2015_variables.s_cost[7] = ( - cost_2015_variables.s_cost_factor[7] - * cost_2015_variables.s_cref[7] - * (cost_2015_variables.s_k[7] / cost_2015_variables.s_kref[7]) + self.data.costs_2015.s_kref[7] = 880.0e0 + self.data.costs_2015.s_cost[7] = ( + self.data.costs_2015.s_cost_factor[7] + * self.data.costs_2015.s_cref[7] + * (self.data.costs_2015.s_k[7] / self.data.costs_2015.s_kref[7]) ) # Total cost of buildings ($) - cost_2015_variables.s_label[8] = "Total cost of buildings" - cost_2015_variables.s_cost[8] = 0.0e0 + self.data.costs_2015.s_label[8] = "Total cost of buildings" + self.data.costs_2015.s_cost[8] = 0.0e0 for j in range(8): - cost_2015_variables.s_cost[8] = ( - cost_2015_variables.s_cost[8] + cost_2015_variables.s_cost[j] + self.data.costs_2015.s_cost[8] = ( + self.data.costs_2015.s_cost[8] + self.data.costs_2015.s_cost[j] ) def calc_land_costs(self): @@ -598,10 +599,10 @@ def calc_land_costs(self): PROCESS Costs Paper (M. Kovari, J. Morris) """ for i in range(9, 13): - cost_2015_variables.s_cost_factor[i] = cost_variables.cost_factor_land + self.data.costs_2015.s_cost_factor[i] = cost_variables.cost_factor_land # Land purchasing cost ($) - cost_2015_variables.s_label[9] = "Land purchasing" + self.data.costs_2015.s_label[9] = "Land purchasing" # ITER Land area (hectares) ITER_total_land_area = 180.0e0 # ITER Land area for key buildings (hectares) @@ -610,59 +611,59 @@ def calc_land_costs(self): ITER_buffer_land_area = ITER_total_land_area - ITER_key_buildings_land_area # Scale with area of cryostat (m) - cost_2015_variables.s_k[9] = np.pi * fwbs_variables.r_cryostat_inboard**2 - cost_2015_variables.s_kref[9] = 638.0e0 + self.data.costs_2015.s_k[9] = np.pi * fwbs_variables.r_cryostat_inboard**2 + self.data.costs_2015.s_kref[9] = 638.0e0 # Cost of land per hectare (2014 $ / ha) - cost_2015_variables.s_cref[9] = 318000.0e0 + self.data.costs_2015.s_cref[9] = 318000.0e0 # Cost of power plant land (2014 $) - cost_2015_variables.s_cost[9] = ( - cost_2015_variables.s_cost_factor[9] - * cost_2015_variables.s_cref[9] + self.data.costs_2015.s_cost[9] = ( + self.data.costs_2015.s_cost_factor[9] + * self.data.costs_2015.s_cref[9] * ( ITER_key_buildings_land_area - * (cost_2015_variables.s_k[9] / cost_2015_variables.s_kref[9]) + * (self.data.costs_2015.s_k[9] / self.data.costs_2015.s_kref[9]) ** cost_variables.costexp + ITER_buffer_land_area ) ) # Land improvement costs ($) - cost_2015_variables.s_label[10] = "Land improvement" + self.data.costs_2015.s_label[10] = "Land improvement" # Cost of clearing ITER land - cost_2015_variables.s_cref[10] = 214.0e6 + self.data.costs_2015.s_cref[10] = 214.0e6 # Scale with area of cryostat (m) - cost_2015_variables.s_k[10] = np.pi * fwbs_variables.r_cryostat_inboard**2 - cost_2015_variables.s_kref[10] = 638.0e0 - cost_2015_variables.s_cost[10] = ( - cost_2015_variables.s_cost_factor[10] - * (cost_2015_variables.s_k[10] / cost_2015_variables.s_kref[10]) + self.data.costs_2015.s_k[10] = np.pi * fwbs_variables.r_cryostat_inboard**2 + self.data.costs_2015.s_kref[10] = 638.0e0 + self.data.costs_2015.s_cost[10] = ( + self.data.costs_2015.s_cost_factor[10] + * (self.data.costs_2015.s_k[10] / self.data.costs_2015.s_kref[10]) ** cost_variables.costexp - * cost_2015_variables.s_cref[10] + * self.data.costs_2015.s_cref[10] ) # Road improvements cost ($) - cost_2015_variables.s_label[11] = "Road improvements" + self.data.costs_2015.s_label[11] = "Road improvements" # Cost of ITER road improvements - cost_2015_variables.s_cref[11] = 150.0e6 + self.data.costs_2015.s_cref[11] = 150.0e6 # Scale with TF coil longest dimension - cost_2015_variables.s_k[11] = ( + self.data.costs_2015.s_k[11] = ( max(build_variables.dh_tf_inner_bore, build_variables.dr_tf_inner_bore) + 2.0e0 * build_variables.dr_tf_inboard ) - cost_2015_variables.s_kref[11] = 14.0e0 - cost_2015_variables.s_cost[11] = ( - cost_2015_variables.s_cost_factor[11] - * cost_2015_variables.s_cref[11] - * (cost_2015_variables.s_k[11] / cost_2015_variables.s_kref[11]) + self.data.costs_2015.s_kref[11] = 14.0e0 + self.data.costs_2015.s_cost[11] = ( + self.data.costs_2015.s_cost_factor[11] + * self.data.costs_2015.s_cref[11] + * (self.data.costs_2015.s_k[11] / self.data.costs_2015.s_kref[11]) ** cost_variables.costexp ) # Total land costs ($) - cost_2015_variables.s_label[12] = "Total land costs" - cost_2015_variables.s_cost[12] = 0.0e0 + self.data.costs_2015.s_label[12] = "Total land costs" + self.data.costs_2015.s_cost[12] = 0.0e0 for j in range(9, 12): - cost_2015_variables.s_cost[12] = ( - cost_2015_variables.s_cost[12] + cost_2015_variables.s_cost[j] + self.data.costs_2015.s_cost[12] = ( + self.data.costs_2015.s_cost[12] + self.data.costs_2015.s_cost[j] ) def calc_tf_coil_costs(self): @@ -672,108 +673,108 @@ def calc_tf_coil_costs(self): PROCESS Costs Paper (M. Kovari, J. Morris) """ for i in range(13, 20): - cost_2015_variables.s_cost_factor[i] = cost_variables.cost_factor_tf_coils + self.data.costs_2015.s_cost_factor[i] = cost_variables.cost_factor_tf_coils # TF coil insertion and welding costs ($) - cost_2015_variables.s_label[13] = "TF Coil insertion and welding" + self.data.costs_2015.s_label[13] = "TF Coil insertion and welding" # ITER coil insertion and welding cost (2014 $) - cost_2015_variables.s_cref[13] = 258.0e6 + self.data.costs_2015.s_cref[13] = 258.0e6 # Scale with total TF coil length (m) - cost_2015_variables.s_k[13] = ( + self.data.costs_2015.s_k[13] = ( tfcoil_variables.n_tf_coils * tfcoil_variables.len_tf_coil ) - cost_2015_variables.s_kref[13] = 18.0e0 * 34.1e0 - cost_2015_variables.s_cost[13] = ( - cost_2015_variables.s_cost_factor[13] - * cost_2015_variables.s_cref[13] - * (cost_2015_variables.s_k[13] / cost_2015_variables.s_kref[13]) + self.data.costs_2015.s_kref[13] = 18.0e0 * 34.1e0 + self.data.costs_2015.s_cost[13] = ( + self.data.costs_2015.s_cost_factor[13] + * self.data.costs_2015.s_cref[13] + * (self.data.costs_2015.s_k[13] / self.data.costs_2015.s_kref[13]) ** cost_variables.costexp ) # TF coil winding costs ($) - cost_2015_variables.s_label[15] = "TF coil winding" + self.data.costs_2015.s_label[15] = "TF coil winding" # ITER winding cost (2014 $) - cost_2015_variables.s_cref[15] = 414.0e6 + self.data.costs_2015.s_cref[15] = 414.0e6 # Scale with the total turn length (m) - cost_2015_variables.s_k[15] = ( + self.data.costs_2015.s_k[15] = ( tfcoil_variables.n_tf_coils * tfcoil_variables.len_tf_coil * tfcoil_variables.n_tf_coil_turns ) - cost_2015_variables.s_kref[15] = 82249.0e0 - cost_2015_variables.s_cost[15] = ( - cost_2015_variables.s_cost_factor[15] - * cost_2015_variables.s_cref[15] - * (cost_2015_variables.s_k[15] / cost_2015_variables.s_kref[15]) + self.data.costs_2015.s_kref[15] = 82249.0e0 + self.data.costs_2015.s_cost[15] = ( + self.data.costs_2015.s_cost_factor[15] + * self.data.costs_2015.s_cref[15] + * (self.data.costs_2015.s_k[15] / self.data.costs_2015.s_kref[15]) ** cost_variables.costexp ) # Copper stand cost for TF coil ($) - cost_2015_variables.s_label[16] = "Copper strand for TF coil" + self.data.costs_2015.s_label[16] = "Copper strand for TF coil" # ITER Chromium plated Cu strand for TF SC cost (2014 $) - cost_2015_variables.s_cref[16] = 21.0e6 + self.data.costs_2015.s_cref[16] = 21.0e6 # Scale with total copper mass (kg) - cost_2015_variables.s_k[16] = ( + self.data.costs_2015.s_k[16] = ( tfcoil_variables.m_tf_coil_copper * tfcoil_variables.n_tf_coils ) - cost_2015_variables.s_kref[16] = 244.0e3 - cost_2015_variables.s_cost[16] = ( - cost_2015_variables.s_cost_factor[16] - * cost_2015_variables.s_cref[16] - * (cost_2015_variables.s_k[16] / cost_2015_variables.s_kref[16]) + self.data.costs_2015.s_kref[16] = 244.0e3 + self.data.costs_2015.s_cost[16] = ( + self.data.costs_2015.s_cost_factor[16] + * self.data.costs_2015.s_cref[16] + * (self.data.costs_2015.s_k[16] / self.data.costs_2015.s_kref[16]) ** cost_variables.costexp ) # superconductor strand cost ($) - cost_2015_variables.s_label[17] = ( + self.data.costs_2015.s_label[17] = ( "Strands with Nb3Sn superconductor and copper stabiliser" ) # ITER Nb3Sn SC strands cost (2014 $) - cost_2015_variables.s_cref[17] = 526.0e6 + self.data.costs_2015.s_cref[17] = 526.0e6 # Scale with the total mass of Nb3Sn (kg) - cost_2015_variables.s_k[17] = ( + self.data.costs_2015.s_k[17] = ( tfcoil_variables.m_tf_coil_superconductor * tfcoil_variables.n_tf_coils ) - cost_2015_variables.s_kref[17] = 210.0e3 - cost_2015_variables.s_cost[17] = ( - cost_2015_variables.s_cost_factor[17] - * cost_2015_variables.s_cref[17] - * (cost_2015_variables.s_k[17] / cost_2015_variables.s_kref[17]) + self.data.costs_2015.s_kref[17] = 210.0e3 + self.data.costs_2015.s_cost[17] = ( + self.data.costs_2015.s_cost_factor[17] + * self.data.costs_2015.s_cref[17] + * (self.data.costs_2015.s_k[17] / self.data.costs_2015.s_kref[17]) ** cost_variables.costexp ) # Superconductor testing cost ($) - cost_2015_variables.s_label[18] = "Testing of superconducting strands" + self.data.costs_2015.s_label[18] = "Testing of superconducting strands" # ITER Nb3Sn strand test costs (2014 $) - cost_2015_variables.s_cref[18] = 4.0e6 - cost_2015_variables.s_cost[18] = ( - cost_2015_variables.s_cost_factor[18] * cost_2015_variables.s_cref[18] + self.data.costs_2015.s_cref[18] = 4.0e6 + self.data.costs_2015.s_cost[18] = ( + self.data.costs_2015.s_cost_factor[18] * self.data.costs_2015.s_cref[18] ) # Superconductor cabling and jacketing cost ($) - cost_2015_variables.s_label[19] = "Cabling and jacketing" + self.data.costs_2015.s_label[19] = "Cabling and jacketing" # ITER cabling and jacketing costs (2014 $) - cost_2015_variables.s_cref[19] = 81.0e6 + self.data.costs_2015.s_cref[19] = 81.0e6 # Scale with total turn length. - cost_2015_variables.s_k[19] = ( + self.data.costs_2015.s_k[19] = ( tfcoil_variables.n_tf_coils * tfcoil_variables.len_tf_coil * tfcoil_variables.n_tf_coil_turns ) - cost_2015_variables.s_kref[19] = 82249.0e0 - cost_2015_variables.s_cost[19] = ( - cost_2015_variables.s_cost_factor[19] - * cost_2015_variables.s_cref[19] - * (cost_2015_variables.s_k[19] / cost_2015_variables.s_kref[19]) + self.data.costs_2015.s_kref[19] = 82249.0e0 + self.data.costs_2015.s_cost[19] = ( + self.data.costs_2015.s_cost_factor[19] + * self.data.costs_2015.s_cref[19] + * (self.data.costs_2015.s_k[19] / self.data.costs_2015.s_kref[19]) ** cost_variables.costexp ) # Total TF coil costs ($) - cost_2015_variables.s_label[20] = "Total TF coil costs" - cost_2015_variables.s_cost[20] = 0.0e0 + self.data.costs_2015.s_label[20] = "Total TF coil costs" + self.data.costs_2015.s_cost[20] = 0.0e0 for j in range(13, 20): - cost_2015_variables.s_cost[20] = ( - cost_2015_variables.s_cost[20] + cost_2015_variables.s_cost[j] + self.data.costs_2015.s_cost[20] = ( + self.data.costs_2015.s_cost[20] + self.data.costs_2015.s_cost[j] ) def calc_remote_handling_costs(self): @@ -781,46 +782,46 @@ def calc_remote_handling_costs(self): PROCESS Costs Paper (M. Kovari, J. Morris) """ for i in range(27, 31): - cost_2015_variables.s_cost_factor[i] = cost_variables.cost_factor_rh + self.data.costs_2015.s_cost_factor[i] = cost_variables.cost_factor_rh # K:\Power Plant Physics and Technology\Costs\Remote handling # From Sam Ha. - cost_2015_variables.s_label[27] = "Moveable equipment" - cost_2015_variables.s_cref[27] = 1.0e6 * ( + self.data.costs_2015.s_label[27] = "Moveable equipment" + self.data.costs_2015.s_cref[27] = 1.0e6 * ( 139.0e0 * cost_variables.num_rh_systems + 410.0e0 ) # Scale with total mass of armour, first wall and blanket (kg) - cost_2015_variables.s_kref[27] = 4.35e6 - cost_2015_variables.s_k[27] = fwbs_variables.armour_fw_bl_mass - cost_2015_variables.s_cost[27] = ( - cost_2015_variables.s_cost_factor[27] - * cost_2015_variables.s_cref[27] - * (cost_2015_variables.s_k[27] / cost_2015_variables.s_kref[27]) + self.data.costs_2015.s_kref[27] = 4.35e6 + self.data.costs_2015.s_k[27] = fwbs_variables.armour_fw_bl_mass + self.data.costs_2015.s_cost[27] = ( + self.data.costs_2015.s_cost_factor[27] + * self.data.costs_2015.s_cref[27] + * (self.data.costs_2015.s_k[27] / self.data.costs_2015.s_kref[27]) ** cost_variables.costexp ) - cost_2015_variables.s_label[28] = ( + self.data.costs_2015.s_label[28] = ( "Active maintenance facility with fixed equipment" ) - cost_2015_variables.s_cref[28] = 1.0e6 * ( + self.data.costs_2015.s_cref[28] = 1.0e6 * ( 95.0e0 * cost_variables.num_rh_systems + 2562.0e0 ) # Scale with total mass of armour, first wall and blanket (kg) - cost_2015_variables.s_kref[28] = 4.35e6 - cost_2015_variables.s_k[28] = fwbs_variables.armour_fw_bl_mass - cost_2015_variables.s_cost[28] = ( - cost_2015_variables.s_cost_factor[28] - * cost_2015_variables.s_cref[28] - * (cost_2015_variables.s_k[28] / cost_2015_variables.s_kref[28]) + self.data.costs_2015.s_kref[28] = 4.35e6 + self.data.costs_2015.s_k[28] = fwbs_variables.armour_fw_bl_mass + self.data.costs_2015.s_cost[28] = ( + self.data.costs_2015.s_cost_factor[28] + * self.data.costs_2015.s_cref[28] + * (self.data.costs_2015.s_k[28] / self.data.costs_2015.s_kref[28]) ** cost_variables.costexp ) # s(30) is not in use - cost_2015_variables.s_label[30] = "Total remote handling costs" - cost_2015_variables.s_cost[30] = ( - cost_2015_variables.s_cost[27] + cost_2015_variables.s_cost[28] + self.data.costs_2015.s_label[30] = "Total remote handling costs" + self.data.costs_2015.s_cost[30] = ( + self.data.costs_2015.s_cost[27] + self.data.costs_2015.s_cost[28] ) def calc_n_plant_and_vv_costs(self): @@ -830,43 +831,45 @@ def calc_n_plant_and_vv_costs(self): PROCESS Costs Paper (M. Kovari, J. Morris) """ for i in range(31, 34): - cost_2015_variables.s_cost_factor[i] = cost_variables.cost_factor_vv + self.data.costs_2015.s_cost_factor[i] = cost_variables.cost_factor_vv # Vacuum vessel - cost_2015_variables.s_label[31] = "Vacuum vessel" + self.data.costs_2015.s_label[31] = "Vacuum vessel" # ITER reference vacuum vessel cost (2014 $) - cost_2015_variables.s_cref[31] = 537.0e6 + self.data.costs_2015.s_cref[31] = 537.0e6 # Scale with outermost midplane radius of vacuum vessel squared (m2) - cost_2015_variables.s_k[31] = ( + self.data.costs_2015.s_k[31] = ( build_variables.r_shld_outboard_outer + build_variables.dr_vv_outboard ) ** 2 - cost_2015_variables.s_kref[31] = 94.09e0 - cost_2015_variables.s_cost[31] = ( - cost_2015_variables.s_cost_factor[31] - * cost_2015_variables.s_cref[31] - * (cost_2015_variables.s_k[31] / cost_2015_variables.s_kref[31]) + self.data.costs_2015.s_kref[31] = 94.09e0 + self.data.costs_2015.s_cost[31] = ( + self.data.costs_2015.s_cost_factor[31] + * self.data.costs_2015.s_cref[31] + * (self.data.costs_2015.s_k[31] / self.data.costs_2015.s_kref[31]) ** cost_variables.costexp ) # Nitrogen plant - cost_2015_variables.s_label[32] = "Liquid nitrogen plant" + self.data.costs_2015.s_label[32] = "Liquid nitrogen plant" # ITER reference cost (2014 $) - cost_2015_variables.s_cref[32] = 86.0e6 + self.data.costs_2015.s_cref[32] = 86.0e6 # Scale with 4.5K cryopower (W) - cost_2015_variables.s_k[32] = heat_transport_variables.helpow - cost_2015_variables.s_kref[32] = 50.0e3 - cost_2015_variables.s_cost[32] = ( - cost_2015_variables.s_cost_factor[32] - * cost_2015_variables.s_cref[32] - * (cost_2015_variables.s_k[32] / cost_2015_variables.s_kref[32]) + self.data.costs_2015.s_k[32] = heat_transport_variables.helpow + self.data.costs_2015.s_kref[32] = 50.0e3 + self.data.costs_2015.s_cost[32] = ( + self.data.costs_2015.s_cost_factor[32] + * self.data.costs_2015.s_cref[32] + * (self.data.costs_2015.s_k[32] / self.data.costs_2015.s_kref[32]) ** cost_variables.costexp ) - cost_2015_variables.s_label[33] = "Total liquid nitrogen plant and vacuum vessel" - cost_2015_variables.s_cost[33] = 0.0e0 + self.data.costs_2015.s_label[33] = ( + "Total liquid nitrogen plant and vacuum vessel" + ) + self.data.costs_2015.s_cost[33] = 0.0e0 for j in range(31, 33): - cost_2015_variables.s_cost[33] = ( - cost_2015_variables.s_cost[33] + cost_2015_variables.s_cost[j] + self.data.costs_2015.s_cost[33] = ( + self.data.costs_2015.s_cost[33] + self.data.costs_2015.s_cost[j] ) def calc_energy_conversion_system(self): @@ -875,18 +878,18 @@ def calc_energy_conversion_system(self): for a fusion power plant based on the costings in the PROCESS costs paper. PROCESS Costs Paper (M. Kovari, J. Morris) """ - cost_2015_variables.s_label[34] = "Energy conversion system" + self.data.costs_2015.s_label[34] = "Energy conversion system" # Set cost factor for energy conversion system - cost_2015_variables.s_cost_factor[34] = cost_variables.cost_factor_bop + self.data.costs_2015.s_cost_factor[34] = cost_variables.cost_factor_bop # Cost of reference energy conversion system (Rolls Royce) - cost_2015_variables.s_cref[34] = 511.0e6 + self.data.costs_2015.s_cref[34] = 511.0e6 # Scale with gross electric power (MWe) - cost_2015_variables.s_k[34] = heat_transport_variables.p_plant_electric_gross_mw - cost_2015_variables.s_kref[34] = 692.0e0 - cost_2015_variables.s_cost[34] = ( - cost_2015_variables.s_cost_factor[34] - * cost_2015_variables.s_cref[34] - * (cost_2015_variables.s_k[34] / cost_2015_variables.s_kref[34]) + self.data.costs_2015.s_k[34] = heat_transport_variables.p_plant_electric_gross_mw + self.data.costs_2015.s_kref[34] = 692.0e0 + self.data.costs_2015.s_cost[34] = ( + self.data.costs_2015.s_cost_factor[34] + * self.data.costs_2015.s_cref[34] + * (self.data.costs_2015.s_k[34] / self.data.costs_2015.s_kref[34]) ** cost_variables.costexp ) @@ -897,124 +900,124 @@ def calc_remaining_subsystems(self): PROCESS Costs Paper (M. Kovari, J. Morris) """ for i in range(35, 60): - cost_2015_variables.s_cost_factor[i] = cost_variables.cost_factor_misc + self.data.costs_2015.s_cost_factor[i] = cost_variables.cost_factor_misc - cost_2015_variables.s_label[35] = "CS and PF coils" + self.data.costs_2015.s_label[35] = "CS and PF coils" # # Cost of ITER CS and PF magnets - cost_2015_variables.s_cref[35] = 1538.0e6 + self.data.costs_2015.s_cref[35] = 1538.0e6 # Scale with sum of (A x turns x radius) of CS and all PF coils - cost_2015_variables.s_k[35] = pfcoil_variables.itr_sum - cost_2015_variables.s_kref[35] = 7.4e8 - cost_2015_variables.s_cost[35] = ( - cost_2015_variables.s_cost_factor[35] - * cost_2015_variables.s_cref[35] - * (cost_2015_variables.s_k[35] / cost_2015_variables.s_kref[35]) + self.data.costs_2015.s_k[35] = pfcoil_variables.itr_sum + self.data.costs_2015.s_kref[35] = 7.4e8 + self.data.costs_2015.s_cost[35] = ( + self.data.costs_2015.s_cost_factor[35] + * self.data.costs_2015.s_cref[35] + * (self.data.costs_2015.s_k[35] / self.data.costs_2015.s_kref[35]) ** cost_variables.costexp ) - cost_2015_variables.s_label[36] = ( + self.data.costs_2015.s_label[36] = ( "Vacuum vessel in-wall shielding, ports and in-vessel coils" ) # Cost of ITER VV in-wall shielding, ports and in-vessel coils - cost_2015_variables.s_cref[36] = 211.0e6 + self.data.costs_2015.s_cref[36] = 211.0e6 # Scale with vacuum vessel mass (kg) - cost_2015_variables.s_k[36] = fwbs_variables.m_vv - cost_2015_variables.s_kref[36] = 5.2360e6 - cost_2015_variables.s_cost[36] = ( - cost_2015_variables.s_cost_factor[36] - * cost_2015_variables.s_cref[36] - * (cost_2015_variables.s_k[36] / cost_2015_variables.s_kref[36]) + self.data.costs_2015.s_k[36] = fwbs_variables.m_vv + self.data.costs_2015.s_kref[36] = 5.2360e6 + self.data.costs_2015.s_cost[36] = ( + self.data.costs_2015.s_cost_factor[36] + * self.data.costs_2015.s_cref[36] + * (self.data.costs_2015.s_k[36] / self.data.costs_2015.s_kref[36]) ** cost_variables.costexp ) - cost_2015_variables.s_label[37] = "Divertor" + self.data.costs_2015.s_label[37] = "Divertor" # Cost of ITER divertor - cost_2015_variables.s_cref[37] = 381.0e6 + self.data.costs_2015.s_cref[37] = 381.0e6 # Scale with max power to SOL (MW) - cost_2015_variables.s_k[37] = physics_variables.p_plasma_separatrix_mw - cost_2015_variables.s_kref[37] = 140.0e0 - cost_2015_variables.s_cost[37] = ( - cost_2015_variables.s_cost_factor[37] - * cost_2015_variables.s_cref[37] - * (cost_2015_variables.s_k[37] / cost_2015_variables.s_kref[37]) + self.data.costs_2015.s_k[37] = physics_variables.p_plasma_separatrix_mw + self.data.costs_2015.s_kref[37] = 140.0e0 + self.data.costs_2015.s_cost[37] = ( + self.data.costs_2015.s_cost_factor[37] + * self.data.costs_2015.s_cref[37] + * (self.data.costs_2015.s_k[37] / self.data.costs_2015.s_kref[37]) ** cost_variables.costexp ) - cost_2015_variables.s_label[38] = "not used" - cost_2015_variables.s_label[39] = "not used" + self.data.costs_2015.s_label[38] = "not used" + self.data.costs_2015.s_label[39] = "not used" - cost_2015_variables.s_label[40] = ( + self.data.costs_2015.s_label[40] = ( "Ex-vessel neutral beam remote handling equipment" ) # Cost of ITER Ex-vessel NBI RH equipment # Increased to 90 Mdollar because of press release - cost_2015_variables.s_cref[40] = 90.0e6 + self.data.costs_2015.s_cref[40] = 90.0e6 # Scale with total aux injected power (MW) - cost_2015_variables.s_k[40] = current_drive_variables.p_hcd_injected_total_mw - cost_2015_variables.s_kref[40] = 50.0e0 - cost_2015_variables.s_cost[40] = ( - cost_2015_variables.s_cost_factor[40] - * cost_2015_variables.s_cref[40] - * (cost_2015_variables.s_k[40] / cost_2015_variables.s_kref[40]) + self.data.costs_2015.s_k[40] = current_drive_variables.p_hcd_injected_total_mw + self.data.costs_2015.s_kref[40] = 50.0e0 + self.data.costs_2015.s_cost[40] = ( + self.data.costs_2015.s_cost_factor[40] + * self.data.costs_2015.s_cref[40] + * (self.data.costs_2015.s_k[40] / self.data.costs_2015.s_kref[40]) ** cost_variables.costexp ) - cost_2015_variables.s_label[41] = "not used" + self.data.costs_2015.s_label[41] = "not used" - cost_2015_variables.s_label[42] = "Vacuum vessel pressure suppression system" + self.data.costs_2015.s_label[42] = "Vacuum vessel pressure suppression system" # Cost of ITER Vacuum vessel pressure suppression system - cost_2015_variables.s_cref[42] = 40.0e6 + self.data.costs_2015.s_cref[42] = 40.0e6 # Scale with total thermal power removed from fusion core (MW) - cost_2015_variables.s_k[42] = ( + self.data.costs_2015.s_k[42] = ( heat_transport_variables.p_plant_primary_heat_mw + heat_transport_variables.p_plant_secondary_heat_mw ) - cost_2015_variables.s_kref[42] = 550.0e0 - cost_2015_variables.s_cost[42] = ( - cost_2015_variables.s_cost_factor[42] - * cost_2015_variables.s_cref[42] - * (cost_2015_variables.s_k[42] / cost_2015_variables.s_kref[42]) + self.data.costs_2015.s_kref[42] = 550.0e0 + self.data.costs_2015.s_cost[42] = ( + self.data.costs_2015.s_cost_factor[42] + * self.data.costs_2015.s_cref[42] + * (self.data.costs_2015.s_k[42] / self.data.costs_2015.s_kref[42]) ** cost_variables.costexp ) - cost_2015_variables.s_label[43] = "Cryostat" + self.data.costs_2015.s_label[43] = "Cryostat" # Cost of ITER cryostat - cost_2015_variables.s_cref[43] = 351.0e6 + self.data.costs_2015.s_cref[43] = 351.0e6 # Scale with cryostat external volume (m3) - cost_2015_variables.s_k[43] = ( + self.data.costs_2015.s_k[43] = ( (np.pi * fwbs_variables.r_cryostat_inboard**2.0e0) * 2.0e0 * fwbs_variables.z_cryostat_half_inside ) - cost_2015_variables.s_kref[43] = 18700.0e0 - cost_2015_variables.s_cost[43] = ( - cost_2015_variables.s_cost_factor[43] - * cost_2015_variables.s_cref[43] - * (cost_2015_variables.s_k[43] / cost_2015_variables.s_kref[43]) + self.data.costs_2015.s_kref[43] = 18700.0e0 + self.data.costs_2015.s_cost[43] = ( + self.data.costs_2015.s_cost_factor[43] + * self.data.costs_2015.s_cref[43] + * (self.data.costs_2015.s_k[43] / self.data.costs_2015.s_kref[43]) ** cost_variables.costexp ) - cost_2015_variables.s_label[44] = "Heat removal system" + self.data.costs_2015.s_label[44] = "Heat removal system" # Cost of ITER cooling water system - cost_2015_variables.s_cref[44] = 724.0e6 + self.data.costs_2015.s_cref[44] = 724.0e6 # Scale with total thermal power removed from fusion core (MW) - cost_2015_variables.s_k[44] = ( + self.data.costs_2015.s_k[44] = ( heat_transport_variables.p_plant_primary_heat_mw + heat_transport_variables.p_plant_secondary_heat_mw ) - cost_2015_variables.s_kref[44] = 550.0e0 - cost_2015_variables.s_cost[44] = ( - cost_2015_variables.s_cost_factor[44] - * cost_2015_variables.s_cref[44] - * (cost_2015_variables.s_k[44] / cost_2015_variables.s_kref[44]) + self.data.costs_2015.s_kref[44] = 550.0e0 + self.data.costs_2015.s_cost[44] = ( + self.data.costs_2015.s_cost_factor[44] + * self.data.costs_2015.s_cref[44] + * (self.data.costs_2015.s_k[44] / self.data.costs_2015.s_kref[44]) ** cost_variables.costexp ) - cost_2015_variables.s_label[45] = "Thermal shields" + self.data.costs_2015.s_label[45] = "Thermal shields" # Cost of ITER thermal shields - cost_2015_variables.s_cref[45] = 126.0e6 + self.data.costs_2015.s_cref[45] = 126.0e6 # Scale with cryostat surface area (m2) - cost_2015_variables.s_k[45] = ( + self.data.costs_2015.s_k[45] = ( 2.0e0 * np.pi * fwbs_variables.r_cryostat_inboard @@ -1022,238 +1025,240 @@ def calc_remaining_subsystems(self): * fwbs_variables.z_cryostat_half_inside + 2 * (np.pi * fwbs_variables.r_cryostat_inboard**2) ) - cost_2015_variables.s_kref[45] = 3902.0e0 - cost_2015_variables.s_cost[45] = ( - cost_2015_variables.s_cost_factor[45] - * cost_2015_variables.s_cref[45] - * (cost_2015_variables.s_k[45] / cost_2015_variables.s_kref[45]) + self.data.costs_2015.s_kref[45] = 3902.0e0 + self.data.costs_2015.s_cost[45] = ( + self.data.costs_2015.s_cost_factor[45] + * self.data.costs_2015.s_cref[45] + * (self.data.costs_2015.s_k[45] / self.data.costs_2015.s_kref[45]) ** cost_variables.costexp ) - cost_2015_variables.s_label[46] = "Pellet injection system" + self.data.costs_2015.s_label[46] = "Pellet injection system" # Cost of ITER pellet injector and pellet injection system - cost_2015_variables.s_cref[46] = 25.0e6 + self.data.costs_2015.s_cref[46] = 25.0e6 # Scale with fusion power (MW) - cost_2015_variables.s_k[46] = physics_variables.p_fusion_total_mw - cost_2015_variables.s_kref[46] = 500.0e0 - cost_2015_variables.s_cost[46] = ( - cost_2015_variables.s_cost_factor[46] - * cost_2015_variables.s_cref[46] - * (cost_2015_variables.s_k[46] / cost_2015_variables.s_kref[46]) + self.data.costs_2015.s_k[46] = physics_variables.p_fusion_total_mw + self.data.costs_2015.s_kref[46] = 500.0e0 + self.data.costs_2015.s_cost[46] = ( + self.data.costs_2015.s_cost_factor[46] + * self.data.costs_2015.s_cref[46] + * (self.data.costs_2015.s_k[46] / self.data.costs_2015.s_kref[46]) ** cost_variables.costexp ) - cost_2015_variables.s_label[47] = "Gas injection and wall conditioning system" + self.data.costs_2015.s_label[47] = "Gas injection and wall conditioning system" # # Cost of ITER gas injection system, GDC, Gi valve boxes - cost_2015_variables.s_cref[47] = 32.0e6 + self.data.costs_2015.s_cref[47] = 32.0e6 # Scale with fusion power (MW) - cost_2015_variables.s_k[47] = physics_variables.p_fusion_total_mw - cost_2015_variables.s_kref[47] = 500.0e0 - cost_2015_variables.s_cost[47] = ( - cost_2015_variables.s_cost_factor[47] - * cost_2015_variables.s_cref[47] - * (cost_2015_variables.s_k[47] / cost_2015_variables.s_kref[47]) + self.data.costs_2015.s_k[47] = physics_variables.p_fusion_total_mw + self.data.costs_2015.s_kref[47] = 500.0e0 + self.data.costs_2015.s_cost[47] = ( + self.data.costs_2015.s_cost_factor[47] + * self.data.costs_2015.s_cref[47] + * (self.data.costs_2015.s_k[47] / self.data.costs_2015.s_kref[47]) ** cost_variables.costexp ) - cost_2015_variables.s_label[48] = "Vacuum pumping" + self.data.costs_2015.s_label[48] = "Vacuum pumping" # Cost of ITER vacuum pumping - cost_2015_variables.s_cref[48] = 201.0e6 + self.data.costs_2015.s_cref[48] = 201.0e6 # Scale with fusion power (MW) - cost_2015_variables.s_k[48] = physics_variables.p_fusion_total_mw - cost_2015_variables.s_kref[48] = 500.0e0 - cost_2015_variables.s_cost[48] = ( - cost_2015_variables.s_cost_factor[48] - * cost_2015_variables.s_cref[48] - * (cost_2015_variables.s_k[48] / cost_2015_variables.s_kref[48]) + self.data.costs_2015.s_k[48] = physics_variables.p_fusion_total_mw + self.data.costs_2015.s_kref[48] = 500.0e0 + self.data.costs_2015.s_cost[48] = ( + self.data.costs_2015.s_cost_factor[48] + * self.data.costs_2015.s_cref[48] + * (self.data.costs_2015.s_k[48] / self.data.costs_2015.s_kref[48]) ** cost_variables.costexp ) - cost_2015_variables.s_label[49] = "Tritium plant" + self.data.costs_2015.s_label[49] = "Tritium plant" # Cost of ITER tritium plant - cost_2015_variables.s_cref[49] = 226.0e6 + self.data.costs_2015.s_cref[49] = 226.0e6 # Scale with fusion power (MW) - cost_2015_variables.s_k[49] = physics_variables.p_fusion_total_mw - cost_2015_variables.s_kref[49] = 500.0e0 - cost_2015_variables.s_cost[49] = ( - cost_2015_variables.s_cost_factor[49] - * cost_2015_variables.s_cref[49] - * (cost_2015_variables.s_k[49] / cost_2015_variables.s_kref[49]) + self.data.costs_2015.s_k[49] = physics_variables.p_fusion_total_mw + self.data.costs_2015.s_kref[49] = 500.0e0 + self.data.costs_2015.s_cost[49] = ( + self.data.costs_2015.s_cost_factor[49] + * self.data.costs_2015.s_cref[49] + * (self.data.costs_2015.s_k[49] / self.data.costs_2015.s_kref[49]) ** cost_variables.costexp ) - cost_2015_variables.s_label[50] = "Cryoplant and distribution" + self.data.costs_2015.s_label[50] = "Cryoplant and distribution" # Cost of ITER Cryoplant and distribution - cost_2015_variables.s_cref[50] = 397.0e6 + self.data.costs_2015.s_cref[50] = 397.0e6 # Scale with heat removal at 4.5 K approx (W) - cost_2015_variables.s_k[50] = heat_transport_variables.helpow - cost_2015_variables.s_kref[50] = 50000.0e0 - cost_2015_variables.s_cost[50] = ( - cost_2015_variables.s_cost_factor[50] - * cost_2015_variables.s_cref[50] - * (cost_2015_variables.s_k[50] / cost_2015_variables.s_kref[50]) + self.data.costs_2015.s_k[50] = heat_transport_variables.helpow + self.data.costs_2015.s_kref[50] = 50000.0e0 + self.data.costs_2015.s_cost[50] = ( + self.data.costs_2015.s_cost_factor[50] + * self.data.costs_2015.s_cref[50] + * (self.data.costs_2015.s_k[50] / self.data.costs_2015.s_kref[50]) ** cost_variables.costexp ) - cost_2015_variables.s_label[51] = "Electrical power supply and distribution" + self.data.costs_2015.s_label[51] = "Electrical power supply and distribution" # Cost of ITER electrical power supply and distribution - cost_2015_variables.s_cref[51] = 1188.0e6 + self.data.costs_2015.s_cref[51] = 1188.0e6 # Scale with total magnetic energy in the poloidal field / resistive diffusion time (W) # For ITER value see # K:\Power Plant Physics and Technology\PROCESS\PROCESS documentation papers\resistive diffusion time.xmcd or pdf - cost_2015_variables.s_k[51] = ( + self.data.costs_2015.s_k[51] = ( pf_power_variables.ensxpfm * 1.0e6 / physics_variables.t_plasma_res_diffusion ) - cost_2015_variables.s_kref[51] = 8.0e9 / 953.0e0 - cost_2015_variables.s_cost[51] = ( - cost_2015_variables.s_cost_factor[51] - * cost_2015_variables.s_cref[51] - * (cost_2015_variables.s_k[51] / cost_2015_variables.s_kref[51]) + self.data.costs_2015.s_kref[51] = 8.0e9 / 953.0e0 + self.data.costs_2015.s_cost[51] = ( + self.data.costs_2015.s_cost_factor[51] + * self.data.costs_2015.s_cref[51] + * (self.data.costs_2015.s_k[51] / self.data.costs_2015.s_kref[51]) ** cost_variables.costexp ) - cost_2015_variables.s_label[52] = "Neutral beam heating and current drive system" + self.data.costs_2015.s_label[52] = ( + "Neutral beam heating and current drive system" + ) # Cost of ITER NB H and CD - cost_2015_variables.s_cref[52] = 814.0e6 + self.data.costs_2015.s_cref[52] = 814.0e6 # Scale with total auxiliary injected power (MW) - cost_2015_variables.s_k[52] = current_drive_variables.p_hcd_injected_total_mw - cost_2015_variables.s_kref[52] = 50.0e0 - cost_2015_variables.s_cost[52] = ( - cost_2015_variables.s_cost_factor[52] - * cost_2015_variables.s_cref[52] - * (cost_2015_variables.s_k[52] / cost_2015_variables.s_kref[52]) + self.data.costs_2015.s_k[52] = current_drive_variables.p_hcd_injected_total_mw + self.data.costs_2015.s_kref[52] = 50.0e0 + self.data.costs_2015.s_cost[52] = ( + self.data.costs_2015.s_cost_factor[52] + * self.data.costs_2015.s_cref[52] + * (self.data.costs_2015.s_k[52] / self.data.costs_2015.s_kref[52]) ** cost_variables.costexp ) - cost_2015_variables.s_label[53] = "Diagnostics systems" + self.data.costs_2015.s_label[53] = "Diagnostics systems" # Cost of ITER diagnostic systems - cost_2015_variables.s_cref[53] = 640.0e6 + self.data.costs_2015.s_cref[53] = 640.0e6 # No scaling - cost_2015_variables.s_cost[53] = ( - cost_2015_variables.s_cost_factor[53] * cost_2015_variables.s_cref[53] + self.data.costs_2015.s_cost[53] = ( + self.data.costs_2015.s_cost_factor[53] * self.data.costs_2015.s_cref[53] ) - cost_2015_variables.s_label[54] = "Radiological protection" + self.data.costs_2015.s_label[54] = "Radiological protection" # Cost of ITER radiological protection - cost_2015_variables.s_cref[54] = 19.0e6 + self.data.costs_2015.s_cref[54] = 19.0e6 # Scale with fusion power (MW) - cost_2015_variables.s_k[54] = physics_variables.p_fusion_total_mw - cost_2015_variables.s_kref[54] = 500.0e0 - cost_2015_variables.s_cost[54] = ( - cost_2015_variables.s_cost_factor[54] - * cost_2015_variables.s_cref[54] - * (cost_2015_variables.s_k[54] / cost_2015_variables.s_kref[54]) + self.data.costs_2015.s_k[54] = physics_variables.p_fusion_total_mw + self.data.costs_2015.s_kref[54] = 500.0e0 + self.data.costs_2015.s_cost[54] = ( + self.data.costs_2015.s_cost_factor[54] + * self.data.costs_2015.s_cref[54] + * (self.data.costs_2015.s_k[54] / self.data.costs_2015.s_kref[54]) ** cost_variables.costexp ) - cost_2015_variables.s_label[55] = "Access control and security systems" + self.data.costs_2015.s_label[55] = "Access control and security systems" # Cost of ITER access control and security systems # Scale with area of cryostat (m2) - cost_2015_variables.s_k[55] = np.pi * fwbs_variables.r_cryostat_inboard**2 - cost_2015_variables.s_kref[55] = 640.0e0 - cost_2015_variables.s_cref[55] = 42.0e6 - cost_2015_variables.s_cost[55] = ( - cost_2015_variables.s_cost_factor[55] - * cost_2015_variables.s_cref[55] - * (cost_2015_variables.s_k[55] / cost_2015_variables.s_kref[55]) + self.data.costs_2015.s_k[55] = np.pi * fwbs_variables.r_cryostat_inboard**2 + self.data.costs_2015.s_kref[55] = 640.0e0 + self.data.costs_2015.s_cref[55] = 42.0e6 + self.data.costs_2015.s_cost[55] = ( + self.data.costs_2015.s_cost_factor[55] + * self.data.costs_2015.s_cref[55] + * (self.data.costs_2015.s_k[55] / self.data.costs_2015.s_kref[55]) ** cost_variables.costexp ) - cost_2015_variables.s_label[56] = "Assembly" + self.data.costs_2015.s_label[56] = "Assembly" # Cost of ITER assembly - cost_2015_variables.s_cref[56] = 732.0e6 + self.data.costs_2015.s_cref[56] = 732.0e6 # Scale with total cost of reactor items (cryostat and everything inside it) - cost_2015_variables.s_k[56] = ( - cost_2015_variables.s_cost[20] - + cost_2015_variables.s_cost[26] - + cost_2015_variables.s_cost[31] - + cost_2015_variables.s_cost[35] - + cost_2015_variables.s_cost[36] - + cost_2015_variables.s_cost[37] - + cost_2015_variables.s_cost[43] - + cost_2015_variables.s_cost[45] - + cost_2015_variables.s_cost[48] - ) - cost_2015_variables.s_kref[56] = ( - cost_2015_variables.s_cref[20] - + cost_2015_variables.s_cref[26] - + cost_2015_variables.s_cref[31] - + cost_2015_variables.s_cref[35] - + cost_2015_variables.s_cref[36] - + cost_2015_variables.s_cref[37] - + cost_2015_variables.s_cref[43] - + cost_2015_variables.s_cref[45] - + cost_2015_variables.s_cref[48] - ) - cost_2015_variables.s_cost[56] = ( - cost_2015_variables.s_cost_factor[56] - * cost_2015_variables.s_cref[56] - * (cost_2015_variables.s_k[56] / cost_2015_variables.s_kref[56]) - ) - - cost_2015_variables.s_label[57] = "Control and communication" + self.data.costs_2015.s_k[56] = ( + self.data.costs_2015.s_cost[20] + + self.data.costs_2015.s_cost[26] + + self.data.costs_2015.s_cost[31] + + self.data.costs_2015.s_cost[35] + + self.data.costs_2015.s_cost[36] + + self.data.costs_2015.s_cost[37] + + self.data.costs_2015.s_cost[43] + + self.data.costs_2015.s_cost[45] + + self.data.costs_2015.s_cost[48] + ) + self.data.costs_2015.s_kref[56] = ( + self.data.costs_2015.s_cref[20] + + self.data.costs_2015.s_cref[26] + + self.data.costs_2015.s_cref[31] + + self.data.costs_2015.s_cref[35] + + self.data.costs_2015.s_cref[36] + + self.data.costs_2015.s_cref[37] + + self.data.costs_2015.s_cref[43] + + self.data.costs_2015.s_cref[45] + + self.data.costs_2015.s_cref[48] + ) + self.data.costs_2015.s_cost[56] = ( + self.data.costs_2015.s_cost_factor[56] + * self.data.costs_2015.s_cref[56] + * (self.data.costs_2015.s_k[56] / self.data.costs_2015.s_kref[56]) + ) + + self.data.costs_2015.s_label[57] = "Control and communication" # Cost of ITER control and data access and communication - cost_2015_variables.s_cref[57] = 219.0e6 + self.data.costs_2015.s_cref[57] = 219.0e6 # Scale with total cost of reactor items (cryostat and everythign inside it) - cost_2015_variables.s_k[57] = ( - cost_2015_variables.s_cost[20] - + cost_2015_variables.s_cost[26] - + cost_2015_variables.s_cost[31] - + cost_2015_variables.s_cost[35] - + cost_2015_variables.s_cost[36] - + cost_2015_variables.s_cost[37] - + cost_2015_variables.s_cost[43] - + cost_2015_variables.s_cost[45] - + cost_2015_variables.s_cost[48] - ) - cost_2015_variables.s_kref[57] = ( - cost_2015_variables.s_cref[20] - + cost_2015_variables.s_cref[26] - + cost_2015_variables.s_cref[31] - + cost_2015_variables.s_cref[35] - + cost_2015_variables.s_cref[36] - + cost_2015_variables.s_cref[37] - + cost_2015_variables.s_cref[43] - + cost_2015_variables.s_cref[45] - + cost_2015_variables.s_cref[48] - ) - cost_2015_variables.s_cost[57] = ( - cost_2015_variables.s_cost_factor[57] - * cost_2015_variables.s_cref[57] - * (cost_2015_variables.s_k[57] / cost_2015_variables.s_kref[57]) + self.data.costs_2015.s_k[57] = ( + self.data.costs_2015.s_cost[20] + + self.data.costs_2015.s_cost[26] + + self.data.costs_2015.s_cost[31] + + self.data.costs_2015.s_cost[35] + + self.data.costs_2015.s_cost[36] + + self.data.costs_2015.s_cost[37] + + self.data.costs_2015.s_cost[43] + + self.data.costs_2015.s_cost[45] + + self.data.costs_2015.s_cost[48] + ) + self.data.costs_2015.s_kref[57] = ( + self.data.costs_2015.s_cref[20] + + self.data.costs_2015.s_cref[26] + + self.data.costs_2015.s_cref[31] + + self.data.costs_2015.s_cref[35] + + self.data.costs_2015.s_cref[36] + + self.data.costs_2015.s_cref[37] + + self.data.costs_2015.s_cref[43] + + self.data.costs_2015.s_cref[45] + + self.data.costs_2015.s_cref[48] + ) + self.data.costs_2015.s_cost[57] = ( + self.data.costs_2015.s_cost_factor[57] + * self.data.costs_2015.s_cref[57] + * (self.data.costs_2015.s_k[57] / self.data.costs_2015.s_kref[57]) ** cost_variables.costexp ) - cost_2015_variables.s_label[58] = "Additional project expenditure" + self.data.costs_2015.s_label[58] = "Additional project expenditure" # Cost of ITER additional ITER IO expenditure - cost_2015_variables.s_cref[58] = 1624.0e6 - cost_2015_variables.s_cost[58] = ( - cost_2015_variables.s_cost_factor[58] * cost_2015_variables.s_cref[58] + self.data.costs_2015.s_cref[58] = 1624.0e6 + self.data.costs_2015.s_cost[58] = ( + self.data.costs_2015.s_cost_factor[58] * self.data.costs_2015.s_cref[58] ) # Calculate miscellaneous costs - cost_2015_variables.s_label[59] = "Logistics" - cost_2015_variables.s_cref[59] = 129.0e6 + self.data.costs_2015.s_label[59] = "Logistics" + self.data.costs_2015.s_cref[59] = 129.0e6 # Scale with cryostat external volume (m) - cost_2015_variables.s_k[59] = ( + self.data.costs_2015.s_k[59] = ( np.pi * fwbs_variables.r_cryostat_inboard**2 * 2.0e0 * fwbs_variables.z_cryostat_half_inside ) - cost_2015_variables.s_kref[59] = 18700.0e0 - cost_2015_variables.s_cost[59] = ( - cost_2015_variables.s_cost_factor[59] - * cost_2015_variables.s_cref[59] - * (cost_2015_variables.s_k[59] / cost_2015_variables.s_kref[59]) + self.data.costs_2015.s_kref[59] = 18700.0e0 + self.data.costs_2015.s_cost[59] = ( + self.data.costs_2015.s_cost_factor[59] + * self.data.costs_2015.s_cref[59] + * (self.data.costs_2015.s_k[59] / self.data.costs_2015.s_kref[59]) ** cost_variables.costexp ) - cost_2015_variables.s_label[60] = "Total remaining subsystem costs" - cost_2015_variables.s_cost[60] = 0.0e0 + self.data.costs_2015.s_label[60] = "Total remaining subsystem costs" + self.data.costs_2015.s_cost[60] = 0.0e0 for j in range(35, 60): - cost_2015_variables.s_cost[60] = ( - cost_2015_variables.s_cost[60] + cost_2015_variables.s_cost[j] + self.data.costs_2015.s_cost[60] = ( + self.data.costs_2015.s_cost[60] + self.data.costs_2015.s_cost[j] ) def value_function(self, x): diff --git a/tests/unit/test_costs_2015.py b/tests/unit/test_costs_2015.py index 9f6c4aad5..033a05709 100644 --- a/tests/unit/test_costs_2015.py +++ b/tests/unit/test_costs_2015.py @@ -1,13 +1,12 @@ -"""Unit tests for costs_2015.f90.""" +"""Unit tests for costs_2015.py.""" -from typing import Any, NamedTuple +from dataclasses import dataclass import numpy as np import pytest from process.data_structure import ( build_variables, - cost_2015_variables, cost_variables, current_drive_variables, fwbs_variables, @@ -17,65 +16,43 @@ physics_variables, tfcoil_variables, ) -from process.models.costs.costs_2015 import Costs2015 @pytest.fixture -def costs2015(): +def costs2015(process_models): """Provides Costs2015 object for testing. :return costs2015: initialised costs2015 object :type costs2015: process.costs2015.Costs2015 """ - return Costs2015() - - -class CalcBuildingCostsParam(NamedTuple): - pwpnb: Any = None - - r_pf_coil_outer_max: Any = None - - p_plant_primary_heat_mw: Any = None - - p_plant_secondary_heat_mw: Any = None - - helpow: Any = None - - c_tf_total: Any = None - - n_tf_coils: Any = None - - e_tf_magnetic_stored_total_gj: Any = None - - r_cryostat_inboard: Any = None - - z_cryostat_half_inside: Any = None - - cost_factor_buildings: Any = None - - light_build_cost_per_vol: Any = None - - tok_build_cost_per_vol: Any = None - - s_kref: Any = None - - s_k: Any = None - - s_cref: Any = None - - s_cost: Any = None - - s_cost_factor: Any = None - - expected_s_kref: Any = None - - expected_s_k: Any = None - - expected_s_cref: Any = None - - expected_s_cost: Any = None - - expected_s_cost_factor: Any = None + return process_models._costs_2015 # noqa: SLF001 + + +@dataclass +class CalcBuildingCostsParam: + pwpnb: float + r_pf_coil_outer_max: float + p_plant_primary_heat_mw: float + p_plant_secondary_heat_mw: float + helpow: float + c_tf_total: float + n_tf_coils: float + e_tf_magnetic_stored_total_gj: float + r_cryostat_inboard: float + z_cryostat_half_inside: float + cost_factor_buildings: float + light_build_cost_per_vol: float + tok_build_cost_per_vol: float + s_kref: list[float] + s_k: list[float] + s_cref: list[float] + s_cost: list[float] + s_cost_factor: list[float] + expected_s_kref: list[float] + expected_s_k: list[float] + expected_s_cref: list[float] + expected_s_cost: list[float] + expected_s_cost_factor: list[float] @pytest.mark.parametrize( @@ -2356,72 +2333,52 @@ def test_calc_building_costs(calcbuildingcostsparam, monkeypatch, costs2015): "tok_build_cost_per_vol", calcbuildingcostsparam.tok_build_cost_per_vol, ) - - monkeypatch.setattr(cost_2015_variables, "s_kref", calcbuildingcostsparam.s_kref) - - monkeypatch.setattr(cost_2015_variables, "s_k", calcbuildingcostsparam.s_k) - - monkeypatch.setattr(cost_2015_variables, "s_cref", calcbuildingcostsparam.s_cref) - - monkeypatch.setattr(cost_2015_variables, "s_cost", calcbuildingcostsparam.s_cost) - - monkeypatch.setattr( - cost_2015_variables, "s_cost_factor", calcbuildingcostsparam.s_cost_factor - ) + for field in ["s_kref", "s_k", "s_cref", "s_cost", "s_cost_factor"]: + monkeypatch.setattr( + costs2015.data.costs_2015, field, getattr(calcbuildingcostsparam, field) + ) costs2015.calc_building_costs() - assert cost_2015_variables.s_kref == pytest.approx( + assert costs2015.data.costs_2015.s_kref == pytest.approx( calcbuildingcostsparam.expected_s_kref ) - assert cost_2015_variables.s_k == pytest.approx(calcbuildingcostsparam.expected_s_k) + assert costs2015.data.costs_2015.s_k == pytest.approx( + calcbuildingcostsparam.expected_s_k + ) - assert cost_2015_variables.s_cref == pytest.approx( + assert costs2015.data.costs_2015.s_cref == pytest.approx( calcbuildingcostsparam.expected_s_cref ) - assert cost_2015_variables.s_cost == pytest.approx( + assert costs2015.data.costs_2015.s_cost == pytest.approx( calcbuildingcostsparam.expected_s_cost ) - assert cost_2015_variables.s_cost_factor == pytest.approx( + assert costs2015.data.costs_2015.s_cost_factor == pytest.approx( calcbuildingcostsparam.expected_s_cost_factor ) -class CalcLandCostsParam(NamedTuple): - dr_tf_inner_bore: Any = None - - dh_tf_inner_bore: Any = None - - dr_tf_inboard: Any = None - - r_cryostat_inboard: Any = None - - cost_factor_land: Any = None - - costexp: Any = None - - s_kref: Any = None - - s_k: Any = None - - s_cref: Any = None - - s_cost: Any = None - - s_cost_factor: Any = None - - expected_s_kref: Any = None - - expected_s_k: Any = None - - expected_s_cref: Any = None - - expected_s_cost: Any = None - - expected_s_cost_factor: Any = None +@dataclass +class CalcLandCostsParam: + dr_tf_inner_bore: float + dh_tf_inner_bore: float + dr_tf_inboard: float + r_cryostat_inboard: float + cost_factor_land: float + costexp: float + s_kref: float + s_k: float + s_cref: float + s_cost: float + s_cost_factor: float + expected_s_kref: float + expected_s_k: float + expected_s_cref: float + expected_s_cost: float + expected_s_cost_factor: float @pytest.mark.parametrize( @@ -4639,74 +4596,53 @@ def test_calc_land_costs(calclandcostsparam, monkeypatch, costs2015): ) monkeypatch.setattr(cost_variables, "costexp", calclandcostsparam.costexp) - - monkeypatch.setattr(cost_2015_variables, "s_kref", calclandcostsparam.s_kref) - - monkeypatch.setattr(cost_2015_variables, "s_k", calclandcostsparam.s_k) - - monkeypatch.setattr(cost_2015_variables, "s_cref", calclandcostsparam.s_cref) - - monkeypatch.setattr(cost_2015_variables, "s_cost", calclandcostsparam.s_cost) - - monkeypatch.setattr( - cost_2015_variables, "s_cost_factor", calclandcostsparam.s_cost_factor - ) + for field in ["s_kref", "s_k", "s_cref", "s_cost", "s_cost_factor"]: + monkeypatch.setattr( + costs2015.data.costs_2015, field, getattr(calclandcostsparam, field) + ) costs2015.calc_land_costs() - assert cost_2015_variables.s_kref == pytest.approx( + assert costs2015.data.costs_2015.s_kref == pytest.approx( calclandcostsparam.expected_s_kref ) - assert cost_2015_variables.s_k == pytest.approx(calclandcostsparam.expected_s_k) + assert costs2015.data.costs_2015.s_k == pytest.approx( + calclandcostsparam.expected_s_k + ) - assert cost_2015_variables.s_cref == pytest.approx( + assert costs2015.data.costs_2015.s_cref == pytest.approx( calclandcostsparam.expected_s_cref ) - assert cost_2015_variables.s_cost == pytest.approx( + assert costs2015.data.costs_2015.s_cost == pytest.approx( calclandcostsparam.expected_s_cost ) - assert cost_2015_variables.s_cost_factor == pytest.approx( + assert costs2015.data.costs_2015.s_cost_factor == pytest.approx( calclandcostsparam.expected_s_cost_factor ) -class CalcTfCoilCostsParam(NamedTuple): - n_tf_coils: Any = None - - len_tf_coil: Any = None - - n_tf_coil_turns: Any = None - - m_tf_coil_copper: Any = None - - m_tf_coil_superconductor: Any = None - - cost_factor_tf_coils: Any = None - - costexp: Any = None - - s_kref: Any = None - - s_k: Any = None - - s_cref: Any = None - - s_cost: Any = None - - s_cost_factor: Any = None - - expected_s_kref: Any = None - - expected_s_k: Any = None - - expected_s_cref: Any = None - - expected_s_cost: Any = None - - expected_s_cost_factor: Any = None +@dataclass +class CalcTfCoilCostsParam: + n_tf_coils: float + len_tf_coil: float + n_tf_coil_turns: float + m_tf_coil_copper: float + m_tf_coil_superconductor: float + cost_factor_tf_coils: float + costexp: float + s_kref: float + s_k: float + s_cref: float + s_cost: float + s_cost_factor: float + expected_s_kref: float + expected_s_k: float + expected_s_cref: float + expected_s_cost: float + expected_s_cost_factor: float @pytest.mark.parametrize( @@ -6933,67 +6869,50 @@ def test_calc_tf_coil_costs(calctfcoilcostsparam, monkeypatch, costs2015): monkeypatch.setattr(cost_variables, "costexp", calctfcoilcostsparam.costexp) - monkeypatch.setattr(cost_2015_variables, "s_kref", calctfcoilcostsparam.s_kref) - - monkeypatch.setattr(cost_2015_variables, "s_k", calctfcoilcostsparam.s_k) - - monkeypatch.setattr(cost_2015_variables, "s_cref", calctfcoilcostsparam.s_cref) - - monkeypatch.setattr(cost_2015_variables, "s_cost", calctfcoilcostsparam.s_cost) - - monkeypatch.setattr( - cost_2015_variables, "s_cost_factor", calctfcoilcostsparam.s_cost_factor - ) + for field in ["s_kref", "s_k", "s_cref", "s_cost", "s_cost_factor"]: + monkeypatch.setattr( + costs2015.data.costs_2015, field, getattr(calctfcoilcostsparam, field) + ) costs2015.calc_tf_coil_costs() - assert cost_2015_variables.s_kref == pytest.approx( + assert costs2015.data.costs_2015.s_kref == pytest.approx( calctfcoilcostsparam.expected_s_kref ) - assert cost_2015_variables.s_k == pytest.approx(calctfcoilcostsparam.expected_s_k) + assert costs2015.data.costs_2015.s_k == pytest.approx( + calctfcoilcostsparam.expected_s_k + ) - assert cost_2015_variables.s_cref == pytest.approx( + assert costs2015.data.costs_2015.s_cref == pytest.approx( calctfcoilcostsparam.expected_s_cref ) - assert cost_2015_variables.s_cost == pytest.approx( + assert costs2015.data.costs_2015.s_cost == pytest.approx( calctfcoilcostsparam.expected_s_cost ) - assert cost_2015_variables.s_cost_factor == pytest.approx( + assert costs2015.data.costs_2015.s_cost_factor == pytest.approx( calctfcoilcostsparam.expected_s_cost_factor ) -class CalcRemoteHandlingCostsParam(NamedTuple): - armour_fw_bl_mass: Any = None - - cost_factor_rh: Any = None - - costexp: Any = None - - num_rh_systems: Any = None - - s_kref: Any = None - - s_k: Any = None - - s_cref: Any = None - - s_cost: Any = None - - s_cost_factor: Any = None - - expected_s_kref: Any = None - - expected_s_k: Any = None - - expected_s_cref: Any = None - - expected_s_cost: Any = None - - expected_s_cost_factor: Any = None +@dataclass +class CalcRemoteHandlingCostsParam: + armour_fw_bl_mass: float + cost_factor_rh: float + costexp: float + num_rh_systems: float + s_kref: float + s_k: float + s_cref: float + s_cost: float + s_cost_factor: float + expected_s_kref: float + expected_s_k: float + expected_s_cref: float + expected_s_cost: float + expected_s_cost_factor: float @pytest.mark.parametrize( @@ -9203,78 +9122,53 @@ def test_calc_remote_handling_costs( monkeypatch.setattr( cost_variables, "num_rh_systems", calcremotehandlingcostsparam.num_rh_systems ) - - monkeypatch.setattr( - cost_2015_variables, "s_kref", calcremotehandlingcostsparam.s_kref - ) - - monkeypatch.setattr(cost_2015_variables, "s_k", calcremotehandlingcostsparam.s_k) - - monkeypatch.setattr( - cost_2015_variables, "s_cref", calcremotehandlingcostsparam.s_cref - ) - - monkeypatch.setattr( - cost_2015_variables, "s_cost", calcremotehandlingcostsparam.s_cost - ) - - monkeypatch.setattr( - cost_2015_variables, "s_cost_factor", calcremotehandlingcostsparam.s_cost_factor - ) + for field in ["s_kref", "s_k", "s_cref", "s_cost", "s_cost_factor"]: + monkeypatch.setattr( + costs2015.data.costs_2015, + field, + getattr(calcremotehandlingcostsparam, field), + ) costs2015.calc_remote_handling_costs() - assert cost_2015_variables.s_kref == pytest.approx( + assert costs2015.data.costs_2015.s_kref == pytest.approx( calcremotehandlingcostsparam.expected_s_kref ) - assert cost_2015_variables.s_k == pytest.approx( + assert costs2015.data.costs_2015.s_k == pytest.approx( calcremotehandlingcostsparam.expected_s_k ) - assert cost_2015_variables.s_cref == pytest.approx( + assert costs2015.data.costs_2015.s_cref == pytest.approx( calcremotehandlingcostsparam.expected_s_cref ) - assert cost_2015_variables.s_cost == pytest.approx( + assert costs2015.data.costs_2015.s_cost == pytest.approx( calcremotehandlingcostsparam.expected_s_cost ) - assert cost_2015_variables.s_cost_factor == pytest.approx( + assert costs2015.data.costs_2015.s_cost_factor == pytest.approx( calcremotehandlingcostsparam.expected_s_cost_factor ) -class CalcNPlantAndVvCostsParam(NamedTuple): - r_shld_outboard_outer: Any = None - - dr_vv_outboard: Any = None - - helpow: Any = None - - cost_factor_vv: Any = None - - costexp: Any = None - - s_kref: Any = None - - s_k: Any = None - - s_cref: Any = None - - s_cost: Any = None - - s_cost_factor: Any = None - - expected_s_kref: Any = None - - expected_s_k: Any = None - - expected_s_cref: Any = None - - expected_s_cost: Any = None - - expected_s_cost_factor: Any = None +@dataclass +class CalcNPlantAndVvCostsParam: + r_shld_outboard_outer: float + dr_vv_outboard: float + helpow: float + cost_factor_vv: float + costexp: float + s_kref: float + s_k: float + s_cref: float + s_cost: float + s_cost_factor: float + expected_s_kref: float + expected_s_k: float + expected_s_cref: float + expected_s_cost: float + expected_s_cost_factor: float @pytest.mark.parametrize( @@ -11489,67 +11383,51 @@ def test_calc_n_plant_and_vv_costs(calcnplantandvvcostsparam, monkeypatch, costs monkeypatch.setattr(cost_variables, "costexp", calcnplantandvvcostsparam.costexp) - monkeypatch.setattr(cost_2015_variables, "s_kref", calcnplantandvvcostsparam.s_kref) - - monkeypatch.setattr(cost_2015_variables, "s_k", calcnplantandvvcostsparam.s_k) - - monkeypatch.setattr(cost_2015_variables, "s_cref", calcnplantandvvcostsparam.s_cref) - - monkeypatch.setattr(cost_2015_variables, "s_cost", calcnplantandvvcostsparam.s_cost) - - monkeypatch.setattr( - cost_2015_variables, "s_cost_factor", calcnplantandvvcostsparam.s_cost_factor - ) + for field in ["s_kref", "s_k", "s_cref", "s_cost", "s_cost_factor"]: + monkeypatch.setattr( + costs2015.data.costs_2015, + field, + getattr(calcnplantandvvcostsparam, field), + ) costs2015.calc_n_plant_and_vv_costs() - assert cost_2015_variables.s_kref == pytest.approx( + assert costs2015.data.costs_2015.s_kref == pytest.approx( calcnplantandvvcostsparam.expected_s_kref ) - assert cost_2015_variables.s_k == pytest.approx( + assert costs2015.data.costs_2015.s_k == pytest.approx( calcnplantandvvcostsparam.expected_s_k ) - assert cost_2015_variables.s_cref == pytest.approx( + assert costs2015.data.costs_2015.s_cref == pytest.approx( calcnplantandvvcostsparam.expected_s_cref ) - assert cost_2015_variables.s_cost == pytest.approx( + assert costs2015.data.costs_2015.s_cost == pytest.approx( calcnplantandvvcostsparam.expected_s_cost ) - assert cost_2015_variables.s_cost_factor == pytest.approx( + assert costs2015.data.costs_2015.s_cost_factor == pytest.approx( calcnplantandvvcostsparam.expected_s_cost_factor ) -class CalcEnergyConversionSystemParam(NamedTuple): - p_plant_electric_gross_mw: Any = None - - cost_factor_bop: Any = None - - costexp: Any = None - - s_kref: Any = None - - s_k: Any = None - - s_cref: Any = None - - s_cost: Any = None - - s_cost_factor: Any = None - - expected_s_kref: Any = None - - expected_s_k: Any = None - - expected_s_cref: Any = None - - expected_s_cost: Any = None - - expected_s_cost_factor: Any = None +@dataclass +class CalcEnergyConversionSystemParam: + p_plant_electric_gross_mw: float + cost_factor_bop: float + costexp: float + s_kref: float + s_k: float + s_cref: float + s_cost: float + s_cost_factor: float + expected_s_kref: float + expected_s_k: float + expected_s_cref: float + expected_s_cost: float + expected_s_cost_factor: float @pytest.mark.parametrize( @@ -13757,98 +13635,62 @@ def test_calc_energy_conversion_system( monkeypatch.setattr( cost_variables, "costexp", calcenergyconversionsystemparam.costexp ) - - monkeypatch.setattr( - cost_2015_variables, "s_kref", calcenergyconversionsystemparam.s_kref - ) - - monkeypatch.setattr(cost_2015_variables, "s_k", calcenergyconversionsystemparam.s_k) - - monkeypatch.setattr( - cost_2015_variables, "s_cref", calcenergyconversionsystemparam.s_cref - ) - - monkeypatch.setattr( - cost_2015_variables, "s_cost", calcenergyconversionsystemparam.s_cost - ) - - monkeypatch.setattr( - cost_2015_variables, - "s_cost_factor", - calcenergyconversionsystemparam.s_cost_factor, - ) + for field in ["s_kref", "s_k", "s_cref", "s_cost", "s_cost_factor"]: + monkeypatch.setattr( + costs2015.data.costs_2015, + field, + getattr(calcenergyconversionsystemparam, field), + ) costs2015.calc_energy_conversion_system() - assert cost_2015_variables.s_kref == pytest.approx( + assert costs2015.data.costs_2015.s_kref == pytest.approx( calcenergyconversionsystemparam.expected_s_kref ) - assert cost_2015_variables.s_k == pytest.approx( + assert costs2015.data.costs_2015.s_k == pytest.approx( calcenergyconversionsystemparam.expected_s_k ) - assert cost_2015_variables.s_cref == pytest.approx( + assert costs2015.data.costs_2015.s_cref == pytest.approx( calcenergyconversionsystemparam.expected_s_cref ) - assert cost_2015_variables.s_cost == pytest.approx( + assert costs2015.data.costs_2015.s_cost == pytest.approx( calcenergyconversionsystemparam.expected_s_cost ) - assert cost_2015_variables.s_cost_factor == pytest.approx( + assert costs2015.data.costs_2015.s_cost_factor == pytest.approx( calcenergyconversionsystemparam.expected_s_cost_factor ) -class CalcRemainingSubsystemsParam(NamedTuple): - p_hcd_injected_total_mw: Any = None - - p_plasma_separatrix_mw: Any = None - - p_fusion_total_mw: Any = None - - t_plasma_res_diffusion: Any = None - - itr_sum: Any = None - - ensxpfm: Any = None - - p_plant_primary_heat_mw: Any = None - - p_plant_secondary_heat_mw: Any = None - - helpow: Any = None - - m_vv: Any = None - - r_cryostat_inboard: Any = None - - z_cryostat_half_inside: Any = None - - cost_factor_misc: Any = None - - costexp: Any = None - - s_kref: Any = None - - s_k: Any = None - - s_cref: Any = None - - s_cost: Any = None - - s_cost_factor: Any = None - - expected_s_kref: Any = None - - expected_s_k: Any = None - - expected_s_cref: Any = None - - expected_s_cost: Any = None - - expected_s_cost_factor: Any = None +@dataclass +class CalcRemainingSubsystemsParam: + p_hcd_injected_total_mw: float + p_plasma_separatrix_mw: float + p_fusion_total_mw: float + t_plasma_res_diffusion: float + itr_sum: float + ensxpfm: float + p_plant_primary_heat_mw: float + p_plant_secondary_heat_mw: float + helpow: float + m_vv: float + r_cryostat_inboard: float + z_cryostat_half_inside: float + cost_factor_misc: float + costexp: float + s_kref: float + s_k: float + s_cref: float + s_cost: float + s_cost_factor: float + expected_s_kref: float + expected_s_k: float + expected_s_cref: float + expected_s_cost: float + expected_s_cost_factor: float @pytest.mark.parametrize( @@ -16133,51 +15975,40 @@ def test_calc_remaining_subsystems(calcremainingsubsystemsparam, monkeypatch, co monkeypatch.setattr(cost_variables, "costexp", calcremainingsubsystemsparam.costexp) - monkeypatch.setattr( - cost_2015_variables, "s_kref", calcremainingsubsystemsparam.s_kref - ) - - monkeypatch.setattr(cost_2015_variables, "s_k", calcremainingsubsystemsparam.s_k) - - monkeypatch.setattr( - cost_2015_variables, "s_cref", calcremainingsubsystemsparam.s_cref - ) - - monkeypatch.setattr( - cost_2015_variables, "s_cost", calcremainingsubsystemsparam.s_cost - ) - - monkeypatch.setattr( - cost_2015_variables, "s_cost_factor", calcremainingsubsystemsparam.s_cost_factor - ) + for field in ["s_kref", "s_k", "s_cref", "s_cost", "s_cost_factor"]: + monkeypatch.setattr( + costs2015.data.costs_2015, + field, + getattr(calcremainingsubsystemsparam, field), + ) costs2015.calc_remaining_subsystems() - assert cost_2015_variables.s_kref == pytest.approx( + assert costs2015.data.costs_2015.s_kref == pytest.approx( calcremainingsubsystemsparam.expected_s_kref ) - assert cost_2015_variables.s_k == pytest.approx( + assert costs2015.data.costs_2015.s_k == pytest.approx( calcremainingsubsystemsparam.expected_s_k ) - assert cost_2015_variables.s_cref == pytest.approx( + assert costs2015.data.costs_2015.s_cref == pytest.approx( calcremainingsubsystemsparam.expected_s_cref ) - assert cost_2015_variables.s_cost == pytest.approx( + assert costs2015.data.costs_2015.s_cost == pytest.approx( calcremainingsubsystemsparam.expected_s_cost ) - assert cost_2015_variables.s_cost_factor == pytest.approx( + assert costs2015.data.costs_2015.s_cost_factor == pytest.approx( calcremainingsubsystemsparam.expected_s_cost_factor ) -class ValueFunctionParam(NamedTuple): - x: Any = None - - expected_v: Any = None +@dataclass +class ValueFunctionParam: + x: float + expected_v: float @pytest.mark.parametrize(