예제 #1
0
 def runTest(self):
     self.assertAlmostEqual(altitude_or_depth_to_absolute_pressure(-160),
                            17.18013, 5,
                            'Wrong pressure at -160m : %s'
                            % altitude_or_depth_to_absolute_pressure(-160))
예제 #2
0
    def runTest(self):
        self.assertAlmostEqual(altitude_or_depth_to_absolute_pressure(-30),
                               4.04454, 5, 'Wrong pressure at -30m : %s'

                               % altitude_or_depth_to_absolute_pressure(-30))
예제 #3
0
 def runTest(self):
     self.assertAlmostEqual(altitude_or_depth_to_absolute_pressure(-100),
                            11.11755, 5,
                            'Wrong pressure at -100m : %s'
                            % altitude_or_depth_to_absolute_pressure(-100))
예제 #4
0
 def runTest(self):
     self.assertAlmostEqual(altitude_or_depth_to_absolute_pressure(3000),
                            0.701085204119, 5,
                            'Wrong pressure at 3000m : %s'
                            % altitude_or_depth_to_absolute_pressure(3000))
예제 #5
0
 def runTest(self):
     self.assertAlmostEqual(altitude_or_depth_to_absolute_pressure(7000),
                            0.4106070795, 5,
                            'Wrong pressure at 7000m : %s'
                            % altitude_or_depth_to_absolute_pressure(7000))
예제 #6
0
 def runTest(self):
     self.assertAlmostEqual(altitude_or_depth_to_absolute_pressure(0),
                            1.01325, 5, 'Wrong pressure at 0m : %s'
                            % altitude_or_depth_to_absolute_pressure(0))
예제 #7
0
 def runTest(self):
     self.assertAlmostEqual(altitude_or_depth_to_absolute_pressure(1000),
                            0.898745604274, 5,
                            'Wrong pressure at 1000m : %s'
                            % altitude_or_depth_to_absolute_pressure(1000))
예제 #8
0
 def runTest(self):
     self.assertAlmostEqual(
         altitude_or_depth_to_absolute_pressure(-160), 17.18013, 5,
         'Wrong pressure at -160m : %s' %
         altitude_or_depth_to_absolute_pressure(-160))
예제 #9
0
    def no_flight_time(self, altitude=settings.FLIGHT_ALTITUDE, tank=None):
        """Evaluate the no flight time.

        by 'ascending' to the choosen flight altitude.
        Ascending will generate the necessary 'stop' at the current depth
        (which is 0m) .
        The stop time represents the no flight time

        :param int altitude: in meter : altitude used for the calculation
        :param float flight_ascent_rate: in m/ms
        :param tank: (optionnal)
                    it is possible to provide a tank while calling
                    no_flight_time to force "no flight deco" with
                    another mix than air.
                    In this case, we will 'consume' the tank
                    When the tank is empty, it automatically switch to air
        :type tank: :class:`dipplanner.tank.Tank`

        :returns: no fight time in seconds
        :rtype: int

        :raises InfiniteDeco: if the no flight time can not achieve enough
                              decompression to be able to go to give altitude
        """
        no_flight_time = 0
        deco_uses_tank = False  # set to true when deco is using a tank
        # need to change gaz to air:
        # create a 'dummy' air tank
        no_flight_air_tank = Tank(
            tank_vol=settings.ABSOLUTE_MAX_TANK_SIZE,
            tank_pressure=settings.ABSOLUTE_MAX_TANK_PRESSURE,
            tank_rule="30b")

        if tank is not None:
            no_flight_tank = tank
            deco_uses_tank = True
            self.logger.info("Accelerating no flight"
                             "time using a tank:%s", tank)
        else:
            no_flight_tank = no_flight_air_tank

        next_stop_pressure = altitude_or_depth_to_absolute_pressure(altitude)
        # bigger stop time to speed up calculation
        # (precision is not necesary here)
        stop_time = 60  # in second -

        model_copy = copy.deepcopy(self.model)
        model_ceiling = model_copy.ceiling_in_pabs()
        while model_ceiling > next_stop_pressure:
            # loop for "deco" calculation based on the new ceiling
            model_copy.const_depth(0.0,
                                   stop_time,
                                   no_flight_tank.f_he,  # f_he
                                   no_flight_tank.f_n2,  # f_n2
                                   0.0)  # ppo2 (for cc)
            no_flight_time += stop_time
            model_ceiling = model_copy.ceiling_in_pabs()
            if deco_uses_tank:
                if no_flight_tank.remaining_gas <= 0:
                    no_flight_tank = no_flight_air_tank
                    deco_uses_tank = False
                    self.logger.info("Tank used for accelerating "
                                     "no flight time is empty, "
                                     "swithing to air at %s s",
                                     no_flight_time)
                else:
                    no_flight_tank.consume_gas(
                        settings.DECO_CONSUMPTION_RATE * stop_time)
            if no_flight_time > 300000:
                raise InfiniteDeco("Infinite deco error")

        self.no_flight_time_value = no_flight_time
        return no_flight_time
