00001
00002
00003
00004
00005
00006
00007
00008
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
00029 }
00030
00031
00032 RawDcsChillerMonitorBlock::RawDcsChillerMonitorBlock(const Int_t *block)
00033 : RawDataBlock(block)
00034 {
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053 }
00054
00055
00056 RawDcsChillerMonitorBlock::~RawDcsChillerMonitorBlock()
00057 {
00058
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
00101
00102 ChillerArray = 3 + GetData();
00103 }
00104
00105 Int_t RawDcsChillerMonitorBlock::GetNumEntries() const
00106 {
00107
00108
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
00127
00128
00129
00130 numEvents=numEntries;
00131 return numEvents;
00132 }
00133
00134 VldContext RawDcsChillerMonitorBlock::GetVldContext() const
00135 {
00136
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