Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

RawDcsChillerMonitorBlock.cxx

Go to the documentation of this file.
00001 
00002 // $Id: RawDcsChillerMonitorBlock.cxx,v 1.3 2005/09/02 22:30:07 rhatcher Exp $
00003 // 
00004 // RawDcsChillerMonitorBlock 
00005 // 
00006 // RawDcsChillerMonitorBlock is a Dcs Chiller System Monitor Block
00007 //
00008 // Author:  E. Beall 2004-02-04
00009 //
00011 
00012 #include "RawData/RawDcsChillerMonitorBlock.h"
00013 
00014 UInt_t RawDcsChillerMonitorBlock::fgDebugFlags = 0;
00015 
00016 #include "MessageService/MsgService.h"
00017 CVSID("$Id: RawDcsChillerMonitorBlock.cxx,v 1.3 2005/09/02 22:30:07 rhatcher Exp $");
00018 #include "MessageService/MsgFormat.h"
00019 
00020 #include "RawData/RawBlockRegistry.h"
00021 REGISTERRAWBLOCK(RawDcsChillerMonitorBlock,kMdBlockDcsChillerMonitor,kMdBlockSourceDcs);
00022 
00023 ClassImp(RawDcsChillerMonitorBlock)
00024 
00025 //_____________________________________________________________________________
00026 RawDcsChillerMonitorBlock::RawDcsChillerMonitorBlock()
00027 {
00028    // Default constructor
00029 }
00030 
00031 //_____________________________________________________________________________
00032 RawDcsChillerMonitorBlock::RawDcsChillerMonitorBlock(const Int_t *block)
00033    : RawDataBlock(block)
00034 {
00035    //  stored block format is:
00036    //---------------------
00037    //  0   # words in block
00038    //  1   checksum
00039    //  2   Block Id
00040    //-----
00041    /*
00042     *  The data has the following repeating structure from here
00043     *  Int_t n = ((i-3)/4) = num blocks (test modulo for errors);
00044     *  Int_t d[n*4];  d = block+3;
00045     *  Int_t indx;
00046     *  d[(indx*4)+0] = timestamp (long sec)
00047     *  d[(indx*4)+1] = rackno (long)
00048     *  d[(indx*4)+2] = raw(long)
00049     *  d[(indx*4)+3] = status(signed long)
00050     *  indx++;(test if indx is greater than n, if so, finito)
00051         *                                          *
00052     */
00053 }
00054 
00055 //_____________________________________________________________________________
00056 RawDcsChillerMonitorBlock::~RawDcsChillerMonitorBlock()
00057 {
00058    // dtor
00059 }
00060 
00061 //_____________________________________________________________________________
00062 std::ostream& RawDcsChillerMonitorBlock::FormatToOStream(ostream& os, 
00063                                                          Option_t *option) const
00064 {
00065     RawDataBlock::FormatToOStream(os,option);
00066     if (option[0] == 'X') return os;
00067     
00068     Int_t numEntries=GetNumEntries();
00069     os << " Number of Entries " << numEntries
00070        << ", Number of Events " << GetNumEvents() << endl;
00071     for(Int_t i = 0; i < numEntries; i++) {
00072        os << "  [" << i << "]"
00073           << " Timestamp " << GetTimeStamp(i).AsString("c") << endl
00074           << "      ReturnWt         " << setw(15) << GetReturnWt(i)
00075           << "      DischargeFct     " << setw(15) << GetDischargeFct(i) << endl
00076           << "      ReturnCwt        " << setw(15) << GetReturnCwt(i)
00077           << "      DischargeCwt     " << setw(15) << GetDischargeCwt(i) << endl
00078           << "      StateFluidCooler " << setw(15) << GetStateFluidCooler(i)
00079           << "      StatePumpP4      " << setw(15) << GetStatePumpP4(i) << endl
00080           << "      StateChiller1    " << setw(15) << GetStateChiller1(i)
00081           << "      StateChiller2    " << setw(15) << GetStateChiller2(i) << endl
00082           << "      DetReturnCwt     " << setw(15) << GetDetReturnCwt(i)
00083           << "      DetSupplyCwt     " << setw(15) << GetDetSupplyCwt(i) << endl
00084           << "      StatePumpP5      " << setw(15) << GetStatePumpP5(i)
00085           << "      StateDetAlarm    " << setw(15) << GetStateDetAlarm(i) << endl
00086           << "      AhuS1RmTemp      " << setw(15) << GetAhuS1RmTemp(i)
00087           << "      Hx3ColdRetWt     " << setw(15) << GetHx3ColdRetWt(i) << endl
00088           << "      Hx3WarmDischWt   " << setw(15) << GetHx3WarmDischWt(i)
00089           << "      StatePumpP1      " << setw(15) << GetStatePumpP1(i) << endl
00090           << "      Fcu1RmTemp       " << setw(15) << GetFcu1RmTemp(i)
00091           << "      Fcu2RmTemp       " << setw(15) << GetFcu2RmTemp(i) << endl
00092           << "      S1RmTemp         " << setw(15) << GetS1RmTemp(i)
00093           << "      SurfaceTemp      " << setw(15) << GetSurfaceTemp(i) << endl;
00094     }
00095    return os;
00096 }
00097 
00098 void RawDcsChillerMonitorBlock::FillChillerArray() const
00099 {
00100 //off by 3 since the first three are 1:num words, 2: checksum
00101 // and 3:block ID
00102         ChillerArray = 3 + GetData();
00103 }
00104 
00105 Int_t RawDcsChillerMonitorBlock::GetNumEntries() const
00106 {
00107 // remember, all versions
00108 // have offset of 3 due to first 3 longs)
00109         if((fSize-3)%21)
00110         {
00111                 MSG("RawData",Msg::kError)
00112                 << " Size of Chiller Block screwed up.  Have: "
00113                 << (fSize-3)%21 << " left over from modulo 20."
00114                 << endl;
00115                 return -1;
00116         }
00117         return ((fSize-3)/21);
00118 }
00119 
00120 Int_t RawDcsChillerMonitorBlock::GetNumEvents() const
00121 {
00122         Int_t numEvents = 1;
00123         Int_t numEntries = GetNumEntries();
00124         FillChillerArray();
00125 
00126         //seek throughout for the number of events (not entries)
00127         //so look for entries where
00128         // FOR CHILLER THERE IS ONLY ONE EVENT PER BLOCK
00129 
00130         numEvents=numEntries;
00131         return numEvents;
00132 }
00133 
00134 VldContext RawDcsChillerMonitorBlock::GetVldContext() const
00135 {
00136 // build validity context
00137         RawBlockId rbid = GetBlockId();
00138         return VldContext(rbid.GetDetector(),rbid.GetSimFlag(),GetTimeStamp(0));
00139 }
00140 
00141 Float_t RawDcsChillerMonitorBlock::GetReturnWt(Int_t indx) const
00142 {
00143         FillChillerArray();
00144         Float_t fValue = 0.0;
00145         memcpy(&fValue,&ChillerArray[(indx*21)+1],4);
00146         return fValue;
00147 }
00148 
00149 Float_t RawDcsChillerMonitorBlock::GetDischargeFct(Int_t indx) const
00150 {
00151         FillChillerArray();
00152         Float_t fValue = 0.0;
00153         memcpy(&fValue,&ChillerArray[(indx*21)+2],4);
00154         return fValue;
00155 }
00156 
00157 Float_t RawDcsChillerMonitorBlock::GetReturnCwt(Int_t indx) const
00158 {
00159         FillChillerArray();
00160         Float_t fValue = 0.0;
00161         memcpy(&fValue,&ChillerArray[(indx*21)+3],4);
00162         return fValue;
00163 }
00164 
00165 Float_t RawDcsChillerMonitorBlock::GetDischargeCwt(Int_t indx) const
00166 {
00167         FillChillerArray();
00168         Float_t fValue = 0.0;
00169         memcpy(&fValue,&ChillerArray[(indx*21)+4],4);
00170         return fValue;
00171 }
00172 
00173 Float_t RawDcsChillerMonitorBlock::GetDetReturnCwt(Int_t indx) const
00174 {
00175         FillChillerArray();
00176         Float_t fValue = 0.0;
00177         memcpy(&fValue,&ChillerArray[(indx*21)+9],4);
00178         return fValue;
00179 }
00180 
00181 Float_t RawDcsChillerMonitorBlock::GetDetSupplyCwt(Int_t indx) const
00182 {
00183         FillChillerArray();
00184         Float_t fValue = 0.0;
00185         memcpy(&fValue,&ChillerArray[(indx*21)+10],4);
00186         return fValue;
00187 }
00188 
00189 Float_t RawDcsChillerMonitorBlock::GetAhuS1RmTemp(Int_t indx) const
00190 {
00191         FillChillerArray();
00192         Float_t fValue = 0.0;
00193         memcpy(&fValue,&ChillerArray[(indx*21)+13],4);
00194         return fValue;
00195 }
00196 
00197 Float_t RawDcsChillerMonitorBlock::GetHx3ColdRetWt(Int_t indx) const
00198 {
00199         FillChillerArray();
00200         Float_t fValue = 0.0;
00201         memcpy(&fValue,&ChillerArray[(indx*21)+14],4);
00202         return fValue;
00203 }
00204 
00205 Float_t RawDcsChillerMonitorBlock::GetHx3WarmDischWt(Int_t indx) const
00206 {
00207         FillChillerArray();
00208         Float_t fValue = 0.0;
00209         memcpy(&fValue,&ChillerArray[(indx*21)+15],4);
00210         return fValue;
00211 }
00212 
00213 Float_t RawDcsChillerMonitorBlock::GetFcu1RmTemp(Int_t indx) const
00214 {
00215         FillChillerArray();
00216         Float_t fValue = 0.0;
00217         memcpy(&fValue,&ChillerArray[(indx*21)+17],4);
00218         return fValue;
00219 }
00220 
00221 Float_t RawDcsChillerMonitorBlock::GetFcu2RmTemp(Int_t indx) const
00222 {
00223         FillChillerArray();
00224         Float_t fValue = 0.0;
00225         memcpy(&fValue,&ChillerArray[(indx*21)+18],4);
00226         return fValue;
00227 }
00228 
00229 Float_t RawDcsChillerMonitorBlock::GetS1RmTemp(Int_t indx) const
00230 {
00231         FillChillerArray();
00232         Float_t fValue = 0.0;
00233         memcpy(&fValue,&ChillerArray[(indx*21)+19],4);
00234         return fValue;
00235 }
00236 
00237 Float_t RawDcsChillerMonitorBlock::GetSurfaceTemp(Int_t indx) const
00238 {
00239         FillChillerArray();
00240         Float_t fValue = 0.0;
00241         memcpy(&fValue,&ChillerArray[(indx*21)+20],4);
00242         return fValue;
00243 }
00244 
00245 

Generated on Mon Feb 15 11:07:28 2010 for loon by  doxygen 1.3.9.1