예제 #1
0
    def testDiscYAML_Bad_Inputs(self):
        self.inputs["water_depth"] = 0.0
        self.inputs["tower_s"] = np.linspace(0, 1, 5)
        self.inputs["tower_layer_thickness"] = 0.25 * np.ones((1, 5))
        self.inputs["tower_foundation_height"] = 0.0
        self.inputs["tower_height"] = 1e2
        self.inputs["tower_outer_diameter_in"] = 8 * np.ones(5)
        self.inputs["tower_outfitting_factor"] = 1.1
        self.discrete_inputs["tower_layer_materials"] = ["steel"]
        self.inputs["monopile_s"] = np.empty(0)
        self.inputs["monopile_layer_thickness"] = np.empty((0, 0))
        self.inputs["monopile_foundation_height"] = 0.0
        self.inputs["monopile_height"] = 0.0
        self.inputs["monopile_outer_diameter_in"] = np.empty(0)
        self.inputs["monopile_outfitting_factor"] = 0.0
        self.discrete_inputs["monopile_layer_materials"] = [""]
        self.inputs["E_mat"] = 1e9 * np.ones((1, 3))
        self.inputs["G_mat"] = 1e8 * np.ones((1, 3))
        self.inputs["sigma_y_mat"] = np.array([1e7])
        self.inputs["rho_mat"] = np.array([1e4])
        self.inputs["unit_cost_mat"] = np.array([1e1])
        self.discrete_inputs["material_names"] = ["steel"]
        myobj = tow.DiscretizationYAML(n_height_tower=5,
                                       n_height_monopile=0,
                                       n_layers_tower=1,
                                       n_layers_monopile=0,
                                       n_mat=1)

        try:
            self.inputs["tower_layer_thickness"][0, -2:] = 0.0
            myobj.compute(self.inputs, self.outputs, self.discrete_inputs,
                          self.discrete_outputs)
            self.assertTrue(False)  # Shouldn't get here
        except ValueError:
            self.assertTrue(True)

        try:
            self.inputs["tower_layer_thickness"][0, -2:] = 0.25
            self.inputs["tower_outer_diameter_in"][-1] = -1.0
            myobj.compute(self.inputs, self.outputs, self.discrete_inputs,
                          self.discrete_outputs)
            self.assertTrue(False)  # Shouldn't get here
        except ValueError:
            self.assertTrue(True)

        try:
            self.inputs["tower_layer_thickness"][0, -2:] = 0.25
            self.inputs["tower_outer_diameter_in"][-1] = 8.0
            self.inputs["tower_s"][-1] = self.inputs["tower_s"][-2]
            myobj.compute(self.inputs, self.outputs, self.discrete_inputs,
                          self.discrete_outputs)
            self.assertTrue(False)  # Shouldn't get here
        except ValueError:
            self.assertTrue(True)
