Example #1
0
    def testNacelle_withTilt(self):
        inputs = {}
        outputs = {}
        discrete_inputs = {}
        discrete_outputs = {}
        myobj = dc.NacelleSystemAdder()

        discrete_inputs["upwind"] = True
        discrete_inputs["uptower"] = True
        inputs["tilt"] = 5.0
        tr = 5 * np.pi / 180.0
        components = [
            "mb1",
            "mb2",
            "lss",
            "hss",
            "gearbox",
            "generator",
            "hvac",
            "brake",
            "nose",
            "bedplate",
            "platform",
            "yaw",
            "cover",
            "transformer",
            "converter",
        ]
        cm3 = ["gearbox", "transformer", "converter", "yaw", "bedplate", "platform", "cover"]
        for k in components:
            inputs[k + "_mass"] = 1e3
            inputs[k + "_I"] = 1e3 * np.array([1, 2, 3])
            if k in cm3:
                inputs[k + "_cm"] = np.array([-3.0 * np.cos(tr), 0.0, 3.0 * np.sin(tr)])
            else:
                inputs[k + "_cm"] = [3.0]

        myobj.compute(inputs, outputs, discrete_inputs, discrete_outputs)
        self.assertEqual(outputs["other_mass"], 1e3 * 6)
        self.assertEqual(outputs["nacelle_mass"], 1e3 * len(components))
        npt.assert_almost_equal(outputs["nacelle_cm"], np.r_[-3.0 * np.cos(tr), 0.0, 3.0 * np.sin(tr)])
        # npt.assert_equal(outputs['nacelle_I'], 1e3*len(components)*np.r_[1.0, 2.0, 3.0, np.zeros(3)])

        discrete_inputs["upwind"] = False
        for k in cm3:
            inputs[k + "_cm"][0] *= -1.0
        myobj.compute(inputs, outputs, discrete_inputs, discrete_outputs)
        self.assertEqual(outputs["other_mass"], 1e3 * 6)
        self.assertEqual(outputs["nacelle_mass"], 1e3 * len(components))
        npt.assert_almost_equal(outputs["nacelle_cm"], np.r_[3.0 * np.cos(tr), 0.0, 3.0 * np.sin(tr)])
        # npt.assert_equal(outputs['nacelle_I'], 1e3*len(components)*np.r_[1.0, 2.0, 3.0, np.zeros(3)])

        discrete_inputs["uptower"] = False
        myobj.compute(inputs, outputs, discrete_inputs, discrete_outputs)
        self.assertEqual(outputs["other_mass"], 1e3 * 6)
        self.assertEqual(outputs["nacelle_mass"], 1e3 * (len(components) - 2))
        npt.assert_almost_equal(outputs["nacelle_cm"], np.r_[3.0 * np.cos(tr), 0.0, 3.0 * np.sin(tr)])
