Tutorial - Zudokakikuto/OreCZML GitHub Wiki

Tutorial

A CZML file is a subset of JSON files. Hence, a CZML file contains only one array of a JSON file. Objects inside the CZML are nammed packet, all the objects we will use are in fact packets.

Before doing anything else, we will need to build the file, it is built with a path where the file will be created.

CzmlFile file = new CzmlFile(output);

Objects that can be added :

Now let's presents all the objects that can be added to the file, they are primary objects :

The Header

Doc here

The header describes the entire scene and the time the simulation will lasts. It is absolutly mandatory that the header is the first object created while writing in the CZML file.

Satellite

Doc here

The satellite object will create a satellite and its path. The path will be computed with a propagation for the duration of the scene. (A propagator can create the header in order to setup the propagation parameters before).

Ground Station

Doc here

The ground station object will create and display a ground station at the surface of the earth.

Visibility Cone

Doc here

The visibility cone is an object that can be build in order to create a Line Of Visibility of to display what the station sees. It can be created only with a station then it will not be bounded to a specific satellite. Or it can be created with a satellite and the visiblity cone will have the height of the satellite.

Line of visibility

Doc here

The line of visibility is a line that will be displayed only when a satellite is visible in the local sky of a ground station.

Constellation

Doc here

The constellation object creates several Satellites at the same time in order to build a constellation with the number of satellites given and orbital planes given.

Attitude Pointing

Doc here

The attitude pointing object aims at drawing a line that represents the projection of the attitude of a satellite in the ground. This way the user that see where the satellite is pointing at the earth, and can even display the path of this pointing.

Covariance Display

Doc here

The covariance display object aims at displaying the covariance of an object in time. It will be centered on the object and will be propagated in time for the simulation.

Field Of Observation

Doc here

The field of observation aims at displaying what does exactly see a satellite that observe the earth. It uses the field of view object from Orekit for the display.

Ground Track

Doc here

The ground track, aims at displaying the projection of an orbit to the surface of the body. This helps understanding how orbits evolve in time.

Satellite Reference System

Doc here

The satellite reference system aims at display a reference system in the local orbital frame of a satellite.

Central Body Reference System

Doc here

The central body reference system displays a reference system fixed on the body used as a central one for the simulation.

Abstract Point On Body

Doc here

The abstract point on body aims at creating a virtual object on earth in time, to use it as a reference to build other objects.

Functions to use

When those objects are created we can now add them to the file with :

file.addObject(objectToAdd);

Be aware that whenever a primary object is created, some functions are available to be used before adding them to the file.

When all the objects are added, we can finally write the czml file with :

file.write();

Usage

Here is an example of what a classic OreCZML call can look like :

// Paths
final String root = System.getProperty("user.dir").replace("\\", "/");
final String outputPath = root + "/Output";
final String outputName = "Output.czml";
final String output = outputPath + "/" + outputName;

// File created
final CzmlFile file = new CzmlFile(output);

// Creation of the clock
final TimeScale UTC = TimeScalesFactory.getUTC();
final double durationOfSimulation = 5 * 3600; // in seconds;
final double stepBetweenEachInstant = 60.0; // in seconds
final AbsoluteDate startDate = new AbsoluteDate(2024, 3, 15, 0, 0, 0.0, UTC);
final AbsoluteDate finalDate = startDate.shiftedBy(durationOfSimulation);
final Clock clock = new Clock(startDate, finalDate, UTC, stepBetweenEachInstant);

// Creation of the header
final Header header = new Header("Low Earth Orbit Tutorial", clock);
file.addObject(header);

// Build of the LEO orbit
final Frame EME2000 = FramesFactory.getEME2000();
final KeplerianOrbit initialOrbit = new KeplerianOrbit(7878000, 0, FastMath.toRadians(10), 0, FastMath.toRadians(90), FastMath.toRadians(0), PositionAngleType.MEAN, EME2000, startDate, Constants.WGS84_EARTH_MU);

// Build the LEO Satellite
final Satellite leoSatellite = new Satellite(initialOrbit);
file.addObject(leoSatellite);

// Write inside the CzmlFile the objects
file.write();