예제 #1
0
    def setUp(self):

        self.nac = NacelleSystemAdder()
예제 #2
0
    def setUp(self):

        self.nac = NacelleSystemAdder()
예제 #3
0
class Test_NacelleSystemAdder(unittest.TestCase):
    def setUp(self):

        self.nac = NacelleSystemAdder()

    def test_functionality(self):

        self.nac.above_yaw_mass = 259430.9
        self.nac.yawMass = 13789.0
        self.nac.machine_rating = 5000.0
        self.nac.lss_mass = 42381.5
        self.nac.main_bearing_mass = 14696.2 / 2.
        self.nac.second_bearing_mass = 14696.2 / 2.
        self.nac.gearbox_mass = 48664.7
        self.nac.hss_mass = 2414.7
        self.nac.generator_mass = 16699.9
        self.nac.bedplate_mass = 108512.5
        self.nac.mainframe_mass = 125076.5
        self.nac.lss_cm = np.random.rand(3)  # np.array([-2.0, 1.0, 1.0])
        self.nac.main_bearing_cm = np.random.rand(
            3)  # np.array([-2.0, 1.0, 1.0])
        self.nac.second_bearing_cm = np.random.rand(
            3)  # np.array([-2.0, 1.0, 1.0])
        self.nac.gearbox_cm = np.random.rand(3)  # np.array([-2.0, 1.0, 1.0])
        self.nac.hss_cm = np.random.rand(3)  # np.array([-2.0, 1.0, 1.0])
        self.nac.generator_cm = np.random.rand(3)  # np.array([-2.0, 1.0, 1.0])
        self.nac.bedplate_cm = np.random.rand(3)  # np.array([-2.0, 1.0, 1.0])
        self.nac.lss_I = np.random.rand(3)  # np.array([1000., 1000., 1000.])
        self.nac.main_bearing_I = np.random.rand(
            3)  # np.array([1000., 1000., 1000.])
        self.nac.second_bearing_I = np.random.rand(
            3)  # np.array([1000., 1000., 1000.])
        self.nac.gearbox_I = np.random.rand(
            3)  # np.array([1000., 1000., 1000.])
        self.nac.hss_I = np.random.rand(3)  # np.array([1000., 1000., 1000.])
        self.nac.generator_I = np.random.rand(
            3)  # np.array([1000., 1000., 1000.])
        self.nac.bedplate_I = np.random.rand(
            3)  # np.array([1000., 1000., 1000.])

        self.nac.run()

        self.assertEqual(round(self.nac.nacelle_mass, 1), 273219.9)

    def test_gradient(self):

        self.nac.above_yaw_mass = np.random.rand(1)[0]  # 5000.
        self.nac.yawMass = np.random.rand(1)[0]  # 5000.
        self.nac.lss_mass = np.random.rand(1)[0]  # 5000.
        self.nac.main_bearing_mass = np.random.rand(1)[0]  # 5000.
        self.nac.second_bearing_mass = np.random.rand(1)[0]  # 5000.
        self.nac.gearbox_mass = np.random.rand(1)[0]  # 5000.
        self.nac.hss_mass = np.random.rand(1)[0]  # 5000.
        self.nac.generator_mass = np.random.rand(1)[0]  # 5000.
        self.nac.bedplate_mass = np.random.rand(1)[0]  # 5000.
        self.nac.mainframe_mass = np.random.rand(1)[0]  # 6000.
        self.nac.lss_cm = np.random.rand(3)  # np.array([-2.0, 1.0, 1.0])
        self.nac.main_bearing_cm = np.random.rand(
            3)  # np.array([-2.0, 1.0, 1.0])
        self.nac.second_bearing_cm = np.random.rand(
            3)  # np.array([-2.0, 1.0, 1.0])
        self.nac.gearbox_cm = np.random.rand(3)  # np.array([-2.0, 1.0, 1.0])
        self.nac.hss_cm = np.random.rand(3)  # np.array([-2.0, 1.0, 1.0])
        self.nac.generator_cm = np.random.rand(3)  # np.array([-2.0, 1.0, 1.0])
        self.nac.bedplate_cm = np.random.rand(3)  # np.array([-2.0, 1.0, 1.0])
        self.nac.lss_I = np.random.rand(3)  # np.array([1000., 1000., 1000.])
        self.nac.main_bearing_I = np.random.rand(
            3)  # np.array([1000., 1000., 1000.])
        self.nac.second_bearing_I = np.random.rand(
            3)  # np.array([1000., 1000., 1000.])
        self.nac.gearbox_I = np.random.rand(
            3)  # np.array([1000., 1000., 1000.])
        self.nac.hss_I = np.random.rand(3)  # np.array([1000., 1000., 1000.])
        self.nac.generator_I = np.random.rand(
            3)  # np.array([1000., 1000., 1000.])
        self.nac.bedplate_I = np.random.rand(
            3)  # np.array([1000., 1000., 1000.])

        check_gradient_unit_test(self, self.nac, tol=1e-5, display=False)
