Commit 44644400 authored by Marco Buttu's avatar Marco Buttu
Browse files

Partial resolution of the noise mark error.

This is a partial fix, not yet tested at the antenna.
The mutex now cover all the calOn() and calOff() code.
I also added the mutex to the updateNoiseMark() method.
I also implemented a workaround to avoid isolated
IO errors: if I got a noise mark error, I do not put 
it a log immediately, but I wait for a second error.
This update will be merged from the trunk to the 
Nuraghe 0.6 TAG.

The next step will affect Nuraghe 0.7. I will enable
the checksum to default. In the MicroControllerBoard
library I will put the checksum control before the 
other checks, and in case of checksum error, I will
raise a new particular exception (MicroControllerBoardIOEx).
When the receiver component catches a MicroControllerBoardIOEx,
it just writes a warning message instead of an error one.

Trunk revision r1485.
parent cce1d7f7
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -412,6 +412,9 @@ private:
    double m_environmentTemperature;
    IRA::ReceiverControl::FetValues m_fetValues;
    DWORD m_statusWord;
    // m_ioMarkError is a flag used to know if we already got an IO
    // error. See mantis issue n.0000236
    bool m_ioMarkError;
    Management::TSystemStatus m_componentStatus;

    void setComponentStatus(const Management::TSystemStatus& status) { if (status>m_componentStatus) m_componentStatus=status;  }
+700 −688
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ void CComponentCore::initialize(maci::ContainerServices* services)
    m_cryoCoolHead=m_cryoCoolHeadWin= m_cryoLNA=m_cryoLNAWin=m_vacuum=0.0;
    m_fetValues.VDL=m_fetValues.IDL=m_fetValues.VGL=m_fetValues.VDR=m_fetValues.IDR=m_fetValues.VGR=0.0;
    m_statusWord=0;
    m_ioMarkError = false;
}

