Exemple #1
0
int initglobst(int tipst, int nporst,
               int day,int month,int year,int hour)
{
 double JD;
 char str[80];
 
 for(int ntk=1; ntk<=MAXTK; ntk++)     //????JDsea->0
   initOMR(ntk);
   
 JD=JulianDate(day,month,year);
 if (hour<12) JD-=1;
 JDsea=JD;
 init_reduction(JD+(12-TZ)/24.);

 if (!init_pasp(tipst,nporst)) return 0;

 strcpy(str,kpstpath);
 strcat(str,zktpath);
// strcpy(zktpath,str);
 zktflag=opencat(zkt,str);
 if (!zktflag) {
   printf("Не открыт файл каталога %s\n",zktpath);
 }
// printf("init: %2d.%2d.%4d %f\n",day,month,year,JDsea);
 return 1;
}
      /* Function to convert from UTC to sidereal time
       * @param t         Epoch
       *
       * @return sidereal time in hours.
       */
   double UTC2SID(const CommonTime& t)
   {
      const YDSTime yds(t);

       // Hours of day (decimal)
      double h(yds.sod/3600.0);

         // Compute Julian Day, including decimals
      double jd(static_cast<double>(JulianDate(t).jd));

         // Temporal value, in centuries
      double tt( (jd - 2451545.0)/36525.0 );

      double sid( 24110.54841 + tt*( (8640184.812866) + 
                  tt*( (0.093104) - (6.2e-6*tt)) ) );

      sid = sid/3600.0 + h;
      sid = ::fmod(sid,24.0);

      if (sid < 0.0)
      {
         sid+=24.0;
      }

      return sid;
   }
void SolarSystem<Frame>::Initialize(
    std::experimental::filesystem::path const& gravity_model_filename,
    std::experimental::filesystem::path const& initial_state_filename) {
  // Parse the files.
  std::ifstream gravity_model_ifstream(gravity_model_filename);
  CHECK(gravity_model_ifstream.good());
  google::protobuf::io::IstreamInputStream gravity_model_zcs(
                                               &gravity_model_ifstream);
  CHECK(google::protobuf::TextFormat::Parse(&gravity_model_zcs,
                                            &gravity_model_));
  CHECK(gravity_model_.has_gravity_model());

  std::ifstream initial_state_ifstream(initial_state_filename);
  CHECK(initial_state_ifstream.good());
  google::protobuf::io::IstreamInputStream initial_state_zcs(
                                               &initial_state_ifstream);
  CHECK(google::protobuf::TextFormat::Parse(&initial_state_zcs,
                                            &initial_state_));
  CHECK(initial_state_.has_initial_state());

  // We don't support using a different frame that the one specified by the
  // instance.
  CHECK_EQ(Frame::tag, initial_state_.initial_state().frame());
  CHECK_EQ(Frame::tag, gravity_model_.gravity_model().frame());

  // Store the data in maps keyed by body name.
  for (auto& body : *gravity_model_.mutable_gravity_model()->mutable_body()) {
    auto const inserted =
        gravity_model_map_.insert(std::make_pair(body.name(), &body));
    CHECK(inserted.second);
  }
  for (auto const& body : initial_state_.initial_state().body()) {
    auto const inserted =
        initial_state_map_.insert(std::make_pair(body.name(), &body));
    CHECK(inserted.second);
  }

  // Check that the maps are consistent.
  auto it1 = gravity_model_map_.begin();
  auto it2 = initial_state_map_.begin();
  for (; it1 != gravity_model_map_.end() && it2 != initial_state_map_.end();
       ++it1, ++it2) {
    CHECK_EQ(it1->first, it2->first);
    names_.push_back(it1->first);
  }
  CHECK(it1 == gravity_model_map_.end()) << it1->first;
  CHECK(it2 == initial_state_map_.end()) << it2->first;

  epoch_ = JulianDate(initial_state_.initial_state().epoch());

  // Call these two functions to parse all the data, so that errors are detected
  // at initialization.  Drop their results on the floor.
  MakeAllMassiveBodies();
  MakeAllDegreesOfFreedom();
}
Exemple #4
0
      /* Compute planet position and velocity in J2000
       *  
       * @param TT         Time(Modified Julian Date in TT<TAI+32.184>) of interest 
       * @param entity     The planet to be computed
       * @param center     relative to whick the result apply
       * @return           The position and velocity of the planet in km and km/s
       */
   Vector<double> IERS::planetJ2kPosVel( const CommonTime& TT, 
                                         PlanetEphemeris::Planet entity,
                                         PlanetEphemeris::Planet center )
   {
      Vector<double> rvJ2k(6,0.0);

      try
      {
         double rvState[6] = {0.0};
         int rc = jplEphemeris.computeState(JulianDate(TT).jd,entity, center, rvState);

         // change the unit to km/s from km/day
         rvState[3] /= 86400.0;
         rvState[4] /= 86400.0;
         rvState[5] /= 86400.0;

         if(rc == 0)
         {
            rvJ2k = rvState;
            return rvJ2k*1000.0; // km->m
         }
         else
         {
            rvJ2k.resize(6,0.0);

            // failed to compute
            InvalidRequest e("Failed to compute, error code: "
               +StringUtils::asString(rc)+" with meaning\n"
               +"-1 and -2 given time is out of the file \n"
               +"-3 and -4 input stream is not open or not valid,"
               +" or EOF was found prematurely");

            GPSTK_THROW(e);
         }
      }
      catch(...)
      {
         Exception e("Failed to compute positon and velocity from JPL ephemeris.");
         GPSTK_THROW(e);
      }

      return rvJ2k;
   }
