Commit 279b8f82 authored by aorlati's avatar aorlati
Browse files

fix issue #885: added support for all the local oscillators. Also the...

fix issue #885: added support for all the local oscillators. Also the procedure to set the solar filter has been enabled. It must be tested though. The configuration files still need to be filled with the correct values.
parent 494d12f6
Loading
Loading
Loading
Loading
+11 −4
Original line number Diff line number Diff line
@@ -467,11 +467,11 @@ protected:
    /** Obtain a valid reference to the local oscillator device
	  * @throw ComponentErrors::CouldntGetComponentExImpl   
     */
    void loadLocalOscillator();
    void loadLocalOscillator(Receivers::LocalOscillator_ptr device,bool &fault,const IRA::CString& name);


    /** Used to free the reference to the local oscillator device */
    void unloadLocalOscillator();
    void unloadLocalOscillator(Receivers::LocalOscillator_ptr device,const IRA::CString& name);


    /************************ CONVERSION FUNCTIONS **************************/
@@ -544,8 +544,15 @@ protected:
private:

    maci::ContainerServices* m_services;
    Receivers::LocalOscillator_var m_localOscillatorDevice;
    bool m_localOscillatorFault;
    Receivers::LocalOscillator_var m_localOscillatorDevice_K;
    bool m_localOscillatorFault_K;
    Receivers::LocalOscillator_var m_localOscillatorDevice_Q;
    bool m_localOscillatorFault_Q;
    Receivers::LocalOscillator_var m_localOscillatorDevice_WL;
    bool m_localOscillatorFault_WL;
    Receivers::LocalOscillator_var m_localOscillatorDevice_WH;
    bool m_localOscillatorFault_WH;    
    
    //double m_localOscillatorValue;
    double m_vacuum;
    CConfiguration<maci::ContainerServices>::BoardValue m_cryoCoolHead;
+151 −87
Original line number Diff line number Diff line
@@ -52,7 +52,10 @@
}

