| 1 | // toillgyroproducer.cc
 | 
|---|
| 2 | // Eric Aubourg         CEA/DAPNIA/SPP   octobre 1999
 | 
|---|
| 3 | 
 | 
|---|
| 4 | #include "toillgyroproducer.h"
 | 
|---|
| 5 | #include "archfileset.h"
 | 
|---|
| 6 | #include "toimanager.h"
 | 
|---|
| 7 | #include "requesthandler.h"
 | 
|---|
| 8 | 
 | 
|---|
| 9 | #define gyroRaw    "gyroRaw"
 | 
|---|
| 10 | #define gyroV      "gyroV"
 | 
|---|
| 11 | #define gyroCal    "gyroCal"
 | 
|---|
| 12 | #define gyroSpeed  "gyroSpeed"
 | 
|---|
| 13 | 
 | 
|---|
| 14 | TOILLGyroProducer::TOILLGyroProducer()
 | 
|---|
| 15 | {
 | 
|---|
| 16 |   possibleTOIs.insert(TOI(gyroRaw,   TOI::all, "", "ADU"));  
 | 
|---|
| 17 |   possibleTOIs.insert(TOI(gyroV,     TOI::all, "", "Volts"));
 | 
|---|
| 18 |   possibleTOIs.insert(TOI(gyroCal,   TOI::unspec, "", "deg/s/V", "theoric"));
 | 
|---|
| 19 |   possibleTOIs.insert(TOI(gyroSpeed, TOI::all, "", "deg/s", "theoric"));
 | 
|---|
| 20 | }
 | 
|---|
| 21 | 
 | 
|---|
| 22 | string TOILLGyroProducer::getName() {
 | 
|---|
| 23 |   return("TOILLGyroProducer 1.0");
 | 
|---|
| 24 | }
 | 
|---|
| 25 | 
 | 
|---|
| 26 | 
 | 
|---|
| 27 | static inline long gyrRaw(block_type_gyro* blk, int igyro, int imesure) {
 | 
|---|
| 28 |   return blk->gyro[igyro][imesure]-32768;
 | 
|---|
| 29 | }
 | 
|---|
| 30 | 
 | 
|---|
| 31 | static inline double gyrV(block_type_gyro* blk, int igyro, int imesure) {
 | 
|---|
| 32 |   return gyrRaw(blk, igyro, imesure) * 2. / 32768.; // +- 2V dynamique sur 16 bits;
 | 
|---|
| 33 | }
 | 
|---|
| 34 | 
 | 
|---|
| 35 | static inline double gyrSpeed(block_type_gyro* blk, int igyro, int imesure) {
 | 
|---|
| 36 |   return gyrV(blk, igyro, imesure) * 10;
 | 
|---|
| 37 | }
 | 
|---|
| 38 | 
 | 
|---|
| 39 | void TOILLGyroProducer::handleBlock(ArchFileSet* fs)
 | 
|---|
| 40 | {
 | 
|---|
| 41 |   block_type_gyro* blk = fs->lastGyro();
 | 
|---|
| 42 |   long sample0 = numero_block(blk)*72;
 | 
|---|
| 43 |   for (set<TOI>::iterator i = producedTOIs.begin(); i != producedTOIs.end(); i++) {
 | 
|---|
| 44 |     int igyro = (*i).index;
 | 
|---|
| 45 |     if ((*i).name == gyroRaw) {
 | 
|---|
| 46 |       for (int j=0; j<nb_per_block*2; j++) {
 | 
|---|
| 47 |         computedValue((*i),sample0+j, gyrRaw(blk,igyro,j));
 | 
|---|
| 48 |       }
 | 
|---|
| 49 |     } else if ((*i).name == gyroV) {
 | 
|---|
| 50 |       for (int j=0; j<nb_per_block*2; j++) {
 | 
|---|
| 51 |         computedValue((*i),sample0+j, gyrV(blk,igyro,j));
 | 
|---|
| 52 |       }
 | 
|---|
| 53 |     } else if ((*i).name == gyroCal) {
 | 
|---|
| 54 |       for (int j=0; j<nb_per_block*2; j++) {
 | 
|---|
| 55 |         computedValue((*i),sample0+j, 10);
 | 
|---|
| 56 |       }
 | 
|---|
| 57 |     } else if ((*i).name == gyroSpeed) {
 | 
|---|
| 58 |       for (int j=0; j<nb_per_block*2; j++) {
 | 
|---|
| 59 |         computedValue((*i),sample0+j, gyrSpeed(blk,igyro,j));
 | 
|---|
| 60 |       }
 | 
|---|
| 61 |     }
 | 
|---|
| 62 |   }
 | 
|---|
| 63 | }
 | 
|---|
| 64 | 
 | 
|---|