Exemple #1
0
 def test_GetCurrentStageN(self):
     self.rocket = Rocket([0.0, 0.0], [0.0, 0.0], [0.0, 0.0])
     self.part_one = RocketPart(1234.5, 2000.0, 0.34)
     self.tank_one = Tank(6789.0, 2000.0, 0.34, 1000.0, 0.5, 100.0)
     self.tank_two = Tank(6789.0, 2000.0, 0.34, 1000.0, 0.5, 100.0)
     self.rocket.append_part(self.part_one)
     self.rocket.append_part(self.tank_one)
     self.rocket.append_part(self.tank_two)
     self.assertEqual(self.rocket.get_current_stage(), self.tank_two)
     self.rocket.decouple()
     self.assertEqual(self.rocket.get_current_stage(), self.tank_one)
Exemple #2
0
 def test_AppendPartRocketPartThenTank(self):
     self.rocket = Rocket([0.0, 0.0], [0.0, 0.0], [0.0, 0.0])
     self.part_one = RocketPart(1000.0, 2000.0, 0.34)
     self.tank_one = Tank(1000.0, 2000.0, 0.34, 1000.0, 0.5, 100.0)
     self.rocket.append_part(self.part_one)
     self.rocket.append_part(self.tank_one)
     self.assertEqual(self.rocket.rocket_parts[0], self.part_one)
     self.assertEqual(self.rocket.rocket_parts[1], self.tank_one)
Exemple #3
0
class GetMassTest(unittest.TestCase):
    def test_GetMassZero(self):
        self.tank = Tank(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0)
        self.assertEqual(self.tank.get_mass(), 0.0)

    def test_GetMassPartZero(self):
        self.tank = Tank(0.0, 0.0, 0.0, 1000.2, 0.0, 0.0, 0.0, 0.0)
        self.assertEqual(self.tank.get_mass(), 1000.2)

    def test_GetMassPropZero(self):
        self.tank = Tank(123.4, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0)
        self.assertEqual(self.tank.get_mass(), 123.4)

    def test_GetMassPositive(self):
        self.tank = Tank(123.4, 0.0, 0.0, 1000.2, 0.0, 0.0, 0.0, 0.0)
        self.assertEqual(self.tank.get_mass(), 123.4 + 1000.2)

    def test_GetMassNegative(self):
        self.tank = Tank(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0)
        self.tank.mass_propellant = -100.2
        with self.assertRaises(ValueError):
            self.tank.get_mass()

    def test_GetMassFalseNonZero(self):
        self.tank = Tank(567.8, 0.0, 0.0, 901.3, 0.0, 0.0, 0.0, 0.0)
        self.assertNotEqual(self.tank.get_mass(), 123.4 + 1000.2)
Exemple #4
0
class GetPressureNozzleTest(unittest.TestCase):
    def test_GetPressureNozzleZero(self):
        self.tank = Tank(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0)
        self.assertEqual(self.tank.get_pressure_nozzle(), 0.0)

    def test_GetPressureNozzlePositive(self):
        self.tank = Tank(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 123.2, 123.2)
        self.assertEqual(self.tank.get_pressure_nozzle(), 123.2)

    def test_GetPressureNozzleNegative(self):
        self.tank = Tank(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0)
        self.tank.pressure_nozzle = -23.2
        with self.assertRaises(ValueError):
            self.tank.get_pressure_nozzle()

    def test_GetPressureNozzleFalseNonZero(self):
        self.tank = Tank(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 472.5, 823.3)
        self.assertNotEqual(self.tank.get_pressure_nozzle(), 123.2)
Exemple #5
0
class GetVelocityExhaustTest(unittest.TestCase):
    def test_GetVelocityExhaustZero(self):
        self.tank = Tank(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0)
        self.assertEqual(self.tank.get_velocity_exhaust(), 0.0)

    def test_GetVelocityExhaustPositive(self):
        self.tank = Tank(0.0, 0.0, 0.0, 0.0, 0.0, 123.0, 0.0, 0.0)
        self.assertEqual(self.tank.get_velocity_exhaust(), 123.0)

    def test_GetVelocityExhaustNegative(self):
        self.tank = Tank(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0)
        self.tank.velocity_exhaust_tank = -123.0
        with self.assertRaises(ValueError):
            self.tank.get_velocity_exhaust()

    def test_GetVelocityExhaustFalseNonZero(self):
        self.tank = Tank(0.0, 0.0, 0.0, 0.0, 0.0, 234.0, 0.0, 0.0)
        self.assertNotEqual(self.tank.get_velocity_exhaust(), 123.0)
