def testTilt(self): myobj = lay.GearedLayout() myobj.compute(self.inputs, self.outputs, self.discrete_inputs, self.discrete_outputs) ds = 6.95 + 2 - 4 / ct self.assertAlmostEqual(self.outputs["L_lss"], 3.1) self.assertAlmostEqual(self.outputs["L_drive"], 6.95) npt.assert_almost_equal( self.outputs["s_drive"], np.array([ 0.0, 0.625, 1.25, 2.0, 2.75, 3.3, 3.85, 3.95, 4.95, 5.95, 6.45, 6.95 ]) - ds, ) self.assertAlmostEqual(self.outputs["s_generator"], 0.625 - ds) self.assertAlmostEqual(self.outputs["s_gearbox"], 3.3 - ds) self.assertAlmostEqual(self.outputs["s_mb1"], 5.95 - ds) self.assertAlmostEqual(self.outputs["s_mb2"], 3.95 - ds) self.assertAlmostEqual(self.outputs["L_bedplate"], 6.95 * ct) self.assertAlmostEqual(self.outputs["H_bedplate"], 4.875 - (2 + 6.95) * st) self.assertAlmostEqual(self.outputs["bedplate_web_height"], 4.725 - (2 + 6.95) * st) self.assertAlmostEqual(self.outputs["constr_length"], (2 + 6.95) * ct - 2 - 2 - 0.5 * 6.5) self.assertAlmostEqual(self.outputs["constr_height"], 4.875 - (2 + 6.95) * st)
def testMassValues(self): self.inputs["tilt"] = 0.0 self.discrete_inputs["upwind"] = True myones = np.ones(5) self.inputs["lss_diameter"] = 2.0 * myones self.inputs["lss_wall_thickness"] = 0.05 * myones myones = np.ones(3) self.inputs["hss_diameter"] = 1.5 * myones self.inputs["hss_wall_thickness"] = 0.04 * myones myobj = lay.GearedLayout() myobj.compute(self.inputs, self.outputs, self.discrete_inputs, self.discrete_outputs) rho = self.inputs["lss_rho"] m_bedplate = 2 * rho * (2 * 1.5 * 0.05 + 4.725 * 0.05) * 6.95 self.assertAlmostEqual(self.outputs["bedplate_mass"], m_bedplate) npt.assert_almost_equal( self.outputs["bedplate_cm"], np.r_[0.5 * 6.95 - 2 - 2.0, 0.0, 0.5 * 4.725 + 0.05]) m_lss = rho * np.pi * (1**2 - 0.95**2) * self.outputs["L_lss"] self.assertAlmostEqual(self.outputs["lss_mass"], m_lss) self.assertAlmostEqual( self.outputs["lss_cm"], 0.5 * (self.outputs["s_lss"][0] + self.outputs["s_lss"][-1])) self.assertAlmostEqual(self.outputs["lss_I"][0], 0.5 * m_lss * (1**2 + 0.95**2)) self.assertAlmostEqual(self.outputs["lss_I"][1], (1 / 12) * m_lss * (3 * (1**2 + 0.95**2) + self.outputs["L_lss"]**2)) m_hss = rho * np.pi * (0.75**2 - 0.71**2) * self.inputs["L_hss"] self.assertAlmostEqual(self.outputs["hss_mass"], m_hss) self.assertAlmostEqual( self.outputs["hss_cm"], 0.5 * (self.outputs["s_hss"][0] + self.outputs["s_hss"][-1])) self.assertAlmostEqual(self.outputs["hss_I"][0], 0.5 * m_hss * (0.75**2 + 0.71**2)) self.assertAlmostEqual(self.outputs["hss_I"][1], (1 / 12) * m_hss * (3 * (0.75**2 + 0.71**2) + self.inputs["L_hss"]**2)) self.discrete_inputs["upwind"] = False myobj.compute(self.inputs, self.outputs, self.discrete_inputs, self.discrete_outputs) npt.assert_almost_equal( self.outputs["bedplate_cm"], np.r_[(2 + 2 - 0.5 * 6.95), 0.0, 0.5 * 4.725 + 0.05]) self.assertAlmostEqual( self.outputs["lss_cm"], 0.5 * (self.outputs["s_lss"][0] + self.outputs["s_lss"][-1])) self.assertAlmostEqual( self.outputs["hss_cm"], 0.5 * (self.outputs["s_hss"][0] + self.outputs["s_hss"][-1]))
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")
def compute_layout(self, direct=True): myobj = lay.DirectLayout() if direct else lay.GearedLayout() myobj.compute(self.inputs, self.outputs, self.discrete_inputs, self.discrete_outputs) for k in self.outputs.keys(): self.inputs[k] = self.outputs[k]