Changeset 2555 for trunk/MagicSoft/Mars


Ignore:
Timestamp:
11/22/03 15:16:32 (21 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/mreport
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mreport/MReportCamera.cc

    r2535 r2555  
    3535#include "MParList.h"
    3636
    37 #include "../mcamera/MCameraHV.h"
     37#include "MCameraCalibration.h"
     38#include "MCameraCooling.h"
     39#include "MCameraHV.h"
     40#include "MCameraLV.h"
     41#include "MCameraAUX.h"
     42#include "MCameraLids.h"
    3843
    3944ClassImp(MReportCamera);
    40 
    41 ClassImp(MCameraCooling);
    42 ClassImp(MCameraLids);
    43 ClassImp(MCameraHV);
    44 ClassImp(MCameraLV);
    45 ClassImp(MCameraCalibration);
    4645
    4746using namespace std;
     
    6059    fLids = (MCameraLids*)plist.FindCreateObj("MCameraLids");
    6160    if (!fLids)
     61        return kFALSE;
     62
     63    fAUX = (MCameraAUX*)plist.FindCreateObj("MCameraAUX");
     64    if (!fAUX)
    6265        return kFALSE;
    6366
     
    124127
    125128    Int_t len;
    126     const Int_t n=sscanf(str.Data(), "%*d %*d %*d %*d %*d %*d %*d %*d %*d %*d %*d %*d %*d %n",
     129
     130    Int_t wall, opt, center, water;
     131    Short_t hwall, hcenter, hip, lop, pump, ref, valv, res, fans;
     132    const Int_t n=sscanf(str.Data(), "%d %d %d %d %hu %hu %hu %hu %hu %hu %hu %hu %hu %n",
     133                         &wall, &opt, &center, &water, &hwall, &hcenter,
     134                         &hip,  &lop, &pump, &ref, &valv, &res, &fans, &len);
     135    if (n!=13)
     136    {
     137        *fLog << err << "ERROR - Reading information of 'COOL' section." << endl;
     138        return kFALSE;
     139    }
     140
     141    fCooling->fTempWall            = 0.1*wall;
     142    fCooling->fTempOptLink         = 0.1*opt;
     143    fCooling->fTempCenter          = 0.1*center;
     144    fCooling->fTempWater           = 0.1*water;
     145    fCooling->fHumWall             = (Byte_t)hwall;
     146    fCooling->fHumCenter           = (Byte_t)hcenter;
     147    fCooling->fStatusPressureHi    = (Bool_t)hip;
     148    fCooling->fStatusPressureLo    = (Bool_t)lop;
     149    fCooling->fStatusPump          = (Bool_t)pump;
     150    fCooling->fStatusRefrigrerator = (Bool_t)ref;
     151    fCooling->fStatusValve         = (Bool_t)valv;
     152    fCooling->fStatusResistor      = (Bool_t)res;
     153    fCooling->fStatusFans          = (Bool_t)fans;
     154
     155    str.Remove(0, len);
     156    str=str.Strip(TString::kLeading);
     157    return kTRUE;
     158}
     159
     160Bool_t MReportCamera::InterpreteLID(TString &str)
     161{
     162    if (!CheckTag(str, "LID "))
     163        return kFALSE;
     164
     165    Int_t len;
     166    Short_t limao, limac, limbo, limbc;
     167    Short_t slimao, slimac, slimbo, slimbc;
     168    Short_t slida, slidb, mlida, mlidb;
     169    const Int_t n=sscanf(str.Data(), "%hu %hu %hu %hu %hu %hu %hu %hu %hu %hu %hu %hu %n",
     170                         &limao, &limac, &limbo, &limbc,
     171                         &slimao, &slimac, &slimbo, &slimbc,
     172                         &slida, &slidb, &mlida, &mlidb,
    127173                         &len);
    128     if (n!=0)
    129     {
    130         *fLog << err << "ERROR - Reading information of 'COOL' section." << endl;
    131         return kFALSE;
    132     }
    133     str.Remove(0, len);
    134     str=str.Strip(TString::kLeading);
    135     return kTRUE;
    136 }
    137 
    138 Bool_t MReportCamera::InterpreteLID(TString &str)
    139 {
    140     if (!CheckTag(str, "LID "))
    141         return kFALSE;
    142 
    143     Int_t len;
    144     const Int_t n=sscanf(str.Data(), "%*d %*d %*d %*d %*d %*d %*d %*d %*d %*d %*d %*d %n",
    145              &len);
    146     if (n!=0)
     174    if (n!=12)
    147175    {
    148176        *fLog << err << "ERROR - Reading information of 'LID' section." << endl;
    149177        return kFALSE;
    150178    }
     179
     180    fLids->fLidA.fLimitOpen       = (Bool_t)limao;
     181    fLids->fLidA.fLimitClose      = (Bool_t)limac;
     182    fLids->fLidA.fSafetyLimitOpen = (Bool_t)slimao;
     183    fLids->fLidA.fSafetyLimitClose= (Bool_t)slimac;
     184    fLids->fLidA.fStatusLid       = (Byte_t)slida;
     185    fLids->fLidA.fStatusMotor     = (Byte_t)mlida;
     186
     187    fLids->fLidB.fLimitOpen       = (Bool_t)limbo;
     188    fLids->fLidB.fLimitClose      = (Bool_t)limbc;
     189    fLids->fLidB.fSafetyLimitOpen = (Bool_t)slimbo;
     190    fLids->fLidB.fSafetyLimitClose= (Bool_t)slimbc;
     191    fLids->fLidB.fStatusLid       = (Byte_t)slidb;
     192    fLids->fLidB.fStatusMotor     = (Byte_t)mlidb;
     193
    151194    str.Remove(0, len);
    152195    str=str.Strip(TString::kLeading);
     
    160203
    161204    Int_t len;
    162     const Int_t n=sscanf(str.Data(), "%*d %*d %*d %*d %n",
    163              &len);
    164     if (n!=0)
     205    Short_t c1, c2;
     206    const Int_t n=sscanf(str.Data(), "%hd %hd %hd %hd %n",
     207                         &fHV->fVoltageA, &fHV->fVoltageB, &c1, &c2, &len);
     208    if (n!=4)
    165209    {
    166210        *fLog << err << "ERROR - Reading information of 'HVPS' section." << endl;
    167211        return kFALSE;
    168212    }
     213
     214    fHV->fCurrentA = (Byte_t)c1;
     215    fHV->fCurrentB = (Byte_t)c2;
     216
    169217    str.Remove(0, len);
    170218    str=str.Strip(TString::kLeading);
     
    178226
    179227    Int_t len;
    180     const Int_t n=sscanf(str.Data(), "%*d %*d %*d %*d %*d %*d %*d %*d %*d %*d %*d %*d %*d %*d %*d %*d %*d %*d %*d %n",
    181                          &len);
    182     if (n!=0)
     228    Short_t vap5, vap12, van12, vbp5, vbp12, vbn12;
     229    Short_t valp12, vblp12, cap5, cap12, can12, cbp5, cbp12;
     230    Short_t cbn12, calp12, cblp12, lvps, temp, hum;
     231    const Int_t n=sscanf(str.Data(), "%hd %hd %hd %hd %hd %hd %hd %hd %hd %hd %hd %hd %hd %hd %hd %hd %hd %hd %hd %n",
     232                         &vap5, &vap12, &van12, &vbp5, &vbp12, &vbn12,
     233                         &valp12, &vblp12, &cap5, &cap12, &can12, &cbp5, &cbp12,
     234                         &cbn12, &calp12, &cblp12, &lvps, &temp, &hum, &len);
     235    if (n!=19)
    183236    {
    184237        *fLog << err << "ERROR - Reading information of 'LV' section." << endl;
    185238        return kFALSE;
    186239    }
     240
     241    fLV->fRequestPowerSupply = (Bool_t)lvps;
     242    fLV->fTemp = 0.1*temp;
     243    fLV->fHumidity = (Byte_t)hum;
     244
     245    fLV->fPowerSupplyA.fVoltagePos5V         = 0.01*vap5;
     246    fLV->fPowerSupplyA.fVoltagePos12V        = 0.01*vap12;
     247    fLV->fPowerSupplyA.fVoltageNeg12V        = 0.01*van12;
     248    fLV->fPowerSupplyA.fVoltageOptLinkPos12V = 0.01*valp12;
     249    fLV->fPowerSupplyA.fCurrentPos5V         = 0.001*cap5;
     250    fLV->fPowerSupplyA.fCurrentPos12V        = 0.001*cap12;
     251    fLV->fPowerSupplyA.fCurrentNeg12V        = 0.001*can12;
     252    fLV->fPowerSupplyA.fCurrentOptLinkPos12V = 0.001*calp12;
     253
     254    fLV->fPowerSupplyB.fVoltagePos5V         = 0.01*vbp5;
     255    fLV->fPowerSupplyB.fVoltagePos12V        = 0.01*vbp12;
     256    fLV->fPowerSupplyB.fVoltageNeg12V        = 0.01*vbn12;
     257    fLV->fPowerSupplyB.fVoltageOptLinkPos12V = 0.01*vblp12;
     258    fLV->fPowerSupplyB.fCurrentPos5V         = 0.001*cbp5;
     259    fLV->fPowerSupplyB.fCurrentPos12V        = 0.001*cbp12;
     260    fLV->fPowerSupplyB.fCurrentNeg12V        = 0.001*cbn12;
     261    fLV->fPowerSupplyB.fCurrentOptLinkPos12V = 0.001*cblp12;
     262
    187263    str.Remove(0, len);
    188264    str=str.Strip(TString::kLeading);
     
    196272
    197273    Int_t len;
    198     const Int_t n=sscanf(str.Data(), "%*d %*d %n", &len);
    199     if (n!=0)
     274    Short_t led, fan;
     275    const Int_t n=sscanf(str.Data(), "%hd %hd %n", &led, &fan, &len);
     276    if (n!=2)
    200277    {
    201278        *fLog << err << "ERROR - Reading information of 'AUX' section." << endl;
    202279        return kFALSE;
    203280    }
     281
     282    fAUX->fRequestCaosLEDs=(Bool_t)led;
     283    fAUX->fRequestFansFADC=(Bool_t)fan;
     284
    204285    str.Remove(0, len);
    205286    str=str.Strip(TString::kLeading);
     
    213294
    214295    Int_t len;
    215     const Int_t n=sscanf(str.Data(), "%*d %*d %*d %*d %n", &len);
    216     if (n!=0)
     296    Short_t hv, lv, cont, pin;
     297
     298    const Int_t n=sscanf(str.Data(), "%hd %hd %hd %hd %n", &hv, &lv, &cont, &pin, &len);
     299    if (n!=4)
    217300    {
    218301        *fLog << err << "ERROR - Reading information of 'CAL' section." << endl;
     
    220303    }
    221304
     305    fCalibration->fRequestHiVoltage = (Bool_t)hv;
     306    fCalibration->fRequestLoVoltage = (Bool_t)lv;
     307    fCalibration->fRequestContLight = (Bool_t)cont;
     308    fCalibration->fRequestPinDiode  = (Bool_t)pin;
     309
    222310    str.Remove(0, len);
    223311    str=str.Strip(TString::kBoth);
     312    return kTRUE;
     313}
     314
     315Bool_t MReportCamera::InterpreteCamera(TString &str)
     316{
     317    //
     318    // I have tried to do it with pure pointer arithmentics, but most of the time is spent
     319    // to do the sscanf. So we gain less than 5% not using TString like it is done here.
     320    Int_t len;
     321    Short_t cal, stat, hvps, lid, lv, cool, hv, dc, led, fan, can, io, clv;
     322    Int_t n=sscanf(str.Data(), " %hd %hd %hd %hd %hd %hd %hd %hd %hd %hd %hd %hd %hd %n",
     323                   &cal, &stat, &hvps, &lid, &lv, &cool, &hv,
     324                   &dc, &led, &fan, &can, &io, &clv, &len);
     325    if (n!=13)
     326    {
     327        *fLog << err << "ERROR - Cannot interprete status' of subsystems." << endl;
     328        return kFALSE;
     329    }
     330    str.Remove(0, len);
     331    str=str.Strip(TString::kLeading);
     332
     333    fHV->fStatus                   = (Byte_t)hvps;
     334    fLids->fStatus                 = (Byte_t)lid;
     335    fLV->fStatus                   = (Byte_t)lv;
     336    fCooling->fStatus              = (Byte_t)cool;
     337    fHV->fStatusRamping            = (Byte_t)hv;
     338    fAUX->fStatusCaosLEDs          = (Bool_t)led;
     339    fAUX->fStatusFansFADC          = (Bool_t)fan;
     340    fCalibration->fStatus          = (Bool_t)cal;
     341    fCalibration->fStatusCANbus    = (Bool_t)can;
     342    fCalibration->fStatusIO        = (Bool_t)io;
     343    fCalibration->fStatusLoVoltage = (Bool_t)clv;
     344    fStatus                        = (Byte_t)stat;
     345    fStatusDC                      = (Byte_t)dc;
     346
    224347    return kTRUE;
    225348}
     
    229352Bool_t MReportCamera::InterpreteBody(TString &str)
    230353{
    231     //
    232     // I have tried to do it with pure pointer arithmentics, but most of the time is spent
    233     // to do the sscanf. So we gain less than 5% not using TString like it is done here.
    234     Int_t len;
    235     Int_t n=sscanf(str.Data(), " %*d %*d %*d %*d %*d %*d %*d %*d %*d %*d %*d %*d %*d %n",
    236                    &len);
    237 
    238     if (n!=0)
    239     {
    240         *fLog << err << "ERROR - Cannot interprete status' of subsystems." << endl;
    241         return kFALSE;
    242     }
    243     str.Remove(0, len);
    244     str=str.Strip(TString::kLeading);
     354    if (!InterpreteCamera(str))
     355        return kFALSE;
    245356
    246357    if (!InterpreteDC(str))
  • trunk/MagicSoft/Mars/mreport/Makefile

    r2520 r2555  
    2222#  connect the include files defined in the config.mk file
    2323#
    24 INCLUDES = -I. -I../mbase -I../mtools
     24INCLUDES = -I. -I../mbase -I../mtools -I../mcamera
    2525
    2626#------------------------------------------------------------------------------
Note: See TracChangeset for help on using the changeset viewer.