Exemple #6
0
 def test_InitTankFalseNonZero(self):
     self.tank = Tank(15.0, 2341.2, 94830.1, 0.23, 0.23, 1002.2, 4.2, 8.23)
     self.assertNotEqual(self.tank.drag_coefficient_part, 130000.0)
     self.assertNotEqual(self.tank.mass_part, 134.0)
     self.assertNotEqual(self.tank.surface_part, 0.34)
     self.assertNotEqual(self.tank.mass_propellant, 100000.0)
     self.assertNotEqual(self.tank.mass_change_tank, 666.0)
     self.assertNotEqual(self.tank.velocity_exhaust_tank, 369.2)
     self.assertNotEqual(self.tank.surface_nozzle, 2.2)
     self.assertNotEqual(self.tank.pressure_nozzle, 10023.2)
Exemple #7
0
 def test_InitTankZero(self):
     self.tank = Tank(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0)
     self.assertEqual(self.tank.mass_part, 0.0)
     self.assertEqual(self.tank.surface_part, 0.0)
     self.assertEqual(self.tank.drag_coefficient_part, 0.0)
     self.assertEqual(self.tank.mass_propellant, 0.0)
     self.assertEqual(self.tank.mass_change_tank, 0.0)
     self.assertEqual(self.tank.velocity_exhaust_tank, 0.0)
     self.assertEqual(self.tank.surface_nozzle, 0.0)
     self.assertEqual(self.tank.pressure_nozzle, 0.0)
Exemple #8
0
 def test_decoupleLastTank(self):
     self.rocket = Rocket([0.0, 0.0], [0.0, 0.0], [0.0, 0.0])
     self.part_one = RocketPart(1234.5, 2000.0, 0.34)
     self.tank_one = Tank(6789.0, 2000.0, 0.34, 1000.0, 0.5, 100.0)
     self.rocket.append_part(self.part_one)
     self.rocket.append_part(self.tank_one)
     self.assertEqual(self.rocket.rocket_parts[0], self.part_one)
     self.assertEqual(self.rocket.rocket_parts[1], self.tank_one)
     self.rocket.decouple()
     self.assertEqual(len(self.rocket.rocket_parts), 1)
Exemple #9
0
 def test_SetSurfaceNPartsFalseNonZero(self):
     self.rocket = Rocket([0.0, 0.0], [0.0, 0.0], [0.0, 0.0])
     self.part_one = RocketPart(1234.5, 3000.0, 0.34)
     self.tank_one = Tank(6789.0, 3000.0, 0.34, 1000.0, 0.5, 100.0)
     self.rocket.append_part(self.part_one)
     self.rocket.set_surface()
     self.assertNotEqual(self.rocket.get_surface(), 2000.0)
     self.rocket.append_part(self.tank_one)
     self.rocket.set_surface()
     self.assertNotEqual(self.rocket.get_surface(), 4000.0)
Exemple #10
0
 def test_SetSurfaceNParts(self):
     self.rocket = Rocket([0.0, 0.0], [0.0, 0.0], [0.0, 0.0])
     self.part_one = RocketPart(1000.0, 2000.0, 0.34)
     self.tank_one = Tank(1000.0, 2000.0, 0.34, 1000.0, 0.5, 100.0)
     self.rocket.append_part(self.part_one)
     self.rocket.set_surface()
     self.assertEqual(self.rocket.get_surface(), 2000.0)
     self.rocket.append_part(self.tank_one)
     self.rocket.set_surface()
     self.assertEqual(self.rocket.get_surface(), 4000.0)
