Example #1
0
    def _initialize_cables(self):
        """
        Creates the base cable objects for each type of array cable being used.
        """

        if isinstance(self._design["cables"], str):
            self._design["cables"] = [self._design["cables"]]
        if isinstance(self._design["cables"], list):
            _cables = {}
            for name in self._design["cables"]:
                _cables[name] = extract_library_specs("cables", name)
            self._design["cables"] = _cables

        _cables = {}
        for name, cable in self._design["cables"].items():
            cable.setdefault("name", name)
            _cables[name] = cable
        self._design["cables"] = _cables

        # Cables are ordered from smallest to largest
        cables = OrderedDict(
            sorted(
                self._design["cables"].items(),
                key=lambda item: item[1]["current_capacity"],
            ))

        # Instantiate cables as Cable objects. Use "name" property from file
        # instead of filename.
        self.cables = OrderedDict()
        for specs in cables.values():
            name = specs["name"]
            self.cables[name] = Cable(specs)
Example #2
0
    def _initialize_custom_data(self):
        windfarm = self.config["array_system_design"]["location_data"]

        self.location_data = extract_library_specs("cables",
                                                   windfarm,
                                                   file_type="csv")

        # Make sure no data is missing
        missing = set(self.COLUMNS).difference(self.location_data.columns)
        if missing:
            raise ValueError(
                f"The following columns must be included in the location data: {missing}"
            )

        self._format_windfarm_data()

        # Ensure there is no missing data in required columns
        missing_data_cols = [
            c for c in self.REQUIRED
            if pd.isnull(self.location_data[c]).sum() > 0
        ]
        if missing_data_cols:
            raise ValueError(f"Missing data in columns: {missing_data_cols}!")

        # Ensure there is no missing data in optional columns
        missing_data_cols = [
            c for c in self.OPTIONAL
            if (pd.isnull(self.location_data[c])
                | self.location_data[c] == 0).sum() > 0
        ]
        if missing_data_cols:
            message = f"Missing data in columns {missing_data_cols}; " "all values will be calculated."
            warnings.warn(message)

        # Ensure the number of turbines matches what's expected
        if self.location_data.shape[0] != self.system.num_turbines:
            raise ValueError(
                f"The provided number of turbines ({self.location_data.shape[0]}) ",
                f"does not match the plant data ({self.system.num_turbines}).",
            )

        n_coords = self.location_data.groupby(
            ["turbine_latitude", "turbine_longitude"]).ngroups
        duplicates = self.location_data.shape[0] - n_coords
        if duplicates > 0:
            raise ValueError(
                f"There are {duplicates} rows with duplicate coordinates.")

        # Ensure the number of turbines on a string is within the limits
        longest_string = self.location_data["order"].unique().size
        self.num_strings = self.location_data.groupby(
            ["substation_id", "string"]).ngroups
        if longest_string > self.num_turbines_full_string:
            raise ValueError("Strings can't contain more than "
                             f"{self.num_turbines_full_string} turbines.")
        else:
            self.num_turbines_full_string = longest_string
            del self.num_turbines_partial_string
            del self.num_partial_strings
Example #3
0
__author__ = "Rob Hammond"
__copyright__ = "Copyright 2020, National Renewable Energy Laboratory"
__maintainer__ = "Jake Nunemaker"
__email__ = "*****@*****.**"

from copy import deepcopy

import pandas as pd
import pytest
from wisdem.orbit import ProjectManager
from wisdem.orbit.core.library import extract_library_specs
from wisdem.orbit.core.defaults import process_times as pt
from wisdem.orbit.phases.install import ScourProtectionInstallation
from wisdem.test.test_orbit.data import test_weather

config = extract_library_specs("config", "scour_protection_install")


def test_simulation_creation():
    sim = ScourProtectionInstallation(config)

    assert sim.config == config
    assert sim.env
    assert sim.port
    assert sim.spi_vessel
    assert sim.num_turbines
    assert sim.tonnes_per_substructure


@pytest.mark.parametrize("weather", (None, test_weather),
                         ids=["no_weather", "test_weather"])
Example #4
0
"""Tests for the `MooredSubInstallation` class and related infrastructure."""

__author__ = "Jake Nunemaker"
__copyright__ = "Copyright 2020, National Renewable Energy Laboratory"
__maintainer__ = "Jake Nunemaker"
__email__ = "*****@*****.**"

