Commit 5a959510 authored by TheDebbio's avatar TheDebbio
Browse files

env temp

parent 4c1a116c
Loading
Loading
Loading
Loading
+24 −0
Original line number Diff line number Diff line
@@ -146,6 +146,30 @@ public:
            const BYTE value=0x00
    ) throw (IRA::ReceiverControlEx);


     /** Return the env temperature 
     *
     *  @param converter pointer to the function that performs the conversion from
     *  voltage to Kelvin; default value is NULL, and in this case the value
     *  returned by vertexTemperature is the voltage value (the value before conversion).
     *  @param data_type the type of the data; the default type is a 32 bit floating point
     *  @param port_type the port type; the default port is the AD24
     *  @param port_number the port number; the default value is a range of port numbers from
     *  8 to 15.
     *  @param raw_index the index that allows to get the vertex temperature value from the 
     *  port_number range. The default value is 6.
     *  @return the vertex temperature in Kelvin if converter != NULL, the value in voltage
     *  (before conversion) otherwise.
     *  @throw ReceiverControlEx
     */
    double environmentTemperature(
            double (*converter)(double voltage)=NULL,
            const BYTE data_type=MCB_CMD_DATA_TYPE_F32,     
            const BYTE port_type=MCB_PORT_TYPE_AD24,       
            const BYTE port_number=MCB_PORT_NUMBER_00_07,  
            const size_t raw_index=5                      
    ) throw (ReceiverControlEx);

private:


+1 −1
Original line number Diff line number Diff line
@@ -1072,7 +1072,7 @@ void CComponentCore::updateEnvironmentTemperature() throw (ReceiversErrors::Rece
{
    // not under the mutex protection because the m_control object is thread safe (at the micro controller board stage)
    try {
        m_environmentTemperature.temperature = m_control->vertexTemperature(Helpers::voltageConverter);
        m_environmentTemperature.temperature = m_control->environmentTemperature(Helpers::voltageConverter);        
        m_environmentTemperature.timestamp = getTimeStamp();
    }
    catch (IRA::ReceiverControlEx& ex) {
+29 −0
Original line number Diff line number Diff line
@@ -174,3 +174,32 @@ void ReceiverControlCBand::resetVacuumValveOpenDelay(
        throw IRA::ReceiverControlEx(error_msg + ex.what());
    }    
}

double ReceiverControlCBand::environmentTemperature(
        double (*converter)(double voltage),
        const BYTE data_type,     
        const BYTE port_type,       
        const BYTE port_number,  
        const size_t raw_index                      
        ) throw (ReceiverControlEx)
{
    try {

        std::vector<BYTE> parameters = makeRequest(
                m_dewar_board_ptr,      // Pointer to the dewar board
                MCB_CMD_GET_DATA,       // Command to send
                3,                      // Number of parameters
                data_type,
                port_type,
                port_number
        );

        // Return the vertex temperature in Kelvin for a given voltage VALUE
        return converter != NULL ? converter(get_value(parameters, raw_index)) : \
                            get_value(parameters, raw_index);
    }
    catch(MicroControllerBoardEx& ex) {
        std::string error_msg = "ReceiverControl: error getting the vertex temperature.\n";
        throw ReceiverControlEx(error_msg + ex.what());
    }
}
 No newline at end of file