예제 #2
0
    def testDiscYAML_Monopile_DifferentMaterials(self):
        self.inputs["water_depth"] = 30.0
        self.inputs["tower_s"] = np.linspace(0, 1, 5)
        self.inputs["tower_layer_thickness"] = 0.25 * np.ones((1, 5))
        self.inputs["tower_foundation_height"] = 10.0
        self.inputs["tower_height"] = 1e2
        self.inputs["tower_outer_diameter_in"] = 8 * np.ones(5)
        self.inputs["tower_outfitting_factor"] = 1.1
        self.discrete_inputs["tower_layer_materials"] = ["steel"]
        self.inputs["monopile_s"] = np.linspace(0, 1, 5)
        self.inputs["monopile_layer_thickness"] = 0.5 * np.ones((1, 5))
        self.inputs["monopile_foundation_height"] = -40.0
        self.inputs["monopile_height"] = 50.0
        self.inputs["monopile_outer_diameter_in"] = 10 * np.ones(5)
        self.inputs["monopile_outer_diameter_in"][-1] = 8
        self.inputs["monopile_outfitting_factor"] = 1.2
        self.discrete_inputs["monopile_layer_materials"] = ["other"]
        self.inputs["E_mat"] = 1e9 * np.vstack((np.ones((1, 3)), 2 * np.ones(
            (1, 3))))
        self.inputs["G_mat"] = 1e8 * np.vstack((np.ones((1, 3)), 2 * np.ones(
            (1, 3))))
        self.inputs["sigma_y_mat"] = np.array([1e7, 2e7])
        self.inputs["rho_mat"] = np.array([1e4, 2e4])
        self.inputs["unit_cost_mat"] = np.array([1e1, 2e1])
        self.discrete_inputs["material_names"] = ["steel", "other"]
        myobj = tow.DiscretizationYAML(n_height_tower=5,
                                       n_height_monopile=5,
                                       n_layers_tower=1,
                                       n_layers_monopile=1,
                                       n_mat=2)
        myobj.compute(self.inputs, self.outputs, self.discrete_inputs,
                      self.discrete_outputs)

        npt.assert_equal(self.outputs["tower_section_height"],
                         np.r_[10.0, 15.0, 12.5 * np.ones(2), 25 * np.ones(4)])
        npt.assert_equal(self.outputs["tower_outer_diameter"],
                         np.r_[10 * np.ones(4), 8 * np.ones(5)])
        npt.assert_equal(self.outputs["tower_wall_thickness"],
                         np.r_[0.5 * np.ones(4), 0.25 * np.ones(4)])
        npt.assert_equal(self.outputs["outfitting_factor"],
                         np.r_[1.2 * np.ones(4), 1.1 * np.ones(4)])
        npt.assert_equal(self.outputs["E"], 1e9 *
                         np.r_[2 * np.ones(4), np.ones(4)])
        npt.assert_equal(self.outputs["G"], 1e8 *
                         np.r_[2 * np.ones(4), np.ones(4)])
        npt.assert_equal(self.outputs["sigma_y"], 1e7 *
                         np.r_[2 * np.ones(4), np.ones(4)])
        npt.assert_equal(self.outputs["rho"], 1e4 *
                         np.r_[2 * np.ones(4), np.ones(4)])
        npt.assert_equal(self.outputs["unit_cost"], 1e1 *
                         np.r_[2 * np.ones(4), np.ones(4)])
        npt.assert_equal(self.outputs["z_start"], -40.0)
        npt.assert_equal(self.outputs["transition_piece_height"], 10.0)
        npt.assert_equal(self.outputs["suctionpile_depth"], 10.0)
예제 #3
0
    def testDiscYAML_Monopile_RedoPileNodes(self):
        self.inputs["water_depth"] = 30.0
        self.inputs["tower_s"] = np.linspace(0, 1, 5)
        self.inputs["tower_layer_thickness"] = 0.25 * np.ones((1, 5))
        self.inputs["tower_height"] = 1e2
        self.inputs["tower_foundation_height"] = 10.0
        self.inputs["tower_outer_diameter_in"] = 8 * np.ones(5)
        self.inputs["tower_outfitting_factor"] = 1.1
        self.discrete_inputs["tower_layer_materials"] = ["steel"]
        self.inputs["monopile_s"] = np.linspace(0, 1, 20)
        self.inputs["monopile_layer_thickness"] = 0.5 * np.ones((1, 20))
        self.inputs["monopile_foundation_height"] = -40.0
        self.inputs["monopile_height"] = 50.0
        self.inputs["monopile_outer_diameter_in"] = 10 * np.ones(20)
        self.inputs["monopile_outer_diameter_in"][-1] = 8
        self.inputs["monopile_outfitting_factor"] = 1.2
        self.discrete_inputs["monopile_layer_materials"] = ["steel"]
        self.inputs["E_mat"] = 1e9 * np.ones((1, 3))
        self.inputs["G_mat"] = 1e8 * np.ones((1, 3))
        self.inputs["sigma_y_mat"] = np.array([1e7])
        self.inputs["rho_mat"] = np.array([1e4])
        self.inputs["unit_cost_mat"] = np.array([1e1])
        self.discrete_inputs["material_names"] = ["steel"]
        myobj = tow.DiscretizationYAML(n_height_tower=5,
                                       n_height_monopile=20,
                                       n_layers_tower=1,
                                       n_layers_monopile=1,
                                       n_mat=1)
        myobj.compute(self.inputs, self.outputs, self.discrete_inputs,
                      self.discrete_outputs)

        npt.assert_equal(self.outputs["tower_section_height"][0], 10.0)
        # npt.assert_almost_equal(self.outputs["tower_section_height"][1:4], (2.63157895*4-10)/4)
        npt.assert_almost_equal(
            self.outputs["tower_section_height"][4:],
            np.r_[2.63157895 * np.ones(15), 25 * np.ones(4)])
        npt.assert_equal(self.outputs["tower_outer_diameter"],
                         np.r_[10 * np.ones(19), 8 * np.ones(5)])
        npt.assert_equal(self.outputs["tower_wall_thickness"],
                         np.r_[0.5 * np.ones(19), 0.25 * np.ones(4)])
        npt.assert_equal(self.outputs["outfitting_factor"],
                         np.r_[1.2 * np.ones(19), 1.1 * np.ones(4)])
        npt.assert_equal(self.outputs["E"], 1e9 * np.ones(23))
        npt.assert_equal(self.outputs["G"], 1e8 * np.ones(23))
        npt.assert_equal(self.outputs["sigma_y"], 1e7 * np.ones(23))
        npt.assert_equal(self.outputs["rho"], 1e4 * np.ones(23))
        npt.assert_equal(self.outputs["unit_cost"], 1e1 * np.ones(23))
        npt.assert_equal(self.outputs["z_start"], -40.0)
        npt.assert_equal(self.outputs["transition_piece_height"], 10.0)
        npt.assert_equal(self.outputs["suctionpile_depth"], 10.0)
