Changes to RadarFragment's satellite data views

This commit is contained in:
Arty Bishop committed 2022-02-22 11:29:49 +00:00
1 parent 6189fb497e
commit 0c71c4db29
10 files changed
+99 -46

No files matched your search

@@ -25,8 +25,8 @@ data class SatPos(
var latitude: Double = 0.0,
var longitude: Double = 0.0,
var altitude: Double = 0.0,
var range: Double = 0.0,
var rangeRate: Double = 0.0,
var distance: Double = 0.0,
var distanceRate: Double = 0.0,
var theta: Double = 0.0,
var time: Long = 0L
) {
@@ -34,11 +34,11 @@ data class SatPos(
private val speedOfLight = 2.99792458E8
fun getDownlinkFreq(freq: Long): Long {
return (freq.toDouble() * (speedOfLight - this.rangeRate * 1000.0) / speedOfLight).toLong()
return (freq.toDouble() * (speedOfLight - distanceRate * 1000.0) / speedOfLight).toLong()
}
fun getUplinkFreq(freq: Long): Long {
return (freq.toDouble() * (speedOfLight + this.rangeRate * 1000.0) / speedOfLight).toLong()
return (freq.toDouble() * (speedOfLight + distanceRate * 1000.0) / speedOfLight).toLong()
}
fun getOrbitalVelocity(): Double {
@@ -50,7 +50,7 @@ data class SatPos(
fun getRangeCircle(): List<GeoPos> {
val positions = mutableListOf<GeoPos>()
val beta = acos(earthRadiusKm / (earthRadiusKm + this.altitude))
val beta = acos(earthRadiusKm / (earthRadiusKm + altitude))
// val radiusKm = earthRadiusKm * acos(earthRadiusKm / (earthRadiusKm + altitude))
var tempAzimuth = 0
while (tempAzimuth < 360) {
@@ -146,8 +146,8 @@ abstract class Satellite(val data: OrbitalData) {
if (azim < 0.0) azim += twoPi
satPos.azimuth = azim
satPos.elevation = asin(topZ / range.w)
satPos.range = range.w
satPos.rangeRate = dot(range, rgvel) / range.w
satPos.distance = range.w
satPos.distanceRate = dot(range, rgvel) / range.w
}
// Returns the ECI position and velocity of the observer