Crate cggtts

source ·
Expand description

CGGTTS

Rust library to parse and generate CGGTTS data.

crates.io Rust crates.io crates.io

CGGTTS is a file format to describe a local clock behavior against a single or the combination of clocks embedded in Satellite Vehicles (SV).
Exchanging CGGTTS files enables so called “Common View” Time Transfer.

CGGTTS is specified by the Bureau International des Poids & des Mesures (BIPM): CGGTTS 2E specifications

This library only supports revision 2E, and will reject other revisions.

Getting started

Add “cggtts” to your Cargo.toml

cggtts = "4"

Use CGGTTS to parse local files

use cggtts::prelude::CGGTTS;

let cggtts = CGGTTS::from_file("../data/dual/GZGTR560.258");
assert!(cggtts.is_ok());

let cggtts = cggtts.unwrap();
assert_eq!(cggtts.station, "LAB");
assert_eq!(cggtts.tracks.len(), 2097);

CGGTTS is the core structure, it comprises the list of tracks (measurements) and some header information.

use cggtts::CGGTTS;
fn main() {
    let cggtts = CGGTTS::from_file("../data/single/GZSY8259.506")
        .unwrap();
    assert_eq!(cggtts.station, "SY82");
    assert_eq!(cggtts.follows_bipm_specs(), true);
    if let Some(track) = cggtts.tracks.first() {
        let duration = track.duration;
        let (refsys, srsys) = (track.data.refsys, track.data.srsys);
        assert_eq!(track.has_ionospheric_data(), false);
        assert_eq!(track.follows_bipm_specs(), true);
    }
}

Advanced CGGTTS

Comes with ionospheric parameters estimates

 use cggtts::CGGTTS;
 fn main() {
     let cggtts = CGGTTS::from_file("../data/dual/RZSY8257.000")
         .unwrap();
     if let Some(track) = cggtts.tracks.first() {
         assert_eq!(track.has_ionospheric_data(), true);
         if let Some(iono) = track.iono {
             let (msio, smsi, isg) = (iono.msio, iono.smsi, iono.isg);
         }
     }
 }

CGGTTS production

Use to_string to dump CGGTTS data

use gnss_rs as gnss;
use cggtts::prelude::*;
use cggtts::Coordinates;
use cggtts::track::Track;
use gnss::prelude::{Constellation, SV};
use std::io::Write;
fn main() {
    let rcvr = Rcvr::default()
        .manufacturer("SEPTENTRIO")  
        .receiver("POLARRx5")
        .serial_number("#12345")
        .year(2023)
        .release("v1");

    let mut cggtts = CGGTTS::default()
        .station("AJACFR")
        .receiver(rcvr)
        .apc_coordinates(Coordinates {
            x: 0.0_f64,
            y: 0.0_f64,
            z: 0.0_f64,
        })
        .reference_time(ReferenceTime::UTCk("LAB".to_string()))
        .reference_frame("ITRF");
        
    // add some tracks

    // TrackData is mandatory
    let data = TrackData {
        refsv: 0.0_f64,
        srsv: 0.0_f64,
        refsys: 0.0_f64,
        srsys: 0.0_f64,
        dsg: 0.0_f64,
        ioe: 0_u16,
        smdt: 0.0_f64,
        mdtr: 0.0_f64,
        mdio: 0.0_f64,
        smdi: 0.0_f64,
    };

    // tracking parameters
    let epoch = Epoch::default();
    let sv = SV::default();
    let (elevation, azimuth) = (0.0_f64, 0.0_f64);
    let duration = Duration::from_seconds(780.0);

    // receiver channel being used
    let rcvr_channel = 0_u8;

    // option 1: track resulting from a single SV observation
    let track = Track::new(
        sv,
        epoch,
        duration,
        CommonViewClass::SingleChannel,
        elevation,
        azimuth,
        data,
        None,
        rcvr_channel,
        "L1C",
    );
    cggtts.tracks.push(track);
    let mut fd = std::fs::File::create("test.txt") // does not respect naming conventions
        .unwrap();
    write!(fd, "{}", cggtts).unwrap();
}

To produced advanced CGGTTS data correctly, one should specify / provide

  • secondary hardware info [IMS]
  • ionospheric parameter estimates
  • specify carrier dependent delays [see Delay]

Modules

Structs

  • CGGTTS structure to store a list of comparison, between a local clock and a reference time. Common view time transfer is then achieved by exchanging CGGTTS data between two remote sites that used the same reference time.

Enums

Constants