diff --git a/ORBIT/phases/design/array_system_design.py b/ORBIT/phases/design/array_system_design.py index f1f65055..0e401bab 100644 --- a/ORBIT/phases/design/array_system_design.py +++ b/ORBIT/phases/design/array_system_design.py @@ -361,36 +361,15 @@ def run(self): self._create_wind_farm_layout() self._create_cable_section_lengths() - def save_layout(self, save_name, return_df=False, folder="cables"): - """Outputs a csv of the substation and turbine positional and cable - related components. - - Parameters - ---------- - save_name : str - The name of the file without an extension to be saved to - /cables/.csv. - return_df : bool, optional - If true, returns layout_df, a pandas.DataFrame of the cabling - layout, by default False. - folder : str, optional - If "cables", then the layout will saved to the "cables" folder, and - if "plant", then the layout will be saved to the "project/plant" - folder. + def create_layout_df(self) -> pd.DataFrame: + """Creates a Pandas DataFrame layout. Returns ------- pd.DataFrame - The DataFrame with the layout data. - - Raises - ------ - ValueError - Raised if ``folder`` is not one of "cables" or "plant". + Wind farm layout compatible with the ``CustomArrayDesignLayout`` or + for use with external models. """ - if folder not in ("cables", "plant"): - raise ValueError("`folder` must be one of: 'cables' or plant'.") - num_turbines = self.system.num_turbines columns = [ "id", @@ -460,9 +439,42 @@ def save_layout(self, save_name, return_df=False, folder="cables"): layout_df.cable_length = [""] + self.sections_cable_lengths.flatten()[ :num_turbines ].tolist() - data = [columns] + layout_df.to_numpy().tolist() + return layout_df + + def save_layout(self, save_name, return_df=False, folder="cables"): + """Outputs a csv of the substation and turbine positional and cable + related components. + + Parameters + ---------- + save_name : str + The name of the file without an extension to be saved to + /cables/.csv. + return_df : bool, optional + If true, returns layout_df, a pandas.DataFrame of the cabling + layout, by default False. + folder : str, optional + If "cables", then the layout will saved to the "cables" folder, and + if "plant", then the layout will be saved to the "project/plant" + folder. + + Returns + ------- + pd.DataFrame + The DataFrame with the layout data. + + Raises + ------ + ValueError + Raised if ``folder`` is not one of "cables" or "plant". + """ + if folder not in ("cables", "plant"): + raise ValueError("`folder` must be one of: 'cables' or plant'.") + + layout_df = self.create_layout_df() + data = [layout_df.columns] + layout_df.to_numpy().tolist() print( - f"Saving custom array CSV to: /cables/{save_name}.csv" # noqa: E501 + f"Saving custom array CSV to: /{folder}/{save_name}.csv" # noqa: E501 ) export_library_specs(folder, save_name, data, file_ext="csv") if return_df: diff --git a/docs/source/changelog.rst b/docs/source/changelog.rst index d5ec6b38..d150de16 100644 --- a/docs/source/changelog.rst +++ b/docs/source/changelog.rst @@ -9,22 +9,25 @@ Unreleased configuration input. - Move the matplotlib import from the import section of ``/ORBIT/phases/design/array_system_design.py`` to the ``CustomArraySystemDesign.plot_array_system`` for missing module error handling. +- Adds a general layout ``DataFrame`` creation method as ``ArraySystemDesign.create_layout_df()`` that + is called by the ``save_layout`` method to maintain backwards compatibility, but opens up the ability + gather the layout without saving it to a file. - Updated default `soft_capex` factors. `PR #201 `_ - - `construction_insurance_factor` updated from 0.115 to 0.0207 based on industry benchmarking, resulting in higher construction insurance costs. - - `interest_during_construction` updated from 4.4% to 6.5% based on financial assumptions from the 2025 Annual Technology Baseline (ATB), increasing construction financing costs. - - `decommissioning_factor` updated from 0.175 to 0.2 based on industry benchmarking, leading to higher decommissioning costs than in previous versions. + - `construction_insurance_factor` updated from 0.115 to 0.0207 based on industry benchmarking, resulting in higher construction insurance costs. + - `interest_during_construction` updated from 4.4% to 6.5% based on financial assumptions from the 2025 Annual Technology Baseline (ATB), increasing construction financing costs. + - `decommissioning_factor` updated from 0.175 to 0.2 based on industry benchmarking, leading to higher decommissioning costs than in previous versions. - Updated default `project_capex` values. `PR #201 `_ - - `site_auction_price` increased from 100M to 105M USD to account for rent fees before operation. - - `site_assessment_cost`, `construction_plan_cost`, and `installation_plan_cost` increased from 50M, 1M, and 0.25M USD to 200M, 25M, and 25M USD, respectively. - - Total `project_capex` excluding `site_auction_price` now sums to 250M USD, aligning with DevEx recommendations based on industry benchmarking. - - These updates lead to higher default total project costs than in previous versions. + - `site_auction_price` increased from 100M to 105M USD to account for rent fees before operation. + - `site_assessment_cost`, `construction_plan_cost`, and `installation_plan_cost` increased from 50M, 1M, and 0.25M USD to 200M, 25M, and 25M USD, respectively. + - Total `project_capex` excluding `site_auction_price` now sums to 250M USD, aligning with DevEx recommendations based on industry benchmarking. + - These updates lead to higher default total project costs than in previous versions. - Included onshore substation costs in BOS CapEx and project breakdown. `PR #201 `_ - - The `ElectricalDesign` module previously calculated onshore substation costs but did not include them in `capex_breakdown` or `bos_capex`. - - These costs are now incorporated when `ElectricalDesign` is used, resulting in higher `bos_capex`, `soft_capex`, and `total_capex` than in prior versions. + - The `ElectricalDesign` module previously calculated onshore substation costs but did not include them in `capex_breakdown` or `bos_capex`. + - These costs are now incorporated when `ElectricalDesign` is used, resulting in higher `bos_capex`, `soft_capex`, and `total_capex` than in prior versions. - Cable configuration file updates. `PR #201 `_ - - Added a new dynamic cable configuration file for floating cases: `library/cables/XLPE_1200mm_220kV_dynamic.yaml`. - - Updated cost values for `library/cables/XLPE_630mm_66kV.yaml` and `library/cables/XLPE_630mm_66kV_dynamic.yaml` based on industry benchmarking. - - All cable cost updates are expressed in 2024 USD for consistency with other library configuration files. + - Added a new dynamic cable configuration file for floating cases: `library/cables/XLPE_1200mm_220kV_dynamic.yaml`. + - Updated cost values for `library/cables/XLPE_630mm_66kV.yaml` and `library/cables/XLPE_630mm_66kV_dynamic.yaml` based on industry benchmarking. + - All cable cost updates are expressed in 2024 USD for consistency with other library configuration files. 1.2.4 -----