Beispiel #1
0
 def test_create_write_read_bladestructure(self):
     if not os.path.exists(self.test_dir):
         os.makedirs(self.test_dir)
     write_bladestructure(self.st3d, os.path.join(self.test_dir, 'test'))
     st3dn = read_bladestructure(os.path.join(self.test_dir, 'test'))
     self.assertEqual(np.testing.assert_array_equal(
                      self.st3d['DPs'][:, 4],
                      st3dn['DPs'][:, 4]), None)
     self.assertEqual(np.testing.assert_array_equal(
                      self.st3d['regions'][2]['thicknesses'][:, 4],
                      st3dn['regions'][2]['thicknesses'][:, 4]), None)
     uniax = self.uniax
     self.assertEqual(np.testing.assert_array_equal(
                      self.st3d['matprops'][1, :],
                      [uniax.E1,
                       uniax.E2,
                       uniax.E3,
                       uniax.nu12,
                       uniax.nu13,
                       uniax.nu23,
                       uniax.G12,
                       uniax.G13,
                       uniax.G23,
                       uniax.rho,
                       ]), None)
     shutil.rmtree(self.test_dir)
Beispiel #2
0
 def test_create_write_read_bladestructure(self):
     if not os.path.exists(self.test_dir):
         os.makedirs(self.test_dir)
     write_bladestructure(self.st3d, os.path.join(self.test_dir, 'test'))
     st3dn = read_bladestructure(os.path.join(self.test_dir, 'test'))
     self.assertEqual(
         np.testing.assert_array_equal(self.st3d['DPs'][:, 4],
                                       st3dn['DPs'][:, 4]), None)
     self.assertEqual(
         np.testing.assert_array_equal(
             self.st3d['regions'][2]['thicknesses'][:, 4],
             st3dn['regions'][2]['thicknesses'][:, 4]), None)
     uniax = self.uniax
     self.assertEqual(
         np.testing.assert_array_equal(self.st3d['matprops'][1, :], [
             uniax.E1,
             uniax.E2,
             uniax.E3,
             uniax.nu12,
             uniax.nu13,
             uniax.nu23,
             uniax.G12,
             uniax.G13,
             uniax.G23,
             uniax.rho,
         ]), None)
     shutil.rmtree(self.test_dir)
Beispiel #3
0
 def test_read_write_read_bladestructure_version_1(self):
     if not os.path.exists(self.test_dir):
         os.makedirs(self.test_dir)
     st3d = read_bladestructure(os.path.join(self.data_version_1, self.blade))
     write_bladestructure(st3d, os.path.join(self.test_dir, 'test'))
     st3dn = read_bladestructure(os.path.join(self.test_dir, 'test'))
     self.assertEqual(np.testing.assert_array_equal(
                      st3dn['web_def'],
                      st3d_desired['web_def']), None)
     shutil.rmtree(self.test_dir)
Beispiel #4
0
 def test_read_write_read_bladestructure_version_1(self):
     if not os.path.exists(self.test_dir):
         os.makedirs(self.test_dir)
     st3d = read_bladestructure(os.path.join(self.data_version_1, self.blade))
     write_bladestructure(st3d, os.path.join(self.test_dir, 'test'))
     st3dn = read_bladestructure(os.path.join(self.test_dir, 'test'))
     self.assertEqual(np.testing.assert_array_equal(
                      st3dn['web_def'],
                      st3d_desired['web_def']), None)
     shutil.rmtree(self.test_dir)