Exemple #11
0
 def test_SetMassNParts(self):
     self.rocket = Rocket([0.0, 0.0], [0.0, 0.0], [0.0, 0.0])
     self.part_one = RocketPart(1000.0, 2000.0, 0.34)
     self.tank_one = Tank(1000.0, 2000.0, 0.34, 1000.0, 0.5, 100.0)
     self.rocket.append_part(self.part_one)
     self.rocket.set_mass()
     self.assertEqual(self.rocket.get_mass(), 1000.0)
     self.rocket.append_part(self.tank_one)
     self.rocket.set_mass()
     self.assertEqual(self.rocket.get_mass(), 3000.0)
Exemple #12
0
 def test_InitTankPositive(self):
     self.tank = Tank(130000.0, 134.0, 0.34, 100000.0, 0.23, 369.2, 2.2,
                      10023.2)
     self.assertEqual(self.tank.mass_part, 130000.0)
     self.assertEqual(self.tank.surface_part, 134.0)
     self.assertEqual(self.tank.drag_coefficient_part, 0.34)
     self.assertEqual(self.tank.mass_propellant, 100000.0)
     self.assertEqual(self.tank.mass_change_tank, 0.23)
     self.assertEqual(self.tank.velocity_exhaust_tank, 369.2)
     self.assertEqual(self.tank.surface_nozzle, 2.2)
     self.assertEqual(self.tank.pressure_nozzle, 10023.2)
Exemple #13
0
class GetThrustLevelTankTest(unittest.TestCase):
    def test_GetThrustLevelZero(self):
        self.tank = Tank(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0)
        self.tank.thrust_level_tank = 0.0
        self.assertEqual(self.tank.get_thrust_level(), 0.0)

    def test_GetThrustLevelPositiveSubZero(self):
        self.tank = Tank(15.0, 2341.2, 94830.1, 0.23, 0.23, 1002.2, 0.0, 0.0)
        self.tank.thrust_level_tank = 0.23
        self.assertEqual(self.tank.get_thrust_level(), 0.23)

    def test_GetThrustLevelPositiveAboveZero(self):
        self.tank = Tank(15.0, 2341.2, 94830.1, 0.23, 0.23, 1002.2, 0.0, 0.0)
        self.tank.thrust_level_tank = 1.23
        with self.assertRaises(ValueError):
            self.tank.get_thrust_level()

    def test_GetThrustLevelNegative(self):
        self.tank = Tank(15.0, 2341.2, 94830.1, 0.23, 0.23, 1002.2, 0.0, 0.0)
        self.tank.thrust_level_tank = -10003.2
        with self.assertRaises(ValueError):
            self.tank.get_thrust_level()

    def test_GetThrustLevelFalseNonZero(self):
        self.tank = Tank(15.0, 2341.2, 94830.1, 0.23, 0.23, 1002.2, 0.0, 0.0)
        self.assertNotEqual(self.tank.get_thrust_level, 0.23)
Exemple #14
0
 def test_decoupleNTimes(self):
     self.rocket = Rocket([0.0, 0.0], [0.0, 0.0], [0.0, 0.0])
     self.part_one = RocketPart(1234.5, 2000.0, 0.34)
     self.tank_one = Tank(6789.0, 2000.0, 0.34, 1000.0, 0.5, 100.0)
     self.tank_two = Tank(6789.0, 2000.0, 0.34, 1000.0, 0.5, 100.0)
     self.tank_three = Tank(6789.0, 2000.0, 0.34, 1000.0, 0.5, 100.0)
     self.tank_four = Tank(6789.0, 2000.0, 0.34, 1000.0, 0.5, 100.0)
     self.tank_five = Tank(6789.0, 2000.0, 0.34, 1000.0, 0.5, 100.0)
     self.rocket.append_part(self.part_one)
     self.rocket.append_part(self.tank_one)
     self.rocket.append_part(self.tank_two)
     self.rocket.append_part(self.tank_three)
     self.rocket.append_part(self.tank_four)
     self.rocket.append_part(self.tank_five)
     self.assertEqual(len(self.rocket.rocket_parts), 6)
     self.assertEqual(self.rocket.rocket_parts[-1], self.tank_five)
     self.rocket.decouple()
     self.assertEqual(len(self.rocket.rocket_parts), 5)
     self.assertEqual(self.rocket.rocket_parts[-1], self.tank_four)
     self.rocket.decouple()
     self.assertEqual(len(self.rocket.rocket_parts), 4)
     self.assertEqual(self.rocket.rocket_parts[-1], self.tank_three)
