[350] | 1 | // toiiter.h
|
---|
| 2 | // Eric Aubourg CEA/DAPNIA/SPP juillet 1999
|
---|
| 3 |
|
---|
[310] | 4 | #ifndef TOIITER_H
|
---|
| 5 | #define TOIITER_H
|
---|
| 6 |
|
---|
| 7 |
|
---|
| 8 | #include <vector>
|
---|
| 9 | #include <set>
|
---|
[350] | 10 | #include <map>
|
---|
[310] | 11 | #include <string>
|
---|
| 12 | #include "archeopsfile.h"
|
---|
[358] | 13 | #include "auxgps.h"
|
---|
[363] | 14 | #include "tsid.h"
|
---|
[310] | 15 |
|
---|
| 16 | enum TOIKind {
|
---|
[407] | 17 | sampleNum, // Numero d''echantillon (timer interne transputer)
|
---|
| 18 | internalTime, // temps transputer depuis debut manip, en secondes.
|
---|
[432] | 19 | mjd, // UTC (en jours, MJD = JD - 2450000).
|
---|
| 20 | mutc, // UTC en heure, avec soustraction d'origine
|
---|
| 21 | boloMuV, // tension en microVolts, filtree avec filtre carre indexe par bolometre
|
---|
| 22 | boloMuV2, // tension en microVolts, avec soustraction offset filtre
|
---|
| 23 | boloRawMuV, // tension brute en microVolts, non filtree indexe par bolometre, sans chgt signe
|
---|
[407] | 24 | boloTemp, // Kelvins, need R(T) -> N/A
|
---|
[408] | 25 | boloDACV, // tension de reference du DAC (microVolts)
|
---|
[410] | 26 | boloDACI, // courant (microAmps)
|
---|
[432] | 27 | boloRawMuVCN, // compression noise on bolo (microVolts), no filter
|
---|
| 28 | boloMuV2T, // total, microVolts, avec consigne DAC
|
---|
[410] | 29 | boloRes, // Resistance, ohms
|
---|
[432] | 30 | boloGainAmpli, //
|
---|
[410] | 31 | dilDAC, // dilution DAC, index = 0-47
|
---|
| 32 | dilSwitch, // dilution, mot de 32 bits
|
---|
[432] | 33 | serviceTemp, // service temperature, K
|
---|
[407] | 34 | sstDiode, // signal brut SST, indice = diode, 0-45
|
---|
| 35 | sstChannel, // signal brut SST, indice = canal, 0-47
|
---|
| 36 | sstDiodeCN, // compression noise
|
---|
| 37 | sstChannelCN, // compression noise
|
---|
| 38 | sstStarCnt, // nombre d''etoiles detectees durant ce sample
|
---|
| 39 | sstStarZ, // numero de diode d''une eventuelle etoile, i=etoile 0..n
|
---|
| 40 | sstStarF, // flux d''une eventuelle etoile, <0 si moins de i+1 etoiles
|
---|
| 41 | sstStarT, // temps d''une eventuelle etoile, <0 si moins de i+1 etoiles
|
---|
| 42 | gyroRaw, // valeur brute du gyro, index = 0,1,2
|
---|
[432] | 43 | gyroV, // tension gyro, V, index = 0,1,2
|
---|
[407] | 44 | gyroSpeed, // vitesse gyro, deg/s, index = 0,1,2, calibree...
|
---|
| 45 | gpsTime, // temps fourni par GPS
|
---|
[419] | 46 | longitude, // position ballon, degrees +=EST
|
---|
| 47 | latitude, // position ballon, degrees +=NORD
|
---|
[407] | 48 | altitude, // position ballon, m
|
---|
| 49 | tsid, // temps sideral en secondes
|
---|
[432] | 50 | azimuthBolo, // azimut
|
---|
| 51 | alphaRotAxis, //
|
---|
| 52 | deltaRotAxis, //
|
---|
| 53 | alphaZenith, //
|
---|
| 54 | deltaZenith, //
|
---|
[407] | 55 | alphaSst, //
|
---|
| 56 | deltaSst, //
|
---|
[432] | 57 | alphaFPAxis, //
|
---|
| 58 | deltaFPAxis, //
|
---|
[407] | 59 | alphaBolo, // sur le ciel, indexe par bolometre
|
---|
[436] | 60 | deltaBolo, // sur le ciel, indexe par bolometre
|
---|
| 61 | voyantEVO,
|
---|
| 62 | voyantEVF,
|
---|
| 63 | commandeEV0,
|
---|
| 64 | commandeEVF,
|
---|
| 65 | commandeEVB,
|
---|
| 66 | commandeEVV,
|
---|
| 67 | pressEnt3He,
|
---|
| 68 | debit3He,
|
---|
| 69 | pressSor3He,
|
---|
| 70 | pressEnt4He,
|
---|
| 71 | debit4He,
|
---|
| 72 | pressSor4He,
|
---|
| 73 | pressAirVanne,
|
---|
| 74 | pressPompChar,
|
---|
| 75 | pressMembrane,
|
---|
| 76 | pressExterne,
|
---|
| 77 | tensPile10T,
|
---|
| 78 | tensPileP18D,
|
---|
| 79 | tensPileM18D,
|
---|
| 80 | tensPile10B,
|
---|
| 81 | tensPileP18B,
|
---|
| 82 | tensPileM18B,
|
---|
| 83 | tensPileCh,
|
---|
| 84 | swPile5,
|
---|
| 85 | swPile15,
|
---|
| 86 | tempCaissH1,
|
---|
| 87 | tempCaissH2,
|
---|
| 88 | tempCaissB1,
|
---|
| 89 | tempCaissB2,
|
---|
| 90 | tempCaissTHe,
|
---|
| 91 | tempCaissPiles,
|
---|
| 92 | tempCaissDrv,
|
---|
| 93 | pressHeBain,
|
---|
| 94 | pressPirani
|
---|
[407] | 95 | };
|
---|
[310] | 96 |
|
---|
[315] | 97 | class TOIInterpolator;
|
---|
[310] | 98 |
|
---|
| 99 | class TOIIter {
|
---|
| 100 | public:
|
---|
[315] | 101 | TOIIter(TOIIter const&); // $CHECK$ prevoir operator = ?
|
---|
[310] | 102 | ~TOIIter();
|
---|
| 103 | bool Next();
|
---|
| 104 |
|
---|
[315] | 105 | bool canGetValue(int column); // data is available for that...
|
---|
| 106 | double getValue(int column);
|
---|
| 107 | bool newValue(int column); // a juste change ?
|
---|
| 108 | bool extendValue(int column); // une valeur plus ancienne, etendue ?
|
---|
| 109 | bool interpValue(int column); // une valeur interpolee avec valeur future ?
|
---|
[342] | 110 | bool isTrig(int column);
|
---|
[310] | 111 | TOIKind getKind(int column);
|
---|
[315] | 112 | int getIndex(int column); // si plusieurs, exemple, tension bolo 2
|
---|
[310] | 113 |
|
---|
[315] | 114 | bool canGetTOI(TOIKind kind, int index=0);
|
---|
| 115 | double getTOI(TOIKind kind, int index=0);
|
---|
| 116 |
|
---|
| 117 |
|
---|
[342] | 118 | int getBlockSampleIndex(); // numero d''echantillon dans dernier bloc bolo
|
---|
| 119 | int getSampleIndex(); // numero d''echantillon
|
---|
[426] | 120 | int getUnderSampling();
|
---|
[358] | 121 | double getMJD();
|
---|
[310] | 122 |
|
---|
| 123 | block_type_param* lastParam();
|
---|
| 124 | block_type_journal* lastJournal();
|
---|
| 125 | block_type_reglage* lastReglage();
|
---|
| 126 | block_type_dilution* lastDilution();
|
---|
| 127 | block_type_gps* lastGPS();
|
---|
| 128 | block_type_une_periode* lastUnePeriode();
|
---|
| 129 | block_type_synchro_sol* lastSynchroSol();
|
---|
| 130 | block_type_pointage_sol* lastPointageSol();
|
---|
| 131 | block_type_bolo* lastBolo();
|
---|
| 132 | block_type_gyro* lastGyro();
|
---|
| 133 | block_type_sst* lastSST();
|
---|
| 134 | block_type_bolo_comprime* lastBoloComp();
|
---|
| 135 | block_type_gyro_comprime* lastGyroComp();
|
---|
| 136 | block_type_sst_comprime* lastSSTComp();
|
---|
[342] | 137 |
|
---|
[393] | 138 | ArcheopsFile* currentFile() {if (!initDone) Init(); return file;}
|
---|
[310] | 139 |
|
---|
| 140 | protected:
|
---|
| 141 | TOIIter();
|
---|
| 142 | void Init(); // After setting the options, opens the first file.
|
---|
[350] | 143 | void ScanFiles(); // Parcourt tous les fichiers, cherche le premier echantillon...
|
---|
[310] | 144 |
|
---|
[426] | 145 | bool Next1();
|
---|
[350] | 146 | bool NextSample(); // no test of trange
|
---|
[310] | 147 | bool NextFile();
|
---|
| 148 |
|
---|
| 149 | ArcheopsFile* file;
|
---|
[350] | 150 | string directory; // If directory scanning
|
---|
| 151 | set<string> files; // list of files to be read...
|
---|
| 152 | map<string, long> file1stSamp; // premier echantillon de chaque fichier
|
---|
[310] | 153 | set<string>::iterator curFile;
|
---|
[342] | 154 | bool isOnBoardRecorder;
|
---|
[310] | 155 |
|
---|
| 156 | int imes;
|
---|
| 157 |
|
---|
[432] | 158 | double tStart, tEnd; // MJD
|
---|
| 159 | double utcStart, utcEnd; // UTC, will be converted towards tStart tEnd at init
|
---|
| 160 | long sStart, sEnd; // samplenum
|
---|
[310] | 161 |
|
---|
[394] | 162 | //double tBlock0; // MJD du bloc numero zero...
|
---|
| 163 | //double perEch; // periode d''echantillonage en secondes
|
---|
[310] | 164 |
|
---|
| 165 | struct info {
|
---|
| 166 | TOIKind kind;
|
---|
| 167 | int index;
|
---|
| 168 | bool triggering;
|
---|
| 169 | bool interpolated;
|
---|
| 170 | };
|
---|
| 171 |
|
---|
[315] | 172 | int getColTOI(TOIKind kind, int index=0);
|
---|
| 173 |
|
---|
[310] | 174 | long trigMask;
|
---|
| 175 |
|
---|
| 176 | vector<info> infos;
|
---|
| 177 |
|
---|
| 178 | friend class TOISvr;
|
---|
| 179 |
|
---|
[342] | 180 | // Gestion de l''interpolation, par delegation a un autre iterateur
|
---|
[315] | 181 | TOIIter* rawIter; // iterateur sans interpolation, qui avance avec retard
|
---|
[401] | 182 | // en bufferisant les valeurs. S''il existe, on lui delegue
|
---|
[315] | 183 | // toutes les operations agissant sur le fichier.
|
---|
| 184 | TOIInterpolator* interp; // interpolateurs pour stocker les valeurs
|
---|
| 185 | long lastSample; // last interpolated sample
|
---|
| 186 | long maxLookAhead;
|
---|
[342] | 187 | bool fetchAhead(); // avance d''une TOI en nourrissant les interpolateurs
|
---|
[315] | 188 |
|
---|
[358] | 189 | AuxGPS* auxGPS;
|
---|
[363] | 190 | TSid tSid;
|
---|
[358] | 191 |
|
---|
[426] | 192 | int underSample;
|
---|
| 193 |
|
---|
[310] | 194 | private:
|
---|
[393] | 195 | bool initDone;
|
---|
[310] | 196 | };
|
---|
| 197 |
|
---|
| 198 | #endif
|
---|