예제 #4
0
    def testDiscYAML_Land_1Material(self):

        # Test land based, 1 material
        self.inputs["water_depth"] = 0.0
        self.inputs["tower_s"] = np.linspace(0, 1, 5)
        self.inputs["tower_layer_thickness"] = 0.25 * np.ones((1, 5))
        self.inputs["tower_foundation_height"] = 0.0
        self.inputs["tower_height"] = 1e2
        self.inputs["tower_outer_diameter_in"] = 8 * np.ones(5)
        self.inputs["tower_outfitting_factor"] = 1.1
        self.discrete_inputs["tower_layer_materials"] = ["steel"]
        self.inputs["monopile_s"] = np.empty(0)
        self.inputs["monopile_layer_thickness"] = np.empty((0, 0))
        self.inputs["monopile_foundation_height"] = 0.0
        self.inputs["monopile_height"] = 0.0
        self.inputs["monopile_outer_diameter_in"] = np.empty(0)
        self.inputs["monopile_outfitting_factor"] = 0.0
        self.discrete_inputs["monopile_layer_materials"] = [""]
        self.inputs["E_mat"] = 1e9 * np.ones((1, 3))
        self.inputs["G_mat"] = 1e8 * np.ones((1, 3))
        self.inputs["sigma_y_mat"] = np.array([1e7])
        self.inputs["rho_mat"] = np.array([1e4])
        self.inputs["unit_cost_mat"] = np.array([1e1])
        self.discrete_inputs["material_names"] = ["steel"]
        myobj = tow.DiscretizationYAML(n_height_tower=5,
                                       n_height_monopile=0,
                                       n_layers_tower=1,
                                       n_layers_monopile=0,
                                       n_mat=1)
        myobj.compute(self.inputs, self.outputs, self.discrete_inputs,
                      self.discrete_outputs)

        npt.assert_equal(self.outputs["tower_section_height"],
                         25.0 * np.ones(4))
        npt.assert_equal(self.outputs["tower_outer_diameter"],
                         self.inputs["tower_outer_diameter_in"])
        npt.assert_equal(self.outputs["tower_wall_thickness"],
                         0.25 * np.ones(4))
        npt.assert_equal(self.outputs["outfitting_factor"], 1.1 * np.ones(4))
        npt.assert_equal(self.outputs["E"], 1e9 * np.ones(4))
        npt.assert_equal(self.outputs["G"], 1e8 * np.ones(4))
        npt.assert_equal(self.outputs["sigma_y"], 1e7 * np.ones(4))
        npt.assert_equal(self.outputs["rho"], 1e4 * np.ones(4))
        npt.assert_equal(self.outputs["unit_cost"], 1e1 * np.ones(4))
        npt.assert_equal(self.outputs["z_start"], 0.0)
        npt.assert_equal(self.outputs["transition_piece_height"], 0.0)
        npt.assert_equal(self.outputs["suctionpile_depth"], 0.0)
