Satellite: Difference between revisions

From Maria GDK Wiki
Jump to navigation Jump to search
()
()
Line 33: Line 33:
A satellite object consists of two draw objects; a satellite position object of type symbol and a satellite trajectory object of type line. Both object types are not required, but are usually used. The position shows where the actual satellite is at the given time. The trajectory shows where the satellite has been in the past and will be in the future.
A satellite object consists of two draw objects; a satellite position object of type symbol and a satellite trajectory object of type line. Both object types are not required, but are usually used. The position shows where the actual satellite is at the given time. The trajectory shows where the satellite has been in the past and will be in the future.


www.space-track.org
https://www.space-track.org


https://in-the-sky.org/satmap_worldmap.php
https://in-the-sky.org/satmap_worldmap.php

Revision as of 17:57, 13 January 2022

The GDK layer "Satellite" defined in the namespace TPG.GeoFramework.SatelliteLayer handles satellites, they can therefore easily be separated from other draw types. Satellite objects in this layer are controlled using the TPG.GeoFramework.SatelliteLayer.SatelliteLayerViewModel class.

The TLE string

A satellite position and its trajectory is computed from a TLE string. The format of the TLE is described in https://www.space-track.org/documentation#/tle. The TLE for a satellite can for example be acquired from www.space-track.org using the TPG.Satellite.Implementation.SatelliteUtil.GetSpaceTrack method. The content of the TLE will be unique for each satellite and is also adjusted through time to give as accurate position computations as possible.

//Example of TLE text used in tests
public static string TestTle()
{
    var tle = "0 ISS (ZARYA)";
    tle += "\n1 25544U 98067A   20227.03014521  .00002523  00000-0  53627-4 0  9998";
    tle += "\n2 25544  51.6461  62.1977 0001435  30.4470 104.2862 15.49164713240985";
    return tle;
}

Convert time to satellite position

The mathematics to convert time to position based on the TLE is done with an external library. Currently the conversion is supported by two different libraries. The functionality is available through the facades TPG.Data.Satellite.Interface.ISatelliteData and TPG.Data.Satellite.Interface.ISatelliteTle. This is done so that adding new libraries can be done without affecting the satellite code.


These libraries are currently supported (free):

The OneSgp4GdkTle library

https://www.nuget.org/packages/One_Sgp4 https://github.com/1manprojects/one_Sgp4

The SgpDotNeTle library

https://www.nuget.org/packages/SGP.NET/ https://github.com/parzivail/SGP.NET

In addition the library http://www.zeptomoby.com/satellites/ might be of interest in the future. This library has a very extensive functionality, but has not been added since it has a very high license cost.

What is a satellite?

A satellite object consists of two draw objects; a satellite position object of type symbol and a satellite trajectory object of type line. Both object types are not required, but are usually used. The position shows where the actual satellite is at the given time. The trajectory shows where the satellite has been in the past and will be in the future.

https://www.space-track.org

https://in-the-sky.org/satmap_worldmap.php

https://www.n2yo.com

https://www.phiphase.com

https://www.phiphase.com/wp-content/uploads/2021/10/satellite_coverage-1.pdf

http://www.celestrak.com

https://www.researchgate.net/figure/Conceptual-Earth-model-for-calculating-Azimuth-angle-i-i14-and-Elevation-angle-i_fig3_343181019

Satellite implementation

The Satellite class implements the actual satellite and has dedicated interfaces for different satellite functionality.

public class Satellite : ISatellite, ISatelliteTime, ISatelliteDevice, ISatelliteFootprints, ISatelliteLineOfSight, ISatelliteTimeTicks
{
.
.
}

ISatellite class

Properties for basic satellite functionality like position, trajectory, satellite ID, satellite name, visibility.

ISatellite.ISatellitePosition

The satellite position is handled by the ISatellitePosition class. The property ISatellitePosition.Position contains the (Lat,Lon) position, corresponding time for the position, satellite height at the position, and also the possibilit to add additional key,value information for this point.

ISatellite.ISatelliteTrajectory