예제 #10
0
 def runTest(self):
     self.assertAlmostEqual(
         altitude_or_depth_to_absolute_pressure(-30), 4.04454, 5,
         'Wrong pressure at -30m : %s' %
         altitude_or_depth_to_absolute_pressure(-30))
예제 #11
0
 def runTest(self):
     self.assertAlmostEqual(
         altitude_or_depth_to_absolute_pressure(-100), 11.11755, 5,
         'Wrong pressure at -100m : %s' %
         altitude_or_depth_to_absolute_pressure(-100))
예제 #12
0
 def runTest(self):
     self.assertAlmostEqual(
         altitude_or_depth_to_absolute_pressure(7000), 0.4106070795, 5,
         'Wrong pressure at 7000m : %s' %
         altitude_or_depth_to_absolute_pressure(7000))
예제 #13
0
 def runTest(self):
     self.assertAlmostEqual(
         altitude_or_depth_to_absolute_pressure(3000), 0.701085204119, 5,
         'Wrong pressure at 3000m : %s' %
         altitude_or_depth_to_absolute_pressure(3000))
예제 #14
0
 def runTest(self):
     self.assertAlmostEqual(
         altitude_or_depth_to_absolute_pressure(1000), 0.898745604274, 5,
         'Wrong pressure at 1000m : %s' %
         altitude_or_depth_to_absolute_pressure(1000))
예제 #15
0
 def runTest(self):
     self.assertAlmostEqual(
         altitude_or_depth_to_absolute_pressure(0), 1.01325, 5,
         'Wrong pressure at 0m : %s' %
         altitude_or_depth_to_absolute_pressure(0))
예제 #16
0
    def no_flight_time(self, altitude=settings.FLIGHT_ALTITUDE, tank=None):
        """Evaluate the no flight time.

        by 'ascending' to the choosen flight altitude.
        Ascending will generate the necessary 'stop' at the current depth
        (which is 0m) .
        The stop time represents the no flight time

        :param int altitude: in meter : altitude used for the calculation
        :param float flight_ascent_rate: in m/ms
        :param tank: (optionnal)
                    it is possible to provide a tank while calling
                    no_flight_time to force "no flight deco" with
                    another mix than air.
                    In this case, we will 'consume' the tank
                    When the tank is empty, it automatically switch to air
        :type tank: :class:`dipplanner.tank.Tank`

        :returns: no fight time in seconds
        :rtype: int

        :raises InfiniteDeco: if the no flight time can not achieve enough
                              decompression to be able to go to give altitude
        """
        no_flight_time = 0
        deco_uses_tank = False  # set to true when deco is using a tank
        # need to change gaz to air:
        # create a 'dummy' air tank
        no_flight_air_tank = Tank(
            tank_vol=settings.ABSOLUTE_MAX_TANK_SIZE,
            tank_pressure=settings.ABSOLUTE_MAX_TANK_PRESSURE,
            tank_rule="30b")

        if tank is not None:
            no_flight_tank = tank
            deco_uses_tank = True
            self.logger.info("Accelerating no flight"
                             "time using a tank:%s", tank)
        else:
            no_flight_tank = no_flight_air_tank

        next_stop_pressure = altitude_or_depth_to_absolute_pressure(altitude)
        # bigger stop time to speed up calculation
        # (precision is not necesary here)
        stop_time = 60  # in second -

        model_copy = copy.deepcopy(self.model)
        model_ceiling = model_copy.ceiling_in_pabs()
        while model_ceiling > next_stop_pressure:
            # loop for "deco" calculation based on the new ceiling
            model_copy.const_depth(
                0.0,
                stop_time,
                no_flight_tank.f_he,  # f_he
                no_flight_tank.f_n2,  # f_n2
                0.0)  # ppo2 (for cc)
            no_flight_time += stop_time
            model_ceiling = model_copy.ceiling_in_pabs()
            if deco_uses_tank:
                if no_flight_tank.remaining_gas <= 0:
                    no_flight_tank = no_flight_air_tank
                    deco_uses_tank = False
                    self.logger.info(
                        "Tank used for accelerating "
                        "no flight time is empty, "
                        "swithing to air at %s s", no_flight_time)
                else:
                    no_flight_tank.consume_gas(settings.DECO_CONSUMPTION_RATE *
                                               stop_time)
            if no_flight_time > 300000:
                raise InfiniteDeco("Infinite deco error")

        self.no_flight_time_value = no_flight_time
        return no_flight_time