Class AttenuationParameters
java.lang.Object
org.noise_planet.noisemodelling.propagation.AttenuationParameters
Data input for a propagation Path process.
- Author:
- Pierre Aumond
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final doubledouble[]doubleRepresents the default speed of sound in air under standard conditions, measured in meters per second.static final double[]doublestatic final doublestatic final doubleFrequency bands values, by third octavebooleandoubleRepresents the relative humidity in percentage, ranging from 0 to 100.static final doublestatic final doublestatic final doublestatic final doublestatic final doublestatic final doubledoubleStandard atmosphere atm (Pa)booleandoubleTemperature in celsiusdouble[]probability occurrence favourable condition -
Constructor Summary
ConstructorsConstructorDescriptionAttenuationParameters(boolean thirdOctave) AttenuationParameters(List<Integer> freq_lvl, List<Double> freq_lvl_exact, List<Double> freq_lvl_a_weighting) Copy constructor -
Method Summary
Modifier and TypeMethodDescriptionstatic double[]Converts a java.sql.Array to a double[] array.static doublegetAlpha(double frequency, double temperature, double pressure, double humidity) ISO-9613 p1double[]get the atmospheric attenuation coefficient in dB/km at the nominal centre frequency for each frequency band, in accordance with ISO 9613-1.static double[]getAtmoCoeffArray(List<Double> freq_lvl, double temperature, double pressure, double humidity) doublestatic doublegetCoefAttAtmos(double frequency, double humidity, double pressure, double T_kel) Compute AAtmstatic doublegetCoefAttAtmosCnossos(double freq, double humidity, double pressure, double T_kel) static doublegetCoefAttAtmosSpps(double frequency, double humidity, double pressure, double tempKelvin) This function calculates the atmospheric attenuation coefficient of sound in air ISO 9613-1:1993(F)doubledoubledoublestatic intgetRoseIndex(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:static intgetRoseIndex(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):doubledouble[]protected voidinit()booleanisgDisc()booleanstatic voidreadFromDatabase(ResultSet rs, Map<String, AttenuationParameters> cnossosParametersPerPeriod) Reads attenuation parameters from a database ResultSet and populates a map with these parameters for different periods.voidsetDefaultOccurrence(double defaultOccurrence) voidsetFrequencies(List<Integer> freq_lvl) voidsetgDisc(boolean gDisc) setGDisc(boolean gDisc) setHumidity(double humidity) Set relative humidity in percentage.setPressure(double pressure) setPrime2520(boolean prime2520) setTemperature(double temperature) voidsetWindRose(double[] windRose) voidwriteToDatabase(Connection connection, String tableName, String period) Writes the attenuation parameters to an H2 database table.
-
Field Details
-
K_0
public static final double K_0- See Also:
-
Pref
public static final double Pref- See Also:
-
Kref
public static final double Kref- See Also:
-
FmolO
public static final double FmolO- See Also:
-
FmolN
public static final double FmolN- See Also:
-
KvibO
public static final double KvibO- See Also:
-
KvibN
public static final double KvibN- See Also:
-
K01
public static final double K01- See Also:
-
a8
public static final double a8 -
freq_lvl
Frequency bands values, by third octave -
freq_lvl_exact
-
freq_lvl_a_weighting
-
DEFAULT_WIND_ROSE
public static final double[] DEFAULT_WIND_ROSE -
temperature
public double temperatureTemperature in celsius -
celerity
public double celerityRepresents 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 humidityRepresents 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 pressureStandard atmosphere atm (Pa) -
alpha_atmo
public double[] alpha_atmo -
defaultOccurrence
public double defaultOccurrence -
gDisc
public boolean gDisc -
prime2520
public boolean prime2520 -
windRose
public double[] windRoseprobability occurrence favourable condition
-
-
Constructor Details
-
AttenuationParameters
public AttenuationParameters() -
AttenuationParameters
public AttenuationParameters(boolean thirdOctave) -
AttenuationParameters
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 namesfreq_lvl_exact- Exact frequency values for computationsfreq_lvl_a_weighting- A weighting values
-
-
Method Details
-
init
protected void init() -
getFrequencies
-
setFrequencies
-
getFrequenciesExact
-
getFrequenciesAWeighting
-
setHumidity
Set relative humidity in percentage.- Parameters:
humidity- relative humidity in percentage. 0-100
-
setPressure
-
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) -
getDefaultOccurrence
public double getDefaultOccurrence()- Returns:
- Default favourable probability (0-1)
-
setDefaultOccurrence
public void setDefaultOccurrence(double defaultOccurrence) - Parameters:
defaultOccurrence- Default favourable probability (0-1)
-
setGDisc
-
setPrime2520
-
setTemperature
- Parameters:
temperature- Temperature in ° celsius
-
getAtmoCoeffArray
-
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 pascalT_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 pascalT_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 celsiuspressure- 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 instancetableName- the name of the table in the databaseperiod- 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 SQLExceptionReads 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 parameterscnossosParametersPerPeriod- 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
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
-