Example #2
0
    def setup(self):
        opt = self.options["modeling_options"]["WISDEM"]["DriveSE"]
        n_dlcs = self.options["n_dlcs"]
        direct = opt["direct"]
        dogen = self.options["modeling_options"]["flags"]["generator"]
        n_pc = self.options["modeling_options"]["WISDEM"]["RotorSE"]["n_pc"]

        self.set_input_defaults("machine_rating", units="kW")
        self.set_input_defaults("planet_numbers", [3, 3, 0])
        self.set_input_defaults("gear_configuration", "eep")
        self.set_input_defaults("hvac_mass_coeff", 0.025, units="kg/kW/m")
        # self.set_input_defaults('mb1Type', 'CARB')
        # self.set_input_defaults('mb2Type', 'SRB')
        self.set_input_defaults("uptower", True)
        self.set_input_defaults("upwind", True)
        self.set_input_defaults("n_blades", 3)

        # Materials prep
        self.add_subsystem(
            "mat",
            DriveMaterials(
                direct=direct,
                n_mat=self.options["modeling_options"]["materials"]["n_mat"]),
            promotes=["*"],
        )

        # Need to do these first, before the layout
        self.add_subsystem("hub",
                           Hub_System(modeling_options=opt["hub"]),
                           promotes=["*"])
        self.add_subsystem("gear",
                           Gearbox(direct_drive=direct),
                           promotes=["*"])

        # Layout and mass for the big items
        if direct:
            self.add_subsystem("layout", lay.DirectLayout(), promotes=["*"])
        else:
            self.add_subsystem("layout", lay.GearedLayout(), promotes=["*"])

        # All the smaller items
        self.add_subsystem("bear1", dc.MainBearing())
        self.add_subsystem("bear2", dc.MainBearing())
        self.add_subsystem("brake",
                           dc.Brake(direct_drive=direct),
                           promotes=["*"])
        self.add_subsystem("elec", dc.Electronics(), promotes=["*"])
        self.add_subsystem("yaw",
                           dc.YawSystem(),
                           promotes=[
                               "yaw_mass", "yaw_I", "yaw_cm", "rotor_diameter",
                               "D_top"
                           ])

        # Generator
        self.add_subsystem("rpm", dc.RPM_Input(n_pc=n_pc), promotes=["*"])
        if dogen:
            gentype = self.options["modeling_options"]["WISDEM"][
                "GeneratorSE"]["type"]
            self.add_subsystem(
                "generator",
                Generator(design=gentype, n_pc=n_pc),
                promotes=[
                    "generator_mass",
                    "generator_cost",
                    "generator_I",
                    "machine_rating",
                    "generator_efficiency",
                    "rated_torque",
                    ("rotor_mass", "generator_rotor_mass"),
                    ("rotor_I", "generator_rotor_I"),
                    ("stator_mass", "generator_stator_mass"),
                    ("stator_I", "generator_stator_I"),
                ],
            )
        else:
            self.add_subsystem("gensimp",
                               dc.GeneratorSimple(direct_drive=direct,
                                                  n_pc=n_pc),
                               promotes=["*"])

        # Final tallying
        self.add_subsystem("misc", dc.MiscNacelleComponents(), promotes=["*"])
        self.add_subsystem("nac", dc.NacelleSystemAdder(), promotes=["*"])
        self.add_subsystem("rna", dc.RNA_Adder(), promotes=["*"])

        # Structural analysis
        self.add_subsystem("lss",
                           ds.Hub_Rotor_LSS_Frame(n_dlcs=n_dlcs,
                                                  modeling_options=opt,
                                                  direct_drive=direct),
                           promotes=["*"])
        if direct:
            self.add_subsystem("nose",
                               ds.Nose_Stator_Bedplate_Frame(
                                   modeling_options=opt, n_dlcs=n_dlcs),
                               promotes=["*"])
        else:
            self.add_subsystem("hss",
                               ds.HSS_Frame(modeling_options=opt,
                                            n_dlcs=n_dlcs),
                               promotes=["*"])
            self.add_subsystem("bed",
                               ds.Bedplate_IBeam_Frame(modeling_options=opt,
                                                       n_dlcs=n_dlcs),
                               promotes=["*"])

        # Output-to-input connections
        self.connect("bedplate_rho", ["pitch_system.rho", "spinner.metal_rho"])
        self.connect("bedplate_Xy", ["pitch_system.Xy", "spinner.Xy"])
        self.connect("bedplate_mat_cost", "spinner.metal_cost")
        self.connect("hub_rho", ["hub_shell.rho", "rho_castiron"])
        self.connect("hub_Xy", "hub_shell.Xy")
        self.connect("hub_mat_cost", "hub_shell.metal_cost")
        self.connect("spinner_rho",
                     ["spinner.composite_rho", "rho_fiberglass"])
        self.connect("spinner_Xt", "spinner.composite_Xt")
        self.connect("spinner_mat_cost", "spinner.composite_cost")

        if direct:
            self.connect("D_bearing1", "bear1.D_bearing")
            self.connect("D_bearing2", "bear2.D_bearing")

        self.connect("bear1.mb_mass", "mb1_mass")
        self.connect("bear1.mb_I", "mb1_I")
        self.connect("bear1.mb_max_defl_ang", "mb1_max_defl_ang")
        self.connect("s_mb1", "mb1_cm")
        self.connect("bear2.mb_mass", "mb2_mass")
        self.connect("bear2.mb_I", "mb2_I")
        self.connect("bear2.mb_max_defl_ang", "mb2_max_defl_ang")
        self.connect("s_mb2", "mb2_cm")
        self.connect("bedplate_rho", "yaw.rho")
        self.connect("s_gearbox", "gearbox_cm")
        self.connect("s_generator", "generator_cm")

        if dogen:
            self.connect("generator.R_out", "R_generator")
            self.connect("bedplate_E", "generator.E")
            self.connect("bedplate_G", "generator.G")

            if direct:
                self.connect("lss_rpm", "generator.shaft_rpm")
                self.connect("torq_deflection", "generator.y_sh")
                self.connect("torq_rotation", "generator.theta_sh")
                self.connect("stator_deflection", "generator.y_bd")
                self.connect("stator_rotation", "generator.theta_bd")

                self.linear_solver = lbgs = om.LinearBlockGS()
                self.nonlinear_solver = nlbgs = om.NonlinearBlockGS()
                nlbgs.options["maxiter"] = 3
                nlbgs.options["atol"] = nlbgs.options["atol"] = 1e-2
                nlbgs.options["iprint"] = 0
            else:
                self.connect("hss_rpm", "generator.shaft_rpm")
