Commit 134e3827 authored by TheDebbio's avatar TheDebbio
Browse files

Seems we get a lib, but a const chain through ReceiverConfHnd needs to be...

Seems we get a lib, but a const chain through ReceiverConfHnd needs to be reviewed from getCurrentAccess or getCurrentSetup
parent a09692e5
Loading
Loading
Loading
Loading
+64 −1
Original line number Diff line number Diff line
@@ -52,5 +52,68 @@
	} BoardValue;


/** Helpers namespace */

namespace Helpers{

     /**
     * @todo 
     */    
     double linearFit(double *X,double *Y,const WORD& size,double x){
     	int low=-1,high=-1;
    	for (WORD j=0;j<size;j++) {
        if (x==X[j]) {
            return Y[j];
        }
        else if (x<X[j]) {
            if (high==-1) high=j;
            else if (X[j]<X[high]) high=j;
        }
        else if (x>X[j]) { // X value is lower
            if (low==-1) low=j;
            else if (X[j]>X[low]) low=j;
        }
    	}
    	if ((high!=-1) && (low!=-1)) {
        double slope=X[low]-X[high];
        return ((x-X[high])/slope)*Y[low]-((x-X[low])/slope)*Y[high];
    	}else if (high==-1) {
        return Y[low];
    	}else if (low==-1) {
        return Y[high];
    	}else return 0.0; //this will never happen if size!=0
    }

    /**
     *  Convert the voltage value of the vacuum to mbar
     */
    double voltage2mbar(double voltage) { return(pow(10, 1.5 * voltage - 12)); }

    /**
     *  Convert the voltage value of the temperatures to Kelvin
     */
    double voltage2Kelvin(double voltage) {
        return voltage < 1.12 ?  (660.549422889947 * pow(voltage, 6)) - (2552.334255456860 * pow(voltage, 5)) + (3742.529989384570 * pow(voltage, 4))
            - (2672.656926956470 * pow(voltage, 3)) + (947.905578508975 * pow(voltage, 2)) - 558.351002849576 * voltage + 519.607622398508  :
            (865.747519105672 * pow(voltage, 6)) - (7271.931957100480 * pow(voltage, 5)) + (24930.666241800500 * pow(voltage, 4))
            - (44623.988512320400 * pow(voltage, 3)) + (43962.922216886600 * pow(voltage, 2)) - 22642.245121997700 * voltage + 4808.631312836750;
    }

    /**
     *  Convert the voltage value of the temperatures to Celsius (Sensor B57703-10K)
     */
    double voltage2Celsius(double voltage) 
    { return -5.9931 * pow(voltage, 5) + 40.392 * pow(voltage, 4) - 115.41 * pow(voltage, 3) + 174.67 * pow(voltage, 2) - 174.23 * voltage + 112.79; }

    /**
     *  Convert the ID voltage value to the mA value
     */
    double currentConverter(double voltage) { return(10 * voltage); }

    /**
     *  Convert the VD and VG voltage values using a right scale factor
     */
    double voltageConverter(double voltage) { return(voltage); }

}
#endif
 No newline at end of file