The satellite trajectory is handled by the ISatelliteTrajectory class. The property ISatellitePosition.Trajectory contains a list of satellite positions which is used to draw the trajectory line. In addition the parameters StartTime and StopTime contains the start and stop time for the trajectory.

ISatelliteTime class

Properties used in time related methods for the satellite object.

ISatelliteDevice class

Properties used in device related computations for satellite object. The most important computation is adjusting the trajectory's start and stop time so that the trajectory covers the actual device extent. This class is normally not used externally.

ISatelliteFootprints class

Adds footprints functionality to a satellite. A satellite can have many footprints with different setup where each footprint has a unique ID.

This code adds a footprint to a satellite:

var satellite = satelliteLayerViewModel.GetSatellite(satelliteId) as Satellite;
satellite.AddFootprint(new SatelliteFootprint()
            {
                Id = Guid.NewGuid().ToString(),
                ViewAngle = Footprint,
                CircleLineColor = LineColor,
                HubLineColor = OutlineColor != Colors.Black ? OutlineColor : LineColor,
                HubLineThickness = OutlineColor != Colors.Black && TimerSecs < 50 ? TimerSecs  : new SatelliteFootprint().HubLineThickness,
                CircleLineThickness = LineWidthValue,
                FootprintSettings = FootprintSetting(),
                LabelPlacement = FootprintSetting(),
                TiltAngle = FootprintTiltAngle,
                RotateAngle = FootprintRotateAngle,
                DrawFootprintAsStripe = FootprintAsStripe,
                AccumulateFootprintStripe = AccumulateFootprintStripe,
                StripeFillColor = stripeFillColor,
                StripeLineColor = LineColor,
                StripeFillStyle = FillStyle.Solid

            });

In addition the class contains methods to handle footprints like retrieve and remove footprints.

ISatelliteFootprint class

Defines settings for the footprint used in calculations and rendering.

ISatelliteLineOfSight class

tt

ISatelliteTimeTicks class

tt

How to create satellite objects

The satellite objects are first created and then added to the satellite layer.

Create only a satellite position object

This test code shows how to create a position object:

var satellite = new TPG.GeoFramework.SatelliteLayer.Satellite
{
   Tle = TestTle(),
   MetadataSetting = (long)SatelliteObject.TleMetadata.All,
   RecalculateTrajectoryAlways = FullCurveCalculations
};
Assert.NotNull(satellite);

//calculate the satellite position for this time
var time = new DateTime(2020, 08, 14, 7, 55, 26, DateTimeKind.Utc);
Assert.IsTrue(satellite.CreateSatellite(time));
Assert.AreEqual(1, satellite.Objects.Count);
Assert.IsNotNull(satellite.Objects.First() as ISatellitePosition);

Create a satellite with both position and trajectory objects

This test code shows how to create a complete satellite:

var satellite = new TPG.GeoFramework.SatelliteLayer.Satellite
{
   Tle = TestTle(),
   MetadataSetting = (long)SatelliteObject.TleMetadata.All,
   RecalculateTrajectoryAlways = FullCurveCalculations
};
Assert.NotNull(satellite);

//calculate the satellite position for this time
var time = new DateTime(2020, 08, 14, 7, 55, 26, DateTimeKind.Utc);
//create trajectory 10 minutes before and after position
var span = new TimeSpan(0, 0, 10, 0);
Assert.IsTrue(satellite.CreateSatellite(time, span, span));
Assert.AreEqual(2, satellite.Objects.Count);
Assert.NotNull(satellite.SatellitePosition);
Assert.NotNull(satellite.SatelliteTrajectory);

Add satellites to the satellite layer

This code shows how to add satellites to the satellite layer:

//The satellite layer
SatelliteLayerViewModel _satelliteLayerViewModel = ...

//create satellites, details not shown
var createdSatellites = new List<ISatellite>();
createdSatellites = CreateSatellites();

//prevent refresh while we are adding satellites
_satelliteLayerViewModel.LockRedraw = true;

foreach (var satellite in createdSatellites)         
   _satelliteLayerViewModel.AddSatellite(satellite);

//will refresh rendering
_satelliteLayerViewModel.LockRedraw = false;