コード例 #1
0
ファイル: Start.hpp プロジェクト: cordic/GnuRadar
   // pull settings from the configuration file
   GnuRadarSettingsPtr GetSettings( ConfigFile& configuration ) {

      GnuRadarSettingsPtr settings( new GnuRadarSettings() );

      settings->numChannels    = configuration.NumChannels();
      settings->decimationRate = configuration.Decimation();
      settings->fpgaFileName   = configuration.FPGAImage();

      //Program GNURadio
      for ( int i = 0; i < configuration.NumChannels(); ++i ) {
         settings->Tune ( i, configuration.DDC ( i ) );
         settings->Phase( i, configuration.Phase( i ) );
      }

      //change these as needed
      settings->fUsbBlockSize  = 0;
      settings->fUsbNblocks    = 0;
      settings->mux            = 0xf3f2f1f0;

      return settings;
   }
コード例 #2
0
ファイル: Start.hpp プロジェクト: cordic/GnuRadar
   Hdf5Ptr SetupHDF5( ConfigFile& configuration ) throw( H5::Exception )
   {
      std::string fileSet = configuration.DataFileBaseName();
      Hdf5Ptr h5File_( new HDF5 ( fileSet , hdf5::WRITE ) );

      h5File_->Description ( "GnuRadar Software" + configuration.Version() );
      h5File_->WriteStrAttrib ( "START_TIME", currentTime.GetTime() );
      h5File_->WriteStrAttrib ( "INSTRUMENT", configuration.Receiver() );
      h5File_->WriteAttrib<int> ( "CHANNELS", configuration.NumChannels(),
            H5::PredType::NATIVE_INT, H5::DataSpace() );
      h5File_->WriteAttrib<double> ( "SAMPLE_RATE", configuration.SampleRate(),
            H5::PredType::NATIVE_DOUBLE, H5::DataSpace() );
      h5File_->WriteAttrib<double> ( "BANDWIDTH", configuration.Bandwidth(),
            H5::PredType::NATIVE_DOUBLE, H5::DataSpace() );
      h5File_->WriteAttrib<int> ( "DECIMATION", configuration.Decimation(),
            H5::PredType::NATIVE_INT, H5::DataSpace() );
      h5File_->WriteAttrib<double> ( "OUTPUT_RATE", configuration.OutputRate(),
            H5::PredType::NATIVE_DOUBLE, H5::DataSpace() );
      h5File_->WriteAttrib<double> ( "IPP", configuration.IPP(),
            H5::PredType::NATIVE_DOUBLE, H5::DataSpace() );
      h5File_->WriteAttrib<double> ( "RF", configuration.TxCarrier() , 
            H5::PredType::NATIVE_DOUBLE, H5::DataSpace() );

      for ( int i = 0; i < configuration.NumChannels(); ++i ) {

         h5File_->WriteAttrib<double> ( 
               "DDC" + lexical_cast<string> ( i ),
               configuration.DDC ( i ), 
               H5::PredType::NATIVE_DOUBLE, 
               H5::DataSpace() 
               );

         h5File_->WriteAttrib<double> ( 
               "PHASE" + lexical_cast<string> ( i ),
               configuration.Phase ( i ), 
               H5::PredType::NATIVE_DOUBLE, 
               H5::DataSpace() 
               );
      }

      h5File_->WriteAttrib<int> ( 
            "SAMPLE_WINDOWS", configuration.NumWindows(),
            H5::PredType::NATIVE_INT, H5::DataSpace()
            );

      for ( int i = 0; i < configuration.NumWindows(); ++i ) {

         // TODO: Window Renaming scheme - 10/19/2010
         // Standardize window naming and add the user-defined
         // window name as a separate attribute.

         h5File_->WriteAttrib<int> ( 
               configuration.WindowName ( i ) + "_START", 
               configuration.WindowStart ( i ),
               H5::PredType::NATIVE_INT, H5::DataSpace()
               );

         h5File_->WriteAttrib<int> ( 
               configuration.WindowName ( i ) + "_STOP", 
               configuration.WindowStop ( i ),
               H5::PredType::NATIVE_INT, H5::DataSpace()
               );

         // update gnuradar shared buffer header
         header_->AddWindow( configuration.WindowName(i),
               configuration.WindowStart(i),
               configuration.WindowStop(i)
               );
      }

      return h5File_;
   }