예제 #5
0
    def testDiscYAML_Land_2Materials(self):
        # Test land based, 2 materials
        self.inputs["water_depth"] = 0.0
        self.inputs["tower_s"] = np.linspace(0, 1, 5)
        self.inputs["tower_layer_thickness"] = np.array(
            [[0.2, 0.2, 0.2, 0.0, 0.0], [0.0, 0.0, 0.0, 0.1, 0.1]])
        self.inputs["tower_foundation_height"] = 0.0
        self.inputs["tower_height"] = 1e2
        self.inputs["tower_outer_diameter_in"] = 8 * np.ones(5)
        self.inputs["tower_outfitting_factor"] = 1.1
        self.discrete_inputs["tower_layer_materials"] = ["steel", "other"]
        self.inputs["monopile_s"] = np.empty(0)
        self.inputs["monopile_layer_thickness"] = np.empty((0, 0))
        self.inputs["monopile_foundation_height"] = 0.0
        self.inputs["monopile_height"] = 0.0
        self.inputs["monopile_outer_diameter_in"] = np.empty(0)
        self.inputs["monopile_outfitting_factor"] = 0.0
        self.discrete_inputs["monopile_layer_materials"] = [""]
        self.inputs["E_mat"] = 1e9 * np.vstack((np.ones((1, 3)), 2 * np.ones(
            (1, 3))))
        self.inputs["G_mat"] = 1e8 * np.vstack((np.ones((1, 3)), 2 * np.ones(
            (1, 3))))
        self.inputs["sigma_y_mat"] = np.array([1e7, 2e7])
        self.inputs["rho_mat"] = np.array([1e4, 2e4])
        self.inputs["unit_cost_mat"] = np.array([1e1, 2e1])
        self.discrete_inputs["material_names"] = ["steel", "other"]
        myobj = tow.DiscretizationYAML(n_height_tower=5,
                                       n_height_monopile=0,
                                       n_layers_tower=1,
                                       n_layers_monopile=0,
                                       n_mat=2)
        myobj.compute(self.inputs, self.outputs, self.discrete_inputs,
                      self.discrete_outputs)

        # Define mixtures
        v = np.r_[np.mean([0.2, 0]), np.mean([0.1, 0.0])]
        vv = v / v.sum()
        x = np.r_[1, 2]
        xx1 = np.sum(x * vv)  # Mass weighted
        xx2 = 0.5 * np.sum(vv * x) + 0.5 / np.sum(vv / x)  # Volumetric method
        xx3 = np.sum(x * x * vv) / xx1  # Mass-cost weighted
        npt.assert_equal(self.outputs["tower_section_height"],
                         25.0 * np.ones(4))
        npt.assert_equal(self.outputs["tower_outer_diameter"],
                         self.inputs["tower_outer_diameter_in"])
        npt.assert_almost_equal(self.outputs["tower_wall_thickness"],
                                np.array([0.2, 0.2, v.sum(), 0.1]))
        npt.assert_equal(self.outputs["outfitting_factor"], 1.1 * np.ones(4))
        npt.assert_almost_equal(self.outputs["E"],
                                1e9 * np.array([1, 1, xx2, 2]))
        npt.assert_almost_equal(self.outputs["G"],
                                1e8 * np.array([1, 1, xx2, 2]))
        npt.assert_almost_equal(self.outputs["sigma_y"],
                                1e7 * np.array([1, 1, xx2, 2]))
        npt.assert_almost_equal(self.outputs["rho"],
                                1e4 * np.array([1, 1, xx1, 2]))
        npt.assert_almost_equal(self.outputs["unit_cost"],
                                1e1 * np.array([1, 1, xx3, 2]))
        npt.assert_equal(self.outputs["z_start"], 0.0)
        npt.assert_equal(self.outputs["transition_piece_height"], 0.0)
        npt.assert_equal(self.outputs["suctionpile_depth"], 0.0)