#define CONFIG_PATH "DataBlock/KQWReceiver"
#define LOTABLE_PATH CONFIG_PATH"/Synthesizer"
#define LOTABLE_K_PATH CONFIG_PATH"/Synthesizer_K"
#define LOTABLE_Q_PATH CONFIG_PATH"/Synthesizer_Q"
#define LOTABLE_WL_PATH CONFIG_PATH"/Synthesizer_WLOW"
#define LOTABLE_WH_PATH CONFIG_PATH"/Synthesizer_WHIGH"
#define MARKTABLE_PATH CONFIG_PATH"/NoiseMark"
#define FEEDTABLE_PATH CONFIG_PATH"/Feeds"
#define TAPERTABLE_PATH CONFIG_PATH"/Taper"
@@ -102,6 +105,13 @@ public:
      ACS::Time timestamp;
	} BoardValue;
	
	typedef enum {
		KBAND=0,
		QBAND=2,
		WLBAND=4,
		WHBAND=6
	} TBandId;
	

	/**
	 * Default constructor
@@ -179,16 +189,56 @@ public:
	DWORD getRightMarkTable(ACS::doubleSeq& freq,ACS::doubleSeq& markValue,short feed) const;

	/**
	 * @return the instance of the local oscillator component  that the receiver will use to drive the set its LO
	 * @return the instance of the K-band local oscillator component  that the receiver will use to drive the set its LO
	 */
	inline const IRA::CString& getLocalOscillatorInstance_K() const { return m_localOscillator_K_Instance; }
	
	/**
	 * @return the instance of the Q-band local oscillator component  that the receiver will use to drive the set its LO
	 */
	inline const IRA::CString& getLocalOscillatorInstance_Q() const { return m_localOscillator_Q_Instance; }
	
	/**
	 * @return the instance of the WL-band local oscillator component  that the receiver will use to drive the set its LO
	*/
	inline const IRA::CString& getLocalOscillatorInstance_WL() const { return m_localOscillator_W1_Instance; }
	
	/**
	 * @return the instance of the WH-band local oscillator component  that the receiver will use to drive the set its LO
	*/
	inline const IRA::CString& getLocalOscillatorInstance_WH() const { return m_localOscillator_W2_Instance; }

	/**
	 * Return the synth table for the K band
	 * @param freq vector with the synthesizer frequencies. It must be freed by caller.
	 * @param power corresponding powers for the frequencies vector. It must be freed by caller.
	 * @return the size of the output vectors
	 */
	//inline const IRA::CString& getLocalOscillatorInstance() const { return m_localOscillatorInstance; }
	DWORD getSynthesizerTable_K(double * &freq,double *&power) const;
	
		/**
	 * Return the synth table for the Q band
	 * @param freq vector with the synthesizer frequencies. It must be freed by caller.
	 * @param power corresponding powers for the frequencies vector. It must be freed by caller.
	 * @return the size of the output vectors
	 */
	DWORD getSynthesizerTable(double *& freq,double *& power) const;
	DWORD getSynthesizerTable_Q(double * &freq,double *&power) const;
	
		/**
	 * Return the synth table for the WL band
	 * @param freq vector with the synthesizer frequencies. It must be freed by caller.
	 * @param power corresponding powers for the frequencies vector. It must be freed by caller.
	 * @return the size of the output vectors
	 */
	DWORD getSynthesizerTable_WL(double * &freq,double *&power) const;
	
		/**
	 * Return the synth table for the WH band
	 * @param freq vector with the synthesizer frequencies. It must be freed by caller.
	 * @param power corresponding powers for the frequencies vector. It must be freed by caller.
	 * @return the size of the output vectors
	 */
	DWORD getSynthesizerTable_WH(double * &freq,double *&power) const;

	/**
	 * @param freq vector with the frequencies. It must be freed by caller.
@@ -236,6 +286,8 @@ public:
    */ 
    inline const DWORD getArrayIndex(const long& feed, const long& ifs) const { return feed*2+ifs; }
    
    inline const DWORD getArrayIndex(const long& feed) const { return feed*2; }

    /** 
     * @return the length of the dedicated arrays where the relative information are located 
    */ 
@@ -290,7 +342,7 @@ public:
	/**
	 * @return the current frequency for local Oscillator (MHz)
	 */
	void setCurrentLOValue(const ACS::doubleSeq& lo);
	//void setCurrentLOValue(const ACS::doubleSeq& lo);
	
	void setCurrentLOValue(const double& val,const long& pos);

@@ -325,6 +377,7 @@ public:
	*/
	void init(T *Services,IRA::CString comp_name=""); 
	

private:
	IRA::CString m_dewarIPAddress;
	DWORD m_dewarPort;
@@ -359,19 +412,30 @@ private:


	IRA::CDBTable *m_markTable;
	IRA::CDBTable *m_loTable;
	IRA::CDBTable *m_loTable_K;
	IRA::CDBTable *m_loTable_Q;
	IRA::CDBTable *m_loTable_WL;
	IRA::CDBTable *m_loTable_WH;
	
	IRA::CDBTable *m_taperTable;
	IRA::CDBTable *m_feedsTable;

	TMarkValue *m_markVector;
	TLOValue * m_loVector;
	DWORD m_loVectorLen;
	TLOValue * m_loVector_K;
	TLOValue * m_loVector_Q;
	TLOValue * m_loVector_WL;
	TLOValue * m_loVector_WH;
	DWORD m_loVectorLen_K;
	DWORD m_loVectorLen_Q;
	DWORD m_loVectorLen_WL;
	DWORD m_loVectorLen_WH;
	DWORD m_markVectorLen;
	TTaperValue * m_taperVector;
	DWORD m_taperVectorLen;
	TFeedValue * m_feedVector; // length given by m_feeds
	
	void updateBandWith(const long& pos);
	void updateBandWith();
	WORD openSynthTable(IRA::CDBTable * &table, const IRA::CString &path, TLOValue * &loV);
};


