Exemplo n.º 1
0
    def test_get_atmospheric_data(self):
        huginn_data_path = configuration.get_data_path()

        fdm_builder = FDMBuilder(huginn_data_path)
        fdmexec = fdm_builder.create_fdm()

        atmosphere = Atmosphere(fdmexec)

        self.assertAlmostEqual(
            atmosphere.pressure,
            convert_jsbsim_pressure(fdmexec.GetAtmosphere().GetPressure()), 3)

        self.assertAlmostEqual(
            atmosphere.sea_level_pressure,
            convert_jsbsim_pressure(fdmexec.GetAtmosphere().GetPressureSL()),
            3)

        self.assertAlmostEqual(
            atmosphere.temperature,
            convert_jsbsim_temperature(
                fdmexec.GetAtmosphere().GetTemperature()), 3)

        self.assertAlmostEqual(
            atmosphere.sea_level_temperature,
            convert_jsbsim_temperature(
                fdmexec.GetAtmosphere().GetTemperatureSL()), 3)

        self.assertAlmostEqual(
            atmosphere.density,
            convert_jsbsim_density(fdmexec.GetAtmosphere().GetDensity()), 3)

        self.assertAlmostEqual(
            atmosphere.sea_level_density,
            convert_jsbsim_density(fdmexec.GetAtmosphere().GetDensitySL()), 3)
Exemplo n.º 2
0
    def test_convert_pressure(self):
        pressure = 1.0
        
        expected_pressure = 47.8803

        converted_pressure = convert_jsbsim_pressure(pressure)

        self.assertAlmostEqual(converted_pressure, expected_pressure, 3)
Exemplo n.º 3
0
    def airspeed(self):
        """Returns the airspeed in knots"""
        total_pressure = self.fdmexec.GetAuxiliary().GetTotalPressure()

        total_pressure = convert_jsbsim_pressure(total_pressure)

        return true_airspeed(total_pressure,
                             self._atmosphere.pressure,
                             self._atmosphere.temperature)
Exemplo n.º 4
0
    def test_pitot_tube(self):
        huginn_data_path = configuration.get_data_path()

        fdm_builder = FDMBuilder(huginn_data_path)
        fdm_builder.aircraft = "Rascal"
        fdmexec = fdm_builder.create_fdm()

        sensors = Sensors(fdmexec)

        self.assertAlmostEqual(
            sensors.pitot_tube.true_pressure,
            convert_jsbsim_pressure(fdmexec.GetAuxiliary().GetTotalPressure()))
Exemplo n.º 5
0
    def test_presure_sensor(self):
        huginn_data_path = configuration.get_data_path()

        fdm_builder = FDMBuilder(huginn_data_path)
        fdm_builder.aircraft = "Rascal"
        fdmexec = fdm_builder.create_fdm()

        sensors = Sensors(fdmexec)

        self.assertAlmostEqual(
            sensors.pressure_sensor.true_pressure,
            convert_jsbsim_pressure(fdmexec.GetAtmosphere().GetPressure()))
Exemplo n.º 6
0
    def test_pitot_tube(self):
        huginn_data_path = configuration.get_data_path()

        fdm_builder = FDMBuilder(huginn_data_path)
        fdm_builder.aircraft = "Rascal"
        fdmexec = fdm_builder.create_fdm()

        pitot_tube = PitotTube(fdmexec)

        self.assertAlmostEqual(
            pitot_tube.true_pressure,
            convert_jsbsim_pressure(fdmexec.GetAuxiliary().GetTotalPressure()),
            3)
        self.assertAlmostEqual(
            pitot_tube.pressure,
            pitot_tube.true_pressure + pitot_tube.measurement_noise, 3)
Exemplo n.º 7
0
    def test_airspeed(self):
        huginn_data_path = configuration.get_data_path()

        fdm_builder = FDMBuilder(huginn_data_path)
        fdmexec = fdm_builder.create_fdm()

        airspeed_indicator = AirspeedIndicator(fdmexec)

        total_pressure = fdmexec.GetAuxiliary().GetTotalPressure()

        total_pressure = convert_jsbsim_pressure(total_pressure)

        atmosphere = Atmosphere(fdmexec)

        expected_airspeed = true_airspeed(total_pressure, atmosphere.pressure,
                                          atmosphere.temperature)

        self.assertAlmostEqual(airspeed_indicator.airspeed, expected_airspeed,
                               3)
Exemplo n.º 8
0
    def true_pressure(self):
        """Return the true pressure in pascal"""
        pressure = self.fdmexec.GetAuxiliary().GetTotalPressure()

        return convert_jsbsim_pressure(pressure)
Exemplo n.º 9
0
    def true_pressure(self):
        """Return the true pressure in pascal"""
        pressure = self.fdmexec.GetAuxiliary().GetTotalPressure()

        return convert_jsbsim_pressure(pressure)
Exemplo n.º 10
0
    def sea_level_pressure(self):
        """Returns the pressure at the sea level. The value will be in
        Pascal"""
        pressure = self.fdmexec.GetAtmosphere().GetPressureSL()

        return convert_jsbsim_pressure(pressure)
Exemplo n.º 11
0
    def pressure(self):
        """Returns the pressure at the current altitude. The value will be in
        Pascal"""
        pressure = self.fdmexec.GetAtmosphere().GetPressure()

        return convert_jsbsim_pressure(pressure)