How to use the floris.logging_manager.LoggerBase function in FLORIS

To help you get started, we’ve selected a few FLORIS examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github NREL / floris / floris / simulation / wake_velocity / base_velocity_deficit.py View on Github external
# use this file except in compliance with the License. You may obtain a copy of
# the License at http://www.apache.org/licenses/LICENSE-2.0

# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations under
# the License.

import numpy as np

from ...utilities import cosd, sind, tand
from ...logging_manager import LoggerBase


class VelocityDeficit(LoggerBase):
    """
    Base VelocityDeficit object class. This class contains a method for getting
    the relevant model parameters from the input dictionary, or for supplying
    default values if none are supplied.
    """

    def __init__(self, parameter_dictionary):
        """
        Stores the parameter dictionary for the wake velocity model.

        Args:
            parameter_dictionary (dict): Dictionary containing the wake
                velocity model parameters. See individual wake velocity
                models for details of specific key-value pairs.
        """
        self.requires_resolution = False
github NREL / floris / floris / tools / optimization / pyoptsparse / optimization.py View on Github external
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at http://www.apache.org/licenses/LICENSE-2.0

# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations under
# the License.

# See https://floris.readthedocs.io for documentation

from ....logging_manager import LoggerBase


class Optimization(LoggerBase):
    """
    Base optimization class.

    Args:
        fi (:py:class:`floris.tools.floris_utilities.FlorisInterface`):
            Interface from FLORIS to the tools package.

    Returns:
        Optimization: An instantiated Optimization object.
    """

    def __init__(self, model, solver=None):
        """
        Instantiate Optimization object and its parameters.
        """
        self.model = model
github NREL / floris / floris / tools / sowfa_utilities.py View on Github external
# See https://floris.readthedocs.io for documentation

import os
import re

import numpy as np
import pandas as pd

from .cut_plane import CutPlane, get_plane_from_flow_data
from .flow_data import FlowData
from ..utilities import Vec3
from ..logging_manager import LoggerBase