+146 −68
Original line number Diff line number Diff line
@@ -7,9 +7,9 @@ CConfiguration<T>::CConfiguration()
    m_markVectorLen = 0;
    m_markTable=NULL;
    m_mode="";
    m_loTable=NULL;
    m_loVector=NULL;
    m_loVectorLen=0;
    m_loTable_K=m_loTable_Q=m_loTable_WL=m_loTable_WH=NULL;
    m_loVector_K=m_loVector_Q=m_loVector_WL=m_loVector_WH=NULL;
    m_loVectorLen_K=m_loVectorLen_Q=m_loVectorLen_WL=m_loVectorLen_WH=0;
    m_BandPolarizations = NULL;
    m_feedsTable = NULL;
    m_feedVector = NULL;
@@ -29,8 +29,17 @@ CConfiguration<T>::~CConfiguration()
    if (m_markTable) {
        delete m_markTable;
    }
    if (m_loTable) {
        delete m_loTable;
    if (m_loTable_K) {
    	delete m_loTable_K;
    }
    if (m_loTable_Q) {
    	delete m_loTable_Q;
    }
    if (m_loTable_WL) {
        delete m_loTable_WL;
    }
    if (m_loTable_WH) {
        delete m_loTable_WH;
    } 
    if (m_feedsTable) {
        delete m_feedsTable;
@@ -41,8 +50,17 @@ CConfiguration<T>::~CConfiguration()
    if (m_markVector) {
        delete [] m_markVector;
    }
    if (m_loVector) {
        delete [] m_loVector;
    if (m_loVector_K) {
        delete [] m_loVector_K;
    }
    if (m_loVector_Q) {
        delete [] m_loVector_Q;
    }
    if (m_loVector_WL) {
        delete [] m_loVector_WL;
    }
    if (m_loVector_WH) {
        delete [] m_loVector_WH;
    }
    if (m_taperVector) {
        delete [] m_taperVector;
@@ -83,6 +101,67 @@ CConfiguration<T>::~CConfiguration()
}


/*
   @throw (
   ComponentErrors::CDBAccessExImpl
   ComponentErrors::MemoryAllocationExImpl
   ComponentErrors::CDBAccessExImpl)
*/
template <class T>
WORD CConfiguration<T>::openSynthTable(IRA::CDBTable * &table, const IRA::CString &path, TLOValue * &loV)
{
	IRA::CError ErrEvent;
	IRA::CString field;
	WORD len;
	try {
		table=new IRA::CDBTable(m_services,"SynthesizerEntry",path); 
	}
    catch (std::bad_alloc& ex) {
        _EXCPT(ComponentErrors::MemoryAllocationExImpl,dummy,"CConfiguration::openSynthTable()");
        throw dummy;
    }

    ErrEvent.Reset();
    if (!table->addField(ErrEvent,"Frequency",IRA::CDataField::DOUBLE)) {
        field="Frequency";
    }
    else if (!table->addField(ErrEvent,"OutputPower",IRA::CDataField::DOUBLE)) {
        field="OutputPower";
    }
    if (!ErrEvent.isNoError()) {
        _EXCPT_FROM_ERROR(ComponentErrors::CDBAccessExImpl,dummy,ErrEvent);
        dummy.setFieldName((const char *)field);
        throw dummy;
    }

    if (!table->openTable(ErrEvent))   {
        _EXCPT_FROM_ERROR(ComponentErrors::CDBAccessExImpl, dummy, ErrEvent);
        throw dummy;
    }
    table->First();
    len=table->recordCount();

    try {
        loV=new TLOValue[len];
    }
    catch (std::bad_alloc& ex) {
        _EXCPT(ComponentErrors::MemoryAllocationExImpl,dummy,"CConfiguration::openSynthTable()");
        throw dummy;
    }
    ACS_LOG(LM_FULL_INFO,"CConfiguration::openSynthTable()",(LM_DEBUG,"SYNTH_VALUE_ENTRY_NUMBER: %d",len));
    for (WORD i=0;i<len;i++) {
        loV[i].frequency=(*table)["Frequency"]->asDouble();
        loV[i].outputPower=(*table)["OutputPower"]->asDouble();
        ACS_LOG(LM_FULL_INFO,"CConfiguration::openSynthTable()",(LM_DEBUG,"SYNTH_VALUE_ENTRY: %lf %lf",loV[i].frequency,loV[i].outputPower));
        table->Next();
    }
    table->closeTable();
    delete table;
    table=NULL;
    return len;
} 


/*
   throw (
   ComponentErrors::CDBAccessExImpl,
@@ -102,8 +181,8 @@ void CConfiguration<T>::init(T *Services,IRA::CString comp_name)
    _GET_STRING_ATTRIBUTE(m_services,"LNAIPAddress", "LNA IP address:",m_LNAIPAddress,comp_name);
	 _GET_STRING_ATTRIBUTE(m_services,"LocalOscillator_K_Instance","Local oscillator for K band:",m_localOscillator_K_Instance,comp_name);
	 _GET_STRING_ATTRIBUTE(m_services,"LocalOscillator_Q_Instance","Local oscillator for Q band:",m_localOscillator_Q_Instance,comp_name);
	 _GET_STRING_ATTRIBUTE(m_services,"LocalOscillator_W1_Instance","Local oscillator for W1 band:",m_localOscillator_W1_Instance,comp_name);
	 _GET_STRING_ATTRIBUTE(m_services,"LocalOscillator_W2_Instance","Local oscillator for W2 band:",m_localOscillator_W2_Instance,comp_name);
	 _GET_STRING_ATTRIBUTE(m_services,"LocalOscillator_W1_Instance","Local oscillator for W low band:",m_localOscillator_W1_Instance,comp_name);
	 _GET_STRING_ATTRIBUTE(m_services,"LocalOscillator_W2_Instance","Local oscillator for W high band:",m_localOscillator_W2_Instance,comp_name);
	 _GET_DWORD_ATTRIBUTE(m_services,"DewarPort","Dewar port:",m_dewarPort,comp_name);
    _GET_DWORD_ATTRIBUTE(m_services,"LNAPort","LNA port:",m_LNAPort,comp_name);
    _GET_DWORD_ATTRIBUTE(m_services,"WatchDogResponseTime","Response time of watch dog thread (uSec):",m_watchDogResponseTime,comp_name);
@@ -140,6 +219,7 @@ void CConfiguration<T>::init(T *Services,IRA::CString comp_name)
    // Set the default operating mode
    setMode(mode);


    // The noise mark
    try {
        m_markTable = new IRA::CDBTable(Services,"MarkEntry",MARKTABLE_PATH);
@@ -190,56 +270,17 @@ void CConfiguration<T>::init(T *Services,IRA::CString comp_name)
        m_markVector[i].markValue));
        m_markTable->Next();
    }
    
    m_markVectorLen = len;
    m_markTable->closeTable();
    delete m_markTable;
    m_markTable = NULL;
    
    // The synthesizer
    try {
        m_loTable=new IRA::CDBTable(Services,"SynthesizerEntry",LOTABLE_PATH);
    }
    catch (std::bad_alloc& ex) {
        _EXCPT(ComponentErrors::MemoryAllocationExImpl,dummy,"CConfiguration::init()");
        throw dummy;
    }
    error.Reset();
    if (!m_loTable->addField(error,"Frequency",IRA::CDataField::DOUBLE)) {
        field="Frequency";
    }
    else if (!m_loTable->addField(error,"OutputPower",IRA::CDataField::DOUBLE)) {
        field="OutputPower";
    }
    if (!error.isNoError()) {
        _EXCPT_FROM_ERROR(ComponentErrors::CDBAccessExImpl,dummy,error);
        dummy.setFieldName((const char *)field);
        throw dummy;
    }
    if (!m_loTable->openTable(error))   {
        _EXCPT_FROM_ERROR(ComponentErrors::CDBAccessExImpl, dummy, error);
        throw dummy;
    }
    m_loTable->First();
    len=m_loTable->recordCount();
    try {
        m_loVector=new TLOValue[len];
    }
    catch (std::bad_alloc& ex) {
        _EXCPT(ComponentErrors::MemoryAllocationExImpl,dummy,"CConfiguration::init()");
        throw dummy;
    }
    ACS_LOG(LM_FULL_INFO,"CConfiguration::init()",(LM_DEBUG,"SYNTH_VALUE_ENTRY_NUMBER: %d",len));
    for (WORD i=0;i<len;i++) {
        m_loVector[i].frequency=(*m_loTable)["Frequency"]->asDouble();
        m_loVector[i].outputPower=(*m_loTable)["OutputPower"]->asDouble();
        ACS_LOG(LM_FULL_INFO,"CConfiguration::init()",(LM_DEBUG,"SYNTH_VALUE_ENTRY: %lf %lf",m_loVector[i].frequency,m_loVector[i].outputPower));
        m_loTable->Next();
    }
    m_loVectorLen=len;
    m_loTable->closeTable();
    delete m_loTable;
    m_loTable=NULL;

	m_loVectorLen_K=openSynthTable(m_loTable_K,LOTABLE_K_PATH,m_loVector_K);
	m_loVectorLen_Q=openSynthTable(m_loTable_Q,LOTABLE_Q_PATH,m_loVector_Q);
	m_loVectorLen_WL=openSynthTable(m_loTable_WL,LOTABLE_WL_PATH,m_loVector_WL);
	m_loVectorLen_WH=openSynthTable(m_loTable_WH,LOTABLE_WH_PATH,m_loVector_WH);


    // The feeds
@@ -343,7 +384,7 @@ void CConfiguration<T>::init(T *Services,IRA::CString comp_name)
    m_taperTable = NULL;
}

template <class T>
/*template <class T>
void CConfiguration<T>::setCurrentLOValue(const ACS::doubleSeq& lo)
{
	for (WORD k=0;k<MIN(lo.length(),getArrayLen());k++) {
@@ -352,23 +393,24 @@ void CConfiguration<T>::setCurrentLOValue(const ACS::doubleSeq& lo)
			updateBandWith(k);
		}
	}	
}
}*/

template <class T>
void CConfiguration<T>::setCurrentLOValue(const double& val,const long& pos)
{
	if ((pos>=0) && (pos<=getArrayLen())) {
	if ((pos>=0) && (pos<=getFeeds())) {
		if (val>=0.0) {
			m_currentLOValue[pos]=val;
			updateBandWith(pos);
			m_currentLOValue[getArrayIndex(pos)]=val;
			m_currentLOValue[getArrayIndex(pos)+1]=val;
			updateBandWith();
		}
	}
}

template <class T>
void CConfiguration<T>::updateBandWith(const long& pos)
void CConfiguration<T>::updateBandWith()
{
	m_BandIFBandwidth[pos]=m_BandRFMax[pos]-(m_BandIFMin[pos]+m_currentLOValue[pos]);
	for (WORD i=0;i<getArrayLen();i++) m_BandIFBandwidth[i]=m_BandRFMax[i]-(m_BandIFMin[i]+m_currentLOValue[i]);
}

/*
@@ -508,15 +550,51 @@ void CConfiguration<T>::setMode(const char * mode)
}

template <class T>
DWORD CConfiguration<T>::getSynthesizerTable(double * &freq,double *&power) const
DWORD CConfiguration<T>::getSynthesizerTable_K(double * &freq,double *&power) const
{
    freq= new double [m_loVectorLen_K];
    power=new double [m_loVectorLen_K];
    for (DWORD j=0;j<m_loVectorLen_K;j++) {
        freq[j]=m_loVector_K[j].frequency;
        power[j]=m_loVector_K[j].outputPower;
    }
    return m_loVectorLen_K;
}

template <class T>
DWORD CConfiguration<T>::getSynthesizerTable_Q(double * &freq,double *&power) const
{
    freq= new double [m_loVectorLen_Q];
    power=new double [m_loVectorLen_Q];
    for (DWORD j=0;j<m_loVectorLen_K;j++) {
        freq[j]=m_loVector_Q[j].frequency;
        power[j]=m_loVector_Q[j].outputPower;
    }
    return m_loVectorLen_Q;
}

template <class T>
DWORD CConfiguration<T>::getSynthesizerTable_WL(double * &freq,double *&power) const
{
    freq= new double [m_loVectorLen_WL];
    power=new double [m_loVectorLen_WL];
    for (DWORD j=0;j<m_loVectorLen_WL;j++) {
        freq[j]=m_loVector_WL[j].frequency;
        power[j]=m_loVector_WL[j].outputPower;
    }
    return m_loVectorLen_WL;
}

template <class T>
DWORD CConfiguration<T>::getSynthesizerTable_WH(double * &freq,double *&power) const
{
    freq= new double [m_loVectorLen];
    power=new double [m_loVectorLen];
    for (DWORD j=0;j<m_loVectorLen;j++) {
        freq[j]=m_loVector[j].frequency;
        power[j]=m_loVector[j].outputPower;
    freq= new double [m_loVectorLen_WH];
    power=new double [m_loVectorLen_WH];
    for (DWORD j=0;j<m_loVectorLen_WH;j++) {
        freq[j]=m_loVector_WH[j].frequency;
        power[j]=m_loVector_WH[j].outputPower;
    }
    return m_loVectorLen;
    return m_loVectorLen_WH;
}

template <class T>
+106 −84

File changed.

Preview size limit exceeded, changes collapsed.

+21 −3
Original line number Diff line number Diff line
@@ -41,9 +41,27 @@ public:
		
		::testing::Test::RecordProperty("Records number of the Noise Mark Table",conf.getMarkVectorLen());

		::testing::Test::RecordProperty("Records number of the Synth Table",conf.getSynthesizerTable(loFreq,loPower));
		::testing::Test::RecordProperty("Synth[0].freq",loFreq[0]);
		::testing::Test::RecordProperty("Synth[0].power",loPower[0]);
		::testing::Test::RecordProperty("Records number of the K-band Synth Table",conf.getSynthesizerTable_K(loFreq,loPower));
		::testing::Test::RecordProperty("Synth_K[0].freq",loFreq[0]);
		::testing::Test::RecordProperty("Synth_K[0].power",loPower[0]);
		delete [] loFreq;
		delete [] loPower;
		
		::testing::Test::RecordProperty("Records number of the Q-band Synth Table",conf.getSynthesizerTable_Q(loFreq,loPower));
		::testing::Test::RecordProperty("Synth_Q[0].freq",loFreq[0]);
		::testing::Test::RecordProperty("Synth_Q[0].power",loPower[0]);
		delete [] loFreq;
		delete [] loPower;
		
		::testing::Test::RecordProperty("Records number of the WL-band Synth Table",conf.getSynthesizerTable_WL(loFreq,loPower));
		::testing::Test::RecordProperty("Synth_WL[0].freq",loFreq[0]);
		::testing::Test::RecordProperty("Synth_WL[0].power",loPower[0]);
		delete [] loFreq;
		delete [] loPower;
		
				::testing::Test::RecordProperty("Records number of the WH-band Synth Table",conf.getSynthesizerTable_WH(loFreq,loPower));
		::testing::Test::RecordProperty("Synth_WH[0].freq",loFreq[0]);
		::testing::Test::RecordProperty("Synth_WH[0].power",loPower[0]);
		delete [] loFreq;
		delete [] loPower;		

Loading