Beispiel #5
0
def write_recorded_bladestructure(st3d, db, coordinate, filebase):

    data = db[coordinate]['Unknowns']

    s = st3d['s']
    stnew = {}
    stnew['s'] = s
    stnew['materials'] = st3d['materials']
    stnew['matprops'] = st3d['matprops']
    stnew['failcrit'] = st3d['failcrit']
    stnew['failmat'] = st3d['failmat']
    stnew['web_def'] = st3d['web_def']
    stnew['version'] = st3d['version']

    nsec = s.shape[0]
    nDP = st3d['DPs'].shape[1]

    DPs = np.array([data['DP%02d' % i] for i in range(nDP)]).T
    stnew['DPs'] = DPs
    stnew['regions'] = []
    stnew['webs'] = []
    for ireg, reg in enumerate(st3d['regions']):
        rnew = {}
        rnew['layers'] = reg['layers']
        nl = len(reg['layers'])
        Ts = np.zeros((nsec, nl))
        As = np.zeros((nsec, nl))

        for i, lname in enumerate(reg['layers']):
            varname = 'r%02d%s' % (ireg, lname)
            Ts[:, i] = data[varname + 'T']
            As[:, i] = data[varname + 'A']
        rnew['thicknesses'] = Ts
        rnew['angles'] = As
        stnew['regions'].append(rnew)

    for ireg, reg in enumerate(st3d['webs']):
        rnew = {}
        rnew['layers'] = reg['layers']
        nl = len(reg['layers'])
        Ts = np.zeros((nsec, nl))
        As = np.zeros((nsec, nl))

        for i, lname in enumerate(reg['layers']):
            varname = 'w%02d%s' % (ireg, lname)
            Ts[:, i] = data[varname + 'T']
            As[:, i] = data[varname + 'A']
        rnew['thicknesses'] = Ts
        rnew['angles'] = As
        stnew['webs'].append(rnew)

    write_bladestructure(stnew, filebase)
Beispiel #6
0
    def test_version_2_geo3d(self):

        if not os.path.exists(self.test_dir):
            os.makedirs(self.test_dir)
        st3d = read_bladestructure(os.path.join(self.data_version_2, 'Param2_10MW'))
        write_bladestructure(st3d, os.path.join(self.test_dir, 'test'))
        st3dn = read_bladestructure(os.path.join(self.test_dir, 'test'))
        self.assertEqual(np.testing.assert_array_equal(
                         st3dn['cap_DPs'],
                         st3d_desired['cap_DPs']), None)
        self.assertEqual(np.testing.assert_array_equal(
                         st3dn['le_DPs'],
                         st3d_desired['le_DPs']), None)
        self.assertEqual(np.testing.assert_array_equal(
                         st3dn['te_DPs'],
                         st3d_desired['te_DPs']), None)
        self.assertEqual(np.testing.assert_array_equal(
                         st3dn['cap_width_ps'],
                         st3d_desired['cap_width_ps']), None)
        shutil.rmtree(self.test_dir)
Beispiel #7
0
# read the blade structure including the geo3d file
st3d = read_bladestructure(os.path.join(PATH, 'data_version_2/Param2_10MW'))

# instantiate class with st3d dict and set additional surface params
st = ComputeDPsParam2(st3d,
                      x=pf['x'],
                      y=pf['y'],
                      z=pf['z'],
                      surface=d.surface)

st.compute()

# save the DPs to new st file
st3d['DPs'] = st.DPs
write_bladestructure(st3d, 'param2_st')

# --- 4 ---

# simple plots
st.plot(coordsys='rotor')
st.plot_topview(coordsys='rotor')

# --- 5 ---

# set the struct_angle to 15 deg
# and shift the main laminates and webs forward

st.struct_angle = 15.
st.cap_center_ss = np.linspace(0.5, 0.0, 20) / 86.366
st.cap_center_ps = np.linspace(0.5, 0.0, 20) / 86.366
Beispiel #8
0
import numpy as np
from fusedwind.turbine.structure import read_bladestructure, write_bladestructure, interpolate_bladestructure

st3d = read_bladestructure('data/DTU10MW')
write_bladestructure(st3d, 'test_out')
st3dn = read_bladestructure('test_out')

#s_new = np.linspace(0, 1, 20)
#st3dn = interpolate_bladestructure(r.st3d, s_new)
Beispiel #9
0
def write_recorded_bladestructure(st3d, db, coordinate, filebase):

    stnew = get_recorded_bladestructure(st3d, db, coordinate)

    write_bladestructure(stnew, filebase)
Beispiel #10
0
def write_recorded_bladestructure(st3d, db, coordinate, filebase):

    stnew = get_recorded_bladestructure(st3d, db, coordinate)

    write_bladestructure(stnew, filebase)