class SowfaInterface(LoggerBase):
    """
    Object to facilitate interaction with flow data output by SOWFA.

    Returns:
        :py:class:`floris.tools.sowfa_utilities.SowfaInterface`: object
    """

    def __init__(
        self,
        case_folder,
        flow_data_sub_path="array_mean/array.mean0D_UAvg.vtk",
        setup_sub_path="setUp",
        turbine_array_sub_path="constant/turbineArrayProperties",
        turbine_sub_path="constant/turbineProperties",
        controlDict_sub_path="system/controlDict",
        turbine_output_sub_path="turbineOutput/20000",
github NREL / floris / floris / simulation / wake_deflection / base_velocity_deflection.py View on Github external
# use this file except in compliance with the License. You may obtain a copy of
# the License at http://www.apache.org/licenses/LICENSE-2.0

# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations under
# the License.

import numpy as np

from ...utilities import cosd, sind, tand
from ...logging_manager import LoggerBase


class VelocityDeflection(LoggerBase):
    """
    This is the super-class for all wake deflection models. It includes
    implementations of functions that subclasses should use to perform
    secondary steering. See :cite:`bvd-King2019Controls`. for more details on
    how secondary steering is calculated.

    References:
        .. bibliography:: /source/zrefs.bib
            :style: unsrt
            :filter: docname in docnames
            :keyprefix: bvd-
    """

    def __init__(self, parameter_dictionary):
        """
        Stores the parameter dictionary for the wake deflection model.
github NREL / floris / floris / simulation / turbine.py View on Github external
# See https://floris.readthedocs.io for documentation


import math

import numpy as np
from scipy.stats import norm
from scipy.spatial import distance_matrix
from scipy.interpolate import interp1d

from ..utilities import cosd, sind, tand
from ..logging_manager import LoggerBase


class Turbine(LoggerBase):
    """
    Turbine is a class containing objects pertaining to the individual
    turbines.

    Turbine is a model class representing a particular wind turbine. It
    is largely a container of data and parameters, but also contains
    methods to probe properties for output.

    Args:
        instance_dictionary: A dictionary that is generated from the
            input_reader; it should have the following key-value pairs:

            -   **description** (*str*): A string containing a description of
                the turbine.
            -   **properties** (*dict*): A dictionary containing the following
                key-value pairs:
github NREL / floris / floris / tools / optimization / scipy / yaw_wind_rose_parallel.py View on Github external
# the License.

# See https://floris.readthedocs.io for documentation

from itertools import repeat

import numpy as np
import pandas as pd
from scipy.optimize import minimize

from floris.tools.optimization.scipy.yaw_wind_rose import YawOptimizationWindRose

from ....logging_manager import LoggerBase


class YawOptimizationWindRoseParallel(YawOptimizationWindRose, LoggerBase):
    """
    YawOptimizationWindRose is a subclass of
    :py:class:`~.tools.optimizationscipy.YawOptimizationWindRose` that is used
    to perform parallel computing to optimize the yaw angles of all turbines in
    a Floris Farm for multiple sets of inflow conditions (combinations of wind
    speed, wind direction, and optionally turbulence intensity) using the scipy
    optimize package. Parallel optimization is performed using the
    MPIPoolExecutor method of the mpi4py.futures module.
    """

    def __init__(
        self,
        fi,
        wd,
        ws,
        ti=None,
github NREL / floris / floris / tools / cc_blade_utilities.py View on Github external
from scipy import interpolate

import floris.tools as wfct

from ..logging_manager import LoggerBase


# Attempt CCBlade import and raise error if no success
try:
    from ccblade import CCAirfoil, CCBlade
except ImportError:
    err_msg = (
        "CCBlade was not found. See http://wisdem.github.io/CCBlade for "
        + "installation instructions."
    )
    logger = LoggerBase()
    logger.error(err_msg, stack_info=True)
    raise ImportError(err_msg)


# Some useful constants
degRad = np.pi / 180.0
rpmRadSec = 2.0 * (np.pi) / 60.0
base_R = 63.0  # Actual NREL 5MW radius

# Function returns a scaled NREL 5MW rotor object from CC-Blade
def CCrotor(
    Rtip=base_R,
    Rhub=1.5,
    hubHt=90.0,
    shearExp=0.2,
    rho=1.225,
github NREL / floris / floris / simulation / floris.py View on Github external
# the License.

# See https://floris.readthedocs.io for documentation


import pickle

import floris.logging_manager as logging_manager

from .farm import Farm
from .wake import Wake
from .turbine import Turbine
from .input_reader import InputReader


class Floris(logging_manager.LoggerBase):
    """
    Top-level class that describes a Floris model and initializes the
    simulation. Use the :py:class:`~.simulation.farm.Farm` attribute to
    access other objects within the model.
    """

    def __init__(self, input_file=None, input_dict=None):
        """
        Import this class with one of the two optional input arguments
        to create a Floris model. The `input_dict` and `input_file`
        should both conform to the same data format.

        Args:
            input_file (str, optional): Path to the input file which will
                be parsed and converted to a Python dict.
            input_dict (dict, optional): Python dict given directly.
github NREL / floris / floris / tools / floris_interface.py View on Github external
import pandas as pd
import matplotlib.pyplot as plt
from scipy.stats import norm

from floris.simulation import Floris, Turbine, WindMap, TurbineMap

from .cut_plane import CutPlane, get_plane_from_flow_data
from .flow_data import FlowData
from ..utilities import Vec3
from .visualization import visualize_cut_plane
from ..logging_manager import LoggerBase
from .layout_functions import visualize_layout, build_turbine_loc
from .interface_utilities import get_params, set_params, show_params


class FlorisInterface(LoggerBase):
    """
    FlorisInterface provides a high-level user interface to many of the
    underlying methods within the FLORIS framework. It is meant to act as a
    single entry-point for the majority of users, simplifying the calls to
    methods on objects within FLORIS.
    """

    def __init__(self, input_file=None, input_dict=None):
        """
        Initialize the FLORIS interface by pointing toward an input file or
        dictionary. Inputs from either **input_file** or **input_dict** are
        parsed within the :py:class:`~.simulation.input_reader` through
        the :py:class:`~.simulation.floris` object. Either an
        **input_file** or **input_dict** is required.

        Args:
github NREL / floris / floris / simulation / wake_turbulence / base_wake_turbulence.py View on Github external
# Copyright 2020 NREL

# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at http://www.apache.org/licenses/LICENSE-2.0

# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations under
# the License.

from ...logging_manager import LoggerBase


class WakeTurbulence(LoggerBase):
    """
    This is the super-class for all wake turbulence models. It includes
    implementations of functions that subclasses should use to retrieve
    model-specific parameters from the input dictionary.
    """

    def __init__(self, parameter_dictionary):
        """
        Stores the parameter dictionary for the wake deflection model.

        Args:
            parameter_dictionary (dict): Contains the wake turbulence
                model parameters. See individual wake turbulence
                models for details of specific key-value pairs.
        """
        self.parameter_dictionary = parameter_dictionary