Changeset 2535 for trunk/MagicSoft/Mars
- Timestamp:
- 11/19/03 20:46:54 (21 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 20 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r2534 r2535 12 12 * mreport/MReportFileRead.cc: 13 13 - replaced SetTime by SetupReading 14 15 * mreport/MReportCamera.[h,cc]: 16 - use new stuff 17 18 * mcamera/*: 19 - added 14 20 15 21 -
trunk/MagicSoft/Mars/mreport/MReportCamera.cc
r2520 r2535 33 33 34 34 #include "MAstro.h" 35 #include "MParList.h" 36 37 #include "../mcamera/MCameraHV.h" 35 38 36 39 ClassImp(MReportCamera); 37 40 41 ClassImp(MCameraCooling); 42 ClassImp(MCameraLids); 43 ClassImp(MCameraHV); 44 ClassImp(MCameraLV); 45 ClassImp(MCameraCalibration); 46 38 47 using namespace std; 39 48 … … 41 50 { 42 51 fName = "MReportCamera"; 52 } 53 54 Bool_t MReportCamera::SetupReading(MParList &plist) 55 { 56 fCooling = (MCameraCooling*)plist.FindCreateObj("MCameraCooling"); 57 if (!fCooling) 58 return kFALSE; 59 60 fLids = (MCameraLids*)plist.FindCreateObj("MCameraLids"); 61 if (!fLids) 62 return kFALSE; 63 64 fHV = (MCameraHV*)plist.FindCreateObj("MCameraHV"); 65 if (!fHV) 66 return kFALSE; 67 68 fLV = (MCameraLV*)plist.FindCreateObj("MCameraLV"); 69 if (!fLV) 70 return kFALSE; 71 72 fCalibration = (MCameraCalibration*)plist.FindCreateObj("MCameraCalibration"); 73 if (!fCalibration) 74 return kFALSE; 75 76 return MReport::SetupReading(plist); 77 } 78 79 Bool_t MReportCamera::CheckTag(TString &str, const char *tag) const 80 { 81 if (!str.BeginsWith(tag)) 82 { 83 *fLog << err << "ERROR - '" << tag << "' tag not found." << endl; 84 return kFALSE; 85 } 86 str.Remove(0, strlen(tag)); // Remove DC currents 87 return kTRUE; 88 } 89 90 Bool_t MReportCamera::InterpreteDC(TString &str) 91 { 92 if (!CheckTag(str, "DC ")) 93 return kFALSE; 94 95 str.Remove(0, 577*4); // Remove DC currents 96 str=str.Strip(TString::kLeading); 97 return kTRUE; 98 } 99 100 Bool_t MReportCamera::InterpreteHV(TString &str) 101 { 102 if (!CheckTag(str, "HV ")) 103 return kFALSE; 104 105 for (int i=0; i<577; i++) 106 { 107 const Char_t hex[4] = { str[i*3], str[i*3+1], str[i*3+2], 0 }; 108 const Int_t n=sscanf(hex, "%3hx", &fHV->fHV[i]); 109 if (n==1) 110 continue; 111 112 *fLog << err << "ERROR - Reading hexadecimal HV information." << endl; 113 return kFALSE; 114 } 115 str.Remove(0, 577*3); // Remove DC currents 116 str=str.Strip(TString::kLeading); 117 return kTRUE; 118 } 119 120 Bool_t MReportCamera::InterpreteCOOL(TString &str) 121 { 122 if (!CheckTag(str, "COOL ")) 123 return kFALSE; 124 125 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", 127 &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) 147 { 148 *fLog << err << "ERROR - Reading information of 'LID' section." << endl; 149 return kFALSE; 150 } 151 str.Remove(0, len); 152 str=str.Strip(TString::kLeading); 153 return kTRUE; 154 } 155 156 Bool_t MReportCamera::InterpreteHVPS(TString &str) 157 { 158 if (!CheckTag(str, "HVPS ")) 159 return kFALSE; 160 161 Int_t len; 162 const Int_t n=sscanf(str.Data(), "%*d %*d %*d %*d %n", 163 &len); 164 if (n!=0) 165 { 166 *fLog << err << "ERROR - Reading information of 'HVPS' section." << endl; 167 return kFALSE; 168 } 169 str.Remove(0, len); 170 str=str.Strip(TString::kLeading); 171 return kTRUE; 172 } 173 174 Bool_t MReportCamera::InterpreteLV(TString &str) 175 { 176 if (!CheckTag(str, "LV ")) 177 return kFALSE; 178 179 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) 183 { 184 *fLog << err << "ERROR - Reading information of 'LV' section." << endl; 185 return kFALSE; 186 } 187 str.Remove(0, len); 188 str=str.Strip(TString::kLeading); 189 return kTRUE; 190 } 191 192 Bool_t MReportCamera::InterpreteAUX(TString &str) 193 { 194 if (!CheckTag(str, "AUX ")) 195 return kFALSE; 196 197 Int_t len; 198 const Int_t n=sscanf(str.Data(), "%*d %*d %n", &len); 199 if (n!=0) 200 { 201 *fLog << err << "ERROR - Reading information of 'AUX' section." << endl; 202 return kFALSE; 203 } 204 str.Remove(0, len); 205 str=str.Strip(TString::kLeading); 206 return kTRUE; 207 } 208 209 Bool_t MReportCamera::InterpreteCAL(TString &str) 210 { 211 if (!CheckTag(str, "CAL ")) 212 return kFALSE; 213 214 Int_t len; 215 const Int_t n=sscanf(str.Data(), "%*d %*d %*d %*d %n", &len); 216 if (n!=0) 217 { 218 *fLog << err << "ERROR - Reading information of 'CAL' section." << endl; 219 return kFALSE; 220 } 221 222 str.Remove(0, len); 223 str=str.Strip(TString::kBoth); 224 return kTRUE; 43 225 } 44 226 … … 47 229 Bool_t MReportCamera::InterpreteBody(TString &str) 48 230 { 49 *fLog << dbg << "C" << flush; 50 return kTRUE; 51 } 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); 245 246 if (!InterpreteDC(str)) 247 return kFALSE; 248 249 if (!InterpreteHV(str)) 250 return kFALSE; 251 252 if (!InterpreteCOOL(str)) 253 return kFALSE; 254 255 if (!InterpreteLID(str)) 256 return kFALSE; 257 258 if (!InterpreteHVPS(str)) 259 return kFALSE; 260 261 if (!InterpreteLV(str)) 262 return kFALSE; 263 264 if (!InterpreteAUX(str)) 265 return kFALSE; 266 267 if (!InterpreteCAL(str)) 268 return kFALSE; 269 270 if (str!="OVER") 271 { 272 *fLog << err << "ERROR - 'OVER' tag not found." << endl; 273 return kFALSE; 274 } 275 276 return kTRUE; 277 } -
trunk/MagicSoft/Mars/mreport/MReportCamera.h
r2520 r2535 5 5 #include "MReport.h" 6 6 #endif 7 /* 8 class MCameraCooling : public MParContainer 9 { 10 friend class MReportCamera; 11 private: 12 Bool_t fStatus; // Monitored status: , Cam.COOLING_state 13 14 Bool_t fStatusPressureHi; // 0=ok, 1=Obstruct 15 Bool_t fStatusPressureLo; // 0=ok, 1=leakage 16 Bool_t fStatusPumb; // 0=off, 1=on 17 Bool_t fStatusRefrigrerator; // 0=off, 1=on 18 Bool_t fStatusValve; // 0=recirculate, 1=new 19 Bool_t fStatusResistor; // 0=off, 1=on 20 Bool_t fStatusFans; // 0=off, 1=on 21 22 Float_t fTempCenter; // [deg C] Temperature at the camera center 23 Float_t fTempWall; // [deg C] Temperature at the camera wall 24 Float_t fTempOptLink; // [deg C] Temperature at the optical link 25 Float_t fTempWater; // [deg C] Temperature of the water 26 27 Byte_t fHumAll; // [%] Relative humidity over all 28 Byte_t fHumCenter; // [%] Relative humidity camera center 29 30 public: 31 ClassDef(MCameraCooling, 0) 32 }; 33 class MCameraLid : public MParContainer 34 { 35 friend class MReportCamera; 36 private: 37 Bool_t fLimitTop; // 0=not active, 1= active 38 Bool_t fLimitBottom; // 0=not active, 1= active 39 Bool_t fSaftyLimitTop; // 0=not active, 1= active 40 Bool_t fSaftyLimitBottom; // 0=not active, 1= active 41 Byte_t fStatusLid; // 0=positioning, 1=open, 2=closed 42 Byte_t fStatusMotor; // 0=stopped, 1=opening, 2=closing 43 public: 44 ClassDef(MCameraLid, 0) 45 }; 46 class MCameraLids : public MParContainer 47 { 48 friend class MReportCamera; 49 private: 50 MCameraLid *fLidA; 51 MCameraLid *fLidB; 52 53 Bool_t fStatus; // [?] Monitored status, Cam.LID_state 54 public: 55 ClassDef(MCameraLids, 0) 56 }; 57 58 class MCameraPowerSupply : public MParContainer 59 { 60 friend class MReportCamera; 61 private: 62 Float_t fVoltagePos5V; // [V] voltage_pos5 63 Float_t fVoltagePos12V; // [V] voltage_pos12 64 Float_t fVoltageNeg12V; // [V] voltage_neg12 65 Float_t fCurrentPos5V; // [A] current_pos5 66 Float_t fCurrentPos12V; // [A] current_pos12 67 Float_t fCurrentNeg12V; // [A] current_neg12 68 public: 69 ClassDef(MCameraPowerSupply, 0) 70 }; 71 72 class MCameraLV : public MParContainer 73 { 74 friend class MReportCamera; 75 private: 76 Bool_t fStatus; // Monitored status: , Cam.LV_state 77 Bool_t fRequestPowerSupply; // Requested status: o=off, 1=on, blv_ps_status 78 Bool_t fRequestTemp; // Requested status: o=off, 1=on, blv_temp 79 Bool_t fRequestHumidity; // Requested status: o=off, 1=on, blv_RelativeHumidity 80 81 MCameraPowerSupply fPowerSupplyA; // power supply A 82 MCameraPowerSupply fPowerSupplyB; // power supply B 83 84 Float_t fVoltageOptLinkPos12V; // [V] voltage_opt_link_pos12 85 Float_t fVoltageOptLinkSparePos12V; // [V] voltage_opt_link_spare_pos12 86 87 Float_t fCurrentOptLinkPos12V; // [A] current_opt_link_pos12 88 Float_t fCurrentOptLinkSparePos12V; // [A] current_opt_link_spare_pos12 89 90 public: 91 ClassDef(MCameraLV, 0) 92 }; 93 94 class MCameraAUX : public MParContainer 95 { 96 friend class MReportCamera; 97 private: 98 Bool_t fRequestCaosLEDs; // Requested status: o=off, 1=on, bAux_CaOsLEDs_Off/On 99 Bool_t fRequestFansFADC; // Requested status: o=off, 1=on, bAux_FADC_FANs_Off/On 100 Bool_t fStatusCaosLEDs; // Monitored status: o=off, 1=on, Cam.CaOs.LED_state 101 Bool_t fStatusFansFADC; // Monitored status: o=off, 1=on, Cam.FADC.Fans_state 102 public: 103 ClassDef(MCameraAUX, 0) 104 }; 105 106 class MCameraCalibration : public MParContainer 107 { 108 friend class MReportCamera; 109 private: 110 Bool_t fStatus; // Monitored status: o=off, 1=on, CamCalib_state 111 Bool_t fStatusCANbus; // Monitored status: o=off, 1=on, Cal.CanBus_state 112 Bool_t fStatusIO; // Monitored status: o=off, 1=on, Cal.IO_state 113 Bool_t fStatusLoVoltage; // Monitored status: o=off, 1=on, Cal.LV_state 114 115 Bool_t fRequestHiVoltage; // Requested status: o=off, 1=on, bcalib_HV_Off/On 116 Bool_t fRequestLoVoltage; // Requested status: o=off, 1=on, bcalib_LV_Off/On 117 Bool_t fRequestContLight; // Requested status: o=off, 1=on, bcalib_ContinuousLight_Off/On 118 Bool_t fRequestPinDiode; // Requested status: o=off, 1=on, bcalib_PinDiode_Off/On 119 120 public: 121 ClassDef(MCameraCalibration, 0) 122 }; 123 #include <TArrayS.h> 124 class MCameraHV : public MParContainer 125 { 126 friend class MReportCamera; 127 private: 128 Bool_t fStatus; // Monitored status of the High Voltage, Cam.HV.PS_state 129 Bool_t fStatusPowerSupply; // Monitored status of the HV Power supply, Cam.HV_state 130 131 Short_t fVoltageA; // [V] Measured voltage of power supply A, hvps1 132 Short_t fVoltageB; // [V] Measured voltage of power supply B, hvps2 133 134 Short_t fCurrentA; // [A] Measured current of power supply A, curr1 135 Short_t fCurrentB; // [A] Measured current of power supply B, curr2 136 137 TArrayS fHV; // [V] Measured high Voltages for all PMTs 138 public: 139 MCameraHV() : fHV(577) { } 140 ClassDef(MCameraHV, 0) 141 }; 142 */ 143 144 class MCameraCooling; 145 class MCameraLids; 146 class MCameraHV; 147 class MCameraLV; 148 class MCameraCalibration; 7 149 8 150 class MReportCamera : public MReport 9 151 { 10 152 private: 153 Bool_t fStatus; // [?] Monitored status of the sentinel, Sentinel_state 154 Bool_t fStatusDC; // [?] Monitored status of the DC currents, Cam.DC_state 155 156 MCameraCooling *fCooling; 157 MCameraLids *fLids; 158 MCameraHV *fHV; 159 MCameraLV *fLV; 160 MCameraCalibration *fCalibration; 161 162 Bool_t SetupReading(MParList &plist); 163 Bool_t CheckTag(TString &str, const char *tag) const; 164 165 Bool_t InterpreteDC(TString &str); 166 Bool_t InterpreteHV(TString &str); 167 Bool_t InterpreteCOOL(TString &str); 168 Bool_t InterpreteLID(TString &str); 169 Bool_t InterpreteHVPS(TString &str); 170 Bool_t InterpreteLV(TString &str); 171 Bool_t InterpreteAUX(TString &str); 172 Bool_t InterpreteCAL(TString &str); 173 11 174 public: 12 175 MReportCamera(); … … 14 177 Bool_t InterpreteBody(TString &str); 15 178 16 ClassDef(MReportCamera, 0) // Base class for control reports179 ClassDef(MReportCamera, 1) // Base class for control reports 17 180 }; 18 181 -
trunk/MagicSoft/Mars/status.cc
r2521 r2535 93 93 // Evaluate arguments 94 94 // 95 MArgs arg(argc, (const char**)argv);95 MArgs arg(argc, argv); 96 96 97 97 if (arg.HasOption("-?") || arg.HasOption("-h")) … … 282 282 283 283 tlist.PrintStatistics(); 284 284 285 return 0; 285 286 }
Note:
See TracChangeset
for help on using the changeset viewer.