Esempio n. 1
0
    def test_opt_file(self):

        res = results()

        fname = pjoin(self.fbase, 'data', 'dtu10mw.opt')
        df = res.load_operation(fname)
        tmp = [
            5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
            23, 24, 25
        ]
        np.testing.assert_allclose(tmp, df['windspeed'].values)
        self.assertEqual(df.values.shape, (21, 3))

        fname = pjoin(pdirname(__file__), 'data', 'kb6.opt')
        df = res.load_operation(fname)
        tmp = [
            4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
            22, 23, 24, 25
        ]
        np.testing.assert_allclose(tmp, df['windspeed'].values)
        tmp = [
            7.20147212792062, 14.1560777401151, 24.5923689569214,
            39.2304595043255, 58.7985344647829, 83.2307972895692,
            106.401798353616, 106.400099017382, 106.403429471703,
            106.3986284106, 106.39861469995, 106.393720086642,
            106.404364646693, 106.401389916882, 106.4047949236,
            106.398523413816, 106.403149136568, 106.399813867904,
            106.424042832599, 106.400584861663, 106.43349513828,
            106.469433544515
        ]
        np.testing.assert_allclose(tmp, df['P_aero'].values)
        self.assertEqual(df.values.shape, (22, 5))
Esempio n. 2
0
 def test_pwr_file(self):
     fnames = [
         'dtu10mw_nofull.pwr',
         'dtu10mw_nogradient.pwr',
         'dtu10mw_nogradient_v2.pwr',
         'dtu10mw_v1.pwr',
     ]
     for fname in fnames:
         fname = pjoin(self.fbase, 'data', fname)
         res = results()
         df_data, units = res.load_pwr_df(fname)
         data = np.loadtxt(fname)
         self.assertEqual(data.shape, df_data.shape)
         np.testing.assert_allclose(data, df_data.values)
Esempio n. 3
0
    def test_cmb_df(self):
        fname1 = pjoin(self.fbase, 'data/campbell_diagram.cmb')
        speed, freq, damp, real_eig = results().load_cmb(fname1)

        self.assertIsNone(real_eig)

        df = results().load_cmb_df(fname1)
        mods = freq.shape[1]
        ops = freq.shape[0]

        self.assertEqual(len(speed), ops)
        self.assertEqual(ops, 21)
        self.assertEqual(mods, 10)

        for k in range(ops):
            df_oper = df[df['wind_ms'] == speed[k]]
            np.testing.assert_allclose(freq[k, :], df_oper['Fd_hz'].values)
            np.testing.assert_allclose(damp[k, :],
                                       df_oper['damp_ratio'].values)
            np.testing.assert_allclose(np.arange(1,
                                                 len(df_oper) + 1),
                                       df_oper['mode'])
            self.assertEqual(len(df_oper['wind_ms'].unique()), 1)
            self.assertEqual(df_oper['wind_ms'].unique()[0], speed[k])
    def set_hs2opdata(self, master, basename):
        """Load the HS2 operational data file and create opt_tags for HAWC2
        cases.

        Returns
        -------
        opt_tags : list of dicts
        """
        fpath = os.path.join(master.tags['[data_dir]'],
                             master.tags['[operational_data]'])
        hs2_res = hs2.results()
        operation = hs2_res.load_operation(fpath)
        omegas = operation.rotorspeed_rpm.values*np.pi/30.0
        winds = operation.windspeed.values
        pitchs = -1.0*operation.pitch_deg.values

        return self.set_opdata(winds, pitchs, omegas, basename=basename)
Esempio n. 5
0
    def test_ind_file(self):
        fnames = [
            'dtu10mw_nofull_defl_u10000.ind',
            'dtu10mw_nofull_fext_u10000.ind',
            'dtu10mw_nofull_u10000.ind',
            'dtu10mw_nogradient_defl_u10000.ind',
            'dtu10mw_nogradient_fext_u10000.ind',
            'dtu10mw_nogradient_u10000.ind',
            'dtu10mw_v1_defl_u10000.ind',
            'dtu10mw_v1_fext_u10000.ind',
            'dtu10mw_v1_u10000.ind',
        ]

        for fname in fnames:
            fname = pjoin(self.fbase, 'data', fname)
            res = results()
            df_data = res.load_ind(fname)
            data = np.loadtxt(fname)
            np.testing.assert_allclose(data, df_data.values)
    def __init__(self, config):
        """

        Parameters
        ----------

        config : Config class based on ConfigBase

        """
        self.hs2_res = hs2.results()
        self.h2_maps = config.h2_maps

        self.units = {'curved_s': '[m]',
                      'Cl': '[-]',
                      'Cd': '[-]',
                      'Ct': '[-]',
                      'Cp': '[-]',
                      'ax_ind': '[-]',
                      'tan_ind': '[-]',
                      'vrel': '[m/s]',
                      'inflow_angle': '[deg]',
                      'AoA': '[deg]',
                      'pos_x': '[m]',
                      'pos_y': '[m]',
                      'pos_z': '[m]',
                      'def_x': '[m]',
                      'def_y': '[m]',
                      'def_z': '[m]',
                      'torsion': '[deg]',
                      'twist': '[deg]',
                      'ax_ind_vel': '[m/s]',
                      'tan_ind_vel': '[m/s]',
                      'F_x': '[N/m]',
                      'F_y': '[N/m]',
                      'M': '[Nm/m]',
                      'chord': '[m]'}
Esempio n. 7
0
    sig = res.ReadAll()

    # METHOD B
    path, file = os.path.dirname(fname), os.path.basename(fname)
    res = windIO.LoadResults(path, file)
    sig = res.sig
    sel = res.ch_details
    # result in dataframe with unique channel names (instead of indices)
    sig_df = res.sig2df()
    ch_df = res.ch_df

    # =============================================================================
    # READ HAWCStab2 files
    # =============================================================================

    res = hawcstab2.results()

    fname = '../wetb/prepost/tests/data/campbell_diagram.cmb'
    df_cmb = res.load_cmb_df(fname)

    fname = '../wetb/prepost/tests/data/dtu10mw_v1_defl_u10000.ind'
    df_ind = res.load_ind(fname)

    fname = '../wetb/prepost/tests/data/dtu10mw.opt'
    df_opt = res.load_operation(fname)

    fname = '../wetb/prepost/tests/data/dtu10mw_v1.pwr'
    df_pwr, units = res.load_pwr_df(fname)

    fname = '../wetb/prepost/tests/data/controller_input_quadratic.txt'
    tuning = hawcstab2.ReadControlTuning()
 def _body_structure_modes_hs(self, fname):
     self.body_freq_hs = hs2.results().load_cmb_df(fname)