Commit 44f5661b authored by SRT Operator's avatar SRT Operator
Browse files

Roach integration

parent dcd51fef
Loading
Loading
Loading
Loading
+9 −4
Original line number Diff line number Diff line
@@ -72,7 +72,8 @@ public:
	 * Call this function to get the number of inputs
	 * In this implementation the inputs number is the same of the number of section (SIMPLE_SECTION)
	 */
	inline void getInputsNumber(long &in) const { in=m_sectionsNumber; }
	//inline void getInputsNumber(long &in) const { in=m_sectionsNumber; }
	inline void getInputsNumber(long &in) const { in=m_rfInputs; }
		
	/**
	 * Call this function to get the milliseconds of integration time
@@ -291,7 +292,7 @@ public:
	 * @throw ComponentErrors::NotAllowedExImpl
	 */	
	void stopDataAcquisition() throw (BackendsErrors::ConnectionExImpl,BackendsErrors::NakExImpl,
			ComponentErrors::SocketErrorExImpl,ComponentErrors::TimeoutExImpl,ComponentErrors::NotAllowedExImpl);
			ComponentErrors::SocketErrorExImpl,ComponentErrors::TimeoutExImpl,ComponentErrors::NotAllowedExImpl,BackendsErrors::BackendFailExImpl);
	
	/**
	 * This function will stop the current acquisition job without caring about the component or the backend status
@@ -319,7 +320,7 @@ public:
	 * @return the epoch of the real expected start time.
	 */
	ACS::Time resumeDataAcquisition(const ACS::Time& startT) throw (BackendsErrors::ConnectionExImpl,ComponentErrors::NotAllowedExImpl,
		BackendsErrors::NakExImpl,ComponentErrors::SocketErrorExImpl,ComponentErrors::TimeoutExImpl);
		BackendsErrors::NakExImpl,ComponentErrors::SocketErrorExImpl,ComponentErrors::TimeoutExImpl,BackendsErrors::BackendFailExImpl);
	
	/**
	 * This function will suspend the data acquisition job.
@@ -331,7 +332,7 @@ public:
	 * @throw ComponentErrors::NotAllowedExImpl
	 */
	void suspendDataAcquisition() throw (BackendsErrors::ConnectionExImpl,ComponentErrors::NotAllowedExImpl,
			BackendsErrors::NakExImpl,ComponentErrors::SocketErrorExImpl,ComponentErrors::TimeoutExImpl);
			BackendsErrors::NakExImpl,ComponentErrors::SocketErrorExImpl,ComponentErrors::TimeoutExImpl,BackendsErrors::BackendFailExImpl);
	
	/**
	 * Called to get a single measure of the total power for each in channel. The measure is done by the slow mode of the backend
@@ -639,6 +640,10 @@ private:
	 */
	double m_tpiZero[MAX_SECTION_NUMBER];

    long m_rfInputs;

    double m_filter;
	
	/**
	 * Pointer to the configuration table, every record of the table stores a possible backend setup.
	 */
+104 −27
Original line number Diff line number Diff line
@@ -128,6 +128,7 @@ void CCommandLine::Init(CConfiguration *config) throw (ComponentErrors::SocketEr
		}
	} */	

    /* After the first connection, the server send the protocol version string */
    res=receiveBuffer(rBuff,RECBUFFERSIZE);
    //printf("connect = %s\n", rBuff);

@@ -153,7 +154,7 @@ void CCommandLine::Init(CConfiguration *config) throw (ComponentErrors::SocketEr
}

