Loading Medicina/Servers/MedicinaCBand/include/Configuration.h +15 −4 Original line number Diff line number Diff line Loading @@ -179,6 +179,11 @@ public: */ inline const IRA::CString& getSetupMode() { return m_conf_hnd.getCurrentSetup().m_name; } /** * @brief Getter whole current setup */ ReceiverConfHandler::ConfigurationSetup getCurrentSetup(){ return m_conf_hnd.getCurrentSetup(); } /** * @return the lower limit of the RF coming from the receiver (MHz) */ Loading @@ -187,17 +192,23 @@ public: /** * @return the upper limit of the RF coming from the receiver (MHz) */ inline double const * const getRFMax() { 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() { 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() { 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 Loading Medicina/Servers/MedicinaCBand/include/Defs.h +4 −2 Original line number Diff line number Diff line Loading @@ -24,9 +24,11 @@ #include <cstdio> #define MED_TRACE() do { fprintf(stderr, "MED_LOG %s:%d:%s() \n", __FILE__, __LINE__, __func__); } while(0); #define MED_TRACE_MSG(msg) do { fprintf(stderr, "MED_LOG %s:%d:%s() - %s \n", __FILE__, __LINE__, __func__, msg); } while(0); #define MED_TRACE_FMT(fmt,...) do { fprintf(stderr, fmt, __VA_ARGS__); } while(0); #else #define MED_TRACE() #define MED_TRACE_MSG(msg) do { } while(0); #define MED_TRACE_FMT(fmt,...) do { } while(0); #endif /* Loading Medicina/Servers/MedicinaCBand/src/ComponentCore.cpp +64 −28 Original line number Diff line number Diff line #include "ComponentCore.h" #include "Commons.h" #include "ReceiverConfHandler.h" #include <LogFilter.h> _IRA_LOGFILTER_IMPORT; Loading Loading @@ -81,25 +82,39 @@ void CComponentCore::activate(const char *mode) throw (ReceiversErrors::ModeErro ComponentErrors::CouldntGetComponentExImpl,ComponentErrors::CORBAProblemExImpl,ReceiversErrors::LocalOscillatorErrorExImpl,ReceiversErrors::NoRemoteControlErrorExImpl, ReceiversErrors::ReceiverControlBoardErrorExImpl) { MED_TRACE(); MED_TRACE_MSG(" IN "); /* activate mode */ baci::ThreadSyncGuard guard(&m_mutex); bool l_res= m_configuration.m_conf_hnd.setMode(mode); bool l_res= m_configuration.m_conf_hnd.setConfiguration(mode); if (! l_res){ MED_TRACE_MSG(" EXC set mode"); _EXCPT(ReceiversErrors::ModeErrorExImpl,impl,"CComponentErrors::setMode()"); throw impl; } guard.release(); MED_TRACE_MSG(" ASK IFs "); /* For every feed ( L R for med C) populate core member * arrays eg bandwidth polarization.. */ m_startFreq.length(m_configuration.getIFs()); m_bandwidth.length(m_configuration.getIFs()); m_polarization.length(m_configuration.getIFs()); for (WORD i=0;i<m_configuration.getIFs();i++) { m_startFreq[i]=m_configuration.getIFMin()[i]; m_bandwidth[i]=m_configuration.getIFBandwidth()[i]; m_polarization[i]=(long)m_configuration.getPolarizations()[i]; m_localOscillatorValue[i]=m_configuration.getDefaultLO()[i]; ReceiverConfHandler::ConfigurationSetup l_setup= m_configuration.getCurrentSetup(); m_startFreq.length(l_setup.m_IFs); m_bandwidth.length(l_setup.m_IFs); m_polarization.length(l_setup.m_IFs); MED_TRACE_FMT("IFMin len %d\n",l_setup.m_IFMin.size()); MED_TRACE_FMT("IFBandwidth len %d\n",l_setup.m_IFBandwidth.size()); MED_TRACE_FMT("Polar. len %d\n",l_setup.m_polarizations.size()); MED_TRACE_FMT("Default LO len %d\n",l_setup.m_defaultLO.size()); try{ for (WORD i=0; i < l_setup.m_IFs; i++) { MED_TRACE_MSG(" SET PARAMS IF "); m_startFreq[i]=l_setup.m_IFMin[i]; m_bandwidth[i]=l_setup.m_IFBandwidth[i]; m_polarization[i]=(long)l_setup.m_polarizations[i]; m_localOscillatorValue[i]=l_setup.m_defaultLO[i]; } }catch(...){ MED_TRACE_MSG(" EXC SET IFS "); } // Basic operations lnaOn(); // throw (ReceiversErrors::NoRemoteControlErrorExImpl,ReceiversErrors::ReceiverControlBoardErrorExImpl) Loading @@ -107,9 +122,11 @@ void CComponentCore::activate(const char *mode) throw (ReceiversErrors::ModeErro // Remote control check bool answer; try { MED_TRACE_MSG(" CHECK LOCAL REMOTE "); answer=m_control->isRemoteOn(); } catch (IRA::ReceiverControlEx& ex) { MED_TRACE_MSG(" LOCAL REMOTE EXC"); _EXCPT(ReceiversErrors::ReceiverControlBoardErrorExImpl,impl,"CComponentCore::activate()"); impl.setDetails(ex.what().c_str()); setStatusBit(CONNECTIONERROR); Loading @@ -123,7 +140,7 @@ void CComponentCore::activate(const char *mode) throw (ReceiversErrors::ModeErro _IRA_LOGFILTER_LOG(LM_NOTICE, "CComponentCore::activate()", "RECEIVER_COMMUNICATION_MODE_LOCAL"); setStatusBit(LOCAL); } MED_TRACE(); MED_TRACE_MSG(" OUT "); } Loading Loading @@ -178,20 +195,38 @@ void CComponentCore::setMode(const char * mode) throw (ReceiversErrors::ModeErro cmdMode.MakeUpper(); bool l_res= m_configuration.m_conf_hnd.setMode(mode); if (!l_res) { MED_TRACE_MSG(" EXCP "); _EXCPT(ReceiversErrors::ModeErrorExImpl,impl,"CComponentErrors::setMode()"); throw impl; } // for (WORD i=0;i<m_configuration.getIFs();i++) { m_startFreq[i]=m_configuration.getIFMin()[i]; m_bandwidth[i]=m_configuration.getIFBandwidth()[i]; m_polarization[i]=(long)m_configuration.getPolarizations()[i]; ReceiverConfHandler::ConfigurationSetup l_setup= m_configuration.getCurrentSetup(); /**/ try{ MED_TRACE_FMT("Len IFMin %d", l_setup.m_IFBandwidth.size()); for (int i=0; i < l_setup.m_IFs ;i++) { #ifdef MED_DEBUG_LVL fprintf(stderr,"IFMin %f\n",l_setup.m_IFMin[i]); fprintf(stderr,"IFBandwidth %f\n",l_setup.m_IFBandwidth[i]); fprintf(stderr,"IFBandwidth %d\n",l_setup.m_polarizations[i]); #endif m_startFreq[i]= l_setup.m_IFMin[i]; m_bandwidth[i]= l_setup.m_IFBandwidth[i]; m_polarization[i]= (long)l_setup.m_polarizations[i]; } }catch(...){ MED_TRACE_MSG(" EXC 1 "); } // the set the default LO for the default LO for the selected mode..... ACS::doubleSeq lo; lo.length(m_configuration.getIFs()); for (WORD i=0;i<m_configuration.getIFs();i++) { lo[i]=m_configuration.getDefaultLO()[i]; MED_TRACE_MSG(" LO "); lo.length(l_setup.m_IFs); try{ for (WORD i=0; i < l_setup.m_IFs; i++) { MED_TRACE_MSG(" LO DEFAULT "); lo[i]= l_setup.m_defaultLO[i]; } }catch(...){ MED_TRACE_MSG(" EXC 2 "); } setLO(lo); // throw (ComponentErrors::ValidationErrorExImpl,ComponentErrors::ValueOutofRangeExImpl,ComponentErrors::CouldntGetComponentExImpl,ComponentErrors::CORBAProblemExImpl,ReceiversErrors::LocalOscillatorErrorExImpl) m_calDiode=false; Loading @@ -199,8 +234,7 @@ void CComponentCore::setMode(const char * mode) throw (ReceiversErrors::ModeErro MED_TRACE_MSG(" OUT "); } const IRA::CString CComponentCore::getSetupMode() { const IRA::CString CComponentCore::getSetupMode(){ baci::ThreadSyncGuard guard(&m_mutex); return m_configuration.m_conf_hnd.getActualConfStr(); } Loading @@ -211,17 +245,19 @@ void CComponentCore::setLO(const ACS::doubleSeq& lo) throw (ComponentErrors::ValidationErrorExImpl,ComponentErrors::ValueOutofRangeExImpl, ComponentErrors::CouldntGetComponentExImpl,ComponentErrors::CORBAProblemExImpl,ReceiversErrors::LocalOscillatorErrorExImpl) { MED_TRACE_MSG(" IN "); baci::ThreadSyncGuard guard(&m_mutex); m_mixer.setValue(lo); /** @todo Bandwidth update, check it */ ReceiverConfHandler::ConfigurationSetup l_setup= m_configuration.getCurrentSetup(); double l_lo_value= m_mixer.getValue(); for (WORD i=0; i < m_configuration.getIFs(); i++) { m_bandwidth[i]= m_configuration.getRFMax()[i]-( m_startFreq[i] + l_lo_value ); for (WORD i=0; i < l_setup.m_IFs; i++) { m_bandwidth[i]= l_setup.m_RFMax[i]-( m_startFreq[i] + l_lo_value ); // the if bandwidth could never be larger than the max IF bandwidth: if (m_bandwidth[i] > m_configuration.getIFBandwidth()[i]) m_bandwidth[i]= m_configuration.getIFBandwidth()[i]; if (m_bandwidth[i] > l_setup.m_IFBandwidth[i]) m_bandwidth[i]= l_setup.m_IFBandwidth[i]; } ACS_LOG(LM_FULL_INFO,"CComponentCore::setLO()",(LM_NOTICE,"LOCAL_OSCILLATOR %lf",l_lo_value)); MED_TRACE_MSG(" OUT "); } void CComponentCore::getLO(ACS::doubleSeq& lo) Loading Medicina/Servers/MedicinaCBand/src/MixerOperator.cpp +21 −11 Original line number Diff line number Diff line Loading @@ -73,11 +73,11 @@ bool MixerOperator::setValue(const ACS::doubleSeq& p_values) ComponentErrors::CORBAProblemExImpl, ReceiversErrors::LocalOscillatorErrorExImpl) { MED_TRACE(); /** @todo controllare */ MED_TRACE_MSG(" IN "); if(!m_init_ok || CORBA::is_nil(m_loDev_1st) || CORBA::is_nil(m_loDev_1st) ){ ACS_LOG(LM_FULL_INFO,"CComponentCore::setLO()", (LM_NOTICE,"LOs not ready to be set")); MED_TRACE_MSG(" EXCP devices not found "); return false; } /**/ Loading @@ -85,6 +85,9 @@ bool MixerOperator::setValue(const ACS::doubleSeq& p_values) double *freq=NULL; double *power=NULL; DWORD size; ReceiverConfHandler::ConfigurationSetup l_setup= m_configuration.getCurrentSetup(); if (p_values.length()==0) { _EXCPT(ComponentErrors::ValidationErrorExImpl,impl,"CComponentCore::setLO"); impl.setReason("at least one value must be provided"); Loading @@ -97,27 +100,30 @@ bool MixerOperator::setValue(const ACS::doubleSeq& p_values) return false; } // now check if the requested value match the limits if (p_values[0]<m_configuration.getLOMin()[0]) { if (p_values[0]<l_setup.m_LOMin[0]) { _EXCPT(ComponentErrors::ValueOutofRangeExImpl,impl,"CComponentCore::setLO"); impl.setValueName("local oscillator lower limit"); impl.setValueLimit(m_configuration.getLOMin()[0]); impl.setValueLimit(l_setup.m_LOMin[0]); throw impl; } else if (p_values[0]>m_configuration.getLOMax()[0]) { else if (p_values[0]> l_setup.m_LOMax[0]) { _EXCPT(ComponentErrors::ValueOutofRangeExImpl,impl,"CComponentCore::setLO"); impl.setValueName("local oscillator upper limit"); impl.setValueLimit(m_configuration.getLOMax()[0]); impl.setValueLimit(l_setup.m_LOMax[0]); throw impl; } MED_TRACE_MSG(" calculate value "); //computes the synthesizer settings trueValue= p_values[0]+m_configuration.getFixedLO2()[0]; trueValue= p_values[0]+l_setup.m_fixedLO2[0]; size= m_configuration.getSynthesizerTable(freq,power); amp= round(Helpers::linearFit(freq,power,size,trueValue)); if (power) delete [] power; if (freq) delete [] freq; ACS_LOG(LM_FULL_INFO,"CComponentCore::setLO()",(LM_DEBUG,"SYNTHESIZER_VALUES %lf %lf",trueValue,amp)); try { #ifndef EXCLUDE_MIXER m_loDev_1st->set(amp, trueValue); #endif } catch (CORBA::SystemException& ex) { m_mixer_fault= true; Loading @@ -131,7 +137,7 @@ bool MixerOperator::setValue(const ACS::doubleSeq& p_values) throw impl; } m_current_value= p_values[0]; MED_TRACE(); MED_TRACE_MSG(" OUT "); return true; } Loading @@ -140,7 +146,11 @@ double MixerOperator::getValue() double l_power; double l_freq; try{ #ifndef EXCLUDE_MIXER m_loDev_1st->get(l_power, l_freq); #else return 0.0; #endif } catch (ReceiversErrors::ReceiversErrorsEx& ex) { _ADD_BACKTRACE(ReceiversErrors::LocalOscillatorErrorExImpl,impl,ex,"CComponentCore::setLO()"); throw impl; Loading Medicina/Servers/MedicinaCBand/src/ReceiverConfHandler.cpp +37 −5 Original line number Diff line number Diff line Loading @@ -15,8 +15,8 @@ ReceiverConfHandler::ReceiverConfHandler() /* Conf - names */ m_conf_name[CCC_Normal]= "CCCNormal"; m_conf_name[CCC_Narrow]= "CCCNarrow"; m_conf_name[CHC_Normal]= "chcNormal"; m_conf_name[CHC_Narrow]= "chcNarrow"; m_conf_name[CHC_Normal]= "CHCNormal"; m_conf_name[CHC_Narrow]= "CHCNarrow"; /* Filling partial conf definitions */ m_receiver_name[CCC]= "CCC"; m_receiver_name[CHC]= "CHC"; Loading Loading @@ -100,11 +100,13 @@ ReceiverConfHandler::~ReceiverConfHandler() /* *** SETTERS *** */ bool ReceiverConfHandler::setConfiguration(ConfigurationName p_conf_name){ MED_TRACE(); MED_TRACE_MSG(" IN "); if (findConfiguration(p_conf_name)){ m_current_conf= m_available_current[p_conf_name]; MED_TRACE_MSG(" OUT TRUE "); return true; } MED_TRACE_MSG(" OUT "); return false; } Loading @@ -122,6 +124,23 @@ bool ReceiverConfHandler::setConfigurationSetup(ConfigurationName p_conf_name, { if (findConfiguration(p_conf_name)){ m_conf_data[p_conf_name]= p_setup; #ifdef MED_DEBUG_LVL fprintf(stderr, " -- SETUP START -- \n"); fprintf(stderr, " ifmin[0] %d \n", p_setup.m_IFs); for (int i=0; i < p_setup.m_IFs; i++){ fprintf(stderr, "Pol[%d] %d \n",i, (long)p_setup.m_polarizations[i]); fprintf(stderr, "IFMin[%d] %f \n",i, p_setup.m_IFMin[i]); //fprintf(stderr, "RFMin[%d] %d \n",i, p_setup.m_RFMin[i]); //fprintf(stderr, "IFMax[%d] %d \n",i, p_setup.m_RFMax[i]); fprintf(stderr, "Bw[%d] %f \n",i, p_setup.m_IFBandwidth[i]); //fprintf(stderr, "defaultLO[%d] %d \n",i, p_setup.m_defaultLO[i]); //fprintf(stderr, "LOMin[%d] %d \n",i, p_setup.m_LOMin[i]); //fprintf(stderr, "LOMax[%d] %d \n",i, p_setup.m_LOMax[i]); } fprintf(stderr, " -- SETUP END -- \n"); #endif /**/ return true; } return false; Loading Loading @@ -197,31 +216,38 @@ bool ReceiverConfHandler::setMode(IRA::CString p_mode_name) MED_TRACE_MSG(" IN "); ModeName l_mode_enum; bool l_ret= findModeFromString(p_mode_name, l_mode_enum); if (!l_ret) if (!l_ret){ MED_TRACE_MSG(" OUT FALSE "); return false; } MED_TRACE_MSG(" SWITCH "); switch (l_mode_enum){ case Normal: if (m_current_conf.m_receiver == CCC){ setConfiguration(CCC_Normal); MED_TRACE_MSG(" OUT CCC NORMAL TRUE "); return true; } if (m_current_conf.m_receiver == CHC){ setConfiguration(CHC_Normal); MED_TRACE_MSG(" OUT CHC NORMAL TRUE "); return true; } break; case Narrow: if (m_current_conf.m_receiver == CCC){ setConfiguration(CCC_Narrow); MED_TRACE_MSG(" OUT CCC NARROW TRUE "); return true; } if (m_current_conf.m_receiver == CHC){ setConfiguration(CHC_Narrow); MED_TRACE_MSG(" OUT CHC NARROW TRUE "); return true; } break; } MED_TRACE_MSG(" OUT FALSE "); return false; } Loading @@ -248,11 +274,14 @@ ReceiverConfHandler::ConfigurationName ReceiverConfHandler::getActualConf(){ } ReceiverConfHandler::ConfigurationSetup ReceiverConfHandler::getCurrentSetup() { MED_TRACE_MSG(" IN "); ReceiverConfHandler::ConfigurationName l_name_enum = m_current_conf.m_name; if (!findConfiguration(l_name_enum)){ setConfiguration(CCC_Normal); MED_TRACE_MSG(" OUT DEFAULT "); return m_conf_data[CCC_Normal]; } MED_TRACE_MSG(" OUT "); return m_conf_data[l_name_enum]; } Loading Loading @@ -329,13 +358,16 @@ bool ReceiverConfHandler::findEnumFromString(IRA::CString & p_conf_name, bool ReceiverConfHandler::findModeFromString(IRA::CString & p_mode_name, ModeName & p_mode_enum) const { MED_TRACE_FMT(" Asking for mode string %s\n", p_mode_name); std::map<ReceiverConfHandler::ModeName, IRA::CString>::const_iterator l_it; for (l_it= m_mode_name.begin(); l_it != m_mode_name.end(); ++l_it ){ if (l_it->second == p_mode_name){ MED_TRACE_MSG(" CONF FOUND "); p_mode_enum= l_it->first; return true; } } MED_TRACE_MSG(" CONF NOT FOUND "); return false; } Loading Loading
Medicina/Servers/MedicinaCBand/include/Configuration.h +15 −4 Original line number Diff line number Diff line Loading @@ -179,6 +179,11 @@ public: */ inline const IRA::CString& getSetupMode() { return m_conf_hnd.getCurrentSetup().m_name; } /** * @brief Getter whole current setup */ ReceiverConfHandler::ConfigurationSetup getCurrentSetup(){ return m_conf_hnd.getCurrentSetup(); } /** * @return the lower limit of the RF coming from the receiver (MHz) */ Loading @@ -187,17 +192,23 @@ public: /** * @return the upper limit of the RF coming from the receiver (MHz) */ inline double const * const getRFMax() { 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() { 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() { 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 Loading
Medicina/Servers/MedicinaCBand/include/Defs.h +4 −2 Original line number Diff line number Diff line Loading @@ -24,9 +24,11 @@ #include <cstdio> #define MED_TRACE() do { fprintf(stderr, "MED_LOG %s:%d:%s() \n", __FILE__, __LINE__, __func__); } while(0); #define MED_TRACE_MSG(msg) do { fprintf(stderr, "MED_LOG %s:%d:%s() - %s \n", __FILE__, __LINE__, __func__, msg); } while(0); #define MED_TRACE_FMT(fmt,...) do { fprintf(stderr, fmt, __VA_ARGS__); } while(0); #else #define MED_TRACE() #define MED_TRACE_MSG(msg) do { } while(0); #define MED_TRACE_FMT(fmt,...) do { } while(0); #endif /* Loading
Medicina/Servers/MedicinaCBand/src/ComponentCore.cpp +64 −28 Original line number Diff line number Diff line #include "ComponentCore.h" #include "Commons.h" #include "ReceiverConfHandler.h" #include <LogFilter.h> _IRA_LOGFILTER_IMPORT; Loading Loading @@ -81,25 +82,39 @@ void CComponentCore::activate(const char *mode) throw (ReceiversErrors::ModeErro ComponentErrors::CouldntGetComponentExImpl,ComponentErrors::CORBAProblemExImpl,ReceiversErrors::LocalOscillatorErrorExImpl,ReceiversErrors::NoRemoteControlErrorExImpl, ReceiversErrors::ReceiverControlBoardErrorExImpl) { MED_TRACE(); MED_TRACE_MSG(" IN "); /* activate mode */ baci::ThreadSyncGuard guard(&m_mutex); bool l_res= m_configuration.m_conf_hnd.setMode(mode); bool l_res= m_configuration.m_conf_hnd.setConfiguration(mode); if (! l_res){ MED_TRACE_MSG(" EXC set mode"); _EXCPT(ReceiversErrors::ModeErrorExImpl,impl,"CComponentErrors::setMode()"); throw impl; } guard.release(); MED_TRACE_MSG(" ASK IFs "); /* For every feed ( L R for med C) populate core member * arrays eg bandwidth polarization.. */ m_startFreq.length(m_configuration.getIFs()); m_bandwidth.length(m_configuration.getIFs()); m_polarization.length(m_configuration.getIFs()); for (WORD i=0;i<m_configuration.getIFs();i++) { m_startFreq[i]=m_configuration.getIFMin()[i]; m_bandwidth[i]=m_configuration.getIFBandwidth()[i]; m_polarization[i]=(long)m_configuration.getPolarizations()[i]; m_localOscillatorValue[i]=m_configuration.getDefaultLO()[i]; ReceiverConfHandler::ConfigurationSetup l_setup= m_configuration.getCurrentSetup(); m_startFreq.length(l_setup.m_IFs); m_bandwidth.length(l_setup.m_IFs); m_polarization.length(l_setup.m_IFs); MED_TRACE_FMT("IFMin len %d\n",l_setup.m_IFMin.size()); MED_TRACE_FMT("IFBandwidth len %d\n",l_setup.m_IFBandwidth.size()); MED_TRACE_FMT("Polar. len %d\n",l_setup.m_polarizations.size()); MED_TRACE_FMT("Default LO len %d\n",l_setup.m_defaultLO.size()); try{ for (WORD i=0; i < l_setup.m_IFs; i++) { MED_TRACE_MSG(" SET PARAMS IF "); m_startFreq[i]=l_setup.m_IFMin[i]; m_bandwidth[i]=l_setup.m_IFBandwidth[i]; m_polarization[i]=(long)l_setup.m_polarizations[i]; m_localOscillatorValue[i]=l_setup.m_defaultLO[i]; } }catch(...){ MED_TRACE_MSG(" EXC SET IFS "); } // Basic operations lnaOn(); // throw (ReceiversErrors::NoRemoteControlErrorExImpl,ReceiversErrors::ReceiverControlBoardErrorExImpl) Loading @@ -107,9 +122,11 @@ void CComponentCore::activate(const char *mode) throw (ReceiversErrors::ModeErro // Remote control check bool answer; try { MED_TRACE_MSG(" CHECK LOCAL REMOTE "); answer=m_control->isRemoteOn(); } catch (IRA::ReceiverControlEx& ex) { MED_TRACE_MSG(" LOCAL REMOTE EXC"); _EXCPT(ReceiversErrors::ReceiverControlBoardErrorExImpl,impl,"CComponentCore::activate()"); impl.setDetails(ex.what().c_str()); setStatusBit(CONNECTIONERROR); Loading @@ -123,7 +140,7 @@ void CComponentCore::activate(const char *mode) throw (ReceiversErrors::ModeErro _IRA_LOGFILTER_LOG(LM_NOTICE, "CComponentCore::activate()", "RECEIVER_COMMUNICATION_MODE_LOCAL"); setStatusBit(LOCAL); } MED_TRACE(); MED_TRACE_MSG(" OUT "); } Loading Loading @@ -178,20 +195,38 @@ void CComponentCore::setMode(const char * mode) throw (ReceiversErrors::ModeErro cmdMode.MakeUpper(); bool l_res= m_configuration.m_conf_hnd.setMode(mode); if (!l_res) { MED_TRACE_MSG(" EXCP "); _EXCPT(ReceiversErrors::ModeErrorExImpl,impl,"CComponentErrors::setMode()"); throw impl; } // for (WORD i=0;i<m_configuration.getIFs();i++) { m_startFreq[i]=m_configuration.getIFMin()[i]; m_bandwidth[i]=m_configuration.getIFBandwidth()[i]; m_polarization[i]=(long)m_configuration.getPolarizations()[i]; ReceiverConfHandler::ConfigurationSetup l_setup= m_configuration.getCurrentSetup(); /**/ try{ MED_TRACE_FMT("Len IFMin %d", l_setup.m_IFBandwidth.size()); for (int i=0; i < l_setup.m_IFs ;i++) { #ifdef MED_DEBUG_LVL fprintf(stderr,"IFMin %f\n",l_setup.m_IFMin[i]); fprintf(stderr,"IFBandwidth %f\n",l_setup.m_IFBandwidth[i]); fprintf(stderr,"IFBandwidth %d\n",l_setup.m_polarizations[i]); #endif m_startFreq[i]= l_setup.m_IFMin[i]; m_bandwidth[i]= l_setup.m_IFBandwidth[i]; m_polarization[i]= (long)l_setup.m_polarizations[i]; } }catch(...){ MED_TRACE_MSG(" EXC 1 "); } // the set the default LO for the default LO for the selected mode..... ACS::doubleSeq lo; lo.length(m_configuration.getIFs()); for (WORD i=0;i<m_configuration.getIFs();i++) { lo[i]=m_configuration.getDefaultLO()[i]; MED_TRACE_MSG(" LO "); lo.length(l_setup.m_IFs); try{ for (WORD i=0; i < l_setup.m_IFs; i++) { MED_TRACE_MSG(" LO DEFAULT "); lo[i]= l_setup.m_defaultLO[i]; } }catch(...){ MED_TRACE_MSG(" EXC 2 "); } setLO(lo); // throw (ComponentErrors::ValidationErrorExImpl,ComponentErrors::ValueOutofRangeExImpl,ComponentErrors::CouldntGetComponentExImpl,ComponentErrors::CORBAProblemExImpl,ReceiversErrors::LocalOscillatorErrorExImpl) m_calDiode=false; Loading @@ -199,8 +234,7 @@ void CComponentCore::setMode(const char * mode) throw (ReceiversErrors::ModeErro MED_TRACE_MSG(" OUT "); } const IRA::CString CComponentCore::getSetupMode() { const IRA::CString CComponentCore::getSetupMode(){ baci::ThreadSyncGuard guard(&m_mutex); return m_configuration.m_conf_hnd.getActualConfStr(); } Loading @@ -211,17 +245,19 @@ void CComponentCore::setLO(const ACS::doubleSeq& lo) throw (ComponentErrors::ValidationErrorExImpl,ComponentErrors::ValueOutofRangeExImpl, ComponentErrors::CouldntGetComponentExImpl,ComponentErrors::CORBAProblemExImpl,ReceiversErrors::LocalOscillatorErrorExImpl) { MED_TRACE_MSG(" IN "); baci::ThreadSyncGuard guard(&m_mutex); m_mixer.setValue(lo); /** @todo Bandwidth update, check it */ ReceiverConfHandler::ConfigurationSetup l_setup= m_configuration.getCurrentSetup(); double l_lo_value= m_mixer.getValue(); for (WORD i=0; i < m_configuration.getIFs(); i++) { m_bandwidth[i]= m_configuration.getRFMax()[i]-( m_startFreq[i] + l_lo_value ); for (WORD i=0; i < l_setup.m_IFs; i++) { m_bandwidth[i]= l_setup.m_RFMax[i]-( m_startFreq[i] + l_lo_value ); // the if bandwidth could never be larger than the max IF bandwidth: if (m_bandwidth[i] > m_configuration.getIFBandwidth()[i]) m_bandwidth[i]= m_configuration.getIFBandwidth()[i]; if (m_bandwidth[i] > l_setup.m_IFBandwidth[i]) m_bandwidth[i]= l_setup.m_IFBandwidth[i]; } ACS_LOG(LM_FULL_INFO,"CComponentCore::setLO()",(LM_NOTICE,"LOCAL_OSCILLATOR %lf",l_lo_value)); MED_TRACE_MSG(" OUT "); } void CComponentCore::getLO(ACS::doubleSeq& lo) Loading
Medicina/Servers/MedicinaCBand/src/MixerOperator.cpp +21 −11 Original line number Diff line number Diff line Loading @@ -73,11 +73,11 @@ bool MixerOperator::setValue(const ACS::doubleSeq& p_values) ComponentErrors::CORBAProblemExImpl, ReceiversErrors::LocalOscillatorErrorExImpl) { MED_TRACE(); /** @todo controllare */ MED_TRACE_MSG(" IN "); if(!m_init_ok || CORBA::is_nil(m_loDev_1st) || CORBA::is_nil(m_loDev_1st) ){ ACS_LOG(LM_FULL_INFO,"CComponentCore::setLO()", (LM_NOTICE,"LOs not ready to be set")); MED_TRACE_MSG(" EXCP devices not found "); return false; } /**/ Loading @@ -85,6 +85,9 @@ bool MixerOperator::setValue(const ACS::doubleSeq& p_values) double *freq=NULL; double *power=NULL; DWORD size; ReceiverConfHandler::ConfigurationSetup l_setup= m_configuration.getCurrentSetup(); if (p_values.length()==0) { _EXCPT(ComponentErrors::ValidationErrorExImpl,impl,"CComponentCore::setLO"); impl.setReason("at least one value must be provided"); Loading @@ -97,27 +100,30 @@ bool MixerOperator::setValue(const ACS::doubleSeq& p_values) return false; } // now check if the requested value match the limits if (p_values[0]<m_configuration.getLOMin()[0]) { if (p_values[0]<l_setup.m_LOMin[0]) { _EXCPT(ComponentErrors::ValueOutofRangeExImpl,impl,"CComponentCore::setLO"); impl.setValueName("local oscillator lower limit"); impl.setValueLimit(m_configuration.getLOMin()[0]); impl.setValueLimit(l_setup.m_LOMin[0]); throw impl; } else if (p_values[0]>m_configuration.getLOMax()[0]) { else if (p_values[0]> l_setup.m_LOMax[0]) { _EXCPT(ComponentErrors::ValueOutofRangeExImpl,impl,"CComponentCore::setLO"); impl.setValueName("local oscillator upper limit"); impl.setValueLimit(m_configuration.getLOMax()[0]); impl.setValueLimit(l_setup.m_LOMax[0]); throw impl; } MED_TRACE_MSG(" calculate value "); //computes the synthesizer settings trueValue= p_values[0]+m_configuration.getFixedLO2()[0]; trueValue= p_values[0]+l_setup.m_fixedLO2[0]; size= m_configuration.getSynthesizerTable(freq,power); amp= round(Helpers::linearFit(freq,power,size,trueValue)); if (power) delete [] power; if (freq) delete [] freq; ACS_LOG(LM_FULL_INFO,"CComponentCore::setLO()",(LM_DEBUG,"SYNTHESIZER_VALUES %lf %lf",trueValue,amp)); try { #ifndef EXCLUDE_MIXER m_loDev_1st->set(amp, trueValue); #endif } catch (CORBA::SystemException& ex) { m_mixer_fault= true; Loading @@ -131,7 +137,7 @@ bool MixerOperator::setValue(const ACS::doubleSeq& p_values) throw impl; } m_current_value= p_values[0]; MED_TRACE(); MED_TRACE_MSG(" OUT "); return true; } Loading @@ -140,7 +146,11 @@ double MixerOperator::getValue() double l_power; double l_freq; try{ #ifndef EXCLUDE_MIXER m_loDev_1st->get(l_power, l_freq); #else return 0.0; #endif } catch (ReceiversErrors::ReceiversErrorsEx& ex) { _ADD_BACKTRACE(ReceiversErrors::LocalOscillatorErrorExImpl,impl,ex,"CComponentCore::setLO()"); throw impl; Loading
Medicina/Servers/MedicinaCBand/src/ReceiverConfHandler.cpp +37 −5 Original line number Diff line number Diff line Loading @@ -15,8 +15,8 @@ ReceiverConfHandler::ReceiverConfHandler() /* Conf - names */ m_conf_name[CCC_Normal]= "CCCNormal"; m_conf_name[CCC_Narrow]= "CCCNarrow"; m_conf_name[CHC_Normal]= "chcNormal"; m_conf_name[CHC_Narrow]= "chcNarrow"; m_conf_name[CHC_Normal]= "CHCNormal"; m_conf_name[CHC_Narrow]= "CHCNarrow"; /* Filling partial conf definitions */ m_receiver_name[CCC]= "CCC"; m_receiver_name[CHC]= "CHC"; Loading Loading @@ -100,11 +100,13 @@ ReceiverConfHandler::~ReceiverConfHandler() /* *** SETTERS *** */ bool ReceiverConfHandler::setConfiguration(ConfigurationName p_conf_name){ MED_TRACE(); MED_TRACE_MSG(" IN "); if (findConfiguration(p_conf_name)){ m_current_conf= m_available_current[p_conf_name]; MED_TRACE_MSG(" OUT TRUE "); return true; } MED_TRACE_MSG(" OUT "); return false; } Loading @@ -122,6 +124,23 @@ bool ReceiverConfHandler::setConfigurationSetup(ConfigurationName p_conf_name, { if (findConfiguration(p_conf_name)){ m_conf_data[p_conf_name]= p_setup; #ifdef MED_DEBUG_LVL fprintf(stderr, " -- SETUP START -- \n"); fprintf(stderr, " ifmin[0] %d \n", p_setup.m_IFs); for (int i=0; i < p_setup.m_IFs; i++){ fprintf(stderr, "Pol[%d] %d \n",i, (long)p_setup.m_polarizations[i]); fprintf(stderr, "IFMin[%d] %f \n",i, p_setup.m_IFMin[i]); //fprintf(stderr, "RFMin[%d] %d \n",i, p_setup.m_RFMin[i]); //fprintf(stderr, "IFMax[%d] %d \n",i, p_setup.m_RFMax[i]); fprintf(stderr, "Bw[%d] %f \n",i, p_setup.m_IFBandwidth[i]); //fprintf(stderr, "defaultLO[%d] %d \n",i, p_setup.m_defaultLO[i]); //fprintf(stderr, "LOMin[%d] %d \n",i, p_setup.m_LOMin[i]); //fprintf(stderr, "LOMax[%d] %d \n",i, p_setup.m_LOMax[i]); } fprintf(stderr, " -- SETUP END -- \n"); #endif /**/ return true; } return false; Loading Loading @@ -197,31 +216,38 @@ bool ReceiverConfHandler::setMode(IRA::CString p_mode_name) MED_TRACE_MSG(" IN "); ModeName l_mode_enum; bool l_ret= findModeFromString(p_mode_name, l_mode_enum); if (!l_ret) if (!l_ret){ MED_TRACE_MSG(" OUT FALSE "); return false; } MED_TRACE_MSG(" SWITCH "); switch (l_mode_enum){ case Normal: if (m_current_conf.m_receiver == CCC){ setConfiguration(CCC_Normal); MED_TRACE_MSG(" OUT CCC NORMAL TRUE "); return true; } if (m_current_conf.m_receiver == CHC){ setConfiguration(CHC_Normal); MED_TRACE_MSG(" OUT CHC NORMAL TRUE "); return true; } break; case Narrow: if (m_current_conf.m_receiver == CCC){ setConfiguration(CCC_Narrow); MED_TRACE_MSG(" OUT CCC NARROW TRUE "); return true; } if (m_current_conf.m_receiver == CHC){ setConfiguration(CHC_Narrow); MED_TRACE_MSG(" OUT CHC NARROW TRUE "); return true; } break; } MED_TRACE_MSG(" OUT FALSE "); return false; } Loading @@ -248,11 +274,14 @@ ReceiverConfHandler::ConfigurationName ReceiverConfHandler::getActualConf(){ } ReceiverConfHandler::ConfigurationSetup ReceiverConfHandler::getCurrentSetup() { MED_TRACE_MSG(" IN "); ReceiverConfHandler::ConfigurationName l_name_enum = m_current_conf.m_name; if (!findConfiguration(l_name_enum)){ setConfiguration(CCC_Normal); MED_TRACE_MSG(" OUT DEFAULT "); return m_conf_data[CCC_Normal]; } MED_TRACE_MSG(" OUT "); return m_conf_data[l_name_enum]; } Loading Loading @@ -329,13 +358,16 @@ bool ReceiverConfHandler::findEnumFromString(IRA::CString & p_conf_name, bool ReceiverConfHandler::findModeFromString(IRA::CString & p_mode_name, ModeName & p_mode_enum) const { MED_TRACE_FMT(" Asking for mode string %s\n", p_mode_name); std::map<ReceiverConfHandler::ModeName, IRA::CString>::const_iterator l_it; for (l_it= m_mode_name.begin(); l_it != m_mode_name.end(); ++l_it ){ if (l_it->second == p_mode_name){ MED_TRACE_MSG(" CONF FOUND "); p_mode_enum= l_it->first; return true; } } MED_TRACE_MSG(" CONF NOT FOUND "); return false; } Loading