import pandas as pd
import pytest
from wisdem.orbit.core.library import extract_library_specs
from wisdem.orbit.phases.install import MooredSubInstallation
from wisdem.test.test_orbit.data import test_weather

config = extract_library_specs("config", "moored_install")
no_supply = extract_library_specs("config", "moored_install_no_supply")


def test_simulation_setup():

    sim = MooredSubInstallation(config)
    assert sim.config == config
    assert sim.env

    assert sim.support_vessel
    assert len(sim.sub_assembly_lines) == config["port"]["sub_assembly_lines"]
    assert len(sim.turbine_assembly_lines
               ) == config["port"]["turbine_assembly_cranes"]
    assert len(sim.installation_groups
               ) == config["towing_vessel_groups"]["num_groups"]
    assert sim.num_turbines == config["plant"]["num_turbines"]
Example #5
0
def spi_vessel():

    specs = extract_library_specs("spi_vessel", "test_scour_protection_vessel")
    return Vessel("Test SPI Vessel", specs)
Example #6
0
def heavy_lift():

    specs = extract_library_specs("oss_install_vessel",
                                  "test_heavy_lift_vessel")
    return Vessel("Test Heavy Vessel", specs)
Example #7
0
def cable_vessel():

    specs = extract_library_specs("array_cable_install_vessel",
                                  "test_cable_lay_vessel")
    return Vessel("Test Cable Vessel", specs)
Example #8
0
__author__ = "Jake Nunemaker"
__copyright__ = "Copyright 2019, National Renewable Energy Laboratory"
__maintainer__ = "Jake Nunemaker"
__email__ = "*****@*****.**"

from copy import deepcopy

import pandas as pd
import pytest
from wisdem.orbit import ProjectManager
from wisdem.orbit.core.library import extract_library_specs
from wisdem.orbit.core.defaults import process_times as pt
from wisdem.orbit.phases.install import TurbineInstallation
from wisdem.test.test_orbit.data import test_weather

config_wtiv = extract_library_specs("config", "turbine_install_wtiv")
config_long_mobilize = extract_library_specs("config",
                                             "turbine_install_long_mobilize")
config_wtiv_feeder = extract_library_specs("config", "turbine_install_feeder")
config_wtiv_multi_feeder = deepcopy(config_wtiv_feeder)
config_wtiv_multi_feeder["num_feeders"] = 2
floating = extract_library_specs("config", "floating_turbine_install_feeder")


@pytest.mark.parametrize(
    "config",
    (config_wtiv, config_wtiv_feeder, config_wtiv_multi_feeder, floating),
    ids=["wtiv_only", "single_feeder", "multi_feeder", "floating"],
)
def test_simulation_setup(config):
Example #9
0
__author__ = "Jake Nunemaker"
__copyright__ = "Copyright 2020, National Renewable Energy Laboratory"
__maintainer__ = "Jake Nunemaker"
__email__ = "*****@*****.**"

from copy import deepcopy

import pandas as pd
import pytest
from wisdem.orbit import ProjectManager
from wisdem.orbit.core.library import extract_library_specs
from wisdem.orbit.core.defaults import process_times as pt
from wisdem.orbit.phases.install import MooringSystemInstallation
from wisdem.test.test_orbit.data import test_weather

config = extract_library_specs("config", "mooring_system_install")


def test_simulation_creation():
    sim = MooringSystemInstallation(config)

    assert sim.config == config
    assert sim.env
    assert sim.port
    assert sim.vessel
    assert sim.num_systems


@pytest.mark.parametrize("weather", (None, test_weather),
                         ids=["no_weather", "test_weather"])
def test_full_run_logging(weather):
Example #10
0
__author__ = "Jake Nunemaker"
__copyright__ = "Copyright 2020, National Renewable Energy Laboratory"
__maintainer__ = "Jake Nunemaker"
__email__ = "*****@*****.**"

from copy import deepcopy

from wisdem.orbit import ProjectManager
from numpy.testing import assert_almost_equal
from wisdem.orbit.core.library import extract_library_specs

fixed = extract_library_specs("config", "complete_project")
floating = extract_library_specs("config", "complete_floating_project")