Exemple #5
0
int CivilDateTime::AsJSDDateTime(JSDDateTime* JSDdate)
{
  int etat , k ;
  JulianDate jourJulien;
  double r ;

  etat = AsJulianDate(&jourJulien );
  if (etat == 0)
  {
    k = (int)(jourJulien.get_julianDate() - 0.5) ;

    double day0hTU = (double)k + 0.5;
    JSDdate->set_day0hTU(JulianDate(day0hTU));

    r = (jourJulien.get_julianDate() - day0hTU) * JOURCIVIL_LENGTH ;
    JSDdate->set_second(floor (r)) ;
    JSDdate->set_decimal(r - JSDdate->get_second()) ;
  }

  return etat ;
}
Exemple #6
0
 /// Return the end time of the data
 gpstk::CommonTime endTime(void) const throw(gpstk::Exception)
 { return JulianDate(endJD); }
Exemple #7
0
 /// Return the start time of the data
 gpstk::CommonTime startTime(void) const throw(gpstk::Exception)
 { return JulianDate(startJD); }
bool
TestJulianDate( )
{
    bool ok = true;
    cout << "Testing JulianDate" << endl;

    cout << "JulianDate() [default constructor]" << endl;
    JulianDate julDate;
    TESTCHECK( julDate.Valid( ), true, &ok );
    TESTCHECK( julDate.Day( ), 1, &ok );
    TESTCHECK( julDate.Month( ), 1, &ok );
    TESTCHECK( julDate.Year( ), 1L, &ok );
    TESTCHECK( julDate.JulianDay( ), 1721424L, &ok );
    TESTCHECK( julDate.DayOfWeek( ), 6, &ok );
    TESTCHECK( julDate.ToString( ), string( "Saturday, 1 January 1" ), &ok );
    TESTCHECK( julDate.ToString( "%2W %02d %3M %4y" ),
               string( "Sa 01 Jan    1" ), &ok );

    long jd = 2026872;
    cout << "Set(" << jd << ") :" << endl;
    julDate.Set( jd );
    TESTCHECK( julDate.Valid( ), true, &ok );
    TESTCHECK( julDate.Day( ), 10, &ok );
    TESTCHECK( julDate.Month( ), 4, &ok );
    TESTCHECK( julDate.Year( ), 837L, &ok );
    TESTCHECK( julDate.JulianDay( ), jd, &ok );
    TESTCHECK( julDate.DayOfWeek( ), 2, &ok );
    TESTCHECK( julDate.ToString( ), string( "Tuesday, 10 April 837" ), &ok );
    TESTCHECK( julDate.ToString( "%2W %02d %3M %4y" ),
               string( "Tu 10 Apr  837" ), &ok );
    int incr = 30;
    cout << "Increment(" << incr << ") :" << endl;
    julDate.Increment( incr );
    TESTCHECK( julDate.JulianDay( ), jd + 30, &ok );
    TESTCHECK( julDate.ToString( ), string( "Thursday, 10 May 837" ), &ok );
    incr = 12;
    cout << "Increment( 0, " << incr << ", 0) :" << endl;
    julDate.Increment( 0, incr, 0 );
    TESTCHECK( julDate.ToString( ), string( "Friday, 10 May 838" ), &ok );

    cout << "JulianDate( true ) [today constructor]" << endl;
    JulianDate julToday( true );
    TESTCHECK( julToday.Valid( ), true, &ok );
    cout << "julToday.JulianDay( )=" << julToday.JulianDay( );
    if ( (julToday.JulianDay( ) > 2451545)
         && (julToday.JulianDay( ) < 2500000) ) //test good until 2132
        cout << "\tOK" << endl;
    else
    {
        cout << "\tFAILED" << endl;
        ok = false;
    }
    TESTCHECK( (julDate == julToday), false, &ok );
    TESTCHECK( (julDate < julToday), true, &ok );
    cout << "julToday.ToString()=" << julToday.ToString( ) << endl;

    jd = 1356001;
    cout << "JulianDate( " << jd << " ) [Julian Day constructor]" << endl;
    JulianDate julJD( jd );
    TESTCHECK( julJD.Valid( ), true, &ok );
    TESTCHECK( (julJD == julJD), true, &ok );
    TESTCHECK( (julJD < julDate), true, &ok );
    TESTCHECK( (julJD == julDate), false, &ok );
    TESTCHECK( julJD.ToString( ), string( "Thursday, 12 July -1000" ), &ok );

    int d = 29, m = 2;
    long y = -1000;
    cout << "JulianDate( " << d << ", " << m << ", " << y
         << " ) [D,M,Y constructor]" << endl;
    JulianDate julDMY( d, m, y );
    TESTCHECK( julDMY.Valid( ), true, &ok );
    TESTCHECK( (julDMY < julJD), true, &ok );
    TESTCHECK( (julDMY < julToday), true, &ok );
    TESTCHECK( julDMY.JulianDay( ), 1355867L, &ok );
    TESTCHECK( julDMY.ToString( "%2W %02d %3M %4y" ),
               string( "We 29 Feb -1000" ), &ok );

    jd = 1721423;
    cout << "JulianDate( " << jd << " ) [Julian Day constructor]" << endl;
    JulianDate jul0( jd );
    TESTCHECK( jul0.Valid( ), true, &ok );
    TESTCHECK( (jul0 == jul0), true, &ok );
    TESTCHECK( (jul0 < julDate), true, &ok );
    TESTCHECK( (jul0 == julDate), false, &ok );
    TESTCHECK( jul0.ToString( ), string( "Friday, 31 December 0" ), &ok );

    d = 1; m = 1; y = 0;
    cout << "JulianDate( " << d << ", " << m << ", " << y
         << " ) [D,M,Y constructor]" << endl;
    JulianDate jul110( d, m, y );
    TESTCHECK( jul110.Valid( ), true, &ok );
    TESTCHECK( (jul110 < julJD), false, &ok );
    TESTCHECK( (jul110 < julToday), true, &ok );
    TESTCHECK( jul110.JulianDay( ), 1721058L, &ok );
    TESTCHECK( jul110.ToString( "%2W %02d %3M %4y" ),
               string( "Th 01 Jan    0" ), &ok );

    cout << "JulianDate( jul0 ) [copy constructor]" << endl;
    JulianDate julEq = jul0;
    TESTCHECK( julEq.Valid( ), true, &ok );
    TESTCHECK( (julEq == jul0), true, &ok );
    TESTCHECK( julEq.ToString( ), string( "Friday, 31 December 0" ), &ok );
    cout << "= jul110 [assignment]" << endl;
    julEq = jul110;
    TESTCHECK( julEq.Valid( ), true, &ok );
    TESTCHECK( (julEq == jul0), false, &ok );
    TESTCHECK( (julEq == jul110), true, &ok );
    TESTCHECK( jul110.ToString( "%2W %02d %3M %4y" ),
               string( "Th 01 Jan    0" ), &ok );

    cout << "JulianDate( GregorianDate( 1, 1, 1 ) ) [DateDMY constructor]" << endl;
    JulianDate julGreg( GregorianDate( 1, 1, 1 ) );
    TESTCHECK( julGreg.Valid( ), true, &ok );
    TESTCHECK( julGreg.ToString( ), string( "Monday, 3 January 1" ), &ok );
    cout << "= GregorianDate( 12, 11, 1945 )" << endl;
    julGreg = GregorianDate( 12, 11, 1945 );
    TESTCHECK( julGreg.Valid( ), true, &ok );
    TESTCHECK( julGreg.ToString( ), string( "Monday, 30 October 1945" ), &ok );
    
    cout << "GregorianDate( JulianDate( 3, 1, 1 ) [DateDMY constructor]" << endl;
    GregorianDate gregJul( JulianDate( 3, 1, 1 ) );
    TESTCHECK( gregJul.Valid( ), true, &ok );
    TESTCHECK( gregJul.ToString( ), string( "Monday, 1 January 1" ), &ok );

    struct
    {
        long julianDay;
        int day;
        int month;
        long year;
    } 
    testDates[]
            = {
                { 1507232,  30,  7, -586 },
                { 1660038,   8, 12, -168 },
                { 1746894,  26,  9,   70 },
                { 1770642,   3, 10,  135 },
                { 1892732,   7,  1,  470 },
                { 1931580,  18,  5,  576 },
                { 1974852,   7, 11,  694 },
                { 2091165,  19,  4, 1013 },
                { 2121510,  18,  5, 1096 },
                { 2155780,  16,  3, 1190 },
                { 2174030,   3,  3, 1240 },
                { 2191585,  26,  3, 1288 },
                { 2195262,  20,  4, 1298 },
                { 2229275,   4,  6, 1391 },
                { 2245581,  25,  1, 1436 },
                { 2266101,  31,  3, 1492 },
                { 2288543,   9,  9, 1553 },
                { 2290902,  24,  2, 1560 },
                { 2323141,  31,  5, 1648 },
                { 2334849,  20,  6, 1680 },
                { 2348021,  13,  7, 1716 },
                { 2366979,   8,  6, 1768 },
                { 2385649,  21,  7, 1819 },
                { 2392826,  15,  3, 1839 },
                { 2416224,   6,  4, 1903 },
                { 2425849,  12,  8, 1929 },
                { 2430267,  16,  9, 1941 },
                { 2430834,   6,  4, 1943 },
                { 2431005,  24,  9, 1943 },
                { 2448699,   4,  3, 1992 },
                { 2450139,  12,  2, 1996 },
                { 2465738,  28, 10, 2038 },
                { 2486077,   5,  7, 2094 }
            };

    for ( int i = 0; i < sizeof(testDates)/sizeof(testDates[0]); ++i )
    {
        jd = testDates[i].julianDay;
        d = testDates[i].day;
        m = testDates[i].month;
        y = testDates[i].year;
        cout << "Set( " << d << ", " << m << ", " << y << " ) :" << endl;
        julDate.Set( d, m, y );
        TESTCHECK( julDate.Valid( ), true, &ok );
        TESTCHECK( julDate.JulianDay( ), jd, &ok );
        cout << "Set( " << jd << " ) :" << endl;
        julDate.Set( jd );
        TESTCHECK( julDate.Valid( ), true, &ok );
        TESTCHECK( julDate.Day( ), d, &ok );
        TESTCHECK( julDate.Month( ), m, &ok );
        TESTCHECK( julDate.Year( ), y, &ok );
    }

    if ( ok )
        cout << "JulianDate PASSED." << endl << endl;
    else
        cout << "JulianDate FAILED." << endl << endl;
    return ok;
}
Exemple #9
0
int MakeDatafiles(int argc, char **argv)
{
    if ( argc != 7+2*(atoi(argv[5])) )
    {
      cerr << "\n\n\n";
      cerr << "Usage: " << argv[0] << " <task> [params]\n";
      cerr << "<task>: operation to be performed on data. \n";
      cerr << "        0 - create time-series datafiles\n";
      cerr << "        1 - correlation analysis\n";
      cerr << "        2 - naive prediction\n";
      cerr << "        3 - perceptron prediction\n";
      cerr << "        4 - neural network\n";
      cerr << "<prefix>: I/O prefix\n";
      cerr << "[params]: algorithm specific parameters\n";
      cerr << endl;
      cerr << "create time-series datafiles:\n";
      cerr << "[datafile]: name of file containing data. \n";
      cerr << "[diff]: level of differencing only zero and first level differencing is supported. \n";
      cerr << "[nvar]: number of variables in datafile. \n";
      cerr << "[tgtIdx]: Column of target variable (first column = 0).\n";
      cerr << "[delay1]: delay before starting time-series of first variable\n";
      cerr << "[nlag1]: number of lags to compose the time-series of the first variable from\n";
      cerr << "[delay2]: delay before starting time-series of secon variable\n";
      cerr << "[nlag2]: number of lags to compose the time-series of the second variable from\n";
      cerr << "\n\n\n";
      exit(-1);
    }
    string prefix = argv[2];
    cout << "# I/O prefix: " << prefix << endl;
    //
    string ifile_name = argv[3];
    cout << "# inputfile is: " << ifile_name << endl;
    //
    int diff = atoi(argv[4]);
    cout << "# differencing level is: " << diff << endl;
    if( diff < 0 || diff > 1)
    {
      cerr << "Assert: Invalid level of differencing\n\n";
      exit(-1);
    }
    //
    int nvar = atoi(argv[5]);
    cout << "# nvar is: " << nvar << endl;
    //
    int tgtIdx = atoi(argv[6]);
    cout << "# Target index is: " << tgtIdx << endl;
    if( tgtIdx > nvar-1 )
    {
      cerr << "Assert: Invalid target index\n\n";
      exit(-1);
    }
    //
    vector<int> delay(nvar);
    vector<int> nlags(nvar);
    cout << "# ( delay , lag )\n";
    for(int i=0; i< nvar; i++)
    {
      int argvIdx = 7+2*i;
      delay[i] = atoi(argv[argvIdx]);
      nlags[i] = atoi(argv[argvIdx+1]);
      if( i==tgtIdx && delay[i] <= 0)
      {
        delay[i]==1;
      }
      cout << "# ( " << delay[i] << "," << nlags[i] << " )" << endl;
    }
    int nAtt = 0;
    for( int i=0; i< nvar; i++)
    {
      nAtt += nlags[i];
    }
    //
    cout << "# Reading Data" << endl;
    vector< vector< float > > Examples;
    vector< string > Timestamp;
    ReadData( ifile_name, diff, nvar, tgtIdx, delay, nlags, Examples, Timestamp );
    
    // Divide Examples into Training Set and Testing Set
    int numTrainEx = int( (2.0/3.0)*Examples.size() );
    vector< vector< float > > TrainExamples(numTrainEx);
    vector< string > TrainTimestamp(numTrainEx);
    vector< vector< float > > TestExamples(Examples.size()-numTrainEx);
    vector< string > TestTimestamp(Examples.size()-numTrainEx);
    for(int i=0; i<Examples.size(); i++)
    {
      if(i<numTrainEx)
      {
        TrainTimestamp[i] = Timestamp[i];
        TrainExamples[i] = Examples[i];
      }
      else
      {
        TestTimestamp[i-numTrainEx] = Timestamp[i];
        TestExamples[i-numTrainEx] = Examples[i];
      }
    }
    
    cout << "# Total number of examples: " << Examples.size() << endl;
    cout << "# Number of training examples: " << TrainExamples.size() << endl;
    cout << "# Number of testing examples: " << TestExamples.size() << endl;
    cout << "# Training period: ( " << TrainTimestamp[0] << " , " << TrainTimestamp[TrainTimestamp.size()-1] << " )\n";
    cout << "# Testing period: ( " << TestTimestamp[0] << " , " << TestTimestamp[TestTimestamp.size()-1] << " )\n";
    //
    // create un-normalized training file
    vector< double > TimestampJ;
    JulianDate( TrainTimestamp, TimestampJ );
    //cout << "TrainExamples " << TrainExamples.size() << " " << TrainExamples[0].size() <<endl;
    //cout << "Timestampsize " << TimestampJ.size() << endl;
    string fname = prefix + "-" + "unorm_train.dat";
    ofstream ofile( fname.c_str() );
    ofile << setw(15) << TrainExamples.size() << setw(15) << TrainExamples[0].size() << endl;
    for( int i=0; i<TrainExamples.size(); i++ )
    {
      ofile << setw(15) << fixed << TimestampJ[i] << std::resetiosflags(std::ios::floatfield);
      for( int j=0; j<TrainExamples[0].size(); j++ )
      {
        ofile << setw(15) << TrainExamples[i][j];
      }
      ofile << endl;
    }
    ofile.close();
    //
    // create normalized training file
    vector< vector< float > > normParam;
    NormalizeExamples( 0, TrainExamples, normParam );
    fname = prefix + "-" + "norm_train.dat";
    ofile.open( fname.c_str() );
    //  write # rows, # cols
    ofile << setw(15) << TrainExamples.size() << setw(15) << TrainExamples[0].size() << endl;
    //  write normalization information
    for(int i=0; i<2; i++)
    {
      for(int j=0; j<normParam[i].size(); j++)
      {
        ofile << setw(15) << normParam[i][j];
      }
      ofile << endl;
    }
    // write data
    for( int i=0; i<TrainExamples.size(); i++ )
    {
      ofile << setw(15) << fixed << TimestampJ[i] << std::resetiosflags(std::ios::floatfield);
      for( int j=0; j<TrainExamples[i].size(); j++ )
      {
        ofile << setw(15) << TrainExamples[i][j];
      }
      ofile << endl;
    }
    ofile.close();
    //
    // create un-normalized testing file
    JulianDate( TestTimestamp, TimestampJ );
    fname = prefix + "-" + "unorm_test.dat";
    ofile.open( fname.c_str() );
    ofile << setw(15) << TestExamples.size() << setw(15) << TestExamples[0].size() << endl;
    for( int i=0; i<TestExamples.size(); i++ )
    {
      ofile << setw(15) << fixed << TimestampJ[i] << std::resetiosflags(std::ios::floatfield);
      for( int j=0; j<TestExamples[i].size(); j++ )
      {
        ofile << setw(15) << TestExamples[i][j];
      }
      ofile << endl;
    }
    ofile.close();
    //
    // create normalized testing file
    NormalizeExamples( 1, TestExamples, normParam );
    fname = prefix + "-" + "norm_test.dat";
    ofile.open( fname.c_str() );
    ofile << setw(15) << TestExamples.size() << setw(15) << TestExamples[0].size() << endl;
    for(int i=0; i<2; i++)
    {
      for(int j=0; j<normParam[i].size(); j++)
      {
        ofile << setw(15) << normParam[i][j];
      }
      ofile << endl;
    }
    for( int i=0; i<TestExamples.size(); i++ )
    {
      ofile << setw(15) << fixed << TimestampJ[i] << std::resetiosflags(std::ios::floatfield);
      for( int j=0; j<TestExamples[i].size(); j++ )
      {
        ofile << setw(15) << TestExamples[i][j];
      }
      ofile << endl;
    }
    ofile.close();
}
Exemple #10
0
int read_dumpizm(FILE *f, DUMPIZM &dump)
{
    char str[300];
    int n;
    int Y,M,D, h,m;
    double s;
    double p[25];
    while(1) {
        if (fgets(str,300,f)==NULL) return -1;
        if (memcmp(str,"ST ",3)==0) break;
    }

    n = sscanf(str,"ST %d-%d TK %d", &dump.tipst, &dump.nporst, &dump.ntk);
    if (n<3) return 0;

    if (fgets(str,300,f)==NULL) return 0;
    n = sscanf(str,"%d-%d-%d %d:%d:%lf", &Y,&M,&D, &h,&m,&s);
    if (n<6) return 0;
    dump.jd = JulianDate(D,M,Y);
    dump.time = h*3600+m*60+s;
    if (dump.time<43200) {
        dump.jd--;
        dump.time+=43200;
    } else {
        dump.time-=43200;
    }

    if (fgets(str,300,f)==NULL) return 0;
    n = sscanf(str,"PASP %lf%lf%lf%lf%lf%lf%lf%lf%lf%lf%lf%lf"
               "%lf%lf%lf%lf%lf%lf%lf%lf%lf%lf%lf%lf%lf",
               &p[ 0],&p[ 1],&p[ 2],&p[ 3],&p[ 4],&p[ 5],&p[ 6],&p[ 7],&p[ 8],&p[ 9],
               &p[10],&p[11],&p[12],&p[13],&p[14],&p[15],&p[16],&p[17],&p[18],&p[19],
               &p[20],&p[21],&p[22],&p[23],&p[24]);
    if (n<25) return 0;
    memcpy(dump.pasp, p, 25*sizeof(double));

    if (fgets(str,300,f)==NULL) return 0;
    n = sscanf(str,"A=%lf L=%lf R=%lf VA=%lf VL=%lf VR=%lf",
               &dump.A, &dump.L, &dump.R, &dump.VA, &dump.VL, &dump.VR);
    if (n<6) return 0;

    if (fgets(str,300,f)==NULL) return 0;
    n = sscanf(str,"Nobj=%d Nzv=%d Nko=%d",
               &dump.Nobj, &dump.Nzv, &dump.Nko);
    if (n<3) return 0;

    dump.mobj = new nObj[dump.Nobj];

    for(int i=0; i<dump.Nobj; i++) {
        nObj o;
        int nn;
        if (fgets(str,300,f)==NULL) return 0;
        n = sscanf(str,"N=%d T=%lf X=%f Y=%f VX=%f VY=%f S=%f V=%f KO=%d",
                   &nn, &o.T, &o.X, &o.Y, &o.DX, &o.DY, &o.S, &o.V, &o.KO);
        if (n<9) return 0;
        dump.mobj[i]=o;

    }

    return 1;
}