Example #3
0
    def testNacelle_noTilt(self):
        inputs = {}
        outputs = {}
        discrete_inputs = {}
        discrete_outputs = {}
        myobj = dc.NacelleSystemAdder()

        discrete_inputs["upwind"] = True
        discrete_inputs["uptower"] = True
        inputs["tilt"] = 0.0
        inputs["constr_height"] = 2.0
        inputs["x_bedplate"] = -2 * np.ones(5)
        components = [
            "mb1",
            "mb2",
            "lss",
            "hss",
            "gearbox",
            "generator",
            "generator_stator",
            "generator_rotor",
            "hvac",
            "brake",
            "nose",
            "bedplate",
            "platform",
            "yaw",
            "cover",
            "transformer",
            "converter",
        ]
        cm3 = [
            "gearbox", "transformer", "converter", "yaw", "bedplate",
            "platform", "cover"
        ]
        for k in components:
            inputs[k + "_mass"] = 1e3
            inputs[k + "_I"] = 1e3 * np.array([1, 2, 3])
            if k in cm3:
                inputs[k + "_cm"] = np.array([-5.0, 0.0, 2.0])
            else:
                inputs[k + "_cm"] = [3.0]

        myobj.compute(inputs, outputs, discrete_inputs, discrete_outputs)
        self.assertEqual(outputs["other_mass"], 1e3 * 6)
        self.assertEqual(
            outputs["nacelle_mass"],
            1e3 * (len(components) - 2))  # gen stator / rotor duplication
        npt.assert_equal(outputs["nacelle_cm"], np.r_[-5.0, 0.0, 2.0])
        npt.assert_equal(
            outputs["nacelle_I"], 1e3 * (len(components) - 2) *
            np.r_[1.0, 2.0, 3.0, np.zeros(3)])

        discrete_inputs["upwind"] = False
        for k in cm3:
            inputs[k + "_cm"][0] *= -1.0
        inputs["x_bedplate"] *= -1.0
        myobj.compute(inputs, outputs, discrete_inputs, discrete_outputs)
        self.assertEqual(outputs["other_mass"], 1e3 * 6)
        self.assertEqual(outputs["nacelle_mass"], 1e3 * (len(components) - 2))
        npt.assert_equal(outputs["nacelle_cm"], np.r_[5.0, 0.0, 2.0])
        npt.assert_equal(
            outputs["nacelle_I"], 1e3 * (len(components) - 2) *
            np.r_[1.0, 2.0, 3.0, np.zeros(3)])

        discrete_inputs["uptower"] = False
        myobj.compute(inputs, outputs, discrete_inputs, discrete_outputs)
        self.assertEqual(outputs["other_mass"], 1e3 * 6)
        self.assertEqual(outputs["nacelle_mass"], 1e3 * (len(components) - 4))
        npt.assert_equal(outputs["nacelle_cm"], np.r_[5.0, 0.0, 2.0])
        npt.assert_equal(
            outputs["nacelle_I"], 1e3 * (len(components) - 4) *
            np.r_[1.0, 2.0, 3.0, np.zeros(3)])