예제 #4
0
class Test_NacelleSystemAdder(unittest.TestCase):

    def setUp(self):

        self.nac = NacelleSystemAdder()

    def test_functionality(self):

        self.nac.above_yaw_mass = 259430.9
        self.nac.yawMass = 13789.0
        self.nac.machine_rating = 5000.0
        self.nac.lss_mass = 42381.5
        self.nac.main_bearing_mass = 14696.2/2.
        self.nac.second_bearing_mass = 14696.2/2.
        self.nac.gearbox_mass = 48664.7
        self.nac.hss_mass = 2414.7
        self.nac.generator_mass = 16699.9
        self.nac.bedplate_mass = 108512.5
        self.nac.mainframe_mass = 125076.5
        self.nac.lss_cm = np.random.rand(3)  # np.array([-2.0, 1.0, 1.0])
        self.nac.main_bearing_cm = np.random.rand(3)  # np.array([-2.0, 1.0, 1.0])
        self.nac.second_bearing_cm = np.random.rand(3)  # np.array([-2.0, 1.0, 1.0])
        self.nac.gearbox_cm = np.random.rand(3)  # np.array([-2.0, 1.0, 1.0])
        self.nac.hss_cm = np.random.rand(3)  # np.array([-2.0, 1.0, 1.0])
        self.nac.generator_cm = np.random.rand(3)  # np.array([-2.0, 1.0, 1.0])
        self.nac.bedplate_cm = np.random.rand(3)  # np.array([-2.0, 1.0, 1.0])
        self.nac.lss_I = np.random.rand(3)  # np.array([1000., 1000., 1000.])
        self.nac.main_bearing_I = np.random.rand(3)  # np.array([1000., 1000., 1000.])
        self.nac.second_bearing_I = np.random.rand(3)  # np.array([1000., 1000., 1000.])
        self.nac.gearbox_I = np.random.rand(3)  # np.array([1000., 1000., 1000.])
        self.nac.hss_I = np.random.rand(3)  # np.array([1000., 1000., 1000.])
        self.nac.generator_I = np.random.rand(3)  # np.array([1000., 1000., 1000.])
        self.nac.bedplate_I = np.random.rand(3)  # np.array([1000., 1000., 1000.])

        self.nac.run()

        self.assertEqual(round(self.nac.nacelle_mass,1), 273219.9)

    def test_gradient(self):

        self.nac.above_yaw_mass = np.random.rand(1)[0]  # 5000.
        self.nac.yawMass = np.random.rand(1)[0]  # 5000.
        self.nac.lss_mass = np.random.rand(1)[0]  # 5000.
        self.nac.main_bearing_mass = np.random.rand(1)[0]  # 5000.
        self.nac.second_bearing_mass = np.random.rand(1)[0]  # 5000.
        self.nac.gearbox_mass = np.random.rand(1)[0]  # 5000.
        self.nac.hss_mass = np.random.rand(1)[0]  # 5000.
        self.nac.generator_mass = np.random.rand(1)[0]  # 5000.
        self.nac.bedplate_mass = np.random.rand(1)[0]  # 5000.
        self.nac.mainframe_mass = np.random.rand(1)[0]  # 6000.
        self.nac.lss_cm = np.random.rand(3)  # np.array([-2.0, 1.0, 1.0])
        self.nac.main_bearing_cm = np.random.rand(3)  # np.array([-2.0, 1.0, 1.0])
        self.nac.second_bearing_cm = np.random.rand(3)  # np.array([-2.0, 1.0, 1.0])
        self.nac.gearbox_cm = np.random.rand(3)  # np.array([-2.0, 1.0, 1.0])
        self.nac.hss_cm = np.random.rand(3)  # np.array([-2.0, 1.0, 1.0])
        self.nac.generator_cm = np.random.rand(3)  # np.array([-2.0, 1.0, 1.0])
        self.nac.bedplate_cm = np.random.rand(3)  # np.array([-2.0, 1.0, 1.0])
        self.nac.lss_I = np.random.rand(3)  # np.array([1000., 1000., 1000.])
        self.nac.main_bearing_I = np.random.rand(3)  # np.array([1000., 1000., 1000.])
        self.nac.second_bearing_I = np.random.rand(3)  # np.array([1000., 1000., 1000.])
        self.nac.gearbox_I = np.random.rand(3)  # np.array([1000., 1000., 1000.])
        self.nac.hss_I = np.random.rand(3)  # np.array([1000., 1000., 1000.])
        self.nac.generator_I = np.random.rand(3)  # np.array([1000., 1000., 1000.])
        self.nac.bedplate_I = np.random.rand(3)  # np.array([1000., 1000., 1000.])

        check_gradient_unit_test(self, self.nac, tol=1e-5, display=False)