CConfiguration const * const  CComponentCore::execute() throw (ComponentErrors::CDBAccessExImpl,ComponentErrors::MemoryAllocationExImpl,ComponentErrors::SocketErrorExImpl)
@@ -265,7 +266,7 @@ void CComponentCore::calOn() throw (ReceiversErrors::NoRemoteControlErrorExImpl,
        impl.setReason("receiver not configured yet");
        throw impl;
    }
	guard.release();
    // guard.release();
    if (checkStatusBit(LOCAL)) {
        _EXCPT(ReceiversErrors::NoRemoteControlErrorExImpl,impl,"CComponentCore::calOn()");
        throw impl;
@@ -291,7 +292,7 @@ void CComponentCore::calOff() throw (ReceiversErrors::NoRemoteControlErrorExImpl
        impl.setReason("receiver not configured yet");
        throw impl;
    }
	guard.release();
    // guard.release();
    if (checkStatusBit(LOCAL)) {
        _EXCPT(ReceiversErrors::NoRemoteControlErrorExImpl,impl,"CComponentCore::calOff()");
        throw impl;
@@ -766,6 +767,7 @@ void CComponentCore::updateVacuumPump() throw (ReceiversErrors::ReceiverControlB
void CComponentCore::updateNoiseMark() throw (ReceiversErrors::ReceiverControlBoardErrorExImpl)
{
    bool answer;
    baci::ThreadSyncGuard guard(&m_mutex);
    // not under the mutex protection because the m_control object is thread safe (at the micro controller board stage)
    try {
        answer=m_control->isCalibrationOn();
@@ -776,8 +778,18 @@ void CComponentCore::updateNoiseMark() throw (ReceiversErrors::ReceiverControlBo
        setStatusBit(CONNECTIONERROR);
        throw impl;
    }
	if (answer!=checkStatusBit(NOISEMARK)) setStatusBit(NOISEMARKERROR);
	else clearStatusBit(NOISEMARKERROR);
    if(answer!=checkStatusBit(NOISEMARK)) {
        if(m_ioMarkError) {
            setStatusBit(NOISEMARKERROR);
        }
        else {
            m_ioMarkError = true;
        }
    }
    else {
        clearStatusBit(NOISEMARKERROR);
        m_ioMarkError = false;
    }
    //*********************************************************************************************/
    // EXTNOISEMARK is missing
    /**********************************************************************************************/
+3 −0
Original line number Diff line number Diff line
@@ -565,6 +565,9 @@ private:
    double m_envTemperature;
    IRA::ReceiverControl::FetValues m_fetValues;
    DWORD m_statusWord;
    // m_ioMarkError is a flag used to know if we already got an IO
    // error. See mantis issue n.0000236
    bool m_ioMarkError;
    Management::TSystemStatus m_componentStatus;

    void setComponentStatus(const Management::TSystemStatus& status) { if (status>m_componentStatus) m_componentStatus=status;  }
+18 −14
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ void CComponentCore::initialize(maci::ContainerServices* services)
    m_cryoCoolHead=m_cryoCoolHeadWin= m_cryoLNA=m_cryoLNAWin=m_vacuum=0.0;
    m_fetValues.VDL=m_fetValues. IDL=m_fetValues.VGL=m_fetValues.VDR=m_fetValues.IDR=m_fetValues.VGR=0.0;
    m_statusWord=0;
    m_ioMarkError = false;
}

CConfiguration const * const  CComponentCore::execute() throw (
@@ -263,7 +264,7 @@ void CComponentCore::calOn() throw (
        impl.setReason("receiver not configured yet");
        throw impl;
    }
    guard.release();
    // guard.release();
    if (checkStatusBit(LOCAL)) {
        _EXCPT(ReceiversErrors::NoRemoteControlErrorExImpl,impl,"CComponentCore::calOn()");
        throw impl;
@@ -303,7 +304,7 @@ void CComponentCore::calOff() throw (
        impl.setReason("receiver not configured yet");
        throw impl;
    }
    guard.release();
    // guard.release();
    if (checkStatusBit(LOCAL)) {
        _EXCPT(ReceiversErrors::NoRemoteControlErrorExImpl,impl,"CComponentCore::calOff()");
        throw impl;
@@ -904,6 +905,7 @@ void CComponentCore::updateVacuumPump() throw (ReceiversErrors::ReceiverControlB
void CComponentCore::updateNoiseMark() throw (ReceiversErrors::ReceiverControlBoardErrorExImpl)
{
    bool answer;
    baci::ThreadSyncGuard guard(&m_mutex);
    // Not under the mutex protection because the m_control object is thread safe (at the micro controller board stage)
    try {
        answer=m_control->isCalibrationOn();
@@ -914,20 +916,22 @@ void CComponentCore::updateNoiseMark() throw (ReceiversErrors::ReceiverControlBo
        setStatusBit(CONNECTIONERROR);
        throw impl;
    }
    if (answer!=checkStatusBit(NOISEMARK)) 
    if(answer!=checkStatusBit(NOISEMARK)) {
        if(m_ioMarkError) {
            setStatusBit(NOISEMARKERROR);
    else 
        clearStatusBit(NOISEMARKERROR);
    try {
    	m_control->isCalibrationOn() ? setStatusBit(NOISEMARK) : clearStatusBit(NOISEMARK);
    	m_control->isExtCalibrationOn() ? setStatusBit(EXTNOISEMARK) : clearStatusBit(EXTNOISEMARK);
        }
    catch (IRA::ReceiverControlEx& ex) {
        _EXCPT(ReceiversErrors::ReceiverControlBoardErrorExImpl,impl,"CComponentCore::updateNoiseMark()");
        impl.setDetails(ex.what().c_str());
        setStatusBit(CONNECTIONERROR);
        throw impl;
        else {
            m_ioMarkError = true;
        }

    }
    else {
        clearStatusBit(NOISEMARKERROR);
        m_ioMarkError = false;
    }
    //*********************************************************************************************/
    // EXTNOISEMARK is missing
    //*********************************************************************************************/
    clearStatusBit(CONNECTIONERROR); // the communication was ok so clear the CONNECTIONERROR bit
}

+3 −0
Original line number Diff line number Diff line
@@ -602,6 +602,9 @@ private:
    double m_envTemperature;
    IRA::ReceiverControl::FetValues m_fetValues;
    DWORD m_statusWord;
    // m_ioMarkError is a flag used to know if we already got an IO
    // error. See mantis issue n.0000236
    bool m_ioMarkError;
    Management::TSystemStatus m_componentStatus;

    void setComponentStatus(const Management::TSystemStatus& status) 
Loading