Exemple #15
0
class SetMassPropellantTest(unittest.TestCase):
    def test_SetMassPropellantZero(self):
        self.tank = Tank(0.0, 0.0, 0.0, 999.0, 0.0, 0.0, 0.0, 0.0)
        self.tank.set_mass_propellant(0.0)
        self.assertEqual(self.tank.mass_propellant, 0.0)

    def test_SetMassPropellantPositive(self):
        self.tank = Tank(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0)
        self.tank.set_mass_propellant(999.0)
        self.assertEqual(self.tank.mass_propellant, 999.0)

    def test_SetMassPropellantNegative(self):
        self.tank = Tank(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0)
        with self.assertRaises(ValueError):
            self.tank.set_mass_propellant(-232.2)

    def test_SetMassPropellantFalseNonZero(self):
        self.tank = Tank(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0)
        self.tank.set_mass_propellant(232.2)
        self.assertNotEqual(self.tank.mass_propellant, 999.0)
Exemple #16
0
class GetMassChangeTest(unittest.TestCase):
    def test_GetMassChangeZero(self):
        self.tank = Tank(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0)
        self.assertEqual(self.tank.get_mass_change(), 0.0)

    def test_GetMassChangePositive(self):
        self.tank = Tank(0.0, 0.0, 0.0, 0.0, 230.0, 0.0, 0.0, 0.0)
        self.assertEqual(self.tank.get_mass_change(), 230.0)

    def test_GetMassChangePositiveReducedThrustLevel(self):
        self.tank = Tank(0.0, 0.0, 0.0, 0.0, 230.0, 0.0, 0.0, 0.0)
        self.tank.set_thrust_level(0.5)
        self.assertEqual(self.tank.get_mass_change(), 230.0 * 0.5)

    def test_GetMassChangeNegative(self):
        self.tank = Tank(0.0, 0.0, 0.0, 0.0, 230.0, 0.0, 0.0, 0.0)
        self.tank.thrust_level_tank = -0.5
        with self.assertRaises(ValueError):
            self.tank.get_mass_change()
