Class AttenuationParameters


  • public class AttenuationParameters
    extends Object
    Data input for a propagation Path process.
    Author:
    Pierre Aumond
    • Field Detail

      • a8

        public static final double a8
      • freq_lvl

        protected List<Integer> freq_lvl
        Frequency bands values, by third octave
      • freq_lvl_exact

        protected List<Double> freq_lvl_exact
      • freq_lvl_a_weighting

        protected List<Double> freq_lvl_a_weighting
      • DEFAULT_WIND_ROSE

        public static final double[] DEFAULT_WIND_ROSE
      • temperature

        public double temperature
        Temperature in celsius
      • celerity

        public double celerity
        Represents the default speed of sound in air under standard conditions, measured in meters per second. The value is typically used as a constant for computations requiring the speed of sound. Standard conditions assume a temperature of 15°C at sea level atmospheric pressure.
      • humidity

        public double humidity
        Represents the relative humidity in percentage, ranging from 0 to 100. This variable is utilized in various calculations related to atmospheric attenuation and sound propagation.
      • pressure

        public double pressure
        Standard atmosphere atm (Pa)
      • alpha_atmo

        public double[] alpha_atmo
      • defaultOccurance

        public double defaultOccurance
      • gDisc

        public boolean gDisc
      • prime2520

        public boolean prime2520
      • windRose

        public double[] windRose
        probability occurrence favourable condition
    • Constructor Detail

      • AttenuationParameters

        public AttenuationParameters()
      • AttenuationParameters

        public AttenuationParameters​(boolean thirdOctave)
      • AttenuationParameters

        public AttenuationParameters​(AttenuationParameters other)
        Copy constructor
        Parameters:
        other -
      • AttenuationParameters

        public AttenuationParameters​(List<Integer> freq_lvl,
                                     List<Double> freq_lvl_exact,
                                     List<Double> freq_lvl_a_weighting)
        Parameters:
        freq_lvl - Frequency values for column names
        freq_lvl_exact - Exact frequency values for computations
        freq_lvl_a_weighting - A weighting values
    • Method Detail

      • init

        protected void init()
      • getFrequencies

        public List<Integer> getFrequencies()
      • setFrequencies

        public void setFrequencies​(List<Integer> freq_lvl)
      • getFrequenciesExact

        public List<Double> getFrequenciesExact()
      • getFrequenciesAWeighting

        public List<Double> getFrequenciesAWeighting()
      • setHumidity

        public AttenuationParameters setHumidity​(double humidity)
        Set relative humidity in percentage.
        Parameters:
        humidity - relative humidity in percentage. 0-100
      • getWindRose

        public double[] getWindRose()
      • setWindRose

        public void setWindRose​(double[] windRose)
      • getTemperature

        public double getTemperature()
      • getCelerity

        public double getCelerity()
      • getHumidity

        public double getHumidity()
      • getPressure

        public double getPressure()
      • isPrime2520

        public boolean isPrime2520()
      • isgDisc

        public boolean isgDisc()
      • setgDisc

        public void setgDisc​(boolean gDisc)
      • getDefaultOccurance

        public double getDefaultOccurance()
        Returns:
        Default favorable probability (0-1)
      • setDefaultOccurance

        public void setDefaultOccurance​(double defaultOccurance)
        Parameters:
        defaultOccurance - Default favorable probability (0-1)
      • setTemperature

        public AttenuationParameters setTemperature​(double temperature)
        Parameters:
        temperature - Temperature in ° celsius
      • getAtmoCoeffArray

        public static double[] getAtmoCoeffArray​(List<Double> freq_lvl,
                                                 double temperature,
                                                 double pressure,
                                                 double humidity)
      • getAlpha_atmo

        public double[] getAlpha_atmo()
        get the atmospheric attenuation coefficient in dB/km at the nominal centre frequency for each frequency band, in accordance with ISO 9613-1.
        Returns:
        alpha_atmo
      • getRoseIndex

        public static int getRoseIndex​(org.locationtech.jts.geom.Coordinate receiver,
                                       org.locationtech.jts.geom.Coordinate source)
        get the rose index to search the mean occurrence p of favourable conditions in the direction of the path (S,R):
        Parameters:
        receiver -
        source -
        Returns:
        rose index
      • getRoseIndex

        public static int getRoseIndex​(double angle)
        The north slice is the last array index not the first one Ex for slice width of 20°: - The first column 20° contain winds between 10 to 30 ° - The last column 360° contains winds between 350° to 360° and 0 to 10° get the rose index to search the mean occurrence p of favourable conditions in the direction of the angle:
        Returns:
        rose index
      • getCoefAttAtmosCnossos

        public static double getCoefAttAtmosCnossos​(double freq,
                                                    double humidity,
                                                    double pressure,
                                                    double T_kel)
        Parameters:
        freq - Frequency (Hz)
        humidity - Humidity %
        pressure - Pressure in pascal
        T_kel - Temperature in kelvin
        Returns:
        Atmospheric absorption dB/km
      • getCoefAttAtmos

        public static double getCoefAttAtmos​(double frequency,
                                             double humidity,
                                             double pressure,
                                             double T_kel)
        Compute AAtm
        Parameters:
        frequency - Frequency (Hz)
        humidity - Humidity %
        pressure - Pressure in pascal
        T_kel - Temperature in kelvin
        Returns:
        Atmospheric absorption dB/km
      • getCoefAttAtmosSpps

        public static double getCoefAttAtmosSpps​(double frequency,
                                                 double humidity,
                                                 double pressure,
                                                 double tempKelvin)
        This function calculates the atmospheric attenuation coefficient of sound in air ISO 9613-1:1993(F)
        Parameters:
        frequency - acoustic frequency (Hz)
        humidity - relative humidity (in %) (0-100)
        pressure - atmospheric pressure (in Pa)
        tempKelvin - Temperature in Kelvin (in K)
        Returns:
        atmospheric attenuation coefficient (db/km)
      • getAlpha

        public static double getAlpha​(double frequency,
                                      double temperature,
                                      double pressure,
                                      double humidity)
        ISO-9613 p1
        Parameters:
        frequency - acoustic frequency (Hz)
        temperature - Temperative in celsius
        pressure - atmospheric pressure (in Pa)
        humidity - relative humidity (in %) (0-100)
        Returns:
        Attenuation coefficient dB/KM
      • writeToDatabase

        public void writeToDatabase​(Connection connection,
                                    String tableName,
                                    String period)
                             throws SQLException
        Writes the attenuation parameters to an H2 database table. If the specified table does not exist, it will create the table. Then it inserts or merges the data into the table for the given period.
        Parameters:
        connection - the database connection to the H2 instance
        tableName - the name of the table in the database
        period - the time period for which the parameters are being saved
        Throws:
        SQLException - if a database access error occurs
      • readFromDatabase

        public static void readFromDatabase​(ResultSet rs,
                                            Map<String,​AttenuationParameters> cnossosParametersPerPeriod)
                                     throws SQLException
        Reads attenuation parameters from a database ResultSet and populates a map with these parameters for different periods.
        Parameters:
        rs - the ResultSet object containing the query results with attenuation parameters
        cnossosParametersPerPeriod - a map to store the attenuation parameters indexed by the corresponding period
        Throws:
        SQLException - if a database access error occurs or if the wind rose array length does not match the expected default length
      • convertSqlArrayToDoubleArray

        public static double[] convertSqlArrayToDoubleArray​(Array array)
                                                     throws SQLException
        Converts a java.sql.Array to a double[] array.
        Parameters:
        array - the SQL Array containing double values
        Returns:
        a double[] array or an empty array if the input is null
        Throws:
        SQLException - if a database access error occurs