Commit c33b8af2 authored by Sergio Poppi's avatar Sergio Poppi
Browse files

hologr BE: new file on sendData

parent 05fd874d
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -50,6 +50,7 @@
#include <AntennaBossC.h>
#include "Configuration.h"

#include <string>


//#include "CommandLine.h"
@@ -474,6 +475,7 @@ private:

 	bool m_initialized;
//	SimpleParser::CParser<CCommandLine> * m_parser;
        std::string m_filename;
        
	CConfiguration m_configuration;
	CSenderThread *m_senderThread;
+12 −8
Original line number Diff line number Diff line
@@ -42,6 +42,7 @@ import ACSErrTypeFPGAConnectionImpl
import ACSErrTypeFPGACommunicationImpl
import ComponentErrorsImpl
import Acspy.Util.ACSCorba
import BackendsErrorsImpl



@@ -187,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:
@@ -195,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    
@@ -203,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())
@@ -230,7 +231,7 @@ 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):
           
@@ -253,13 +254,16 @@ class DigitalXCorrelator(DXC__POA.DigitalXCorrelator, ACSComponent, ContainerSer
            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 ACSErrTypeFPGACommunicationImpl.CannotRunExImpl()
            raise BackendErrorsImpl.BackendBusyImpl()
        
 No newline at end of file
+127 −113
Original line number Diff line number Diff line
@@ -161,6 +161,11 @@ void HolographyImpl::initialize() throw (ACSErr::ACSbaseExImpl)
                throw ex.getComponentErrorsEx();
        }

 
  
          
          
        
}

void HolographyImpl::execute() throw (ACSErr::ACSbaseExImpl)
@@ -185,38 +190,7 @@ void HolographyImpl::execute() throw (ACSErr::ACSbaseExImpl)
                throw ex.getComponentErrorsEx();
        }


 
}


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)
                {
                        m_antennaBoss=getContainerServices()->getDefaultComponent<Antenna::AntennaBoss>(ANTENNA_BOSS_INTERFACE);
                        m_sender_thread_param.antennaBoss=m_antennaBoss;
                } 
            } catch (std::bad_alloc& ex) {
		_EXCPT(ComponentErrors::MemoryAllocationExImpl,dummy,"HolographyImpl::sendHeader()");
		
		throw dummy;
	}catch (ComponentErrors::ComponentErrorsExImpl& ex) {
                ex.log(LM_DEBUG);
                throw ex.getComponentErrorsEx();
        }

*/
	try{


               DWORD sampling_time;
                m_correlator->reset();
               sampling_time=m_configuration.getSamplingTime(); 
                cout << "***********************************************" << endl;
                cout << "samplingTime:" << sampling_time;
@@ -226,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
@@ -235,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;
// 	
// 	}
// 	




@@ -294,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();   
          }
         



@@ -301,6 +274,29 @@ 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";
         
        
        }
        
	 
  
          
          
          
          
}
               



void HolographyImpl::sendData(ACS::Time startTime) throw (CORBA::SystemException, BackendsErrors::BackendsErrorsEx,
			ComponentErrors::ComponentErrorsEx)
@@ -308,7 +304,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);

@@ -373,7 +375,18 @@ void HolographyImpl::sendStop() throw (CORBA::SystemException, BackendsErrors::B
		 	az=-0.69; 
			el=0.55;
		}
//	m_correlator->save_coord(az,el);
             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(); 
                }     
}

void HolographyImpl::terminate() throw (CORBA::SystemException, BackendsErrors::BackendsErrorsEx,
@@ -381,18 +394,8 @@ void HolographyImpl::terminate() throw (CORBA::SystemException, BackendsErrors::
{
	AUTO_TRACE("HolographyImpl::terminate()");
        
	try {
       
		getContainerServices()->releaseComponent(m_correlator->name());
	} catch(maciErrType::CannotReleaseComponentExImpl &ex)
	
	{
		ACS_LOG(LM_FULL_INFO,"HolographyImpl::terminate()",(LM_ERROR
		,"CannotReleaseComponentExImpl"));
		ex.log(LM_DEBUG);


	}
	 
	
	
@@ -404,7 +407,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()");


@@ -444,7 +456,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);


        }


}
@@ -529,15 +552,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)
+1 −1
Original line number Diff line number Diff line
@@ -83,7 +83,7 @@ void CSenderThread::runLoop()

	 catch(...)
	{
	   ACS_LOG(LM_FULL_INFO,"CSenderThread::runLoop()",(LM_ERROR,"SenderThread runLopp DXC unknown except"));
	   ACS_LOG(LM_FULL_INFO,"CSenderThread::runLoop()",(LM_ERROR,"SenderThread runloop DXC unknown except"));
	
	}