Beispiel #1
0
 def test_to_weibull_array(self):
     wwr = WeibullWindRoseVT()
     self.random_fill_up(wwr)
     arr = wwr.to_weibull_array()
     assert_array_almost_equal(arr[:, 0], wwr.wind_directions)
     assert_array_almost_equal(arr[:, 1], wwr.frequency)
     assert_array_almost_equal(arr[:, 2], wwr.A)
     assert_array_almost_equal(arr[:, 3], wwr.k)
     assert_almost_equal(arr[:, 1].sum(), 1.0)
 def test_to_weibull_array(self):
     wwr = WeibullWindRoseVT()
     self.random_fill_up(wwr)
     arr = wwr.to_weibull_array()
     assert_array_almost_equal(arr[:, 0], wwr.wind_directions)
     assert_array_almost_equal(arr[:, 1], wwr.frequency)
     assert_array_almost_equal(arr[:, 2], wwr.A)
     assert_array_almost_equal(arr[:, 3], wwr.k)
     assert_almost_equal(arr[:, 1].sum(), 1.0)
Beispiel #3
0
class PlantFromWWH(Component):
    """Create a Plant information from a .wwh WAsP file"""
    # Inputs
    filename = Str(iotype='in', desc='The .wwh file name')

    # Outputs
    wt_layout = VarTree(GenericWindFarmTurbineLayout(),
                        iotype='out',
                        desc='wind turbine properties and layout')
    #wind_rose_array = Array(iotype='out', units='m/s',
    #    desc='Windrose array [wind_directions, frequency, weibull_A, weibull_k]')
    wind_rose_vt = VarTree(WeibullWindRoseVT(),
                           iotype='out',
                           desc='wind turbine Weibull wind rose')

    def __init__(self, filename=None):
        """
        The constructor that can take the wwh filename as optional parameter.
        :param filename: wwh file name [optional]
        :return: self
        """
        super(PlantFromWWH, self).__init__()
        if filename is not None:
            self.filename = filename
            self.execute()

    def execute(self):
        # Reading the .wwf file
        wwh = WWH(self.filename)
        iWT = 0
        for wt, data in wwh.wind_turbines.iteritems():
            turbine = wwh.turbine_descriptions[data['type']]
            self.wt_layout.add_wt(
                WTPC(name='wt_' + wt,
                     position=data['position'][:2],
                     wind_rose=GenericWindRoseVT(
                         weibull_array=data['wind_rose']),
                     power_curve=turbine['data'][:, :2],
                     power_rating=max(turbine['data'][:, 1]),
                     c_t_curve=turbine['data'][:, [0, 2]],
                     cut_in_wind_speed=turbine['data'][0, 0],
                     cut_out_wind_speed=turbine['data'][-1, 0],
                     air_density=turbine['density'],
                     rotor_diameter=turbine['rotor_diameter'],
                     hub_height=data['position'][2]))
            self.wind_rose_vt.add(
                'wt_' + wt, VarTree((WeibullWindRoseVT(data['wind_rose']))))
Beispiel #4
0
 def execute(self):
     # Reading the .wwf file
     wwh = WWH(self.filename)
     iWT = 0
     for wt, data in wwh.wind_turbines.iteritems():
         turbine = wwh.turbine_descriptions[data['type']]
         self.wt_layout.add_wt(
             WTPC(name='wt_' + wt,
                  position=data['position'][:2],
                  wind_rose=GenericWindRoseVT(
                      weibull_array=data['wind_rose']),
                  power_curve=turbine['data'][:, :2],
                  power_rating=max(turbine['data'][:, 1]),
                  c_t_curve=turbine['data'][:, [0, 2]],
                  cut_in_wind_speed=turbine['data'][0, 0],
                  cut_out_wind_speed=turbine['data'][-1, 0],
                  air_density=turbine['density'],
                  rotor_diameter=turbine['rotor_diameter'],
                  hub_height=data['position'][2]))
         self.wind_rose_vt.add(
             'wt_' + wt, VarTree((WeibullWindRoseVT(data['wind_rose']))))
