Class AltBeaconUtils
Considered that radio signal propagation follows equation: Pr = Pt * k / d^n, where: - Pr is received signal strength (expressed in mW), - Pt is transmitted signal strength (expressed in mW), - k is equal to k = c / (4 * pi * f), where: - c is speed of light (which is approximately 9*10^8 m/s) - f is the radio link frequency used by the beacon.
Hence, considering: ratio = Pr / Pt
which is equal to: ratio = k / d^n
And isolating d, whe obtain that: d^n = k / ratio
d = (k / ratio)^(1/n) d = k^(1/n)*ratio^(-1/n)
And thus we can see from this last expression that: coefficient1 = k^(1/n) = (c / (4 * pi * f))^(1/n) coefficient2 = -1/n, where n is the path loss exponent and depends on the environment where the device is used (typically on free space n is equal to 2.0, but can usually range from 1.6 to 1.8 on indoor environments) coefficient3 is a bias term calibrated for each device.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final doubleSpeed of light expressed in meters per second (m/s). -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateConstructor to prevent instantiation of utility class. -
Method Summary
Modifier and TypeMethodDescriptionstatic doublegetCoefficient1(double k, double pathLossExponent) Gets AltBeacon's 1st coefficient.static doublegetCoefficient1WithFrequency(double frequency, double pathLossExponent) Gets AltBeacon's 1st coefficient.static doublegetCoefficient2(double pathLossExponent) Gets AltBeacon's 2nd coefficient.static doublegetDistance(double coefficient1, double coefficient2, double coefficient3, double ratio) Gets distance using AltBeacon's coefficients.static doublegetDistance(double coefficient1, double coefficient2, double coefficient3, double receivedPower, double transmittedPower) Gets distance using AltBeacon's coefficients.static doublegetFrequency(double k) Gets frequency from k value.static doublegetFrequency(double coefficient1, double coefficient2) Gets frequency using AltBeacon's coefficients.static doublegetK(double frequency) Gets k value using provided frequency.static doublegetK(double coefficient1, double coefficient2) Gets k value using AltBeacon's coefficients.static doublegetPathLossExponent(double coefficient2) Gets path loss exponent using AltBeacon's coefficient.static doublegetRatio(double receivedPower, double transmittedPower) Gets power ratio between received power and transmitted power.static doublegetRatio(double coefficient1, double coefficient2, double coefficient3, double distance) Gets power ratio between received power and transmitted power using AltBeacon's coefficients.static doublegetReceivedPower(double ratio, double transmittedPower) Gets received power.static doublegetReceivedPower(double coefficient1, double coefficient2, double coefficient3, double distance, double transmittedPower) Gets received power using AltBeacon's coefficients.static doublegetTransmittedPower(double ratio, double receivedPower) Gets transmitted power.static doublegetTransmittedPower(double coefficient1, double coefficient2, double coefficient3, double distance, double receivedPower) Gets transmitted power using AltBeacon's coefficients.
-
Field Details
-
SPEED_OF_LIGHT
public static final double SPEED_OF_LIGHTSpeed of light expressed in meters per second (m/s).- See Also:
-
-
Constructor Details
-
AltBeaconUtils
private AltBeaconUtils()Constructor to prevent instantiation of utility class.
-
-
Method Details
-
getK
public static double getK(double frequency) Gets k value using provided frequency. K is defined as k = c / (4 * pi * f), where: - c is the speed of light expressed in m/s. - f is the frequency expressed in Hz.- Parameters:
frequency- a frequency (expressed in Hz).- Returns:
- k value.
-
getK
public static double getK(double coefficient1, double coefficient2) Gets k value using AltBeacon's coefficients.- Parameters:
coefficient1- 1st coefficient.coefficient2- 2nd coefficient.- Returns:
- k value.
-
getFrequency
public static double getFrequency(double k) Gets frequency from k value.- Parameters:
k- k value.- Returns:
- frequency expressed in Hz.
-
getFrequency
public static double getFrequency(double coefficient1, double coefficient2) Gets frequency using AltBeacon's coefficients.- Parameters:
coefficient1- 1st coefficient.coefficient2- 2nd coefficient.- Returns:
- frequency expressed in Hz.
-
getPathLossExponent
public static double getPathLossExponent(double coefficient2) Gets path loss exponent using AltBeacon's coefficient.- Parameters:
coefficient2- 2nd coefficient.- Returns:
- path loss exponent.
-
getDistance
public static double getDistance(double coefficient1, double coefficient2, double coefficient3, double ratio) Gets distance using AltBeacon's coefficients.- Parameters:
coefficient1- 1st coefficient.coefficient2- 2nd coefficient.coefficient3- 3rd coefficient.ratio- ratio between received power and transmitted power.- Returns:
- distance expressed in meters.
-
getDistance
public static double getDistance(double coefficient1, double coefficient2, double coefficient3, double receivedPower, double transmittedPower) Gets distance using AltBeacon's coefficients.- Parameters:
coefficient1- 1st coefficient.coefficient2- 2nd coefficient.coefficient3- 3rd coefficient.receivedPower- received power (expressed in mW).transmittedPower- transmitted power (expressed in mW).- Returns:
- distance expressed in meters.
-
getRatio
public static double getRatio(double coefficient1, double coefficient2, double coefficient3, double distance) Gets power ratio between received power and transmitted power using AltBeacon's coefficients.- Parameters:
coefficient1- 1st coefficient.coefficient2- 2nd coefficient.coefficient3- 3rd coefficient.distance- distance expressed in meters.- Returns:
- power ratio.
-
getRatio
public static double getRatio(double receivedPower, double transmittedPower) Gets power ratio between received power and transmitted power.- Parameters:
receivedPower- received power (expressed in mW).transmittedPower- transmitted power (expressed in mW).- Returns:
- power ratio.
-
getReceivedPower
public static double getReceivedPower(double ratio, double transmittedPower) Gets received power.- Parameters:
ratio- ratio between received power and transmitted power.transmittedPower- transmitted power (expressed in mW).- Returns:
- received power (expressed in mW).
-
getReceivedPower
public static double getReceivedPower(double coefficient1, double coefficient2, double coefficient3, double distance, double transmittedPower) Gets received power using AltBeacon's coefficients.- Parameters:
coefficient1- 1st coefficient.coefficient2- 2nd coefficient.coefficient3- 3rd coefficient.distance- distance expressed in meters.transmittedPower- transmitted power expressed in mW.- Returns:
- received power expressed in mW.
-
getTransmittedPower
public static double getTransmittedPower(double ratio, double receivedPower) Gets transmitted power.- Parameters:
ratio- ratio between received power and transmitted power.receivedPower- received power expressed in mW.- Returns:
- transmitted power expressed in mW.
-
getTransmittedPower
public static double getTransmittedPower(double coefficient1, double coefficient2, double coefficient3, double distance, double receivedPower) Gets transmitted power using AltBeacon's coefficients.- Parameters:
coefficient1- 1st coefficient.coefficient2- 2nd coefficient.coefficient3- 3rd coefficient.distance- distance expressed in meters.receivedPower- received power expressed in mW.- Returns:
- transmitted power expressed in mW.
-
getCoefficient1
public static double getCoefficient1(double k, double pathLossExponent) Gets AltBeacon's 1st coefficient.- Parameters:
k- k value.pathLossExponent- path loss exponent.- Returns:
- AltBeacon's 1st coefficient.
-
getCoefficient1WithFrequency
public static double getCoefficient1WithFrequency(double frequency, double pathLossExponent) Gets AltBeacon's 1st coefficient.- Parameters:
frequency- frequency expressed in Hz.pathLossExponent- path loss exponent.- Returns:
- AltBeacon's 1st coefficient.
-
getCoefficient2
public static double getCoefficient2(double pathLossExponent) Gets AltBeacon's 2nd coefficient.- Parameters:
pathLossExponent- path loss exponent.- Returns:
- AltBeacon's 2nd coefficient.
-