Commit a09692e5 authored by TheDebbio's avatar TheDebbio
Browse files

broken, cal mark

parent 6008c033
Loading
Loading
Loading
Loading
+22 −0
Original line number Diff line number Diff line
@@ -19,6 +19,10 @@
#include "Commons.h"
#include "ReceiverConfHandler.h"

// Temperature dummy value to use in case of Connection Error
#define CEDUMMY 100000


/**
 * This class implements the component configuration. The data inside this class are initialized at the startup from the
 * configuration database and then are used (read) inside the component.
@@ -127,6 +131,24 @@ public:
	 */
	DWORD getRightMarkCoeffs(double *& p_out_coeffs) const;

	/**
	 * @brief Get mark temp at given freq ( left )
	 * @details Calculation depends on receiver configuration
	 * 
	 * @param freq Input frequency
	 * @return double Cal mark value
	 */
	double getLeftMarkTemp(double freq);

	/**
	 * @brief Get mark temp at given freq ( right )
	 * @details Calculation depends on receiver configuration
	 * 
	 * @param freq Input frequency
	 * @return double Cal mark value
	 */
	double getRightMarkTemp(double freq);

	/**
	 * @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.
+7 −0
Original line number Diff line number Diff line
@@ -166,6 +166,13 @@ struct ReceiverConfHandler{
     */
    const IRA::CString getActualConfStr();

    /**
     * @brief Get the Actual Configuration
     * 
     * @return ConfigurationName 
     */
    ConfigurationName getActualConf();

    /**
     * @brief Get the Current configuration setup
     * 
+16 −19
Original line number Diff line number Diff line
@@ -453,21 +453,11 @@ void CComponentCore::getCalibrationMark(ACS::doubleSeq& result,
                                bool& onoff,double &scaleFactor) throw (ComponentErrors::ValidationErrorExImpl,ComponentErrors::ValueOutofRangeExImpl)
{
    double realFreq,realBw;    
    double *tableLeftFreq=NULL;
    double *tableLeftMark=NULL;    
    double *tableRightFreq=NULL;
    double *tableRightMark=NULL;
    DWORD sizeL=0;
    DWORD sizeR=0;
    baci::ThreadSyncGuard guard(&m_mutex);
    /* Checking receiver setup */
    /*
    if (m_setupMode=="") {
        _EXCPT(ComponentErrors::ValidationErrorExImpl,impl,"CComponentCore::getCalibrationMark()");
        impl.setReason("receiver not configured yet");
        throw impl;
    }
    */
    /* Checking start frequnency input seq length*/
    unsigned stdLen=freqs.length();
    if ((stdLen!=bandwidths.length()) || (stdLen!=feeds.length()) || (stdLen!=ifs.length())) {
@@ -496,11 +486,18 @@ void CComponentCore::getCalibrationMark(ACS::doubleSeq& result,
    resFreq.length(stdLen);
    resBw.length(stdLen);
    /* Ask for polynomial coeffs from configuration layer */    
    sizeL= m_configuration.getLeftMarkCoeffs(tableLeftMark);
    sizeR= m_configuration.getRightMarkCoeffs(tableRightMark);
    /**@todo rivedere questa parte */
    //sizeL= m_configuration.getLeftMarkCoeffs(tableLeftMark);
    //sizeR= m_configuration.getRightMarkCoeffs(tableRightMark);
    /**@todo rivedere questa parte 
     * in pratica per ogni entry del set di input 
     * freq, bw, feeds, ifs 
     * devo calcolare la relativa cal mark temp tramite
     * la formula polinomiale
     * e ritornare il dato attraverso
     * result, resFreq, resBw ?
    */
    for (unsigned i=0; i < stdLen; i++) {
        // now computes the mark for each input band....considering the present mode and configuration of the receiver.
        /* Get sky frequency for each input freq */
        if (!IRA::CIRATools::skyFrequency(freqs[i],bandwidths[i],m_startFreq[ifs[i]],m_bandwidth[ifs[i]],realFreq,realBw)) {
                realFreq=m_startFreq[ifs[i]];
                realBw=0.0;
@@ -512,11 +509,11 @@ void CComponentCore::getCalibrationMark(ACS::doubleSeq& result,
        realFreq+=realBw/2.0;
        ACS_LOG(LM_FULL_INFO,"CComponentCore::getCalibrationMark()",(LM_DEBUG,"REFERENCE_FREQUENCY %lf",realFreq));
        if (m_polarization[ifs[i]]== (long)Receivers::RCV_LCP) {
            result[i]= linearFit(tableLeftFreq,tableLeftMark,sizeL,realFreq);
            result[i]= m_configuration.getLeftMarkTemp(realFreq);            
            ACS_LOG(LM_FULL_INFO,"CComponentCore::getCalibrationMark()",(LM_DEBUG,"LEFT_MARK_VALUE %lf",result[i]));
        }
        else { //RCV_RCP            
            result[i]=linearFit(tableRightFreq,tableRightMark,sizeR,realFreq);
            result[i]= m_configuration.getRightMarkTemp(realFreq);
            ACS_LOG(LM_FULL_INFO,"CComponentCore::getCalibrationMark()",(LM_DEBUG,"RIGHT_MARK_VALUE %lf",result[i]));
        }
    }
+22 −1
Original line number Diff line number Diff line
// $Id: Configuration.cpp,v 1.5 2011-06-01 18:24:44 a.orlati Exp $

#include "Configuration.h"
#include <math.h>
#include "Defs.h"

using namespace IRA;
@@ -153,6 +154,26 @@ DWORD CConfiguration::getRightMarkCoeffs(double *& p_out_coeffs) const
	return l_coeff_vect_len;
}

double CConfiguration::getLeftMarkTemp(double freq){
	double * l_coeffs= NULL;
	DWORD l_coeffs_len;
	double l_ret= 0.0;
	l_coeffs_len= getLeftMarkCoeffs(l_coeffs);				
	for(int i=0; i< l_coeffs_len; i++){
		l_ret+= l_coeffs[i] *  pow(freq, i);
	}
}

double CConfiguration::getRightMarkTemp(double freq){
	double * l_coeffs= NULL;
	DWORD l_coeffs_len;
	double l_ret= 0.0;
	l_coeffs_len= getRightMarkCoeffs(l_coeffs);				
	for(int i=0; i< l_coeffs_len; i++){
		l_ret+= l_coeffs[i] *  pow(freq, i);
	}
}

DWORD CConfiguration::getTaperTable(double * &freq,double *&taper) const
{
	WORD l_taper_len= m_taper_table.size();
+4 −0
Original line number Diff line number Diff line
@@ -237,6 +237,10 @@ const IRA::CString ReceiverConfHandler::getActualConfStr()
    return m_conf_name[l_name_enum];    
}

ConfigurationName ReceiverConfHandler::getActualConf(){
    return m_current_conf.m_name;
}

ConfigurationSetup ReceiverConfHandler::getCurrentSetup() const {
    ConfigurationName l_name_enum = m_current_conf.m_name;
    if (!findConfiguration(l_name_enum)){