Beispiel #5
0
# The wind rose
weibull_array = np.array(
    [[0.00000000e+00, 3.59673400e-02, 9.22422800e+00, 2.38867200e+00],
     [3.00000000e+01, 3.94977300e-02, 9.86435600e+00, 2.44726600e+00],
     [6.00000000e+01, 5.17838000e-02, 9.65220200e+00, 2.41992200e+00],
     [9.00000000e+01, 6.99794900e-02, 9.98217800e+00, 2.58789100e+00],
     [1.20000000e+02, 8.36383000e-02, 1.00946000e+01, 2.74804700e+00],
     [1.50000000e+02, 6.43412500e-02, 9.64369000e+00, 2.59179700e+00],
     [1.80000000e+02, 8.64220000e-02, 9.63377500e+00, 2.58007800e+00],
     [2.10000000e+02, 1.17690000e-01, 1.05678600e+01, 2.54492200e+00],
     [2.40000000e+02, 1.51555100e-01, 1.14525200e+01, 2.46679700e+00],
     [2.70000000e+02, 1.47361100e-01, 1.17423700e+01, 2.60351600e+00],
     [3.00000000e+02, 1.00109800e-01, 1.16923200e+01, 2.62304700e+00],
     [3.30000000e+02, 5.16542400e-02, 1.01385800e+01, 2.32226600e+00]])
wind_rose = WeibullWindRoseVT()
wind_rose.wind_directions = weibull_array[:, 0]
wind_rose.frequency = weibull_array[:, 1]
wind_rose.k = weibull_array[:, 3]
wind_rose.A = weibull_array[:, 2]

# Minimum distance between turbines
dist_WT_D = 3.0

# #### Plotting the depth

# Some matplotlib options

# In[4]:

#get_ipython().magic(u'matplotlib inline')
Beispiel #6
0

# The wind rose
weibull_array = np.array([[  0.00000000e+00,   3.59673400e-02,  9.22422800e+00,   2.38867200e+00],
                         [  3.00000000e+01,   3.94977300e-02,   9.86435600e+00,   2.44726600e+00],
                         [  6.00000000e+01,   5.17838000e-02,   9.65220200e+00,   2.41992200e+00],
                         [  9.00000000e+01,   6.99794900e-02,   9.98217800e+00,   2.58789100e+00],
                         [  1.20000000e+02,   8.36383000e-02,   1.00946000e+01,   2.74804700e+00],
                         [  1.50000000e+02,   6.43412500e-02,   9.64369000e+00,   2.59179700e+00],
                         [  1.80000000e+02,   8.64220000e-02,   9.63377500e+00,   2.58007800e+00],
                         [  2.10000000e+02,   1.17690000e-01,   1.05678600e+01,   2.54492200e+00],
                         [  2.40000000e+02,   1.51555100e-01,   1.14525200e+01,   2.46679700e+00],
                         [  2.70000000e+02,   1.47361100e-01,   1.17423700e+01,   2.60351600e+00],
                         [  3.00000000e+02,   1.00109800e-01,   1.16923200e+01,   2.62304700e+00],
                         [  3.30000000e+02,   5.16542400e-02,   1.01385800e+01,   2.32226600e+00]])
wind_rose = WeibullWindRoseVT()
wind_rose.wind_directions = weibull_array[:,0]
wind_rose.frequency = weibull_array[:,1]
wind_rose.k = weibull_array[:,3]
wind_rose.A = weibull_array[:,2]

# Minimum distance between turbines
dist_WT_D = 3.0


# #### Plotting the depth

# Some matplotlib options

# In[4]:
Beispiel #7
0
 def test_df(self):
     wwr = WeibullWindRoseVT()
     self.random_fill_up(wwr)
     df = wwr.df()
     self.assertEqual(df.columns.tolist(), ["wind_direction", "frequency", "A", "k"])
 def test_df(self):
     wwr = WeibullWindRoseVT()
     self.random_fill_up(wwr)
     df = wwr.df()
     self.assertEqual(df.columns.tolist(),
                      ['wind_direction', 'frequency', 'A', 'k'])