1 | // toiiter.h
|
---|
2 | // Eric Aubourg CEA/DAPNIA/SPP juillet 1999
|
---|
3 |
|
---|
4 | #ifndef TOIITER_H
|
---|
5 | #define TOIITER_H
|
---|
6 |
|
---|
7 |
|
---|
8 | #include <vector>
|
---|
9 | #include <set>
|
---|
10 | #include <map>
|
---|
11 | #include <string>
|
---|
12 | #include "archeopsfile.h"
|
---|
13 | #include "auxgps.h"
|
---|
14 | #include "tsid.h"
|
---|
15 |
|
---|
16 | enum TOIKind {
|
---|
17 | sampleNum, // Numero d''echantillon (timer interne transputer)
|
---|
18 | internalTime, // temps transputer depuis debut manip, en secondes.
|
---|
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
|
---|
24 | boloTemp, // Kelvins, need R(T) -> N/A
|
---|
25 | boloDACV, // tension de reference du DAC (microVolts)
|
---|
26 | boloDACI, // courant (microAmps)
|
---|
27 | boloRawMuVCN, // compression noise on bolo (microVolts), no filter
|
---|
28 | boloMuV2T, // total, microVolts, avec consigne DAC
|
---|
29 | boloRes, // Resistance, ohms
|
---|
30 | boloGainAmpli, //
|
---|
31 | dilDAC, // dilution DAC, index = 0-47
|
---|
32 | dilSwitch, // dilution, mot de 32 bits
|
---|
33 | serviceTemp, // service temperature, K
|
---|
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
|
---|
43 | gyroV, // tension gyro, V, index = 0,1,2
|
---|
44 | gyroSpeed, // vitesse gyro, deg/s, index = 0,1,2, calibree...
|
---|
45 | gpsTime, // temps fourni par GPS
|
---|
46 | longitude, // position ballon, degrees +=EST
|
---|
47 | latitude, // position ballon, degrees +=NORD
|
---|
48 | altitude, // position ballon, m
|
---|
49 | tsid, // temps sideral en secondes
|
---|
50 | azimuthBolo, // azimut
|
---|
51 | alphaRotAxis, //
|
---|
52 | deltaRotAxis, //
|
---|
53 | alphaZenith, //
|
---|
54 | deltaZenith, //
|
---|
55 | alphaSst, //
|
---|
56 | deltaSst, //
|
---|
57 | alphaFPAxis, //
|
---|
58 | deltaFPAxis, //
|
---|
59 | alphaBolo, // sur le ciel, indexe par bolometre
|
---|
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
|
---|
95 | };
|
---|
96 |
|
---|
97 | class TOIInterpolator;
|
---|
98 |
|
---|
99 | class TOIIter {
|
---|
100 | public:
|
---|
101 | TOIIter(TOIIter const&); // $CHECK$ prevoir operator = ?
|
---|
102 | ~TOIIter();
|
---|
103 | bool Next();
|
---|
104 |
|
---|
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 ?
|
---|
110 | bool isTrig(int column);
|
---|
111 | TOIKind getKind(int column);
|
---|
112 | int getIndex(int column); // si plusieurs, exemple, tension bolo 2
|
---|
113 |
|
---|
114 | bool canGetTOI(TOIKind kind, int index=0);
|
---|
115 | double getTOI(TOIKind kind, int index=0);
|
---|
116 |
|
---|
117 |
|
---|
118 | int getBlockSampleIndex(); // numero d''echantillon dans dernier bloc bolo
|
---|
119 | int getSampleIndex(); // numero d''echantillon
|
---|
120 | int getUnderSampling();
|
---|
121 | double getMJD();
|
---|
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();
|
---|
137 |
|
---|
138 | ArcheopsFile* currentFile() {if (!initDone) Init(); return file;}
|
---|
139 |
|
---|
140 | protected:
|
---|
141 | TOIIter();
|
---|
142 | void Init(); // After setting the options, opens the first file.
|
---|
143 | void ScanFiles(); // Parcourt tous les fichiers, cherche le premier echantillon...
|
---|
144 |
|
---|
145 | bool Next1();
|
---|
146 | bool NextSample(); // no test of trange
|
---|
147 | bool NextFile();
|
---|
148 |
|
---|
149 | ArcheopsFile* file;
|
---|
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
|
---|
153 | set<string>::iterator curFile;
|
---|
154 | bool isOnBoardRecorder;
|
---|
155 |
|
---|
156 | int imes;
|
---|
157 |
|
---|
158 | double tStart, tEnd; // MJD
|
---|
159 | double utcStart, utcEnd; // UTC, will be converted towards tStart tEnd at init
|
---|
160 | long sStart, sEnd; // samplenum
|
---|
161 |
|
---|
162 | //double tBlock0; // MJD du bloc numero zero...
|
---|
163 | //double perEch; // periode d''echantillonage en secondes
|
---|
164 |
|
---|
165 | struct info {
|
---|
166 | TOIKind kind;
|
---|
167 | int index;
|
---|
168 | bool triggering;
|
---|
169 | bool interpolated;
|
---|
170 | };
|
---|
171 |
|
---|
172 | int getColTOI(TOIKind kind, int index=0);
|
---|
173 |
|
---|
174 | long trigMask;
|
---|
175 |
|
---|
176 | vector<info> infos;
|
---|
177 |
|
---|
178 | friend class TOISvr;
|
---|
179 |
|
---|
180 | // Gestion de l''interpolation, par delegation a un autre iterateur
|
---|
181 | TOIIter* rawIter; // iterateur sans interpolation, qui avance avec retard
|
---|
182 | // en bufferisant les valeurs. S''il existe, on lui delegue
|
---|
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;
|
---|
187 | bool fetchAhead(); // avance d''une TOI en nourrissant les interpolateurs
|
---|
188 |
|
---|
189 | AuxGPS* auxGPS;
|
---|
190 | TSid tSid;
|
---|
191 |
|
---|
192 | int underSample;
|
---|
193 |
|
---|
194 | private:
|
---|
195 | bool initDone;
|
---|
196 | };
|
---|
197 |
|
---|
198 | #endif
|
---|