+0 −38
Original line number Diff line number Diff line
@@ -389,44 +389,6 @@ private:
     */
    inline bool checkStatusBit(TStatusBit bit) { return m_statusWord & (1 << bit); }

    /**
     * @todo ?
     */    
    double linearFit(double *X,double *Y,const WORD& size,double x);

    /************************ CONVERSION FUNCTIONS **************************/

    /**
     *  Convert the voltage value of the vacuum to mbar
     */
    static double voltage2mbar(double voltage) { return(pow(10, 1.5 * voltage - 12)); }

    /**
     *  Convert the voltage value of the temperatures to Kelvin
     */
    static double voltage2Kelvin(double voltage) {
        return voltage < 1.12 ?  (660.549422889947 * pow(voltage, 6)) - (2552.334255456860 * pow(voltage, 5)) + (3742.529989384570 * pow(voltage, 4))
            - (2672.656926956470 * pow(voltage, 3)) + (947.905578508975 * pow(voltage, 2)) - 558.351002849576 * voltage + 519.607622398508  :
            (865.747519105672 * pow(voltage, 6)) - (7271.931957100480 * pow(voltage, 5)) + (24930.666241800500 * pow(voltage, 4))
            - (44623.988512320400 * pow(voltage, 3)) + (43962.922216886600 * pow(voltage, 2)) - 22642.245121997700 * voltage + 4808.631312836750;
    }

    /**
     *  Convert the voltage value of the temperatures to Celsius (Sensor B57703-10K)
     */
    static double voltage2Celsius(double voltage) 
    { return -5.9931 * pow(voltage, 5) + 40.392 * pow(voltage, 4) - 115.41 * pow(voltage, 3) + 174.67 * pow(voltage, 2) - 174.23 * voltage + 112.79; }

    /**
     *  Convert the ID voltage value to the mA value
     */
    static double currentConverter(double voltage) { return(10 * voltage); }

    /**
     *  Convert the VD and VG voltage values using a right scale factor
     */
    static double voltageConverter(double voltage) { return(voltage); }

private:

    /**@brief LO device and data collector */        
+16 −17
Original line number Diff line number Diff line
@@ -106,12 +106,12 @@ public:
	/**
	 * @return the instance of the local oscillator component name to drive 1st stage LO
	 */
	inline const IRA::CString& getLocalOscillatorInstance1st() const { return m_localOscillatorInstance1st; }
	 IRA::CString getLocalOscillatorInstance1st() const { return m_localOscillatorInstance1st; }

	/**
	 * @return the instance of the local oscillator component name to drive 2nd stage LO
	 */
	inline const IRA::CString& getLocalOscillatorInstance2nd() const { return m_localOscillatorInstance2nd; }
	IRA::CString getLocalOscillatorInstance2nd() const { return m_localOscillatorInstance2nd; }

	/* **** TABLES **** */

