def testBrake(self): inputs = {} outputs = {} discrete_inputs = {} discrete_outputs = {} myobj = dc.Brake(direct_drive=True) discrete_inputs["direct_drive"] = True inputs["rotor_diameter"] = 200.0 inputs["rated_torque"] = 10e6 inputs["s_rotor"] = 3.0 inputs["s_gearbox"] = 0.0 inputs["brake_mass_user"] = 0.0 myobj.compute(inputs, outputs) self.assertEqual(outputs["brake_mass"], 12200) self.assertEqual(outputs["brake_cm"], 3) npt.assert_equal(outputs["brake_I"], 12200 * np.r_[0.5, 0.25, 0.25]) discrete_inputs["direct_drive"] = False inputs["s_gearbox"] = 5.0 myobj.compute(inputs, outputs) self.assertEqual(outputs["brake_mass"], 12200) self.assertEqual(outputs["brake_cm"], 3) npt.assert_equal(outputs["brake_I"], 12200 * np.r_[0.5, 0.25, 0.25]) inputs["brake_mass_user"] = 42.0 myobj.compute(inputs, outputs) self.assertEqual(outputs["brake_mass"], 42.0) self.assertEqual(outputs["brake_cm"], 3) npt.assert_equal(outputs["brake_I"], 42.0 * np.r_[0.5, 0.25, 0.25])
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")