Commit 3eb006da authored by Matteo DB's avatar Matteo DB
Browse files

mixer conf revire +exc

parent aadc8421
Loading
Loading
Loading
Loading
+17 −12
Original line number Diff line number Diff line
@@ -20,7 +20,7 @@ class MixerOperator{
         * @param p_config Component's config ref
         * @param p_services 
         */
        MixerOperator(CConfiguration & p_config );
        MixerOperator();

        /**
         * @brief Destroy the Mixer Operator object
@@ -32,6 +32,11 @@ class MixerOperator{
        */
        void setServices(maci::ContainerServices * p_services);

        /**
         * @brief Set laoded configuration 
         */
        void setConfigurations(CConfiguration * p_confs);

        /**
        * @brief
        */
@@ -119,8 +124,8 @@ class MixerOperator{
			
    private:
        
        CConfiguration & m_configuration;   /**< Reference to component's config */
		maci::ContainerServices * m_services; /**< maci service */
        CConfiguration * m_configuration;   /**< Reference to component's config */
        bool m_init_ok; /**< Init part completed flag */
        bool m_mixer_fault; /**< Flag indicating some faults on LO devices */
        double m_current_value; /**< memo current value seen from user */
+2 −0
Original line number Diff line number Diff line
@@ -64,6 +64,8 @@ CConfiguration const * const CComponentCore::execute() throw (ComponentErrors::
        _EXCPT(ComponentErrors::SocketErrorExImpl,dummy,"CComponentCore::execute()");
        throw dummy;
    }
    /* Pass conf to mixer */
    m_mixer.setConfigurations(m_configuration);
    MED_TRACE_MSG(" OUT ");
    return &m_configuration;
}
+8 −8
Original line number Diff line number Diff line
@@ -94,14 +94,14 @@ void CConfiguration::init(maci::ContainerServices *Services)
	_GET_DWORD_ATTRIBUTE("RepetitionCacheTime","Log repetition filter, caching time (uSec):",m_repetitionCacheTime,"");
	_GET_DWORD_ATTRIBUTE("RepetitionExpireTime","Log repetition filter, expire time (uSec):",m_repetitionExpireTime,"");	
	/** TEST */
	fprintf(stderr, "---- CONF ----" );
	fprintf(stderr, "LO 1st %s \n", (const char*)m_localOscillatorInstance1st);
	fprintf(stderr, "LO 2st %s \n", (const char*)m_localOscillatorInstance2nd);
	fprintf(stderr, "LNA address %S \n", (const char*)m_LNAIPAddress);
	fprintf(stderr, "LNA port %u \n", m_LNAPort);
	fprintf(stderr, "Dewar address %S \n", (const char*)m_dewarIPAddress);
	fprintf(stderr, "Dewar port %u \n", m_dewarPort);
	fprintf(stderr, "---- * ----" );
	MED_TRACE_MSG("---- CONF ----" );
	MED_TRACE_FMT( "LO 1st %s \n", (const char*)m_localOscillatorInstance1st);
	MED_TRACE_FMT( "LO 2st %s \n", (const char*)m_localOscillatorInstance2nd);
	MED_TRACE_FMT( "LNA address %S \n", (const char*)m_LNAIPAddress);
	MED_TRACE_FMT( "LNA port %u \n", m_LNAPort);
	MED_TRACE_FMT( "Dewar address %S \n", (const char*)m_dewarIPAddress);
	MED_TRACE_FMT( "Dewar port %u \n", m_dewarPort);
	MED_TRACE_FMT( "---- * ----" );
	/* END TEST */	
	/* Get available configurations, access every conf file, filling associated parameters struct */	
	const std::vector<ReceiverConfHandler::ConfigurationName> l_available_confs= m_conf_hnd.getAvailableConfs();
+73 −28
Original line number Diff line number Diff line
@@ -12,11 +12,11 @@
 * Inserire nel modulo ComponetCore e verificare che sia tutto ok
 */

MixerOperator::MixerOperator(CConfiguration & p_config):
    m_configuration(p_config)
MixerOperator::MixerOperator()
{
	MED_TRACE();
	m_services= NULL;
    m_configuration= NULL;
    m_loDev_1st= Receivers::LocalOscillator::_nil();
    m_loDev_2nd= Receivers::LocalOscillator::_nil();
    m_current_value= 0.0;
@@ -35,6 +35,10 @@ void MixerOperator::setServices(maci::ContainerServices * p_services)
	m_services= p_services;
}	

void MixerOperator::setConfigurations(CConfiguration * p_confs){
    m_configuration= p_confs;
}

bool MixerOperator::isLoaded() const
{
  return m_init_ok; 	
@@ -50,17 +54,25 @@ void MixerOperator::loadComponents()
                    (LM_NOTICE,"LOs already actives"));
        return;
    }        
    const char * m_1st_name= m_configuration.getLocalOscillatorInstance1st();
    const char * m_2nd_name= m_configuration.getLocalOscillatorInstance2nd();             
    if (! m_configuration ){
        ACS_LOG(LM_FULL_INFO,"MixerOperator::loadComponents()",
                    (LM_NOTICE,"LOs configuration not provided!"));
        _ADD_BACKTRACE(ReceiversErrors::LocalOscillatorErrorExImpl,impl,ex,"MixerOperator::setLO()");
        throw impl;
    }    
    const char * m_1st_name= m_configuration->getLocalOscillatorInstance1st();
    const char * m_2nd_name= m_configuration->getLocalOscillatorInstance2nd();             
    /* TEST */
    fprintf(stderr,"LO 1 : %s", m_1st_name);
    fprintf(stderr,"LO 2 : %s", m_2nd_name);
    MED_TRACE_FMT("LO 1 : %s", m_1st_name);
    MED_TRACE_FMT("LO 2 : %s", m_2nd_name);
    try{           
        loadDevice(m_loDev_1st, m_1st_name);
        loadDevice(m_loDev_2nd, m_2nd_name);
    }catch(...){
        ACS_LOG(LM_FULL_INFO,"MixerOperator::loadComponents()",
                    (LM_NOTICE,"LOs not ready to be set"));
                    (LM_NOTICE,"LOs loading failed!"));
        _ADD_BACKTRACE(ReceiversErrors::LocalOscillatorErrorExImpl,impl,ex,"MixerOperator::setLO()");
        throw impl;
    }
