Loading Common/Servers/HolographyBackend/include/HolographyImpl.h +16 −3 Original line number Diff line number Diff line Loading @@ -50,6 +50,7 @@ #include <AntennaBossC.h> #include "Configuration.h" #include <string> //#include "CommandLine.h" Loading @@ -66,10 +67,12 @@ #define DXC_INTERFACE "IDL:alma/DXC/DigitalXCorrelator:1.0" #define ANTENNA_BOSS_INTERFACE "IDL:alma/Antenna/AntennaBoss:1.0" #define SCHEDULER_INTERFACE "IDL:alma/Management/Scheduler:1.0" //#define NOANTENNABOSS //#define NOANTENNABOSS #define MAX_SECTION_NUMBER 14 using namespace baci; using namespace ACSBulkDataError; Loading Loading @@ -271,6 +274,10 @@ public: */ virtual ACS::doubleSeq * getZero () throw (CORBA::SystemException, ComponentErrors::ComponentErrorsEx,BackendsErrors::BackendsErrorsEx); /** * This method is just a place holder for this implementation of the genericBackend interface */ virtual void setTargetFileName (const char * fileName) throw (CORBA::SystemException,ComponentErrors::ComponentErrorsEx,BackendsErrors::BackendsErrorsEx); /** * Call this function to set the current time (from the local computer) into the backend. Loading Loading @@ -439,7 +446,10 @@ protected: private: struct THeaderRecord { Backends::TMainHeader header; Backends::TSectionHeader chHeader[MAX_SECTION_NUMBER]; }; // struct THeaderRecord { // Backends::TMainHeader header; Loading Loading @@ -470,6 +480,7 @@ private: bool m_initialized; // SimpleParser::CParser<CCommandLine> * m_parser; std::string m_filename; CConfiguration m_configuration; CSenderThread *m_senderThread; Loading @@ -477,6 +488,8 @@ private: DXC::DigitalXCorrelator_var m_correlator; // reference Antenna::AntennaBoss_var m_antennaBoss; bool m_LogObservedPositions; // Management::Scheduler_var m_scheduler; void deleteAll(); }; Loading Common/Servers/HolographyBackend/src/DigitalXCorrelatorImpl/DigitalXCorrelator.py +51 −29 Original line number Diff line number Diff line Loading @@ -42,6 +42,7 @@ import ACSErrTypeFPGAConnectionImpl import ACSErrTypeFPGACommunicationImpl import ComponentErrorsImpl import Acspy.Util.ACSCorba import BackendsErrorsImpl Loading Loading @@ -85,18 +86,20 @@ class DigitalXCorrelator(DXC__POA.DigitalXCorrelator, ACSComponent, ContainerSer ACSComponent.__init__(self) ContainerServices.__init__(self) self.corr = corr2serial.Correlator() self.name=ContainerServices.getName(self) # self.name=ContainerServices.getName(self) def initialize(self): """Retrieve the CDB parameters.""" # dal=Acspy.Util.ACSCorba.cdb() name=self.getName() dal=Acspy.Util.ACSCorba.cdb() try: # dao=dal.get_DAO_Servant("alma/%s" %self.name) dao=dal.get_DAO_Servant("alma/"+name) print self.name # self.port = int(dao.get_double("PORT")) self.port = int(dao.get_double("PORT")) # self.baudrate = int(dao.get_double("BAUDRATE")) # self.out_file_name = dao.get_string("OUT_FILE_FP") self.out_file_name = dao.get_string("OUT_FILE_FP") # self.max_attempts =int(dao.get_double("MAX_ATTEMPTS")) self.max_attempts =1 Loading @@ -122,30 +125,14 @@ class DigitalXCorrelator(DXC__POA.DigitalXCorrelator, ACSComponent, ContainerSer self.getLogger().logDebug("Error in initialize: cannot connect to FPGA") self.getLogger().logError("Error... cannot connect to FPGA") raise ACSErrTypeFPGAConnectionImpl.CannotConnectExImpl() try: # Version 051: print self.out_file_name dt = datetime.datetime.now() file_id = "_%04d%02d%02d_%02d%02d" %(dt.year, dt.month, dt.day, dt.hour, dt.minute) self.out_file = open(self.out_file_name + file_id, 'a', 0) self.out_file.write("Azimuth".ljust(15) + "Elevation".ljust(15)) for item in ordered_key_list: self.out_file.write(item.ljust(15)) self.out_file.write("Timestamp".ljust(30)) # End 051 # self.out_file = open(out_file, 'w', 0) # V.05 except IOError: self.getLogger().logDebug("Error in initialize: cannot create out_file") self.getLogger().logError("Error creating out_file") raise ComponentErrorsImpl.FileIOErrorExImpl() def cleanUp(self): self.corr.disconnect() self.getLogger().logDebug("CleanUp") self.out_file.close() ComponentLifecycle.cleanUp() #ComponentLifecycle.cleanUp() def aboutToAbort(self): self.getLogger().logDebug("About to Abort") Loading Loading @@ -201,7 +188,7 @@ class DigitalXCorrelator(DXC__POA.DigitalXCorrelator, ACSComponent, ContainerSer except Exception: self.getLogger().logDebug("Error in save_coeff: cannot connect to FPGA") self.getLogger().logError("Error... cannot connect to FPGA") raise ACSErrTypeFPGAConnectionImpl.CannotConnectExImpl() raise BackendErrorsImpl.NakExImpl() # # Running Correlation try: Loading @@ -209,7 +196,7 @@ class DigitalXCorrelator(DXC__POA.DigitalXCorrelator, ACSComponent, ContainerSer except Exception: self.getLogger().logError("Error running correlation.") raise ACSErrTypeFPGACommunicationImpl.CannotRunExImpl() raise BackendErrorsImpl.BackendBusyImpl() # Getting coefficient Loading @@ -217,7 +204,7 @@ class DigitalXCorrelator(DXC__POA.DigitalXCorrelator, ACSComponent, ContainerSer self.corr.getCoeff() except Exception: raise ACSErrTypeFPGACommunicationImpl.CannotGetCoefficientsExImpl() raise BackendErrorsImpl.BackendBusyImpl() # module = sqrt(self.corr.get_real()**2 + self.corr.get_imm()**2) # phase_tmp = atan2(self.corr.get_imm() , self.corr.get_real()) Loading @@ -244,4 +231,39 @@ class DigitalXCorrelator(DXC__POA.DigitalXCorrelator, ACSComponent, ContainerSer self.corr.disconnect() except Exception: print "disconnect exception" raise ACSErrTypeFPGACommunicationImpl.CannotRunExImpl() raise BackendErrorsImpl.BackendBusyImpl() def openFile(self,name): try: self.out_file_name=name print self.out_file_name dt = datetime.datetime.now() file_id = "_%04d%02d%02d_%02d%02d%02d" %(dt.year, dt.month, dt.day, dt.hour, dt.seconds) self.out_file = open(self.out_file_name + file_id, 'a', 0) self.out_file.write("Azimuth".ljust(15) + "Elevation".ljust(15)) for item in ordered_key_list: self.out_file.write(item.ljust(15)) self.out_file.write("Timestamp".ljust(30)) # End 051 # self.out_file = open(out_file, 'w', 0) # V.05 except IOError: self.getLogger().logDebug("Error in initialize: cannot create out_file") self.getLogger().logError("Error creating out_file") raise ComponentErrorsImpl.FileIOErrorExImpl() def closeFile(self): try: self.out_file.close() except IOError: self.getLogger().logDebug("Error in initialize: cannot close out_file") self.getLogger().logError("Error closing out_file") raise ComponentErrorsImpl.FileIOErrorExImpl() def reset(self): try: self.corr.reset() except Exception: print "reset exception" raise BackendErrorsImpl.BackendBusyImpl() No newline at end of file Common/Servers/HolographyBackend/src/HolographyImpl.cpp +200 −108 Original line number Diff line number Diff line Loading @@ -79,7 +79,7 @@ *Local functions */ #define FLOW_NUMBER 1 //using namespace SimpleParser; //_IRA_LOGFILTER_DECLARE; Loading Loading @@ -161,6 +161,11 @@ void HolographyImpl::initialize() throw (ACSErr::ACSbaseExImpl) throw ex.getComponentErrorsEx(); } } void HolographyImpl::execute() throw (ACSErr::ACSbaseExImpl) Loading @@ -169,23 +174,7 @@ void HolographyImpl::execute() throw (ACSErr::ACSbaseExImpl) ACS_LOG(LM_FULL_INFO,"HolographyImpl::execute()",(LM_INFO,"BACKEND_INITIAL_CONFIGURATION")); ACS::Time time; try{ //sets the property defaults....some of them cannot be changed any more (hardware dependent) m_pbackendName->getDevIO()->write(getComponent()->getName(),time); } catch (ACSErr::ACSbaseExImpl& ex) { _ADD_BACKTRACE(ComponentErrors::InitializationProblemExImpl,impl,ex,"TotalPowerImpl::execute()"); throw impl; } } void HolographyImpl::sendHeader() throw (CORBA::SystemException, BackendsErrors::BackendsErrorsEx, ComponentErrors::ComponentErrorsEx) { AUTO_TRACE("HolographyImpl::sendHeader()"); try{ m_correlator=getContainerServices()->getDefaultComponent<DXC::DigitalXCorrelator>("IDL:alma/DXC/DigitalXCorrelator:1.0"); if (m_LogObservedPositions) { Loading @@ -201,10 +190,6 @@ void HolographyImpl::sendHeader() throw (CORBA::SystemException, BackendsErrors: throw ex.getComponentErrorsEx(); } try{ DWORD sampling_time; sampling_time=m_configuration.getSamplingTime(); cout << "***********************************************" << endl; Loading @@ -215,7 +200,7 @@ void HolographyImpl::sendHeader() throw (CORBA::SystemException, BackendsErrors: try { m_sender_thread_param.sender=this; m_sender_thread_param.dxc_correlator=m_correlator; temp=&m_sender_thread_param; // reference to pass to create thread Loading @@ -224,23 +209,9 @@ void HolographyImpl::sendHeader() throw (CORBA::SystemException, BackendsErrors: m_senderThread->setSleepTime(sampling_time*10000); // the sampling time is read from CDB // m_senderThread->setSleepTime(0); // set to 0 // m_senderThread->setResponseTime(50000000); } // if (CORBA::is_nil(m_antennaBoss)) // { // cout <<"ABOSS NOT REFERENCED " << endl; // // } else // { // cout <<"ABOSS REFERENCED " << endl; // // } // Loading Loading @@ -283,6 +254,19 @@ void HolographyImpl::sendHeader() throw (CORBA::SystemException, BackendsErrors: cout<< "unknown except" <<endl; } try{ cout << "**Correlator reset**"<< endl; m_correlator->reset(); }catch (ComponentErrors::ComponentErrorsExImpl& ex) { ex.log(LM_DEBUG); throw ex.getComponentErrorsEx(); } catch (BackendsErrors::BackendsErrorsExImpl& ex) { ex.log(LM_DEBUG); throw ex.getBackendsErrorsEx(); } Loading @@ -290,6 +274,71 @@ void HolographyImpl::sendHeader() throw (CORBA::SystemException, BackendsErrors: } void HolographyImpl::sendHeader() throw (CORBA::SystemException, BackendsErrors::BackendsErrorsEx, ComponentErrors::ComponentErrorsEx) { AUTO_TRACE("HolographyImpl::sendHeader()"); if (m_filename.empty()) { m_filename="/archive/data/holography/holo"; } THeaderRecord bkd; //header for fitswriter bkd.header.sections=2; bkd.header.beams=1; //resultingSampleRate(m_integration,m_commonSampleRate,intTime); //bkd.integration=intTime; bkd.header.integration=25; bkd.header.sampleSize=50; bkd.header.noData=true; long index=0; for (int i=0;i<bkd.header.sections;i++) { if (index<MAX_SECTION_NUMBER) { bkd.chHeader[index].id=i; bkd.chHeader[index].bins=0.; bkd.chHeader[index].polarization=Backends::BKND_LCP; bkd.chHeader[index].bandWidth=0; bkd.chHeader[index].frequency=11533; bkd.chHeader[index].attenuation[0]=0.; // we have always one inputs....so just the first position is significant bkd.chHeader[index].attenuation[1]=0.0; // not significant....placeholder bkd.chHeader[index].IF[0]=0; bkd.chHeader[index].IF[1]=0; // not significant bkd.chHeader[index].sampleRate=5000000; bkd.chHeader[index].feed=i; bkd.chHeader[index].inputs=1; index++; } } try { getSender()->startSend(FLOW_NUMBER,(const char*)&bkd, sizeof(Backends::TMainHeader)+bkd.header.sections*sizeof(Backends::TSectionHeader)); } catch (AVStartSendErrorExImpl& ex) { _ADD_BACKTRACE(BackendsErrors::TXErrorExImpl,impl,ex,"HolographyImpl::sendHeader()"); impl.setDetails("main header could not be sent"); impl.log(LM_DEBUG); throw impl.getBackendsErrorsEx(); } catch (...) { _EXCPT(ComponentErrors::UnexpectedExImpl,impl,"HolographyImpl::sendHeader()"); impl.log(LM_DEBUG); throw impl.getComponentErrorsEx(); } } void HolographyImpl::sendData(ACS::Time startTime) throw (CORBA::SystemException, BackendsErrors::BackendsErrorsEx, ComponentErrors::ComponentErrorsEx) Loading @@ -297,7 +346,13 @@ void HolographyImpl::sendData(ACS::Time startTime) throw (CORBA::SystemException double az,el; TIMEVALUE now; AUTO_TRACE("HolographyImpl::sendData()"); try{ cout << "**Correlator OpenFile**"<< endl; m_correlator->openFile(m_filename.c_str()); // m_correlator->save_coeff(az,el); IRA::CIRATools::getTime(now); Loading Loading @@ -362,27 +417,45 @@ void HolographyImpl::sendStop() throw (CORBA::SystemException, BackendsErrors::B az=-0.69; el=0.55; } // m_correlator->save_coord(az,el); } try{ void HolographyImpl::terminate() throw (CORBA::SystemException, BackendsErrors::BackendsErrorsEx, ComponentErrors::ComponentErrorsEx) m_correlator->closeFile(); } catch (ComponentErrors::ComponentErrorsExImpl& ex) { AUTO_TRACE("HolographyImpl::terminate()"); ex.log(LM_DEBUG); throw ex.getComponentErrorsEx(); } catch (BackendsErrors::BackendsErrorsExImpl& ex) { ex.log(LM_DEBUG); throw ex.getBackendsErrorsEx(); } try { getSender()->stopSend(FLOW_NUMBER); } catch (AVStopSendErrorExImpl& ex) { _ADD_BACKTRACE(BackendsErrors::TXErrorExImpl,impl,ex,"HolographyImpl::sendStop()"); impl.setDetails("stop message could not be sent"); throw impl.getBackendsErrorsEx(); } catch (...) { _EXCPT(ComponentErrors::UnexpectedExImpl,impl,"HolographyImpl::sendStop()"); throw impl.getComponentErrorsEx(); } getContainerServices()->releaseComponent(m_correlator->name()); } catch(maciErrType::CannotReleaseComponentExImpl &ex) { ACS_LOG(LM_FULL_INFO,"HolographyImpl::terminate()",(LM_ERROR ,"CannotReleaseComponentExImpl")); ex.log(LM_DEBUG); } void HolographyImpl::terminate() throw (CORBA::SystemException, BackendsErrors::BackendsErrorsEx, ComponentErrors::ComponentErrorsEx) { AUTO_TRACE("HolographyImpl::terminate()"); } Loading @@ -393,7 +466,16 @@ void HolographyImpl::terminate() throw (CORBA::SystemException, BackendsErrors:: void HolographyImpl::initialize(const char * configuration) throw (CORBA::SystemException, ComponentErrors::ComponentErrorsEx,BackendsErrors::BackendsErrorsEx) { { try{ m_correlator->closeFile(); } catch (ComponentErrors::ComponentErrorsExImpl& ex) { ex.log(LM_DEBUG); throw ex.getComponentErrorsEx(); } catch (BackendsErrors::BackendsErrorsExImpl& ex) { ex.log(LM_DEBUG); throw ex.getBackendsErrorsEx(); } AUTO_TRACE("HolographyImpl::initialize()"); Loading Loading @@ -433,7 +515,18 @@ void HolographyImpl::deleteAll() } try { getContainerServices()->releaseComponent(m_correlator->name()); } catch(maciErrType::CannotReleaseComponentExImpl &ex) { ACS_LOG(LM_FULL_INFO,"HolographyImpl::terminate()",(LM_ERROR ,"CannotReleaseComponentExImpl")); ex.log(LM_DEBUG); } } Loading Loading @@ -518,15 +611,6 @@ void HolographyImpl::activateNoiseCalibrationSwitching(CORBA::Long interleave) t } //char * HolographyImpl::command(const char *configCommand) throw (CORBA::SystemException,ManagementErrors::CommandLineErrorEx) //{ // AUTO_TRACE("HolographyImpl::command()"); // IRA::CString out; // IRA::CString in; // bool error; // return CORBA::string_dup((const char *)out); //} void HolographyImpl::setSection(CORBA::Long input,CORBA::Double freq,CORBA::Double bw,CORBA::Long feed,CORBA::Long pol,CORBA::Double sr,CORBA::Long bins) throw ( CORBA::SystemException,ComponentErrors::ComponentErrorsEx,BackendsErrors::BackendsErrorsEx) Loading @@ -542,6 +626,14 @@ void HolographyImpl::setIntegration(CORBA::Long Integration) throw (CORBA::Syste } void HolographyImpl::setTargetFileName (const char * fileName) throw (CORBA::SystemException,ComponentErrors::ComponentErrorsEx, BackendsErrors::BackendsErrorsEx) { // nothing to do } _PROPERTY_REFERENCE_CPP(HolographyImpl,ACS::ROuLongLong,m_ptime,time); _PROPERTY_REFERENCE_CPP(HolographyImpl,ACS::ROstring,m_pbackendName,backendName); _PROPERTY_REFERENCE_CPP(HolographyImpl,ACS::ROdoubleSeq,m_pbandWidth,bandWidth); Loading Common/Servers/HolographyBackend/src/Makefile +1 −1 Original line number Diff line number Diff line Loading @@ -132,7 +132,7 @@ tttlll_OBJECTS = # # Configuration Database Files # ---------------------------- CDB_SCHEMAS = Holography DigitalXCorrelator # CDB_SCHEMAS = Holography DigitalXCorrelator # # IDL Files and flags Loading Loading
Common/Servers/HolographyBackend/include/HolographyImpl.h +16 −3 Original line number Diff line number Diff line Loading @@ -50,6 +50,7 @@ #include <AntennaBossC.h> #include "Configuration.h" #include <string> //#include "CommandLine.h" Loading @@ -66,10 +67,12 @@ #define DXC_INTERFACE "IDL:alma/DXC/DigitalXCorrelator:1.0" #define ANTENNA_BOSS_INTERFACE "IDL:alma/Antenna/AntennaBoss:1.0" #define SCHEDULER_INTERFACE "IDL:alma/Management/Scheduler:1.0" //#define NOANTENNABOSS //#define NOANTENNABOSS #define MAX_SECTION_NUMBER 14 using namespace baci; using namespace ACSBulkDataError; Loading Loading @@ -271,6 +274,10 @@ public: */ virtual ACS::doubleSeq * getZero () throw (CORBA::SystemException, ComponentErrors::ComponentErrorsEx,BackendsErrors::BackendsErrorsEx); /** * This method is just a place holder for this implementation of the genericBackend interface */ virtual void setTargetFileName (const char * fileName) throw (CORBA::SystemException,ComponentErrors::ComponentErrorsEx,BackendsErrors::BackendsErrorsEx); /** * Call this function to set the current time (from the local computer) into the backend. Loading Loading @@ -439,7 +446,10 @@ protected: private: struct THeaderRecord { Backends::TMainHeader header; Backends::TSectionHeader chHeader[MAX_SECTION_NUMBER]; }; // struct THeaderRecord { // Backends::TMainHeader header; Loading Loading @@ -470,6 +480,7 @@ private: bool m_initialized; // SimpleParser::CParser<CCommandLine> * m_parser; std::string m_filename; CConfiguration m_configuration; CSenderThread *m_senderThread; Loading @@ -477,6 +488,8 @@ private: DXC::DigitalXCorrelator_var m_correlator; // reference Antenna::AntennaBoss_var m_antennaBoss; bool m_LogObservedPositions; // Management::Scheduler_var m_scheduler; void deleteAll(); }; Loading
Common/Servers/HolographyBackend/src/DigitalXCorrelatorImpl/DigitalXCorrelator.py +51 −29 Original line number Diff line number Diff line Loading @@ -42,6 +42,7 @@ import ACSErrTypeFPGAConnectionImpl import ACSErrTypeFPGACommunicationImpl import ComponentErrorsImpl import Acspy.Util.ACSCorba import BackendsErrorsImpl Loading Loading @@ -85,18 +86,20 @@ class DigitalXCorrelator(DXC__POA.DigitalXCorrelator, ACSComponent, ContainerSer ACSComponent.__init__(self) ContainerServices.__init__(self) self.corr = corr2serial.Correlator() self.name=ContainerServices.getName(self) # self.name=ContainerServices.getName(self) def initialize(self): """Retrieve the CDB parameters.""" # dal=Acspy.Util.ACSCorba.cdb() name=self.getName() dal=Acspy.Util.ACSCorba.cdb() try: # dao=dal.get_DAO_Servant("alma/%s" %self.name) dao=dal.get_DAO_Servant("alma/"+name) print self.name # self.port = int(dao.get_double("PORT")) self.port = int(dao.get_double("PORT")) # self.baudrate = int(dao.get_double("BAUDRATE")) # self.out_file_name = dao.get_string("OUT_FILE_FP") self.out_file_name = dao.get_string("OUT_FILE_FP") # self.max_attempts =int(dao.get_double("MAX_ATTEMPTS")) self.max_attempts =1 Loading @@ -122,30 +125,14 @@ class DigitalXCorrelator(DXC__POA.DigitalXCorrelator, ACSComponent, ContainerSer self.getLogger().logDebug("Error in initialize: cannot connect to FPGA") self.getLogger().logError("Error... cannot connect to FPGA") raise ACSErrTypeFPGAConnectionImpl.CannotConnectExImpl() try: # Version 051: print self.out_file_name dt = datetime.datetime.now() file_id = "_%04d%02d%02d_%02d%02d" %(dt.year, dt.month, dt.day, dt.hour, dt.minute) self.out_file = open(self.out_file_name + file_id, 'a', 0) self.out_file.write("Azimuth".ljust(15) + "Elevation".ljust(15)) for item in ordered_key_list: self.out_file.write(item.ljust(15)) self.out_file.write("Timestamp".ljust(30)) # End 051 # self.out_file = open(out_file, 'w', 0) # V.05 except IOError: self.getLogger().logDebug("Error in initialize: cannot create out_file") self.getLogger().logError("Error creating out_file") raise ComponentErrorsImpl.FileIOErrorExImpl() def cleanUp(self): self.corr.disconnect() self.getLogger().logDebug("CleanUp") self.out_file.close() ComponentLifecycle.cleanUp() #ComponentLifecycle.cleanUp() def aboutToAbort(self): self.getLogger().logDebug("About to Abort") Loading Loading @@ -201,7 +188,7 @@ class DigitalXCorrelator(DXC__POA.DigitalXCorrelator, ACSComponent, ContainerSer except Exception: self.getLogger().logDebug("Error in save_coeff: cannot connect to FPGA") self.getLogger().logError("Error... cannot connect to FPGA") raise ACSErrTypeFPGAConnectionImpl.CannotConnectExImpl() raise BackendErrorsImpl.NakExImpl() # # Running Correlation try: Loading @@ -209,7 +196,7 @@ class DigitalXCorrelator(DXC__POA.DigitalXCorrelator, ACSComponent, ContainerSer except Exception: self.getLogger().logError("Error running correlation.") raise ACSErrTypeFPGACommunicationImpl.CannotRunExImpl() raise BackendErrorsImpl.BackendBusyImpl() # Getting coefficient Loading @@ -217,7 +204,7 @@ class DigitalXCorrelator(DXC__POA.DigitalXCorrelator, ACSComponent, ContainerSer self.corr.getCoeff() except Exception: raise ACSErrTypeFPGACommunicationImpl.CannotGetCoefficientsExImpl() raise BackendErrorsImpl.BackendBusyImpl() # module = sqrt(self.corr.get_real()**2 + self.corr.get_imm()**2) # phase_tmp = atan2(self.corr.get_imm() , self.corr.get_real()) Loading @@ -244,4 +231,39 @@ class DigitalXCorrelator(DXC__POA.DigitalXCorrelator, ACSComponent, ContainerSer self.corr.disconnect() except Exception: print "disconnect exception" raise ACSErrTypeFPGACommunicationImpl.CannotRunExImpl() raise BackendErrorsImpl.BackendBusyImpl() def openFile(self,name): try: self.out_file_name=name print self.out_file_name dt = datetime.datetime.now() file_id = "_%04d%02d%02d_%02d%02d%02d" %(dt.year, dt.month, dt.day, dt.hour, dt.seconds) self.out_file = open(self.out_file_name + file_id, 'a', 0) self.out_file.write("Azimuth".ljust(15) + "Elevation".ljust(15)) for item in ordered_key_list: self.out_file.write(item.ljust(15)) self.out_file.write("Timestamp".ljust(30)) # End 051 # self.out_file = open(out_file, 'w', 0) # V.05 except IOError: self.getLogger().logDebug("Error in initialize: cannot create out_file") self.getLogger().logError("Error creating out_file") raise ComponentErrorsImpl.FileIOErrorExImpl() def closeFile(self): try: self.out_file.close() except IOError: self.getLogger().logDebug("Error in initialize: cannot close out_file") self.getLogger().logError("Error closing out_file") raise ComponentErrorsImpl.FileIOErrorExImpl() def reset(self): try: self.corr.reset() except Exception: print "reset exception" raise BackendErrorsImpl.BackendBusyImpl() No newline at end of file
Common/Servers/HolographyBackend/src/HolographyImpl.cpp +200 −108 Original line number Diff line number Diff line Loading @@ -79,7 +79,7 @@ *Local functions */ #define FLOW_NUMBER 1 //using namespace SimpleParser; //_IRA_LOGFILTER_DECLARE; Loading Loading @@ -161,6 +161,11 @@ void HolographyImpl::initialize() throw (ACSErr::ACSbaseExImpl) throw ex.getComponentErrorsEx(); } } void HolographyImpl::execute() throw (ACSErr::ACSbaseExImpl) Loading @@ -169,23 +174,7 @@ void HolographyImpl::execute() throw (ACSErr::ACSbaseExImpl) ACS_LOG(LM_FULL_INFO,"HolographyImpl::execute()",(LM_INFO,"BACKEND_INITIAL_CONFIGURATION")); ACS::Time time; try{ //sets the property defaults....some of them cannot be changed any more (hardware dependent) m_pbackendName->getDevIO()->write(getComponent()->getName(),time); } catch (ACSErr::ACSbaseExImpl& ex) { _ADD_BACKTRACE(ComponentErrors::InitializationProblemExImpl,impl,ex,"TotalPowerImpl::execute()"); throw impl; } } void HolographyImpl::sendHeader() throw (CORBA::SystemException, BackendsErrors::BackendsErrorsEx, ComponentErrors::ComponentErrorsEx) { AUTO_TRACE("HolographyImpl::sendHeader()"); try{ m_correlator=getContainerServices()->getDefaultComponent<DXC::DigitalXCorrelator>("IDL:alma/DXC/DigitalXCorrelator:1.0"); if (m_LogObservedPositions) { Loading @@ -201,10 +190,6 @@ void HolographyImpl::sendHeader() throw (CORBA::SystemException, BackendsErrors: throw ex.getComponentErrorsEx(); } try{ DWORD sampling_time; sampling_time=m_configuration.getSamplingTime(); cout << "***********************************************" << endl; Loading @@ -215,7 +200,7 @@ void HolographyImpl::sendHeader() throw (CORBA::SystemException, BackendsErrors: try { m_sender_thread_param.sender=this; m_sender_thread_param.dxc_correlator=m_correlator; temp=&m_sender_thread_param; // reference to pass to create thread Loading @@ -224,23 +209,9 @@ void HolographyImpl::sendHeader() throw (CORBA::SystemException, BackendsErrors: m_senderThread->setSleepTime(sampling_time*10000); // the sampling time is read from CDB // m_senderThread->setSleepTime(0); // set to 0 // m_senderThread->setResponseTime(50000000); } // if (CORBA::is_nil(m_antennaBoss)) // { // cout <<"ABOSS NOT REFERENCED " << endl; // // } else // { // cout <<"ABOSS REFERENCED " << endl; // // } // Loading Loading @@ -283,6 +254,19 @@ void HolographyImpl::sendHeader() throw (CORBA::SystemException, BackendsErrors: cout<< "unknown except" <<endl; } try{ cout << "**Correlator reset**"<< endl; m_correlator->reset(); }catch (ComponentErrors::ComponentErrorsExImpl& ex) { ex.log(LM_DEBUG); throw ex.getComponentErrorsEx(); } catch (BackendsErrors::BackendsErrorsExImpl& ex) { ex.log(LM_DEBUG); throw ex.getBackendsErrorsEx(); } Loading @@ -290,6 +274,71 @@ void HolographyImpl::sendHeader() throw (CORBA::SystemException, BackendsErrors: } void HolographyImpl::sendHeader() throw (CORBA::SystemException, BackendsErrors::BackendsErrorsEx, ComponentErrors::ComponentErrorsEx) { AUTO_TRACE("HolographyImpl::sendHeader()"); if (m_filename.empty()) { m_filename="/archive/data/holography/holo"; } THeaderRecord bkd; //header for fitswriter bkd.header.sections=2; bkd.header.beams=1; //resultingSampleRate(m_integration,m_commonSampleRate,intTime); //bkd.integration=intTime; bkd.header.integration=25; bkd.header.sampleSize=50; bkd.header.noData=true; long index=0; for (int i=0;i<bkd.header.sections;i++) { if (index<MAX_SECTION_NUMBER) { bkd.chHeader[index].id=i; bkd.chHeader[index].bins=0.; bkd.chHeader[index].polarization=Backends::BKND_LCP; bkd.chHeader[index].bandWidth=0; bkd.chHeader[index].frequency=11533; bkd.chHeader[index].attenuation[0]=0.; // we have always one inputs....so just the first position is significant bkd.chHeader[index].attenuation[1]=0.0; // not significant....placeholder bkd.chHeader[index].IF[0]=0; bkd.chHeader[index].IF[1]=0; // not significant bkd.chHeader[index].sampleRate=5000000; bkd.chHeader[index].feed=i; bkd.chHeader[index].inputs=1; index++; } } try { getSender()->startSend(FLOW_NUMBER,(const char*)&bkd, sizeof(Backends::TMainHeader)+bkd.header.sections*sizeof(Backends::TSectionHeader)); } catch (AVStartSendErrorExImpl& ex) { _ADD_BACKTRACE(BackendsErrors::TXErrorExImpl,impl,ex,"HolographyImpl::sendHeader()"); impl.setDetails("main header could not be sent"); impl.log(LM_DEBUG); throw impl.getBackendsErrorsEx(); } catch (...) { _EXCPT(ComponentErrors::UnexpectedExImpl,impl,"HolographyImpl::sendHeader()"); impl.log(LM_DEBUG); throw impl.getComponentErrorsEx(); } } void HolographyImpl::sendData(ACS::Time startTime) throw (CORBA::SystemException, BackendsErrors::BackendsErrorsEx, ComponentErrors::ComponentErrorsEx) Loading @@ -297,7 +346,13 @@ void HolographyImpl::sendData(ACS::Time startTime) throw (CORBA::SystemException double az,el; TIMEVALUE now; AUTO_TRACE("HolographyImpl::sendData()"); try{ cout << "**Correlator OpenFile**"<< endl; m_correlator->openFile(m_filename.c_str()); // m_correlator->save_coeff(az,el); IRA::CIRATools::getTime(now); Loading Loading @@ -362,27 +417,45 @@ void HolographyImpl::sendStop() throw (CORBA::SystemException, BackendsErrors::B az=-0.69; el=0.55; } // m_correlator->save_coord(az,el); } try{ void HolographyImpl::terminate() throw (CORBA::SystemException, BackendsErrors::BackendsErrorsEx, ComponentErrors::ComponentErrorsEx) m_correlator->closeFile(); } catch (ComponentErrors::ComponentErrorsExImpl& ex) { AUTO_TRACE("HolographyImpl::terminate()"); ex.log(LM_DEBUG); throw ex.getComponentErrorsEx(); } catch (BackendsErrors::BackendsErrorsExImpl& ex) { ex.log(LM_DEBUG); throw ex.getBackendsErrorsEx(); } try { getSender()->stopSend(FLOW_NUMBER); } catch (AVStopSendErrorExImpl& ex) { _ADD_BACKTRACE(BackendsErrors::TXErrorExImpl,impl,ex,"HolographyImpl::sendStop()"); impl.setDetails("stop message could not be sent"); throw impl.getBackendsErrorsEx(); } catch (...) { _EXCPT(ComponentErrors::UnexpectedExImpl,impl,"HolographyImpl::sendStop()"); throw impl.getComponentErrorsEx(); } getContainerServices()->releaseComponent(m_correlator->name()); } catch(maciErrType::CannotReleaseComponentExImpl &ex) { ACS_LOG(LM_FULL_INFO,"HolographyImpl::terminate()",(LM_ERROR ,"CannotReleaseComponentExImpl")); ex.log(LM_DEBUG); } void HolographyImpl::terminate() throw (CORBA::SystemException, BackendsErrors::BackendsErrorsEx, ComponentErrors::ComponentErrorsEx) { AUTO_TRACE("HolographyImpl::terminate()"); } Loading @@ -393,7 +466,16 @@ void HolographyImpl::terminate() throw (CORBA::SystemException, BackendsErrors:: void HolographyImpl::initialize(const char * configuration) throw (CORBA::SystemException, ComponentErrors::ComponentErrorsEx,BackendsErrors::BackendsErrorsEx) { { try{ m_correlator->closeFile(); } catch (ComponentErrors::ComponentErrorsExImpl& ex) { ex.log(LM_DEBUG); throw ex.getComponentErrorsEx(); } catch (BackendsErrors::BackendsErrorsExImpl& ex) { ex.log(LM_DEBUG); throw ex.getBackendsErrorsEx(); } AUTO_TRACE("HolographyImpl::initialize()"); Loading Loading @@ -433,7 +515,18 @@ void HolographyImpl::deleteAll() } try { getContainerServices()->releaseComponent(m_correlator->name()); } catch(maciErrType::CannotReleaseComponentExImpl &ex) { ACS_LOG(LM_FULL_INFO,"HolographyImpl::terminate()",(LM_ERROR ,"CannotReleaseComponentExImpl")); ex.log(LM_DEBUG); } } Loading Loading @@ -518,15 +611,6 @@ void HolographyImpl::activateNoiseCalibrationSwitching(CORBA::Long interleave) t } //char * HolographyImpl::command(const char *configCommand) throw (CORBA::SystemException,ManagementErrors::CommandLineErrorEx) //{ // AUTO_TRACE("HolographyImpl::command()"); // IRA::CString out; // IRA::CString in; // bool error; // return CORBA::string_dup((const char *)out); //} void HolographyImpl::setSection(CORBA::Long input,CORBA::Double freq,CORBA::Double bw,CORBA::Long feed,CORBA::Long pol,CORBA::Double sr,CORBA::Long bins) throw ( CORBA::SystemException,ComponentErrors::ComponentErrorsEx,BackendsErrors::BackendsErrorsEx) Loading @@ -542,6 +626,14 @@ void HolographyImpl::setIntegration(CORBA::Long Integration) throw (CORBA::Syste } void HolographyImpl::setTargetFileName (const char * fileName) throw (CORBA::SystemException,ComponentErrors::ComponentErrorsEx, BackendsErrors::BackendsErrorsEx) { // nothing to do } _PROPERTY_REFERENCE_CPP(HolographyImpl,ACS::ROuLongLong,m_ptime,time); _PROPERTY_REFERENCE_CPP(HolographyImpl,ACS::ROstring,m_pbackendName,backendName); _PROPERTY_REFERENCE_CPP(HolographyImpl,ACS::ROdoubleSeq,m_pbandWidth,bandWidth); Loading
Common/Servers/HolographyBackend/src/Makefile +1 −1 Original line number Diff line number Diff line Loading @@ -132,7 +132,7 @@ tttlll_OBJECTS = # # Configuration Database Files # ---------------------------- CDB_SCHEMAS = Holography DigitalXCorrelator # CDB_SCHEMAS = Holography DigitalXCorrelator # # IDL Files and flags Loading