Documentation
¶
Index ¶
- Constants
- func CalculateDistance(lat1, lng1, lat2, lng2, radius float64) float64
- func CalculateDistanceLOS(lat1, lng1, alt1, lat2, lng2, alt2 float64) float64
- func CalculateFoliageLoss(freq Frequency, depth Distance) (float64, error)
- func CalculateRaleighFading(freq Frequency) (float64, error)
- func CalculateRicanFading(freq Frequency) (float64, error)
- func CalculateWeibullFading(freq Frequency) (float64, error)
- func DecibelMilliVoltToMilliWatt(dbm float64) float64
- func FreeSpaceAttenuation(freq Frequency, distance Distance) float64
- func FreeSpaceAttenuationDB(freq Frequency, distance Distance) float64
- func FrequencyToWavelength(freq Frequency) float64
- func FresnelFirstZoneMax(freq Frequency, dist Distance) (float64, error)
- func FresnelPoint(d1, d2 Distance, freq Frequency, order int64) (float64, error)
- func MilliWattToDecibelMilliVolt(mw float64) float64
- type Distance
- type Frequency
Constants ¶
const ( //C is the speed of light in air in meters per second C = 2.998e+8 // FresnelObstructionOK is the largest acceptable proportion of fresnel zone impingement FresnelObstructionOK = 0.4 // FresnelObstructionIdeal is the largest ideal proportion of fresnel zone impingement FresnelObstructionIdeal = 0.2 Hz Frequency = 1 KHz = Hz * 1000 MHz = KHz * 1000 GHz = MHz * 1000 M Distance = 1 Km = M * 1000 // R is the (average) radius of the earth R = 6.371e6 )
const FresnelMinDistanceWavelengthRadio = 0.1
FresnelMinDistanceWavelengthRadio is the minimum ratio of distance:wavelength for viable calculations This is used as a programattic sanity check for distance >> wavelength
Variables ¶
This section is empty.
Functions ¶
func CalculateDistance ¶
CalculateDistance calculates the distance between two latitude and longitudes Using the haversine (flat earth) formula See: http://www.movable-type.co.uk/scripts/latlong.html
func CalculateDistanceLOS ¶
CalculateDistanceLOS calculates the approximate Line of Sight distance between two lat/lon/alt points This achieves this by wrapping the haversine formula with a flat-earth approximation for height difference. This will be very inaccurate with larger distances. TODO: surely there is a better (ie. not written by me) algorithm for this
func CalculateFoliageLoss ¶
CalculateFoliageLoss calculates path loss in dB due to foliage based on the Weissberger model https://en.wikipedia.org/wiki/Weissberger%27s_model
func CalculateRaleighFading ¶
func CalculateRicanFading ¶
func CalculateWeibullFading ¶
func DecibelMilliVoltToMilliWatt ¶
DecibelMilliVoltToMilliWatt converts dBm to mW
func FreeSpaceAttenuation ¶
FreeSpaceAttenuation calculates the Free Space Path Loss for a given frequency and distance
func FreeSpaceAttenuationDB ¶
FreeSpaceAttenuationDB calculates the Free Space Path Loss for a given frequency and distance in Decibels
func FrequencyToWavelength ¶
FrequencyToWavelength calculates a wavelength from a frequency
func FresnelFirstZoneMax ¶
FresnelFirstZoneMax calculates the maximum fresnel zone radius for a given frequency
func FresnelPoint ¶
FresnelPoint calculates the fresnel zone radius d for a given wavelength and order at a point P between endpoints
func MilliWattToDecibelMilliVolt ¶
MilliWattToDecibelMilliVolt converts mW to dBm