Beispiel #1
0
      // Function implementing the derivative of GLONASS orbital model.
   Vector<double> GloEphemeris::derivative( const Vector<double>& inState,
                                            const Vector<double>& accel )
      const
   {

         // We will need some important PZ90 ellipsoid values
      PZ90Ellipsoid pz90;
      const double j20( pz90.j20() );
      const double mu( pz90.gm_km() );
      const double ae( pz90.a_km() );

         // Let's start getting the current satellite position and velocity
      double  x( inState(0) );          // X coordinate
      double vx( inState(1) );          // X velocity
      double  y( inState(2) );          // Y coordinate
      double vy( inState(3) );          // Y velocity
      double  z( inState(4) );          // Z coordinate
      double vz( inState(5) );          // Z velocity
#pragma unused(vx,vy,vz)

      double r2( x*x + y*y + z*z );
      double r( std::sqrt(r2) );
      double xmu( mu/r2 );
      double rho( ae/r );
      double xr( x/r );
      double yr( y/r );
      double zr( z/r );
      double zr2( zr*zr );
      double k1(j20*xmu*1.5*rho*rho);
      double  cm( k1*(1.0-5.0*zr2) );
      double cmz( k1*(3.0-5.0*zr2) );
      double k2(cm-xmu);

      double gloAx( k2*xr + accel(0) );
      double gloAy( k2*yr + accel(1) );
      double gloAz( (cmz-xmu)*zr + accel(2) );

      Vector<double> dxt(6, 0.0);

         // Let's insert data related to X coordinates
      dxt(0) = inState(1);       // Set X'  = Vx
      dxt(1) = gloAx;            // Set Vx' = gloAx

         // Let's insert data related to Y coordinates
      dxt(2) = inState(3);       // Set Y'  = Vy
      dxt(3) = gloAy;            // Set Vy' = gloAy

         // Let's insert data related to Z coordinates
      dxt(4) = inState(5);       // Set Z'  = Vz
      dxt(5) = gloAz;            // Set Vz' = gloAz

      return dxt;

   }  // End of method 'GloEphemeris::derivative()'
Beispiel #2
0
int main(int argc, char **argv) {
  // (A) ==== Read in command-line options: ==== //
  if (argc < 2) {
    fprintf(stderr,"usage: %s [-f <Input data file>] [-model <model type>] [-gapfile <file with concentration dilution steps.] [-mfile <file with model parameters>] [-pfile <file with priors>] [-n <number of nested objects>] [-max <max number of nesting iterations>] [-mc <number of MCMC trials for finding a new object>] [-D <size of unweighted posterior sample>] [-out <file with unweighted posterior sample>] [-rs <random seed>] \n",argv[0]);
    exit(1);
  }
  int argbase = 1;
  Options *opt = ReadArguments(argbase, argc, argv);
  
  // (B) ==== Read in data and model parameters from files ==== //
  DATAtable dt(opt->file);
  DELTAtable dxt(opt->gapfile);
  Mtable mt(opt->mfile);
  Ptable pt(opt->pfile);
 
  // (C) ==== Carry out nested sampling ==== //
  Nested nst(dt, dxt, mt, pt, opt->model, opt->n, opt->max, opt->mc, opt->rs);
  nst.Results(dt, dxt);
  if (opt->outfile != "none") {
    nst.MCPosterior(dt, dxt, opt->D, opt->outfile, "adaptive"); // adaptive/fixed
  }
  
}