コード例 #1
0
 def __init__(self,
              htcfile=None,
              ae_filename=None,
              pc_filename=None,
              at_time_filename=None,
              st_filename=None,
              blade_name=None):
     if htcfile is not None:
         if isinstance(htcfile, str):
             htcfile = HTCFile(htcfile)
         s = htcfile.new_htc_structure
         #         at_time_filename = at_time_filename or ("output_at_time" in htcfile and os.path.join(htcfile.modelpath, htcfile.output_at_time.filename[0] + ".dat"))
         #         pc_filename = pc_filename or os.path.join(htcfile.modelpath, htcfile.aero.pc_filename[0])
         #         ae_filename = ae_filename or os.path.join(htcfile.modelpath, htcfile.aero.ae_filename[0])
         #
         mainbodies = [s[k] for k in s.keys() if s[k].name_ == "main_body"]
         if blade_name is None:
             blade_name = htcfile.aero.link[2]
         self.mainbody_blade = htcfile.new_htc_structure.get_subsection_by_name(
             blade_name)
         st_filename = st_filename or os.path.join(
             htcfile.modelpath,
             self.mainbody_blade.timoschenko_input.filename[0])
         MainBody.__init__(self, htcfile, blade_name)
     elif st_filename and os.path.isfile(st_filename):
         StFile.__init__(self, st_filename)
     H2aeroBlade.__init__(self,
                          htcfile,
                          ae_filename=ae_filename,
                          pc_filename=pc_filename,
                          at_time_filename=at_time_filename,
                          blade_name=blade_name)
コード例 #2
0
 def test_save_fpm(self):
     fname = os.path.join(testfilepath, 'IEA_15MW_RWT_Blade_fpm_st.dat')
     fname2 = os.path.join(testfilepath, 'IEA_15MW_RWT_Blade_fpm_st2.dat')
     st = StFile(fname)
     st.save(fname2, encoding='utf-8', precision='% 24.15e')
     st2 = StFile(fname2)
     self.assertEqual(len(st.main_data_sets), len(st2.main_data_sets))
     self.assertEqual(len(st.main_data_sets[1]), len(st2.main_data_sets[1]))
     for k in st.main_data_sets[1]:
         testing.assert_almost_equal(st.main_data_sets[1][k],
                                     st2.main_data_sets[1][k],
                                     decimal=12)
     os.remove(fname2)
コード例 #3
0
 def __init__(self, htcfile, body_name):
     if isinstance(htcfile, str):
         htcfile = HTCFile(htcfile)
     self.htcfile = htcfile
     s = htcfile.new_htc_structure
     main_bodies = {
         s[k].name[0]: s[k]
         for k in s.keys() if s[k].name_ == "main_body"
     }
     self.main_body = main_bodies[body_name]
     self.main_body = s.get_subsection_by_name(body_name)
     self.stFile = StFile(
         os.path.join(htcfile.modelpath,
                      self.main_body.timoschenko_input.filename[0]))
     #self.c2def = np.array([v.values[1:5] for v in self.main_body.c2_def if v.name_ == "sec"])
     self.concentrated_mass = [
         cm.values for cm in self.main_body
         if cm.name_.startswith('concentrated_mass')
     ]
コード例 #4
0
 def test_stfile(self):
     st = StFile(testfilepath + 'DTU_10MW_RWT_Blade_st.dat')
     self.assertEqual(st.radius_st()[2], 3.74238)
     self.assertEqual(st.radius_st(3), 3.74238)
     self.assertEqual(st.x_e(67.7351), 4.4320990737400E-01)
     self.assertEqual(st.E(3.74238, 1, 1), 1.2511695058500E+10)
     self.assertEqual(st.E(3.74238, 1, 2), 1.2511695058500E+27)
