//! Convert to ECI /*! * \param double SidrealTime * \return point3D ECI-Position vector of the Coordinate */ public Structs.point3D toECI(double siderealTime) { double srt = siderealTime; double lat_rad = Constants.toRadians * latetude; Structs.point3D eciPos = new Structs.point3D(); double c = 1.0 / Math.Sqrt(1.0 + f * (f - 2.0) * (Math.Sin(lat_rad) * Math.Sin(lat_rad))); double s = (1.0 - f) * (1.0 - f) * c; eciPos.x = a_Wgs72 * c * Math.Cos(lat_rad) * Math.Cos(srt); eciPos.y = a_Wgs72 * c * Math.Cos(lat_rad) * Math.Sin(srt); eciPos.z = a_Wgs72 * s * Math.Sin(lat_rad); return(eciPos); }
//! Calculate ContactWindows for satellite and groundstations /*! * \param Station to calcuate if satellite is in View * \param TimeDate start time * \param List<Sgp4Data> satellite position vector * \param string name of the satellite * \param double tick in witch time is increased by each step * \return List<contactWindow> */ public void calcContactWindows() { One_Sgp4.EpochTime starttime = new One_Sgp4.EpochTime(_time); bool visible = false; ContactWindow window = null; double minElevation = _station.getMinElevation(); for (int i = 0; i < _satPosData.Count(); i++) { double lsr = starttime.getLocalSiderealTime(_station.getLongitude()); Structs.point3D groundLocation = _station.getEci(lsr); Structs.point3D v = new Structs.point3D(); v.x = _satPosData[i].getX() - groundLocation.x; v.y = _satPosData[i].getY() - groundLocation.y; v.z = _satPosData[i].getZ() - groundLocation.z; double r_lat = _station.getLatitude() * Constants.toRadians; double sin_lat = Math.Sin(r_lat); double cos_lat = Math.Cos(r_lat); double sin_srt = Math.Sin(lsr); double cos_srt = Math.Cos(lsr); double rs = sin_lat * cos_srt * v.x + sin_lat * sin_srt * v.y - cos_lat * v.z; double re = -sin_srt * v.x + cos_srt * v.y; double rz = cos_lat * cos_srt * v.x + cos_lat * sin_srt * v.y + sin_lat * v.z; double range = Math.Sqrt(rs * rs + re * re + rz * rz); double elevation = Math.Asin(rz / range); double azimuth = Math.Atan(-re / rs); if (rs > 0.0) { azimuth += Constants.pi; } if (azimuth < 0.0) { azimuth += Constants.twoPi; } if (elevation >= minElevation) { if (visible == false) { window = new ContactWindow(_satName, _station.getName()); window.setStartTime(starttime); } TrackingData testTrack = new TrackingData(azimuth, elevation, range, starttime.ToString()); window.addTrackingData(testTrack); visible = true; } else { if (visible == true) { window.setStopTime(starttime); results.Add(window); } visible = false; } azimuth = azimuth * Constants.toDegrees; starttime.addTick(_tick); } }