def testTiltDownwind(self): self.discrete_inputs["upwind"] = False self.inputs["tilt"] = 5.0 self.inputs["overhang"] = 5 + (2 + 4.5) * ct self.inputs["drive_height"] = 4.875 + (2 + 4.5) * st myobj = lay.DirectLayout() myobj.compute(self.inputs, self.outputs, self.discrete_inputs, self.discrete_outputs) self.assertAlmostEqual(self.outputs["L_nose"], 3.5) self.assertAlmostEqual(self.outputs["L_lss"], 3.0) self.assertAlmostEqual(self.outputs["L_drive"], 4.5) self.assertAlmostEqual( self.outputs["L_bedplate"], self.inputs["overhang"] - (2 + self.outputs["L_drive"]) * ct) self.assertAlmostEqual( self.outputs["H_bedplate"], self.inputs["drive_height"] - (2 + self.outputs["L_drive"]) * st) self.assertAlmostEqual(self.outputs["D_bearing1"], 2.3 - 0.05 - 1.33) self.assertAlmostEqual(self.outputs["D_bearing2"], 2.3 - 0.05 - 1.33) npt.assert_equal(self.outputs["constr_access"][:, -1], 1.33 - 0.08 - 0.9) npt.assert_equal(self.outputs["constr_access"][:, 0], 2.3 - 0.1 - 1.33 - 0.25 * 0.9) self.assertAlmostEqual( self.outputs["constr_length"], self.inputs["overhang"] - (2 + self.outputs["L_drive"]) * ct - 0.5 * self.inputs["D_top"], ) self.assertAlmostEqual(self.outputs["constr_height"], self.outputs["H_bedplate"]) self.assertAlmostEqual(self.outputs["s_rotor"], 2 + 1.5 + 0.5) self.assertAlmostEqual(self.outputs["s_stator"], 0.75) self.assertAlmostEqual(self.outputs["s_mb1"], 1.5 + 2.0) self.assertAlmostEqual(self.outputs["s_mb2"], 1.5) self.assertAlmostEqual(self.outputs["x_bedplate"][-1], 5.0) self.assertAlmostEqual(self.outputs["x_bedplate_inner"][-1], 5.0) self.assertAlmostEqual(self.outputs["x_bedplate_outer"][-1], 5.0) self.assertAlmostEqual(self.outputs["x_bedplate"][0], 0.0) self.assertAlmostEqual(self.outputs["x_bedplate_inner"][0], 0.5 * 6.5) self.assertAlmostEqual(self.outputs["x_bedplate_outer"][0], -0.5 * 6.5) self.assertAlmostEqual(self.outputs["D_bedplate"][0], 6.5) self.assertAlmostEqual(self.outputs["z_bedplate"][0], 0.0) self.assertAlmostEqual(self.outputs["z_bedplate_inner"][0], 0.0) self.assertAlmostEqual(self.outputs["z_bedplate_outer"][0], 0.0) self.assertAlmostEqual(self.outputs["z_bedplate"][-1], 4.875) self.assertAlmostEqual(self.outputs["z_bedplate_inner"][-1], 4.875 - 0.5 * 1.33) self.assertAlmostEqual(self.outputs["z_bedplate_outer"][-1], 4.875 + 0.5 * 1.33) self.assertAlmostEqual(self.outputs["D_bedplate"][-1], 1.33)
def testMassValues(self): self.discrete_inputs["upwind"] = True self.inputs["tilt"] = 0.0 self.inputs["drive_height"] = 5.0 self.inputs["D_top"] = 3.0 self.inputs["overhang"] = 4.5 + 3.5 + 0.5 * 3.0 + 2 myones = np.ones(5) self.inputs["lss_diameter"] = 2.0 * myones self.inputs["nose_diameter"] = 3.0 * myones self.inputs["lss_wall_thickness"] = 0.05 * myones self.inputs["nose_wall_thickness"] = 0.05 * myones self.inputs["bedplate_wall_thickness"] = 0.05 * np.ones(npts) myobj = lay.DirectLayout() myobj.compute(self.inputs, self.outputs, self.discrete_inputs, self.discrete_outputs) rho = self.inputs["lss_rho"] m_bedplate = 5 * 0.5 * np.pi * np.pi * (1.5**2 - (1.5 - 0.05)**2) * rho self.assertAlmostEqual(self.outputs["bedplate_mass"], m_bedplate) self.assertAlmostEqual(self.outputs["bedplate_cm"][0], np.mean(self.outputs["x_bedplate"]), 0) self.assertAlmostEqual(self.outputs["bedplate_cm"][1], 0.0) self.assertAlmostEqual(self.outputs["bedplate_cm"][2], np.mean(self.outputs["z_bedplate"]), 0) 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_nose = rho * np.pi * (1.5**2 - 1.45**2) * self.outputs["L_nose"] self.assertAlmostEqual(self.outputs["nose_mass"], m_nose) self.assertAlmostEqual( self.outputs["nose_cm"], 0.5 * (self.outputs["s_nose"][0] + self.outputs["s_nose"][-1])) self.assertAlmostEqual(self.outputs["nose_I"][0], 0.5 * m_nose * (1.5**2 + 1.45**2)) self.assertAlmostEqual( self.outputs["nose_I"][1], (1 / 12) * m_nose * (3 * (1.5**2 + 1.45**2) + self.outputs["L_nose"]**2))
def testBedplateLengthHeight(self): self.inputs["tilt"] = 0.0 myobj = lay.DirectLayout() myobj.compute(self.inputs, self.outputs, self.discrete_inputs, self.discrete_outputs) self.assertAlmostEqual(self.outputs["L_nose"], 3.5) self.assertAlmostEqual(self.outputs["L_lss"], 3.0) self.assertAlmostEqual(self.outputs["L_drive"], 4.5) self.assertAlmostEqual(self.outputs["L_bedplate"], 5.0) self.assertAlmostEqual(self.outputs["H_bedplate"], 4.875) self.assertAlmostEqual(self.outputs["constr_length"], 5 - 0.5 * 6.5) self.assertAlmostEqual(self.outputs["constr_height"], 4.875) self.inputs["overhang"] = 2.0 + 0.5 * 6.5 + 2 myobj.compute(self.inputs, self.outputs, self.discrete_inputs, self.discrete_outputs) self.assertAlmostEqual(self.outputs["L_nose"], 3.5) self.assertAlmostEqual(self.outputs["L_lss"], 3.0) self.assertAlmostEqual(self.outputs["L_drive"], 4.5) self.assertAlmostEqual(self.outputs["L_bedplate"], 0.5 * 6.5) self.assertAlmostEqual(self.outputs["H_bedplate"], 4.875) self.assertAlmostEqual(self.outputs["constr_length"], -2.5) self.assertAlmostEqual(self.outputs["constr_height"], 4.875)
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]