Commit 9afa09ea authored by Marco Buttu's avatar Marco Buttu
Browse files

receiversMode not allowed after setLO, when the LO is within the band

Test n.5 passed.
> receiversMode=XXL5 (1625:1715)
> setLO=1500
> receiversMode=XXL4 (1300:1800) # Target command
 
Expected: raises ComponentErrors::ComponentErrorsEx
Expected Message: "Mode not allowed. The LO value is within
the band and might generate strong aliasing."
parent 6cd72f8c
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -324,6 +324,18 @@ public:
    );
	

    std::vector<double> getLBandRFMaxFromMode(IRA::CString cmdMode) throw (
            ComponentErrors::CDBAccessExImpl,
            ComponentErrors::MemoryAllocationExImpl, 
            ReceiversErrors::ModeErrorExImpl);
 

    std::vector<double> getLBandRFMinFromMode(IRA::CString cmdMode) throw (
            ComponentErrors::CDBAccessExImpl,
            ComponentErrors::MemoryAllocationExImpl, 
            ReceiversErrors::ModeErrorExImpl);

    
private:
	IRA::CString m_dewarIPAddress;
	WORD m_dewarPort;
+11 −1
Original line number Diff line number Diff line
@@ -65,7 +65,8 @@ CConfiguration const * const CComponentCore::execute() throw (
        throw dummy;
    }
    
    m_localOscillatorValue=0.0;
    
    m_localOscillatorValue = m_configuration.getDefaultLO()[0];
    m_actualMode="";
    return &m_configuration;
}
@@ -203,6 +204,14 @@ void CComponentCore::activate(const char * setup_mode) throw (
{
    baci::ThreadSyncGuard guard(&m_mutex);
    setSetupMode(setup_mode); // It calls the setMode()

    ACS::doubleSeq_var lo = new ACS::doubleSeq;
    lo->length(m_configuration.getIFs());
    for (WORD k=0; k<m_configuration.getIFs(); k++) {
        lo[k] = m_configuration.getDefaultLO()[k];
    }
    setLO(lo);

    guard.release();
    lnaOn(); // Throw (ReceiversErrors::NoRemoteControlErrorExImpl,ReceiversErrors::ReceiverControlBoardErrorExImpl)
    externalCalOff();
@@ -291,6 +300,7 @@ void CComponentCore::externalCalOff() throw (
void CComponentCore::deactivate() throw (ReceiversErrors::NoRemoteControlErrorExImpl,ReceiversErrors::ReceiverControlBoardErrorExImpl)
{
    // no guard needed.
    m_localOscillatorValue = m_configuration.getDefaultLO()[0];
    lnaOff(); // throw (ReceiversErrors::NoRemoteControlErrorExImpl,ReceiversErrors::ReceiverControlBoardErrorExImpl)
}

+52 −0
Original line number Diff line number Diff line
@@ -686,6 +686,58 @@ void CConfiguration::setMode(const char * mode) throw (
}


std::vector<double> CConfiguration::getLBandRFMinFromMode(IRA::CString cmdMode) throw (
        ComponentErrors::CDBAccessExImpl,
        ComponentErrors::MemoryAllocationExImpl, 
        ReceiversErrors::ModeErrorExImpl)
{
    CString MODE_PATH((std::string(CONFIG_PATH) + std::string("/Modes/") + std::string(cmdMode)).c_str());

    std::vector<double> rfMin;
    IRA::CString value, token;

    maci::ContainerServices *Services = m_services;
    _GET_STRING_ATTRIBUTE("LBandRFMin", "L band RF lower limit (MHz):", value, MODE_PATH);
    int start = 0;
    IRA::CError error;
    for (WORD k=0; k<m_IFs; k++) {
        if (!IRA::CIRATools::getNextToken(value, start, ' ', token)) {
            _EXCPT_FROM_ERROR(ComponentErrors::CDBAccessExImpl, dummy, error);
            dummy.setFieldName("LBandRFMin");
            throw dummy;
        }
        rfMin.push_back(token.ToDouble());
    }
    return rfMin;
}


std::vector<double> CConfiguration::getLBandRFMaxFromMode(IRA::CString cmdMode) throw (
        ComponentErrors::CDBAccessExImpl,
        ComponentErrors::MemoryAllocationExImpl, 
        ReceiversErrors::ModeErrorExImpl)
{
    CString MODE_PATH((std::string(CONFIG_PATH) + std::string("/Modes/") + std::string(cmdMode)).c_str());

    std::vector<double> rfMax;
    IRA::CString value, token;

    maci::ContainerServices *Services = m_services;
    _GET_STRING_ATTRIBUTE("LBandRFMax", "L band RF upper limit (MHz):", value, MODE_PATH);
    int start = 0;
    IRA::CError error;
    for (WORD k=0; k<m_IFs; k++) {
        if (!IRA::CIRATools::getNextToken(value, start, ' ', token)) {
            _EXCPT_FROM_ERROR(ComponentErrors::CDBAccessExImpl, dummy, error);
            dummy.setFieldName("LBandRFMax");
            throw dummy;
        }
        rfMax.push_back(token.ToDouble());
    }
    return rfMax;
}


DWORD CConfiguration::getSynthesizerTable(double * &freq,double *&power) const
{
    freq= new double [m_loVectorLen];
+52 −24
Original line number Diff line number Diff line
@@ -77,18 +77,24 @@ void SRTLPBandCore::setMode(const char * mode) throw (
        ReceiversErrors::LocalOscillatorErrorExImpl
    )
{
    try {
    baci::ThreadSyncGuard guard(&m_mutex);
    IRA::CString cmdMode(mode);
    cmdMode.MakeUpper();

    IRA::CString setupMode = getSetupMode();

    if(setupMode.IsEmpty()) {
        _THROW_EXCPT(ReceiversErrors::ModeErrorExImpl, "SRTLPBandCore::setMode(): setup mode not set");
    }

        IRA::CString feed0 = setupMode[0];
        IRA::CString feed1 = setupMode[1];
    IRA::CString feed0, feed1;
    try {
        feed0 = setupMode[0];
        feed1 = setupMode[1];
    }
    catch (...) {
        _THROW_EXCPT(ReceiversErrors::ModeErrorExImpl, "SRTLPBandCore::setMode()");
    }


    if(feed0 == feed1) { // Single feed
        if((feed0 == "L" && cmdMode.Left() != "X") || (feed0 == "P" && cmdMode.Right() != "X"))
@@ -99,21 +105,43 @@ void SRTLPBandCore::setMode(const char * mode) throw (
            _THROW_EXCPT(ReceiversErrors::ModeErrorExImpl, "SRTLPBandCore::setMode(): mismatch with the setup mode");
    }

    // In case of L band, verify the LO value does not fall inside the mode band
    if(feed0 == "L" || feed1 == "L") {
        std::vector<double> rfMin = m_configuration.getLBandRFMinFromMode(cmdMode);
        std::vector<double> rfMax = m_configuration.getLBandRFMaxFromMode(cmdMode);
        ACS::doubleSeq lo;
        getLBandLO(lo);
        for(size_t i=0; i<getIFs(); i++) {
            if(lo[i] >= rfMin[i] && lo[i] <= rfMax[i]) {
                _EXCPT(ReceiversErrors::ModeErrorExImpl, 
                       impl, 
                       "SRTLPBandCore:setMode(): " \
                        "mode not allowed. The LO frequency value is within the band and "\
                        "might generate strong aliasing.");
                throw impl;
            }
        }
    }

    try {
        m_configuration.setMode(cmdMode);
    }
    catch (...) {
        _THROW_EXCPT(ReceiversErrors::ModeErrorExImpl, "SRTLPBandCore::setMode(): cannot set the conf mode");
    }

    try {
        setLBandFilter(m_configuration.getLBandFilterID());
            
        setPBandFilter(m_configuration.getPBandFilterID());
        setLBandPolarization(m_configuration.getLBandPolarization());
        setPBandPolarization(m_configuration.getPBandPolarization());
            
        m_actualMode = m_configuration.getActualMode();
        ACS_LOG(LM_FULL_INFO,"CComponentCore::setMode()",(LM_NOTICE,"RECEIVER_MODE %s", string(m_actualMode).c_str()));
    }
    catch(...) {
        m_actualMode = ""; // If we don't reach the end of the method then the mode will be unknown
        _THROW_EXCPT(ReceiversErrors::ModeErrorExImpl, "SRTLPBandCore::setMode()");
        _THROW_EXCPT(ReceiversErrors::ModeErrorExImpl, "SRTLPBandCore::setMode(): cannot set the filter");
    }
        
    m_actualMode = m_configuration.getActualMode();
    ACS_LOG(LM_FULL_INFO,"CComponentCore::setMode()",(LM_NOTICE,"RECEIVER_MODE %s", string(m_actualMode).c_str()));
}


+4 −0
Original line number Diff line number Diff line
@@ -238,6 +238,7 @@ void SRTLPBandReceiverImpl::cleanUp()
    stopPropertiesMonitoring();
    if (m_monitor != NULL) {
        m_monitor->suspend();
        m_monitor->terminate();
        getContainerServices()->getThreadManager()->destroy(m_monitor);
        m_monitor = NULL;
    }
@@ -253,7 +254,10 @@ void SRTLPBandReceiverImpl::aboutToAbort()
    AUTO_TRACE("SRTLPBandReceiverImpl::aboutToAbort()");
    stopPropertiesMonitoring();
    if (m_monitor != NULL) {
        m_monitor->suspend();
        m_monitor->terminate();
        getContainerServices()->getThreadManager()->destroy(m_monitor);
        m_monitor = NULL;
    }
    m_core.cleanup();
    CharacteristicComponentImpl::aboutToAbort(); 
Loading