Class AttenuationParameters
- java.lang.Object
-
- org.noise_planet.noisemodelling.propagation.AttenuationParameters
-
public class AttenuationParameters extends Object
Data input for a propagation Path process.- Author:
- Pierre Aumond
-
-
Field Summary
Fields Modifier and Type Field Description static double
a8
double[]
alpha_atmo
double
celerity
Represents the default speed of sound in air under standard conditions, measured in meters per second.static double[]
DEFAULT_WIND_ROSE
double
defaultOccurance
static double
FmolN
static double
FmolO
protected List<Integer>
freq_lvl
Frequency bands values, by third octaveprotected List<Double>
freq_lvl_a_weighting
protected List<Double>
freq_lvl_exact
boolean
gDisc
double
humidity
Represents the relative humidity in percentage, ranging from 0 to 100.static double
K_0
static double
K01
static double
Kref
static double
KvibN
static double
KvibO
static double
Pref
double
pressure
Standard atmosphere atm (Pa)boolean
prime2520
double
temperature
Temperature in celsiusdouble[]
windRose
probability occurrence favourable condition
-
Constructor Summary
Constructors Constructor Description AttenuationParameters()
AttenuationParameters(boolean thirdOctave)
AttenuationParameters(List<Integer> freq_lvl, List<Double> freq_lvl_exact, List<Double> freq_lvl_a_weighting)
AttenuationParameters(AttenuationParameters other)
Copy constructor
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static double[]
convertSqlArrayToDoubleArray(Array array)
Converts a java.sql.Array to a double[] array.static double
getAlpha(double frequency, double temperature, double pressure, double humidity)
ISO-9613 p1double[]
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.static double[]
getAtmoCoeffArray(List<Double> freq_lvl, double temperature, double pressure, double humidity)
double
getCelerity()
static double
getCoefAttAtmos(double frequency, double humidity, double pressure, double T_kel)
Compute AAtmstatic double
getCoefAttAtmosCnossos(double freq, double humidity, double pressure, double T_kel)
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)double
getDefaultOccurance()
List<Integer>
getFrequencies()
List<Double>
getFrequenciesAWeighting()
List<Double>
getFrequenciesExact()
double
getHumidity()
double
getPressure()
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: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):double
getTemperature()
double[]
getWindRose()
protected void
init()
boolean
isgDisc()
boolean
isPrime2520()
static void
readFromDatabase(ResultSet rs, Map<String,AttenuationParameters> cnossosParametersPerPeriod)
Reads attenuation parameters from a database ResultSet and populates a map with these parameters for different periods.void
setDefaultOccurance(double defaultOccurance)
void
setFrequencies(List<Integer> freq_lvl)
void
setgDisc(boolean gDisc)
AttenuationParameters
setGDisc(boolean gDisc)
AttenuationParameters
setHumidity(double humidity)
Set relative humidity in percentage.AttenuationParameters
setPressure(double pressure)
AttenuationParameters
setPrime2520(boolean prime2520)
AttenuationParameters
setTemperature(double temperature)
void
setWindRose(double[] windRose)
void
writeToDatabase(Connection connection, String tableName, String period)
Writes the attenuation parameters to an H2 database table.
-
-
-
Field Detail
-
K_0
public static final double K_0
- See Also:
- Constant Field Values
-
Pref
public static final double Pref
- See Also:
- Constant Field Values
-
Kref
public static final double Kref
- See Also:
- Constant Field Values
-
FmolO
public static final double FmolO
- See Also:
- Constant Field Values
-
FmolN
public static final double FmolN
- See Also:
- Constant Field Values
-
KvibO
public static final double KvibO
- See Also:
- Constant Field Values
-
KvibN
public static final double KvibN
- See Also:
- Constant Field Values
-
K01
public static final double K01
- See Also:
- Constant Field Values
-
a8
public static final double a8
-
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
-
-
-
Method Detail
-
init
protected void init()
-
setHumidity
public AttenuationParameters setHumidity(double humidity)
Set relative humidity in percentage.- Parameters:
humidity
- relative humidity in percentage. 0-100
-
setPressure
public AttenuationParameters setPressure(double pressure)
-
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)
-
setGDisc
public AttenuationParameters setGDisc(boolean gDisc)
-
setPrime2520
public AttenuationParameters setPrime2520(boolean prime2520)
-
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 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 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 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
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
-
-