void CCommandLine::stopDataAcquisition() throw (BackendsErrors::ConnectionExImpl,BackendsErrors::NakExImpl,
		ComponentErrors::SocketErrorExImpl,ComponentErrors::TimeoutExImpl,ComponentErrors::NotAllowedExImpl)
		ComponentErrors::SocketErrorExImpl,ComponentErrors::TimeoutExImpl,ComponentErrors::NotAllowedExImpl,BackendsErrors::BackendFailExImpl)
{
	AUTO_TRACE("CCommandLine::stopDataAcquisition()");
	Message reply = sendBackendCommand(Command::stop());
@@ -183,7 +184,7 @@ void CCommandLine::startDataAcquisition() throw (BackendsErrors::BackendBusyExIm
}

ACS::Time CCommandLine::resumeDataAcquisition(const ACS::Time& startT) throw (BackendsErrors::ConnectionExImpl,ComponentErrors::NotAllowedExImpl,
		BackendsErrors::NakExImpl,ComponentErrors::SocketErrorExImpl,ComponentErrors::TimeoutExImpl)
		BackendsErrors::NakExImpl,ComponentErrors::SocketErrorExImpl,ComponentErrors::TimeoutExImpl,BackendsErrors::BackendFailExImpl)
{
	TIMEVALUE now;
	TIMEVALUE epoch;
@@ -221,9 +222,9 @@ ACS::Time CCommandLine::resumeDataAcquisition(const ACS::Time& startT) throw (Ba
	else {
		expectedTime=epoch.value().value;
	}
	if (!checkConnection()) {
	/*if (!checkConnection()) {
		_THROW_EXCPT(BackendsErrors::ConnectionExImpl,"CCommandLine::resumeDataAcquisition()");
	}
	}*/
    Message request = Command::start();
    Message reply = sendBackendCommand(request);
    if(reply.is_success_reply()) {
@@ -234,7 +235,7 @@ ACS::Time CCommandLine::resumeDataAcquisition(const ACS::Time& startT) throw (Ba
}

void CCommandLine::suspendDataAcquisition() throw (BackendsErrors::ConnectionExImpl,ComponentErrors::NotAllowedExImpl,
			BackendsErrors::NakExImpl,ComponentErrors::SocketErrorExImpl,ComponentErrors::TimeoutExImpl)
			BackendsErrors::NakExImpl,ComponentErrors::SocketErrorExImpl,ComponentErrors::TimeoutExImpl,BackendsErrors::BackendFailExImpl)
{
	AUTO_TRACE("CCommandLine::suspendDataAcquisition()");
	/*if ((m_backendStatus & (1 << SUSPEND)) || !getIsBusy()) { //not suspended....running
@@ -242,7 +243,11 @@ void CCommandLine::suspendDataAcquisition() throw (BackendsErrors::ConnectionExI
		impl.setReason("transfer job cannot be suspended in present configuration");
		throw impl;
	}*/
    	Message reply = sendBackendCommand(Command::stop());
    /*if (!checkConnection()) {
		_THROW_EXCPT(BackendsErrors::ConnectionExImpl,"CCommandLine::suspendDataAcquisition()");
	}*/
    Message request = Command::stop();
    Message reply = sendBackendCommand(request);
    if(reply.is_success_reply()) {
        ACS_LOG(LM_FULL_INFO,"CCommandLine::suspendDataAcquisition()",(LM_INFO,"TRANSFER_JOB_SUSPENDED"));
		setStatusField(SUSPEND);
@@ -455,9 +460,10 @@ void CCommandLine::setConfiguration(const long& inputId,const double& freq,const
    else
        newBins = m_bins[inputId];
    
    /*
	if (!checkConnection()) {
		_THROW_EXCPT(BackendsErrors::ConnectionExImpl,"CCommandLine::setConfiguration()");
	}
	}*/


	//len=CProtocol::setConfiguration(sBuff,inputId,m_input[inputId],newAtt,newBW,m_boards); // get the buffer
@@ -894,45 +900,53 @@ void CCommandLine::setDefaultConfiguration(const IRA::CString & config) throw (C
	ACS_LOG(LM_FULL_INFO,"CCommandLine::setDefaultConfiguration()",(LM_INFO,"DEFAULTS_ARE_SET"));
    */
    if (config.Compare("RK00")==0) {
        filter=1250.0;
        m_filter=1250.0;
        m_rfInputs=2;
        m_RK00=true;
        m_RC00=m_RL00=m_RP00=m_RK00S=m_RC00S=m_RL00S=m_RP00S=false;
    }
    if (config.Compare("RC00")==0) {
        filter=1250.0;
        m_filter=1250.0;
        m_rfInputs=2;
        m_RC00=true;
        m_RK00=m_RL00=m_RP00=m_RK00S=m_RC00S=m_RL00S=m_RP00S=false;
    }
    if (config.Compare("RL00")==0) {
        filter = 2300.0;
        m_filter = 2300.0;
        m_rfInputs=2;
        m_RL00=true;
        m_RK00=m_RC00=m_RP00=m_RK00S=m_RC00S=m_RL00S=m_RP00S=false;
    }
    if (config.Compare("RP00")==0) {
        filter = 730.0;
        m_filter = 730.0;
        m_rfInputs=2;
        m_RP00=true;
        m_RK00=m_RC00=m_RL00=m_RK00S=m_RC00S=m_RL00S=m_RP00S=false;
    }
    if (config.Compare("RK00S")==0) {
        filter=1250.0;
        m_filter=1250.0;
        m_rfInputs=2;
        m_RK00S=true;
        m_RC00=m_RL00=m_RP00=m_RK00=m_RC00S=m_RL00S=m_RP00S=false;
    }
    if (config.Compare("RC00S")==0) {
        filter=1250.0;
        m_filter=1250.0;
        m_rfInputs=2;
        m_RC00S=true;
        m_RK00=m_RL00=m_RP00=m_RK00S=m_RC00=m_RL00S=m_RP00S=false;
    }
    if (config.Compare("RL00S")==0) {
        filter = 2300.0;
        m_filter = 2300.0;
        m_rfInputs=2;
        m_RL00S=true;
        m_RK00=m_RC00=m_RP00=m_RK00S=m_RC00S=m_RL00=m_RP00S=false;
    }
    if (config.Compare("RP00S")==0) {
        filter = 730.0;
        m_filter = 730.0;
        m_rfInputs=2;
        m_RP00S=true;
        m_RK00=m_RC00=m_RL00=m_RK00S=m_RC00S=m_RL00S=m_RP00S=false;
    }
    }/*
    try {
        m_totalPower->setSection(0,-1, filter, -1, -1, -1, -1);
        m_totalPower->setSection(1,-1, filter, -1, -1, -1, -1);
@@ -940,7 +954,7 @@ void CCommandLine::setDefaultConfiguration(const IRA::CString & config) throw (C
    catch (...) {
        _EXCPT(ComponentErrors::UnexpectedExImpl,impl,"CCommandLine::setDefaultConfiguration()");
        impl.log(LM_ERROR);
    }
    }*/
}

void CCommandLine::setTargetFileName(const char *conf)
@@ -993,6 +1007,8 @@ void CCommandLine::setup(const char *conf) throw (BackendsErrors::BackendBusyExI
		ComponentErrors::SocketErrorExImpl,BackendsErrors::NakExImpl,ComponentErrors::CDBAccessExImpl,BackendsErrors::MalformedAnswerExImpl,BackendsErrors::ReplyNotValidExImpl,BackendsErrors::BackendFailExImpl)
{
	AUTO_TRACE("CCommandLine::setup()");
    double filter;

/*	if (getIsBusy()) {
		_EXCPT(BackendsErrors::BackendBusyExImpl,impl,"CCommandLine::setup()");
		throw impl;
@@ -1008,6 +1024,59 @@ void CCommandLine::setup(const char *conf) throw (BackendsErrors::BackendBusyExI
	else {
		ACS_LOG(LM_FULL_INFO,"CCommandLine::setup()",(LM_NOTICE,"BACKEND_ROACH2_INITIALIZATION ERROR, CONFIGURATION: %s",conf)); 
	}

    setDefaultConfiguration(conf);

    /*
    if (strcpy(conf,"RK00")) {
        filter=1250.0;
        m_RK00=true;
        m_RC00=m_RL00=m_RP00=m_RK00S=m_RC00S=m_RL00S=m_RP00S=false;
    }
    if (strcpy(conf,"RC00")) {
        filter=1250.0;
        m_RC00=true;
        m_RK00=m_RL00=m_RP00=m_RK00S=m_RC00S=m_RL00S=m_RP00S=false;
    }
    if (strcpy(conf,"RL00")) {
        filter = 2300.0;
        m_RL00=true;
        m_RK00=m_RC00=m_RP00=m_RK00S=m_RC00S=m_RL00S=m_RP00S=false;
    }
    if (strcpy(conf,"RP00")) {
        filter = 730.0;
        m_RP00=true;
        m_RK00=m_RC00=m_RL00=m_RK00S=m_RC00S=m_RL00S=m_RP00S=false;
    }
    if (strcpy(conf,"RK00S")) {
        filter=1250.0;
        m_RK00S=true;
        m_RC00=m_RL00=m_RP00=m_RK00=m_RC00S=m_RL00S=m_RP00S=false;
    }
    if (strcpy(conf,"RC00S")) {
        filter=1250.0;
        m_RC00S=true;
        m_RK00=m_RL00=m_RP00=m_RK00S=m_RC00=m_RL00S=m_RP00S=false;
    }
    if (strcpy(conf,"RL00S")) {
        filter = 2300.0;
        m_RL00S=true;
        m_RK00=m_RC00=m_RP00=m_RK00S=m_RC00S=m_RL00=m_RP00S=false;
    }
    if (strcpy(conf,"RP00S")) {
        filter = 730.0;
        m_RP00S=true;
        m_RK00=m_RC00=m_RL00=m_RK00S=m_RC00S=m_RL00S=m_RP00S=false;
    }*/

    try {
        m_totalPower->setSection(0,-1, m_filter, -1, -1, -1, -1);
        m_totalPower->setSection(1,-1, m_filter, -1, -1, -1, -1);
    }
    catch (...) {
        _EXCPT(ComponentErrors::UnexpectedExImpl,impl,"CCommandLine::setDefaultConfiguration()");
        impl.log(LM_ERROR);
    }
	/*try {
		setDefaultConfiguration(conf);
	}
@@ -1392,18 +1461,23 @@ void CCommandLine::fillMainHeader(Backends::TMainHeader& bkd)
void CCommandLine::fillChannelHeader(Backends::TSectionHeader *chHr,const long& size)
{
	long index=0;
	for (int i=0;i<m_sectionsNumber;i++) {
	//for (int i=0;i<m_sectionsNumber;i++) {
	for (int i=0;i<m_rfInputs;i++) {
                printf("i = %d\n", i);
		if (m_enabled[i]) {
			if (index<size) {
				chHr[index].id=i;
				chHr[index].bins=m_bins[i];
				chHr[index].polarization=m_polarization[i];
                printf("pol = %d\n", m_polarization[i]);
				chHr[index].bandWidth=m_bandWidth[i];
				chHr[index].frequency=m_frequency[i];
				chHr[index].attenuation[0]=m_attenuation[i]; // we have always one inputs....so just the first position is significant
				chHr[index].attenuation[1]=0.0;  // not significant....placeholder				
				chHr[index].IF[0]=m_ifNumber[i];
				chHr[index].IF[1]=0;  // not significant
				//chHr[index].IF[0]=0;
				chHr[index].IF[1]=1;  // not significant
				//chHr[index].IF[1]=0;  // not significant
				chHr[index].sampleRate=/*m_sampleRate[i];*/m_commonSampleRate;
				chHr[index].feed=m_feedNumber[i];
				chHr[index].inputs=1;	
@@ -1575,7 +1649,7 @@ Message
CCommandLine::sendBackendCommand(Message request)
{
	if (!checkConnection()) {
		_THROW_EXCPT(BackendsErrors::ConnectionExImpl,"CCommandLine::startDataAcquisition()");
		_THROW_EXCPT(BackendsErrors::ConnectionExImpl,"CCommandLine::sendBackendCommand()");
	}
	char sBuff[SENDBUFFERSIZE];
	char rBuff[RECBUFFERSIZE];
@@ -1817,6 +1891,9 @@ bool CCommandLine::initializeConfiguration(const IRA::CString & config) throw (C
	else {
		return false;
	}
    //if (config.Compare("RC00")==0)
    //    m_rfInputs=2;

	// Common configurations.......
	m_integration=DEFAULT_INTEGRATION;  // integration if by default zero...that means the 1/samplerate is the real integration time
	m_currentSampleRate=m_integration;  // this is given in milliseconds as sample period
+2 −2
Original line number Diff line number Diff line
@@ -463,7 +463,7 @@ void RoachImpl::sendStop() throw (CORBA::SystemException, BackendsErrors::Backen
	AUTO_TRACE("RoachImpl::sendStop()");

	CSecAreaResourceWrapper<CCommandLine> line=m_commandLine->Get();
	/*try {
	try {
		line->suspendDataAcquisition(); 
	}
	catch (ComponentErrors::ComponentErrorsExImpl& ex) {
@@ -478,7 +478,7 @@ void RoachImpl::sendStop() throw (CORBA::SystemException, BackendsErrors::Backen
		_EXCPT(ComponentErrors::UnexpectedExImpl,dummy,"RoachImpl::sendStop()");
		dummy.log(LM_DEBUG);
		throw dummy.getComponentErrorsEx();
	}*/
	}
	//I explicity release the mutex before accessing the sender thread because it also make use of the command line...just to make sure to avoid deadlock
	//line.Release();
	//m_senderThread->suspendTransfer();