def test_fixed_phase_cost_passing():

    project = ProjectManager(fixed)
    project.run_project()

    assert_almost_equal(
        project.phases["MonopileDesign"].total_cost,
        project.phases["MonopileInstallation"].system_capex,
    )

    assert_almost_equal(
        project.phases["ScourProtectionDesign"].total_cost,
        project.phases["ScourProtectionInstallation"].system_capex,
    )

    assert_almost_equal(
Example #11
0
__author__ = ["Rob Hammond", "Jake Nunemaker"]
__copyright__ = "Copyright 2020, National Renewable Energy Laboratory"
__maintainer__ = "Jake Nunemaker"
__email__ = "*****@*****.**"

from copy import deepcopy

import pandas as pd
import pytest
from wisdem.orbit import ProjectManager
from wisdem.orbit.core.library import extract_library_specs
from wisdem.orbit.core.defaults import process_times as pt
from wisdem.orbit.phases.install import ExportCableInstallation
from wisdem.test.test_orbit.data import test_weather

base_config = extract_library_specs("config", "export_cable_install")
simul_config = deepcopy(base_config)
_ = simul_config.pop("export_cable_bury_vessel")


@pytest.mark.parametrize("config", (base_config, simul_config),
                         ids=["separate", "simultaneous"])
def test_simulation_setup(config):

    sim = ExportCableInstallation(config)
    assert sim.env
    assert sim.cable
    assert sim.cable.linear_density

    actions = [a["action"] for a in sim.env.actions]
    assert "Onshore Construction" in actions
Example #12
0
__copyright__ = "Copyright 2020, National Renewable Energy Laboratory"
__maintainer__ = "Jake Nunemaker"
__email__ = "*****@*****.**"

from copy import deepcopy

import pandas as pd
import pytest
from wisdem.orbit import ProjectManager
from wisdem.orbit.core.library import extract_library_specs
from wisdem.orbit.core.defaults import process_times as pt
from wisdem.orbit.phases.install import OffshoreSubstationInstallation
from wisdem.test.test_orbit.data import test_weather
from wisdem.orbit.core.exceptions import MissingComponent

config_single = extract_library_specs("config", "oss_install")
config_floating = extract_library_specs("config", "floating_oss_install")
config_multi = extract_library_specs("config", "oss_install")
config_multi["num_feeders"] = 2


@pytest.mark.parametrize(
    "config",
    (config_single, config_multi, config_floating),
    ids=["single_feeder", "multi_feeder", "floating"],
)
def test_simulation_setup(config):

    sim = OffshoreSubstationInstallation(config)
    assert sim.config == config
    assert sim.env
__author__ = "Jake Nunemaker"
__copyright__ = "Copyright 2020, National Renewable Energy Laboratory"
__maintainer__ = "Jake Nunemaker"
__email__ = "*****@*****.**"

import os

import pytest
from wisdem.orbit import ProjectManager, load_config, save_config
from wisdem.orbit.core.library import extract_library_specs

complete_project = extract_library_specs("config", "complete_project")


def test_save_and_load_equality(tmp_yaml_del):

    save_config(complete_project, "tmp.yaml", overwrite=True)
    new = load_config("tmp.yaml")

    assert new == complete_project


def test_orbit_version_ProjectManager():

    config = ProjectManager.compile_input_dict(
        ["MonopileDesign", "MonopileInstallation"])
    assert "orbit_version" in config.keys()
Example #14
0
__author__ = "Rob Hammond"
__copyright__ = "Copyright 2020, National Renewable Energy Laboratory"
__maintainer__ = "Rob Hammond"
__email__ = "*****@*****.**"


from copy import deepcopy

import numpy as np
import pytest

from wisdem.orbit.core.library import extract_library_specs
from wisdem.orbit.phases.design import ArraySystemDesign, CustomArraySystemDesign
from wisdem.orbit.core.exceptions import LibraryItemNotFoundError

config_full_ring = extract_library_specs("config", "array_design_full_ring")

config_partial_ring = deepcopy(config_full_ring)
config_partial_ring["plant"]["num_turbines"] = 49

config_full_grid = deepcopy(config_full_ring)
config_full_grid["plant"]["layout"] = "grid"

config_partial_grid = deepcopy(config_full_grid)
config_partial_grid["plant"]["num_turbines"] = 49

config_cables_from_file_fail = deepcopy(config_full_grid)
config_cables_from_file_fail["array_system_design"]["cables"] = "Cable1"

config_custom_base = deepcopy(config_full_grid)
config_custom_base["plant"]["num_turbines"] = 8
"""Tests for the `ExportSystemDesign` class."""

__author__ = "Rob Hammond"
__copyright__ = "Copyright 2020, National Renewable Energy Laboratory"
__maintainer__ = "Rob Hammond"
__email__ = "*****@*****.**"

from copy import deepcopy

import pytest
from wisdem.orbit.core.library import extract_library_specs
from wisdem.orbit.phases.design import ExportSystemDesign

config = extract_library_specs("config", "export_design")


def test_export_system_creation():
    export = ExportSystemDesign(config)
    export.run()

    assert export.num_cables
    assert export.length
    assert export.mass
    assert export.cable
    assert export.total_length
    assert export.total_mass


def test_number_cables():
    export = ExportSystemDesign(config)
    export.run()
Example #16
0
def wtiv():

    specs = extract_library_specs("wtiv", "test_wtiv")
    return Vessel("Test WTIV", specs)
Example #17
0
__copyright__ = "Copyright 2020, National Renewable Energy Laboratory"
__maintainer__ = "Jake Nunemaker"
__email__ = "*****@*****.**"


from copy import deepcopy

import pandas as pd
import pytest
from wisdem.orbit import ProjectManager
from wisdem.orbit.core.library import extract_library_specs
from wisdem.orbit.core.defaults import process_times as pt
from wisdem.orbit.phases.install import ArrayCableInstallation
from wisdem.test.test_orbit.data import test_weather

base_config = extract_library_specs("config", "array_cable_install")
simul_config = deepcopy(base_config)
_ = simul_config.pop("array_cable_bury_vessel")


@pytest.mark.parametrize("config", (base_config, simul_config), ids=["separate", "simultaneous"])
def test_simulation_setup(config):

    sim = ArrayCableInstallation(config)
    assert sim.env


@pytest.mark.parametrize("config", (base_config, simul_config), ids=["separate", "simultaneous"])
def test_vessel_initialization(config):

    sim = ArrayCableInstallation(config)
Example #18
0
def feeder():

    specs = extract_library_specs("feeder", "test_feeder")
    return Vessel("Test Feeder", specs)
Example #19
0
__maintainer__ = "Jake Nunemaker"
__email__ = "*****@*****.**"

from copy import deepcopy

import pandas as pd
import pytest
from wisdem.orbit import ProjectManager
from wisdem.orbit.manager import ProjectProgress
from wisdem.orbit.core.library import extract_library_specs
from wisdem.test.test_orbit.data import test_weather
from wisdem.orbit.core.exceptions import MissingInputs, PhaseNotFound, WeatherProfileError, PhaseDependenciesInvalid

weather_df = pd.DataFrame(test_weather).set_index("datetime")

config = extract_library_specs("config", "project_manager")
complete_project = extract_library_specs("config", "complete_project")


### Top Level
@pytest.mark.parametrize("weather", (None, weather_df))
def test_complete_run(weather):

    project = ProjectManager(config, weather=weather)
    project.run_project()

    actions = pd.DataFrame(project.project_actions)

    phases = ["MonopileInstallation", "TurbineInstallation"]
    assert all(p in list(actions["phase"]) for p in phases)
__copyright__ = "Copyright 2020, National Renewable Energy Laboratory"
__maintainer__ = "Jake Nunemaker"
__email__ = "*****@*****.**"


from copy import deepcopy

import pandas as pd
import pytest
from wisdem.orbit import ProjectManager
from wisdem.orbit.core.library import extract_library_specs
from wisdem.orbit.core.defaults import process_times as pt
from wisdem.orbit.phases.install import MonopileInstallation
from wisdem.test.test_orbit.data import test_weather

config_wtiv = extract_library_specs("config", "single_wtiv_mono_install")
config_wtiv_feeder = extract_library_specs("config", "multi_wtiv_mono_install")
config_wtiv_multi_feeder = deepcopy(config_wtiv_feeder)
config_wtiv_multi_feeder["num_feeders"] = 2


@pytest.mark.parametrize(
    "config",
    (config_wtiv, config_wtiv_feeder, config_wtiv_multi_feeder),
    ids=["wtiv_only", "single_feeder", "multi_feeder"],
)
def test_simulation_setup(config):

    sim = MonopileInstallation(config)
    assert sim.config == config
    assert sim.env