コード例 #5
0
 def test_fpmfile(self):
     st = StFile(os.path.join(testfilepath,
                              'IEA_15MW_RWT_Blade_fpm_st.dat'))
     self.assertEqual(st.radius_st()[2], 5.857445433495505)
     self.assertEqual(st.radius_st(10), 11.71489728616879)
     self.assertEqual(st.x_e(67.7351), 0.7150636117520498)
     self.assertEqual(st.K_11(3.5, 1, 1), 5572685723.993099)
     self.assertEqual(st.K_11(3.5, 1, 2), 5572685723.993099)
コード例 #6
0
 def test_stfile_interpolate(self):
     st = StFile(testfilepath + 'DTU_10MW_RWT_Blade_st.dat')
     self.assertAlmostEqual(st.x_e(72.2261), 0.381148048)
     self.assertAlmostEqual(st.y_e(72.2261), 0.016692967)
コード例 #7
0
class MainBody():
    def __init__(self, htcfile, body_name):
        if isinstance(htcfile, str):
            htcfile = HTCFile(htcfile)
        self.htcfile = htcfile
        s = htcfile.new_htc_structure
        main_bodies = {
            s[k].name[0]: s[k]
            for k in s.keys() if s[k].name_ == "main_body"
        }
        self.main_body = main_bodies[body_name]
        self.main_body = s.get_subsection_by_name(body_name)
        self.stFile = StFile(
            os.path.join(htcfile.modelpath,
                         self.main_body.timoschenko_input.filename[0]))
        #self.c2def = np.array([v.values[1:5] for v in self.main_body.c2_def if v.name_ == "sec"])
        self.concentrated_mass = [
            cm.values for cm in self.main_body
            if cm.name_.startswith('concentrated_mass')
        ]

    @property
    def c2def(self):
        if not hasattr(self, "_c2def"):
            self._c2def = np.array([
                v.values[1:5] for v in self.main_body.c2_def
                if v.name_ == "sec"
            ])
        return self._c2def

    def plot_xz_geometry(self, plt=None):
        if plt is None:
            import matplotlib.pyplot as plt
            plt.figure()
        plt.xlabel("z")
        plt.ylabel("x")
        z = np.linspace(self.c2def[0, 2], self.c2def[-1, 2], 100)
        plt.plot(self.c2def[:, 2], self.c2def[:, 0], '.-', label='Center line')
        plt.plot(z,
                 np.interp(z, self.c2def[:, 2], self.c2def[:, 0]) +
                 self.stFile.x_e(z),
                 label='Elastic center')
        plt.plot(z,
                 np.interp(z, self.c2def[:, 2], self.c2def[:, 0]) +
                 self.stFile.x_cg(z),
                 label='Mass center')
        plt.plot(z,
                 np.interp(z, self.c2def[:, 2], self.c2def[:, 0]) +
                 self.stFile.x_sh(z),
                 label='Shear center')
        for cm in self.concentrated_mass:
            plt.plot(self.c2def[cm[0] - 1, 2] + cm[3],
                     self.c2def[cm[0] - 1, 0] + cm[1],
                     'x',
                     label='Concentrated mass')
        plt.legend()

    def plot_yz_geometry(self, plt=None):
        if plt is None:
            import matplotlib.pyplot as plt
            plt.figure()
        plt.xlabel("z")
        plt.ylabel("y")
        z = np.linspace(self.c2def[0, 2], self.c2def[-1, 2], 100)
        plt.plot(self.c2def[:, 2], self.c2def[:, 1], '.-', label='Center line')
        plt.plot(z,
                 np.interp(z, self.c2def[:, 2], self.c2def[:, 1]) +
                 self.stFile.y_e(z),
                 label='Elastic center')
        plt.plot(z,
                 np.interp(z, self.c2def[:, 2], self.c2def[:, 1]) +
                 self.stFile.y_cg(z),
                 label='Mass center')
        plt.plot(z,
                 np.interp(z, self.c2def[:, 2], self.c2def[:, 1]) +
                 self.stFile.y_sh(z),
                 label='Shear center')
        for cm in self.concentrated_mass:
            plt.plot(self.c2def[cm[0] - 1, 2] + cm[3],
                     self.c2def[cm[0] - 1, 1] + cm[2],
                     'x',
                     label='Concentrated mass')
        plt.legend()