#else
    	#warning "Excluding mixer.."
@@ -72,14 +84,26 @@ void MixerOperator::loadComponents()

void MixerOperator::releaseComponents()
{
#ifndef EXCLUDE_MIXER
    if (! m_configuration ){
        ACS_LOG(LM_FULL_INFO,"MixerOperator::loadComponents()",
                    (LM_NOTICE,"LOs configuration not provided!"));
        _ADD_BACKTRACE(ReceiversErrors::LocalOscillatorErrorExImpl,impl,ex,"MixerOperator::setLO()");
        throw impl;
    }
    const char * m_1st_name= m_configuration->getLocalOscillatorInstance1st();
    const char * m_2nd_name= m_configuration->getLocalOscillatorInstance2nd();
    try{        
	const char * m_1st_name= m_configuration.getLocalOscillatorInstance1st();
    const char * m_2nd_name= m_configuration.getLocalOscillatorInstance2nd();
        releaseDevice(m_loDev_1st, m_1st_name);
        releaseDevice(m_loDev_2nd, m_2nd_name);
    }catch(...){
       MED_TRACE_MSG(" Failed to release LOs ");  
       ACS_LOG(LM_FULL_INFO,"MixerOperator::loadComponents()",
                    (LM_NOTICE,"LOs release failed!"));
        _ADD_BACKTRACE(ReceiversErrors::LocalOscillatorErrorExImpl,impl,ex,"MixerOperator::setLO()");
        throw impl;
    }
#else
#endif
    m_init_ok= false;
}

@@ -97,6 +121,12 @@ bool MixerOperator::setValue(const ACS::doubleSeq& p_values)
		MED_TRACE_MSG(" EXCP devices not found ");                    
        return false;
    }             
    if (! m_configuration ){
        ACS_LOG(LM_FULL_INFO,"MixerOperator::loadComponents()",
                    (LM_NOTICE,"LOs configuration not provided!"));
        _ADD_BACKTRACE(ReceiversErrors::LocalOscillatorErrorExImpl,impl,ex,"MixerOperator::setLO()");
        throw impl;
    }
    /**/
    double trueValue,amp;
    double *freq=NULL;
@@ -132,7 +162,7 @@ bool MixerOperator::setValue(const ACS::doubleSeq& p_values)
	MED_TRACE_MSG(" calculate value ");
    //computes the synthesizer settings
    trueValue= p_values[0]+l_setup.m_fixedLO2[0];
    size= m_configuration.getSynthesizerTable(freq,power);
    size= m_configuration->getSynthesizerTable(freq,power);
    amp= round(Helpers::linearFit(freq,power,size,trueValue));
    if (power) delete [] power;
    if (freq) delete [] freq;
@@ -182,9 +212,24 @@ double MixerOperator::getValue()
bool MixerOperator::isLocked()
{
#ifndef EXCLUDE_MIXER
    bool l_1st_lock= isDeviceLocked(m_loDev_1st, (const char *)m_configuration.getLocalOscillatorInstance1st());
	bool l_2nd_lock= isDeviceLocked(m_loDev_2nd, (const char *)m_configuration.getLocalOscillatorInstance2nd());
    if (! m_configuration ){
        ACS_LOG(LM_FULL_INFO,"MixerOperator::loadComponents()",
                    (LM_NOTICE,"LOs configuration not provided!"));
        _ADD_BACKTRACE(ReceiversErrors::LocalOscillatorErrorExImpl,impl,ex,"MixerOperator::setLO()");
        throw impl;
    }
	const char * m_1st_name= m_configuration->getLocalOscillatorInstance1st();
    const char * m_2nd_name= m_configuration->getLocalOscillatorInstance2nd();       
    try{
        bool l_1st_lock= isDeviceLocked(m_loDev_1st, m_1st_name);
        bool l_2nd_lock= isDeviceLocked(m_loDev_2nd, m_2nd_name);
        return l_1st_lock || l_2nd_lock;
    }catch(...){
        ACS_LOG(LM_FULL_INFO,"MixerOperator::loadComponents()",
                    (LM_NOTICE,"LOs loading failed!"));
        _ADD_BACKTRACE(ReceiversErrors::LocalOscillatorErrorExImpl,impl,ex,"MixerOperator::setLO()");
        throw impl;        
    }
#else
	return false;
#endif