@@ -121,7 +121,7 @@ public:
	 * @param[out] p_out_coeffs Coeff c array
	 * @return Coeff Array len.
	 */
	DWORD getLeftMarkCoeffs( double *& p_out_coeffs) const;
	DWORD getLeftMarkCoeffs( double *& p_out_coeffs) ;

	/**
	 * @brief Get the Right pol. noise Mark Coeffs c array
@@ -129,7 +129,7 @@ public:
	 * @param[out] p_out_coeffs Coeff c array	 
	 * @return Coeff Array len.
	 */
	DWORD getRightMarkCoeffs(double *& p_out_coeffs) const;
	DWORD getRightMarkCoeffs(double *& p_out_coeffs) ;

	/**
	 * @brief Get mark temp at given freq ( left )
@@ -163,7 +163,6 @@ public:
	 */
	DWORD getTaperTable(double * &freq,double *&taper) const;

	
	/**
	 * @param code feed identification codes. It must be freed by caller.
	 * @param xOffset displacement of the feed with respect to the central one along x axis. It must be freed by caller.
@@ -178,62 +177,62 @@ public:
	/**
	 * @return mnemonic of the working mode of the receiver
	 */
	inline const IRA::CString& getSetupMode() const { return m_conf_hnd.getCurrentSetup().m_name; }
	inline const IRA::CString& getSetupMode()  { return m_conf_hnd.getCurrentSetup().m_name; }

	/**
	 * @return the lower limit of the RF coming from the receiver (MHz)
	 */
	inline double const * const  getRFMin() const { return &m_conf_hnd.getCurrentSetup().m_RFMin[0]; }
	inline double const * const  getRFMin()  { return &m_conf_hnd.getCurrentSetup().m_RFMin[0]; }

	/**
	 * @return the upper  limit of the RF coming from the receiver (MHz)
	 */
	inline double const * const  getRFMax() const { return &m_conf_hnd.getCurrentSetup().m_RFMax[0]; }
	inline double const * const  getRFMax()  { return &m_conf_hnd.getCurrentSetup().m_RFMax[0]; }

	/**
	 * @return the start frequency of the IF coming from the receiver (MHz)
	 */
	inline double const * const  getIFMin() const { return &m_conf_hnd.getCurrentSetup().m_IFMin[0]; }
	inline double const * const  getIFMin()  { return &m_conf_hnd.getCurrentSetup().m_IFMin[0]; }

	/**
	 * @return the bandwidth of the IF coming from the receiver (MHz)
	 */
	inline double const * const  getIFBandwidth() const{ return  &m_conf_hnd.getCurrentSetup().m_IFBandwidth[0]; }
	inline double const * const  getIFBandwidth() { return  &m_conf_hnd.getCurrentSetup().m_IFBandwidth[0]; }

	/**
	 * @return the number of IF chains for each feed
	 */
	inline const  DWORD getIFs() const { return m_conf_hnd.getCurrentSetup().m_IFs; }
	inline const  DWORD getIFs()  { return m_conf_hnd.getCurrentSetup().m_IFs; }

	/**
	 * @return the pointer to the polarizations array, the first element correspond to the first IF and so on.....
	 */
	inline Receivers::TPolarization const * const getPolarizations() const { return &m_conf_hnd.getCurrentSetup().m_polarizations[0]; }
	inline Receivers::TPolarization const * const getPolarizations()  { return &m_conf_hnd.getCurrentSetup().m_polarizations[0]; }

	/**
	 * @return the number of feeds
	 */
	inline const  DWORD getFeeds() const { return m_conf_hnd.getCurrentSetup().m_feeds; }
	inline const  DWORD getFeeds()  { return m_conf_hnd.getCurrentSetup().m_feeds; }

	/**
	 * @return the default frequency for the synthesizer  (MHz)
	 */
	inline double const * const  getDefaultLO()  const { return &m_conf_hnd.getCurrentSetup().m_defaultLO[0]; }
	inline double const * const  getDefaultLO()   { return &m_conf_hnd.getCurrentSetup().m_defaultLO[0]; }

	/**
	 * @return the value of the fixed synthesizer used for the second conversion (MHz)
	 */
	inline double const * const  getFixedLO2() const { return &m_conf_hnd.getCurrentSetup().m_fixedLO2[0]; }
	inline double const * const  getFixedLO2()  { return &m_conf_hnd.getCurrentSetup().m_fixedLO2[0]; }

	/**
	 * @return lower limit for the synthesizer tuning (MHz)
	 */
	inline double const * const  getLOMin() const { return  &m_conf_hnd.getCurrentSetup().m_LOMin[0]; }
	inline double const * const  getLOMin()  { return  &m_conf_hnd.getCurrentSetup().m_LOMin[0]; }

	/**
	 * @return upper limit for  the  synthesizer tuning (MHz)
	 */
	inline double const * const  getLOMax() const { return  &m_conf_hnd.getCurrentSetup().m_LOMax[0]; }
	inline double const * const  getLOMax()  { return  &m_conf_hnd.getCurrentSetup().m_LOMax[0]; }

private:

+21 −6
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ class MixerOperator{
        /**
         * @brief Default Ctor
         * @param p_config Component's config ref
         * @param p_services 
         */
        MixerOperator(CConfiguration & p_config );

@@ -26,6 +27,11 @@ class MixerOperator{
         */
        ~MixerOperator();

			/**
			* @brief Set services
			*/
			void setServices(maci::ContainerServices * p_services);

			/**
			* @brief
			*/
@@ -91,7 +97,7 @@ class MixerOperator{
         * @param[in] p_lo_instance LO name to be loaded 
         */
        void loadDevice(Receivers::LocalOscillator_var p_loDev,
                        char * p_lo_name);
                        const char * p_lo_name);

        /**
         * @brief Realse LO device by isntance name
@@ -100,17 +106,26 @@ class MixerOperator{
         * @param p_lo_name instance name
         */
        void releaseDevice(Receivers::LocalOscillator_var p_loDev,
                        char * p_lo_name);
                        const char * p_lo_name);

			/**
			* @brief Single component lock check			 
			* @param p_loDev Component instance
			* @param p_lo_name Component instance name
			* @return true id Device is locked
			*/
			bool isDeviceLocked(Receivers::LocalOscillator_var p_loDev,
										const char* p_lo_name);
			
    private:

        CConfiguration & m_configuration;   /**< Reference to component's config */
		  maci::ContainerServices * m_services; /**< maci service */
        bool m_init_ok; /**< Init part completed flag */
        bool m_mixer_fault; /**< Flag indicating some faults on LO devices */
        double m_current_value; /**< memo current value seen from user */
        Receivers::LocalOscillator_var m_loDev_1st; /**< First LO component */
        Receivers::LocalOscillator_var m_loDev_2nd; /**< Second LO component */          
        char * m_1st_name;  /**< First Lo comp. name */
        char * m_2nd_name;  /**< First Lo comp. name */
};