Exemple #17
0
def main():
    """
    Declare your planet, atmosphere with its layers, the rocket with its parts, the data object and the time delta here
    and run the simulation
    :return:
    """
    # Setup here
    sim_max_step = 100000  # Maximum time steps the simulation should run
    sim_time_step = 0.1  # [s] Timestep the simulation uses
    earth = Planet(pos_planet=[0.0, 0.0],
                   mass_planet=5.974e+24,
                   radius_planet=12756.32 / 2.0 * 1000)
    earth_radius = earth.get_radius()
    troposphere = Layer(pressure_low=101325.0,
                        width_layer=18000.0,
                        temp_gradient=-0.0065,
                        temp_low=288.15)
    stratosphere = Layer(pressure_low=16901.37,
                         width_layer=32000.0,
                         temp_gradient=0.0031875,
                         temp_low=171.15)
    mesosphere = Layer(pressure_low=1.02,
                       width_layer=30000.0,
                       temp_gradient=-0.003333,
                       temp_low=273.15)
    thermosphere = Layer(pressure_low=0.04,
                         width_layer=420000.0,
                         temp_gradient=-0.000405,
                         temp_low=173.15)
    exosphere = Layer(pressure_low=0.0,
                      width_layer=9999999999.0,
                      temp_gradient=0.0,
                      temp_low=3.0)
    earth_atmosphere = Atmosphere()
    earth_atmosphere.add_layer(troposphere)
    earth_atmosphere.add_layer(stratosphere)
    earth_atmosphere.add_layer(mesosphere)
    earth_atmosphere.add_layer(thermosphere)
    earth_atmosphere.add_layer(exosphere)
    # Set maximum propellant mass
    A150_mass_propellant = 484.8076
    # Calculate A150 one tank:
    sim_flight_name = "A150_OneTank"
    sim_data = Data(
        data_file="./Results_2/{}/Results_Data.csv".format(sim_flight_name))
    sim_data.name = "Einstufig"
    A150_payload = 0.0  # kg moegliche Nutzlast
    A150_nose_cone = RocketPart(mass_part=7.0 + 2.31336 + A150_payload,
                                surface_part=0.1140,
                                drag_coefficient_part=0.27)
    A150_liquid_tank = Tank(mass_part=116.1216,
                            surface_part=0.0,
                            drag_coefficient_part=0.0,
                            mass_propellant=A150_mass_propellant,
                            mass_change_tank=9.394,
                            velocity_exhaust_tank=1417.32,
                            surface_nozzle=0.0275,
                            pressure_nozzle=101325.0)
    A150 = Rocket(pos=[earth_radius, 0.0],
                  velocity=[0.0, 0.0],
                  acceleration=[0.0, 0.0])
    A150_booster = Tank(mass_part=28.1232,
                        surface_part=0.0,
                        drag_coefficient_part=0.0,
                        mass_propellant=117.6074,
                        mass_change_tank=47.1733,
                        velocity_exhaust_tank=1747.6074,
                        surface_nozzle=0.0434,
                        pressure_nozzle=101325.0)
    A150.append_part(A150_nose_cone)
    A150.append_part(A150_liquid_tank)
    A150.append_part(A150_booster)
    A150.set_mass()
    A150.set_surface()
    sim_flight = Flight(sim_time_step, earth, A150, earth_atmosphere, sim_data)
    # Running the simulation
    run_sim(sim_flight, sim_flight_name, sim_max_step, sim_time_step)

    # Calculate A150 two tanks 1
    sim_flight_name = "A150_RefTankA"
    sim_data = Data(
        data_file="./Results_2/{}/Results_Data.csv".format(sim_flight_name))
    sim_data.name = "Stufe 1 leer"
    A150_payload = 0.0  # kg moegliche Nutzlast
    A150_nose_cone = RocketPart(mass_part=7.0 + 2.31336 + A150_payload,
                                surface_part=0.1140,
                                drag_coefficient_part=0.27)
    A150_liquid_tank_one = Tank(mass_part=116.1216,
                                surface_part=0.0,
                                drag_coefficient_part=0.0,
                                mass_propellant=A150_mass_propellant,
                                mass_change_tank=9.394,
                                velocity_exhaust_tank=1417.32,
                                surface_nozzle=0.0275,
                                pressure_nozzle=101325.0)
    A150_liquid_tank_two = Tank(mass_part=116.1216,
                                surface_part=0.0,
                                drag_coefficient_part=0.0,
                                mass_propellant=0,
                                mass_change_tank=9.394,
                                velocity_exhaust_tank=1417.32,
                                surface_nozzle=0.0275,
                                pressure_nozzle=101325.0)
    A150 = Rocket(pos=[earth_radius, 0.0],
                  velocity=[0.0, 0.0],
                  acceleration=[0.0, 0.0])
    A150_booster = Tank(mass_part=28.1232,
                        surface_part=0.0,
                        drag_coefficient_part=0.0,
                        mass_propellant=117.6074,
                        mass_change_tank=47.1733,
                        velocity_exhaust_tank=1747.6074,
                        surface_nozzle=0.0434,
                        pressure_nozzle=101325.0)
    A150.append_part(A150_nose_cone)
    A150.append_part(A150_liquid_tank_one)
    A150.append_part(A150_liquid_tank_two)
    A150.append_part(A150_booster)
    A150.set_mass()
    A150.set_surface()
    sim_flight_a = Flight(sim_time_step, earth, A150, earth_atmosphere,
                          sim_data)
    # Running the simulation
    run_sim(sim_flight_a, sim_flight_name, sim_max_step, sim_time_step)

    # Calculate A150 two tanks 1
    sim_flight_name = "A150_RefTankB"
    sim_data = Data(
        data_file="./Results_2/{}/Results_Data.csv".format(sim_flight_name))
    sim_data.name = "Stufe 2 leer"
    A150_payload = 0.0  # kg moegliche Nutzlast
    A150_nose_cone = RocketPart(mass_part=7.0 + 2.31336 + A150_payload,
                                surface_part=0.1140,
                                drag_coefficient_part=0.27)
    A150_liquid_tank_one = Tank(mass_part=116.1216,
                                surface_part=0.0,
                                drag_coefficient_part=0.0,
                                mass_propellant=0,
                                mass_change_tank=9.394,
                                velocity_exhaust_tank=1417.32,
                                surface_nozzle=0.0275,
                                pressure_nozzle=101325.0)
    A150_liquid_tank_two = Tank(mass_part=116.1216,
                                surface_part=0.0,
                                drag_coefficient_part=0.0,
                                mass_propellant=A150_mass_propellant,
                                mass_change_tank=9.394,
                                velocity_exhaust_tank=1417.32,
                                surface_nozzle=0.0275,
                                pressure_nozzle=101325.0)
    A150 = Rocket(pos=[earth_radius, 0.0],
                  velocity=[0.0, 0.0],
                  acceleration=[0.0, 0.0])
    A150_booster = Tank(mass_part=28.1232,
                        surface_part=0.0,
                        drag_coefficient_part=0.0,
                        mass_propellant=117.6074,
                        mass_change_tank=47.1733,
                        velocity_exhaust_tank=1747.6074,
                        surface_nozzle=0.0434,
                        pressure_nozzle=101325.0)
    A150.append_part(A150_nose_cone)
    A150.append_part(A150_liquid_tank_one)
    A150.append_part(A150_liquid_tank_two)
    A150.append_part(A150_booster)
    A150.set_mass()
    A150.set_surface()
    sim_flight_b = Flight(sim_time_step, earth, A150, earth_atmosphere,
                          sim_data)

    # Running the simulation
    run_sim(sim_flight_b, sim_flight_name, sim_max_step, sim_time_step)

    # Searching for optimal tank setup
    divisor = 2
    count = 0
    sim_opt_max_step = 40

    propellant_step = A150_mass_propellant / sim_opt_max_step
    while count < sim_opt_max_step:
        sim_flight_name = "A150_TankSetup_{0:03d}".format(count)
        sim_data = Data(data_file="./Results_2/{}/Results_Data.csv".format(
            sim_flight_name))
        A150_mass_propellant_tank_one = propellant_step * count
        A150_mass_propellant_tank_two = A150_mass_propellant - propellant_step * count
        sim_data.name = "Stufe 1: {0:.2f} kg Stufe 2: {1:.2f} kg".format(
            A150_mass_propellant_tank_two, A150_mass_propellant_tank_one)
        A150 = Rocket(pos=[earth_radius, 0.0],
                      velocity=[0.0, 0.0],
                      acceleration=[0.0, 0.0])
        A150_liquid_tank_one_split = Tank(
            mass_part=116.1216,
            surface_part=0.0,
            drag_coefficient_part=0.0,
            mass_propellant=A150_mass_propellant_tank_one,
            mass_change_tank=9.394,
            velocity_exhaust_tank=1417.32,
            surface_nozzle=0.0275,
            pressure_nozzle=101325.0)
        A150_liquid_tank_two_split = Tank(
            mass_part=116.1216,
            surface_part=0.0,
            drag_coefficient_part=0.0,
            mass_propellant=A150_mass_propellant_tank_two,
            mass_change_tank=9.394,
            velocity_exhaust_tank=1417.32,
            surface_nozzle=0.0275,
            pressure_nozzle=101325.0)
        A150_booster = Tank(mass_part=28.1232,
                            surface_part=0.0,
                            drag_coefficient_part=0.0,
                            mass_propellant=117.6074,
                            mass_change_tank=47.1733,
                            velocity_exhaust_tank=1747.6074,
                            surface_nozzle=0.0434,
                            pressure_nozzle=101325.0)
        A150.append_part(A150_nose_cone)
        A150.append_part(A150_liquid_tank_one_split)
        A150.append_part(A150_liquid_tank_two_split)
        A150.append_part(A150_booster)
        A150.set_mass()
        A150.set_surface()
        sim_flight_p = Flight(sim_time_step, earth, A150, earth_atmosphere,
                              sim_data)
        # Running the simulation
        run_sim(sim_flight_p, sim_flight_name, sim_max_step, sim_time_step)

        count += 1

    # Calculate A150 one tank, no booster:
    sim_flight_name = "A150_NoBooster"
    sim_data = Data(
        data_file="./Results_2/{}/Results_Data.csv".format(sim_flight_name))
    sim_data.name = "Einstufig ohne Booster"
    A150_payload = 0.0  # kg moegliche Nutzlast
    A150_nose_cone = RocketPart(mass_part=7.0 + 2.31336 + A150_payload,
                                surface_part=0.1140,
                                drag_coefficient_part=0.27)
    A150_liquid_tank = Tank(mass_part=116.1216,
                            surface_part=0.0,
                            drag_coefficient_part=0.0,
                            mass_propellant=A150_mass_propellant,
                            mass_change_tank=9.394,
                            velocity_exhaust_tank=1417.32,
                            surface_nozzle=0.0275,
                            pressure_nozzle=101325.0)
    A150 = Rocket(pos=[earth_radius, 0.0],
                  velocity=[0.0, 0.0],
                  acceleration=[0.0, 0.0])
    A150.append_part(A150_nose_cone)
    A150.append_part(A150_liquid_tank)
    A150.set_mass()
    A150.set_surface()
    sim_flight_nb = Flight(sim_time_step, earth, A150, earth_atmosphere,
                           sim_data)
    # Running the simulation
    run_sim(sim_flight_nb, sim_flight_name, sim_max_step, sim_time_step)

    print "Optimization has ended after {} iterations, Results available".format(
        count - 1)
