initl function

Map<String, dynamic> initl(
  1. Map<String, dynamic> options
)

Implementation

Map<String, dynamic> initl(Map<String, dynamic> options) {
  final ecco = options['ecco'];
  final epoch = options['epoch'];
  final inclo = options['inclo'];
  final opsmode = options['opsmode'];
  var no = options['no'];

  // sgp4fix use old way of finding gst
  // ----------------------- earth finalants ---------------------
  // sgp4fix identify finalants and allow alternate values

  // ------------- calculate auxillary epoch quantities ----------
  final eccsq = ecco * ecco;
  final omeosq = 1.0 - eccsq;
  final rteosq = Math.sqrt(omeosq);
  final cosio = Math.cos(inclo);
  final cosio2 = cosio * cosio;

  // ------------------ un-kozai the mean motion -----------------
  final ak = Math.pow((xke / no), x2o3);
  final d1 = (0.75 * j2 * ((3.0 * cosio2) - 1.0)) / (rteosq * omeosq);
  var delPrime = d1 / (ak * ak);
  final adel = ak *
      (1.0 -
          (delPrime * delPrime) -
          (delPrime * ((1.0 / 3.0) + ((134.0 * delPrime * delPrime) / 81.0))));
  delPrime = d1 / (adel * adel);
  no /= (1.0 + delPrime);

  final ao = Math.pow((xke / no), x2o3);
  final sinio = Math.sin(inclo);
  final po = ao * omeosq;
  final con42 = 1.0 - (5.0 * cosio2);
  final con41 = -con42 - cosio2 - cosio2;
  final ainv = 1.0 / ao;
  final posq = po * po;
  final rp = ao * (1.0 - ecco);
  final method = 'n';

  //  sgp4fix modern approach to finding sidereal time
  var gsto;
  if (opsmode == 'a') {
    //  sgp4fix use old way of finding gst
    //  count integer number of days from 0 jan 1970
    final ts70 = epoch - 7305.0;
    final ds70 = (ts70 + 1.0e-8).floor();
    final tfrac = ts70 - ds70;

    //  find greenwich location at epoch
    final c1 = 1.72027916940703639e-2;
    final thgr70 = 1.7321343856509374;
    final fk5r = 5.07551419432269442e-15;
    final c1p2p = c1 + twoPi;
    gsto =
        (thgr70 + (c1 * ds70) + (c1p2p * tfrac) + (ts70 * ts70 * fk5r)) % twoPi;
    if (gsto < 0.0) {
      gsto += twoPi;
    }
  } else {
    gsto = gstime(epoch + 2433281.5);
  }

  return {
    'no': no,
    'method': method,
    'ainv': ainv,
    'ao': ao,
    'con41': con41,
    'con42': con42,
    'cosio': cosio,
    'cosio2': cosio2,
    'eccsq': eccsq,
    'omeosq': omeosq,
    'posq': posq,
    'rp': rp,
    'rteosq': rteosq,
    'sinio': sinio,
    'gsto': gsto,
  };
}