#endif
 No newline at end of file
+18 −19
Original line number Diff line number Diff line
@@ -157,7 +157,7 @@ struct ReceiverConfHandler{
     * @brief Get the Available configuration by enum name
     * @return Available conf names
     */
    const std::vector<ConfigurationName> getAvailableConfs() const;
    std::vector<ConfigurationName> getAvailableConfs() const;

    /**
     * @brief Get the actual configuration by its string tag
@@ -178,14 +178,14 @@ struct ReceiverConfHandler{
     * 
     * @return ConfigurationSetup for selected working mode
     */
    ConfigurationSetup getCurrentSetup() const;
    ConfigurationSetup getCurrentSetup()  ;
    
    /**
    * @brief Getter actual conf file access infos
	 *     
    * @return Current conf file acces
    */
    ConfigurationAccess getCurrentAccess() const;    
    ConfigurationAccess getCurrentAccess()  ;    

    /**
     * @brief Get the Available configuration by enum name
@@ -201,7 +201,7 @@ struct ReceiverConfHandler{
     * @return True if p_conf_name is present on access container
     */
    bool getConfigurationAccess(ConfigurationName p_conf_name,
                                ConfigurationAccess & p_out_conf) const;
                                ConfigurationAccess & p_out_conf) ;

    /**
     * @brief Get the requested configuration setup       
@@ -211,7 +211,7 @@ struct ReceiverConfHandler{
     * @return True when p_output_setup is valid
     */
    bool getConfigurationSetup(ConfigurationName p_conf_name,
                                ConfigurationSetup & p_out_setup) const;
                                ConfigurationSetup & p_out_setup)  ;


    private:
@@ -239,19 +239,9 @@ struct ReceiverConfHandler{
     * @param[out] p_conf_enum Conf enum tag relative to p_conf_name
     * @return true Requested configuration is valid
     */
    bool findEnumFromString(IRA::CString p_conf_name,
    bool findEnumFromString(IRA::CString &p_conf_name,
                             ConfigurationName & p_con_enum) const;
                             
    /**
     * @brief Find Receiver enum from string tag
     * 
     * @param p_receiver_name String tag receiver name
     * @param[out] p_receiver_enum Found receiver enum
     * @return true Receiver enum found
     */
    bool findReceiverFromString(IRA::CString p_receiver_name,
                             ReceiverName & p_receiver_enum) const;

	 /**
     * @brief Find mode enum from string tag
     * 
@@ -259,9 +249,18 @@ struct ReceiverConfHandler{
     * @param[out] p_mode_enum Found mode enum
     * @return true  Mode enum found
     */
    bool findModeFromString(IRA::CString p_mode_name,
                             ReceiverName & p_mode_enum) const;
    bool findModeFromString(IRA::CString & p_mode_name,
                             ModeName & p_mode_enum) const;

    /**
     * @brief Find Receiver enum from string tag
     * 
     * @param p_receiver_name String tag receiver name
     * @param[out] p_receiver_enum Found receiver enum
     * @return true Receiver enum found
     */
    bool findReceiverFromString(IRA::CString & p_receiver_name,
                             ReceiverName & p_receiver_enum) const;                         

    private:

Loading