Exemple #18
0
 def test_GetPressureNozzleNegative(self):
     self.tank = Tank(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0)
     self.tank.pressure_nozzle = -23.2
     with self.assertRaises(ValueError):
         self.tank.get_pressure_nozzle()
Exemple #19
0
 def test_GetPressureNozzleFalseNonZero(self):
     self.tank = Tank(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 472.5, 823.3)
     self.assertNotEqual(self.tank.get_pressure_nozzle(), 123.2)
Exemple #20
0
 def test_GetPressureNozzleZero(self):
     self.tank = Tank(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0)
     self.assertEqual(self.tank.get_pressure_nozzle(), 0.0)
Exemple #21
0
 def test_GetPressureNozzlePositive(self):
     self.tank = Tank(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 123.2, 123.2)
     self.assertEqual(self.tank.get_pressure_nozzle(), 123.2)
Exemple #22
0
 def test_GetSurfaceNozzleFalseNonZero(self):
     self.tank = Tank(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 472.5, 0.0)
     self.assertNotEqual(self.tank.get_surface_nozzle(), 123.2)
Exemple #23
0
 def test_SetMassPropellantFalseNonZero(self):
     self.tank = Tank(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0)
     self.tank.set_mass_propellant(232.2)
     self.assertNotEqual(self.tank.mass_propellant, 999.0)