예제 #6
0
파일: tower.py 프로젝트: maitimalay3/WISDEM
    def setup(self):
        mod_opt = self.options["modeling_options"]["WISDEM"]["TowerSE"]

        n_height_tow = mod_opt["n_height_tower"]
        n_layers_tow = mod_opt["n_layers_tower"]
        n_height_mon = mod_opt["n_height_monopile"]
        n_layers_mon = mod_opt["n_layers_monopile"]
        if "n_height" in mod_opt:
            n_height = mod_opt["n_height"]
        else:
            n_height = mod_opt[
                "n_height"] = n_height_tow if n_height_mon == 0 else n_height_tow + n_height_mon - 1
        nFull = get_nfull(n_height)

        self.set_input_defaults("gravity_foundation_mass", 0.0, units="kg")
        self.set_input_defaults("transition_piece_mass", 0.0, units="kg")
        self.set_input_defaults("tower_outer_diameter",
                                np.ones(n_height),
                                units="m")
        self.set_input_defaults("tower_wall_thickness",
                                np.ones(n_height),
                                units="m")
        self.set_input_defaults("outfitting_factor", np.zeros(n_height - 1))
        self.set_input_defaults("water_depth", 0.0, units="m")
        self.set_input_defaults("hub_height", 0.0, units="m")
        self.set_input_defaults("rho", np.zeros(n_height - 1), units="kg/m**3")
        self.set_input_defaults("unit_cost",
                                np.zeros(n_height - 1),
                                units="USD/kg")
        self.set_input_defaults("labor_cost_rate", 0.0, units="USD/min")
        self.set_input_defaults("painting_cost_rate", 0.0, units="USD/m**2")

        # Inputs here are the outputs from the Tower component in load_IEA_yaml
        # TODO: Use reference axis and curvature, s, instead of assuming everything is vertical on z
        self.add_subsystem(
            "yaml",
            tp.DiscretizationYAML(
                n_height_tower=n_height_tow,
                n_height_monopile=n_height_mon,
                n_layers_tower=n_layers_tow,
                n_layers_monopile=n_layers_mon,
                n_mat=self.options["modeling_options"]["materials"]["n_mat"],
            ),
            promotes=["*"],
        )

        # Promote all but foundation_height so that we can override
        self.add_subsystem(
            "geometry",
            tp.CylinderDiscretization(nPoints=n_height),
            promotes=[
                "z_param",
                "z_full",
                "d_full",
                "t_full",
                ("section_height", "tower_section_height"),
                ("diameter", "tower_outer_diameter"),
                ("wall_thickness", "tower_wall_thickness"),
            ],
        )

        self.add_subsystem("props",
                           CylindricalShellProperties(nFull=nFull),
                           promotes=["Az", "Asx", "Asy", "Ixx", "Iyy", "Jz"])
        self.add_subsystem("tgeometry",
                           tp.TowerDiscretization(n_height=n_height),
                           promotes=["*"])

        self.add_subsystem(
            "cm",
            tp.CylinderMass(nPoints=nFull),
            promotes=[
                "z_full", "d_full", "t_full", "labor_cost_rate",
                "painting_cost_rate"
            ],
        )
        self.add_subsystem(
            "tm",
            tp.TowerMass(n_height=n_height),
            promotes=[
                "z_full",
                "d_full",
                "tower_mass",
                "tower_center_of_mass",
                "tower_section_center_of_mass",
                "tower_I_base",
                "tower_cost",
                "gravity_foundation_mass",
                "gravity_foundation_I",
                "transition_piece_mass",
                "transition_piece_cost",
                "transition_piece_height",
                "transition_piece_I",
                "monopile_mass",
                "monopile_cost",
                "structural_mass",
                "structural_cost",
            ],
        )
        self.add_subsystem(
            "gc",
            util_con.GeometricConstraints(nPoints=n_height),
            promotes=[
                "constr_taper",
                "constr_d_to_t",
                "slope",
                ("d", "tower_outer_diameter"),
                ("t", "tower_wall_thickness"),
            ],
        )

        self.add_subsystem(
            "turb",
            tp.TurbineMass(),
            promotes=[
                "turbine_mass",
                "monopile_mass",
                "tower_mass",
                "tower_center_of_mass",
                "tower_I_base",
                "rna_mass",
                "rna_cg",
                "rna_I",
                "hub_height",
            ],
        )

        # Connections for geometry and mass
        self.connect("z_start", "geometry.foundation_height")
        self.connect("d_full", "props.d")
        self.connect("t_full", "props.t")
        self.connect("rho_full", "cm.rho")
        self.connect("outfitting_full", "cm.outfitting_factor")
        self.connect("unit_cost_full", "cm.material_cost_rate")
        self.connect("cm.mass", "tm.cylinder_mass")
        self.connect("cm.cost", "tm.cylinder_cost")
        self.connect("cm.center_of_mass", "tm.cylinder_center_of_mass")
        self.connect("cm.section_center_of_mass",
                     "tm.cylinder_section_center_of_mass")
        self.connect("cm.I_base", "tm.cylinder_I_base")