Exemple #24
0
 def test_GetSurfaceNozzlePositive(self):
     self.tank = Tank(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 123.2, 0.0)
     self.assertEqual(self.tank.get_surface_nozzle(), 123.2)
Exemple #25
0
 def test_GetSurfaceNozzleNegative(self):
     self.tank = Tank(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0)
     self.tank.surface_nozzle = -23.2
     with self.assertRaises(ValueError):
         self.tank.get_surface_nozzle()
Exemple #26
0
 def test_GetSurfaceNozzleZero(self):
     self.tank = Tank(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0)
     self.assertEqual(self.tank.get_surface_nozzle(), 0.0)
Exemple #27
0
 def test_GetMassChangeNegative(self):
     self.tank = Tank(0.0, 0.0, 0.0, 0.0, 230.0, 0.0, 0.0, 0.0)
     self.tank.thrust_level_tank = -0.5
     with self.assertRaises(ValueError):
         self.tank.get_mass_change()
Exemple #28
0
 def test_GetMassChangePositiveReducedThrustLevel(self):
     self.tank = Tank(0.0, 0.0, 0.0, 0.0, 230.0, 0.0, 0.0, 0.0)
     self.tank.set_thrust_level(0.5)
     self.assertEqual(self.tank.get_mass_change(), 230.0 * 0.5)
Exemple #29
0
 def test_GetMassChangePositive(self):
     self.tank = Tank(0.0, 0.0, 0.0, 0.0, 230.0, 0.0, 0.0, 0.0)
     self.assertEqual(self.tank.get_mass_change(), 230.0)
Exemple #30
0
 def test_GetMassChangeZero(self):
     self.tank = Tank(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0)
     self.assertEqual(self.tank.get_mass_change(), 0.0)