Loading Common/Servers/TotalPower/config/CDB/schemas/TotalPowerSetup.xsd +10 −2 Original line number Diff line number Diff line Loading @@ -56,6 +56,12 @@ </xs:restriction> </xs:simpleType> <xs:element name="inputPort"> <xs:simpleType> <xs:list itemType="SelectedPortType" /> </xs:simpleType> </xs:element> <xs:complexType name="TTableHeader"> <xs:sequence> <xs:element name="configurationID" type="xs:string"> Loading @@ -73,9 +79,11 @@ true if the calibration mark switching could be used </xs:documentation></xs:annotation> </xs:element> <xs:element name="inputPort" type="SelectedPortType"> <xs:element ref="inputPort" minOccurs="1" maxOccurs="unbounded"> <xs:annotation><xs:documentation> selects from which port the RF inputs has to be taken for the present configuration selects from which port the RF inputs has to be taken for the present configuration, if more than one value is provided the inputs are configured on sinble board basis. The numbero of enties shoudl be less than the numebr of installed boards. The board not directly involved in the configuration (i.e stated on the section_boards section) will be configured with 0 attenuation andd full bandwidth </xs:documentation></xs:annotation> </xs:element> <xs:element name="beams" type="xs:long"> Loading Common/Servers/TotalPower/include/CommandLine.h +17 −9 Original line number Diff line number Diff line Loading @@ -57,12 +57,14 @@ public: * @throw BackendsErrors::NakExImpl */ void Init(CConfiguration *config) throw (ComponentErrors::SocketErrorExImpl, ComponentErrors::ValidationErrorExImpl,ComponentErrors::TimeoutExImpl,BackendsErrors::ConnectionExImpl,BackendsErrors::NakExImpl); ComponentErrors::ValidationErrorExImpl,ComponentErrors::TimeoutExImpl,BackendsErrors::ConnectionExImpl,BackendsErrors::NakExImpl, ComponentErrors::CDBAccessExImpl); /** * Call this function to get the milliseconds of integration time * Call this function to get the number of inputs * In this implementation the inputs number is the same of the number of section (SIMPLE_SECTION) */ inline void getInputsNumber(long &in) const { in=m_inputsNumber; } inline void getInputsNumber(long &in) const { in=m_sectionsNumber; } /** * Call this function to get the milliseconds of integration time Loading Loading @@ -227,7 +229,7 @@ public: * @param conf identifier of the configuration to be loaded */ void setup(const char *conf) throw (BackendsErrors::BackendBusyExImpl,BackendsErrors::ConfigurationErrorExImpl,ComponentErrors::TimeoutExImpl,BackendsErrors::ConnectionExImpl, ComponentErrors::SocketErrorExImpl,BackendsErrors::NakExImpl); ComponentErrors::SocketErrorExImpl,BackendsErrors::NakExImpl,ComponentErrors::CDBAccessExImpl); /** * This function can be used to set up an input of the backend. The input is identified by its numeric value. If a configuration Loading Loading @@ -427,7 +429,7 @@ public: */ long *boardsMapping() { return m_boards; } long sectionNumber() { return m_inputsNumber; } long sectionNumber() { return m_sectionsNumber; } /** * Computes the resulting integration time considering the sample rate and the integration time. Loading Loading @@ -504,6 +506,11 @@ private: * allows to link a section to its proper board number */ long m_boards[MAX_SECTION_NUMBER]; /** * Allows to link a board number to its section */ long m_sections[MAX_BOARDS_NUMBER]; /** * the polarization of each backend input */ Loading @@ -513,7 +520,7 @@ private: */ long m_bins[MAX_SECTION_NUMBER]; /** * input type for each backend input * input type for each backend section */ CProtocol::TInputs m_input[MAX_SECTION_NUMBER]; /** Loading @@ -535,7 +542,8 @@ private: /** * input type for the initial configuration */ CProtocol::TInputs m_defaultInput; CProtocol::TInputs m_defaultInput[MAX_BOARDS_NUMBER]; WORD m_defaultInputSize; /** * That's the clock of the backend. Is has the precision of one second */ Loading @@ -551,7 +559,7 @@ private: /** * reports for the number of inputs, for this implementation it happens that number of inputs is equal to the number of sections. */ long m_inputsNumber; long m_sectionsNumber; /** * reports the number of beams (in the current configuration) that the backend deal with Loading Loading @@ -631,7 +639,7 @@ private: * @param config name of the configuration to be loaded * @return false if the configuration name is not coded or known */ bool initializeConfiguration(const IRA::CString & config); bool initializeConfiguration(const IRA::CString & config) throw (ComponentErrors::CDBAccessExImpl); /** * Check if the connection is still up and ready. If a previuos call timed out it will check the status of the connection. Loading Common/Servers/TotalPower/include/Configuration.h +11 −3 Original line number Diff line number Diff line Loading @@ -32,7 +32,8 @@ public: IRA::CString setupID; long sections; bool calSwitchEnabled; CProtocol::TInputs inputPort; CProtocol::TInputs inputPort[MAX_SECTION_NUMBER]; WORD inputPorts; long beams; long section_boards[MAX_SECTION_NUMBER]; Backends::TPolarization polarizations[MAX_SECTION_NUMBER]; Loading Loading @@ -154,10 +155,10 @@ public: /** * This function returns the setups of the backend given the setup ID. * @param setupID setup identifier or mnemonic * @param setup structure containinig the setup parameters. * @param setup structure containing the setup parameters. * @return true if the setup is present, false if not present or the configuration from the CDB is not correct */ bool getSetupFromID(const IRA::CString setupID,TBackendSetup& setup); bool getSetupFromID(const IRA::CString setupID,TBackendSetup& setup) throw (ComponentErrors::CDBAccessExImpl); private: WORD m_wPort; Loading @@ -182,6 +183,13 @@ private: * This is the table used to load from the CDB the backend configurations */ IRA::CDBTable* m_configurationTable; /* * Parse the inputs string in order to extract and check the inputs port configuration for each board * @param conf input string * @param inputPort resulting port configuration * @param size dimension of the inputPort array */ bool getInputPorts(const IRA::CString& conf,CProtocol::TInputs* inputPort,WORD& size); }; #endif /*CONFIGURATION_H_*/ Common/Servers/TotalPower/src/CommandLine.cpp +113 −72 Original line number Diff line number Diff line Loading @@ -57,11 +57,11 @@ CCommandLine::~CCommandLine() } void CCommandLine::Init(CConfiguration *config) throw (ComponentErrors::SocketErrorExImpl, ComponentErrors::ValidationErrorExImpl,ComponentErrors::TimeoutExImpl,BackendsErrors::ConnectionExImpl,BackendsErrors::NakExImpl) ComponentErrors::ValidationErrorExImpl,ComponentErrors::TimeoutExImpl,BackendsErrors::ConnectionExImpl,BackendsErrors::NakExImpl,ComponentErrors::CDBAccessExImpl) { AUTO_TRACE("CCommandLine::Init()"); m_configuration=config; if (!initializeConfiguration(m_configuration->getConfiguration())) { if (!initializeConfiguration(m_configuration->getConfiguration())) { // throw (ComponentErrors::CDBAccessExImpl) IRA::CString msg; _EXCPT(ComponentErrors::ValidationErrorExImpl,impl,"CCommandLine::Init()"); msg.Format("the requested configuration %s is not known",(const char *)m_configuration->getConfiguration()); Loading Loading @@ -374,7 +374,7 @@ void CCommandLine::setAttenuation(const long&inputId, const double& attenuation) throw impl; } if (inputId>=0) { if (inputId>=m_inputsNumber) { if (inputId>=m_sectionsNumber) { _EXCPT(ComponentErrors::ValidationErrorExImpl,impl,"CCommandLine::setAttenuation()"); impl.setReason("the input identifier is out of range"); throw impl; Loading Loading @@ -449,7 +449,7 @@ void CCommandLine::setConfiguration(const long& inputId,const double& freq,const throw impl; } if (inputId>=0) { //check the section id is in valid rages if (inputId>=m_inputsNumber) { if (inputId>=m_sectionsNumber) { _EXCPT(ComponentErrors::ValidationErrorExImpl,impl,"CCommandLine::setConfiguration()"); impl.setReason("the section identifier is out of range"); throw impl; Loading Loading @@ -503,7 +503,7 @@ void CCommandLine::setConfiguration(const long& inputId,const double& freq,const _THROW_EXCPT(BackendsErrors::NakExImpl,"CCommandLine::setConfiguration()"); } m_bandWidth[inputId]=newBW; for (int j=0;j<m_inputsNumber;j++) m_sampleRate[j]=newSR; //the given sample rate is taken also for all the others for (int j=0;j<m_sectionsNumber;j++) m_sampleRate[j]=newSR; //the given sample rate is taken also for all the others m_commonSampleRate=newSR; m_integration=0; // log warning about configuration that are ignored. Loading Loading @@ -628,10 +628,10 @@ void CCommandLine::getZeroTPI(DWORD *tpi) throw (ComponentErrors::TimeoutExImpl, res=receiveBuffer(rBuff,RECBUFFERSIZE); } if (res>0) { // operation was ok. if (!CProtocol::decodeData(rBuff,tpi,m_configuration->getBoardsNumber(),m_inputsNumber,m_boards)) { if (!CProtocol::decodeData(rBuff,tpi,m_configuration->getBoardsNumber(),m_sectionsNumber,m_boards)) { _THROW_EXCPT(BackendsErrors::MalformedAnswerExImpl,"CCommandLine::getZeroTPI()"); } for (int j=0;j<m_inputsNumber;j++) { for (int j=0;j<m_sectionsNumber;j++) { m_tpiZero[j]=(double)tpi[j]/(double)integration; } } Loading Loading @@ -702,8 +702,8 @@ void CCommandLine::getSample(ACS::doubleSeq& tpi,bool zero) throw (ComponentErro if (busy) { // if the backend is sampling data if (zero) { // if the zero tpi....i can only return the last available measure...since i cannot change the configuration and switch to 50Ohm tpi.length(m_inputsNumber); for (int j=0;j<m_inputsNumber;j++) { tpi.length(m_sectionsNumber); for (int j=0;j<m_sectionsNumber;j++) { tpi[j]=m_tpiZero[j]; //it should already be normalized to 1 millisec of integration } return; Loading Loading @@ -780,11 +780,11 @@ void CCommandLine::getSample(ACS::doubleSeq& tpi,bool zero) throw (ComponentErro } if (res>0) { // operation was ok. DWORD data[MAX_SECTION_NUMBER]; if (!CProtocol::decodeData(rBuff,data,m_configuration->getBoardsNumber(),m_inputsNumber,m_boards)) { if (!CProtocol::decodeData(rBuff,data,m_configuration->getBoardsNumber(),m_sectionsNumber,m_boards)) { _THROW_EXCPT(BackendsErrors::MalformedAnswerExImpl,"CCommandLine::getSample()"); } tpi.length(m_inputsNumber); for (int j=0;j<m_inputsNumber;j++) { tpi.length(m_sectionsNumber); for (int j=0;j<m_sectionsNumber;j++) { tpi[j]=(double)data[j]/(double)integration; if (zero) m_tpiZero[j]=tpi[j]; // in case of tpiZero we store it...... } Loading Loading @@ -841,7 +841,8 @@ void CCommandLine::setDefaultConfiguration() throw (ComponentErrors::TimeoutExIm if (!checkConnection()) { _THROW_EXCPT(BackendsErrors::ConnectionExImpl,"CCommandLine::setDefaultConfiguration()"); } len=CProtocol::setConfiguration_broadcast(sBuff,m_defaultInput,m_attenuation[0],m_bandWidth[0]); // get the buffer if (m_defaultInputSize==1) { len=CProtocol::setConfiguration_broadcast(sBuff,m_defaultInput[0],m_attenuation[0],m_bandWidth[0]); // get the buffer if ((res=sendBuffer(sBuff,len))==SUCCESS) { res=receiveBuffer(rBuff,RECBUFFERSIZE); } Loading @@ -849,7 +850,6 @@ void CCommandLine::setDefaultConfiguration() throw (ComponentErrors::TimeoutExIm if (!CProtocol::isAck(rBuff)) { _THROW_EXCPT(BackendsErrors::NakExImpl,"CCommandLine::setDefaultConfiguration()"); } ACS_LOG(LM_FULL_INFO,"CCommandLine::setDefaultConfiguration()",(LM_INFO,"DEFAULTS_ARE_SET")); } else if (res==FAIL) { _EXCPT_FROM_ERROR(ComponentErrors::IRALibraryResourceExImpl,dummy,m_Error); Loading @@ -864,6 +864,41 @@ void CCommandLine::setDefaultConfiguration() throw (ComponentErrors::TimeoutExIm else { _THROW_EXCPT(BackendsErrors::ConnectionExImpl,"CCommandLine::setDefaultConfiguration()"); } } else { for (DWORD k=0;k<m_defaultInputSize;k++) { if (m_sections[k]==-1) { //*************************************************************************** // This should be changed in order to read the Attenuation on board basis and to apply proper db for each board //**************************************************************************** len=CProtocol::setConfiguration(sBuff,(long)k,m_defaultInput[k],13.0,2350.0); } else { len=CProtocol::setConfiguration(sBuff,(long)k,m_defaultInput[k],m_attenuation[m_sections[k]],m_bandWidth[m_sections[k]]); } if ((res=sendBuffer(sBuff,len))==SUCCESS) { res=receiveBuffer(rBuff,RECBUFFERSIZE); } if (res>0) { // operation was ok. if (!CProtocol::isAck(rBuff)) { _THROW_EXCPT(BackendsErrors::NakExImpl,"CCommandLine::setDefaultConfiguration()"); } } else if (res==FAIL) { _EXCPT_FROM_ERROR(ComponentErrors::IRALibraryResourceExImpl,dummy,m_Error); dummy.setCode(m_Error.getErrorCode()); dummy.setDescription((const char*)m_Error.getDescription()); m_Error.Reset(); _THROW_EXCPT_FROM_EXCPT(ComponentErrors::SocketErrorExImpl,dummy,"CCommandLine::setDefaultConfiguration()"); } else if (res==WOULDBLOCK) { _THROW_EXCPT(ComponentErrors::TimeoutExImpl,"CCommandLine::setDefaultConfiguration()"); } else { _THROW_EXCPT(BackendsErrors::ConnectionExImpl,"CCommandLine::setDefaultConfiguration()"); } } } IRA::CIRATools::Wait(0,200000); long integration=(long)round(1.0/ (m_commonSampleRate*1000.0)); len=CProtocol::setIntegrationTime(sBuff,integration); // get the buffer Loading @@ -888,12 +923,13 @@ void CCommandLine::setDefaultConfiguration() throw (ComponentErrors::TimeoutExIm else { _THROW_EXCPT(BackendsErrors::ConnectionExImpl,"CCommandLine::setDefaultConfiguration()"); } ACS_LOG(LM_FULL_INFO,"CCommandLine::setDefaultConfiguration()",(LM_INFO,"DEFAULTS_ARE_SET")); m_setTpiIntegration=false; } void CCommandLine::setup(const char *conf) throw (BackendsErrors::BackendBusyExImpl,BackendsErrors::ConfigurationErrorExImpl,ComponentErrors::TimeoutExImpl,BackendsErrors::ConnectionExImpl, ComponentErrors::SocketErrorExImpl,BackendsErrors::NakExImpl) ComponentErrors::SocketErrorExImpl,BackendsErrors::NakExImpl,ComponentErrors::CDBAccessExImpl) { AUTO_TRACE("CCommandLine::setup()"); if (getIsBusy()) { Loading Loading @@ -1027,8 +1063,8 @@ void CCommandLine::setEnabled(const ACS::longSeq& en) throw (BackendsErrors::Bac _EXCPT(BackendsErrors::BackendBusyExImpl,impl,"CCommandLine::setEnabled()"); throw impl; } if ((long)en.length()>=m_inputsNumber) { bound=m_inputsNumber; if ((long)en.length()>=m_sectionsNumber) { bound=m_sectionsNumber; } else { bound=en.length(); Loading Loading @@ -1071,8 +1107,8 @@ void CCommandLine::getAttenuation(ACS::doubleSeq& att) throw (ComponentErrors::S } res=getConfiguration(); if (res>0) { // load OK att.length(m_inputsNumber); for (int i=0;i<m_inputsNumber;i++) { att.length(m_sectionsNumber); for (int i=0;i<m_sectionsNumber;i++) { att[i]=m_attenuation[i]; } } Loading @@ -1081,8 +1117,8 @@ void CCommandLine::getAttenuation(ACS::doubleSeq& att) throw (ComponentErrors::S void CCommandLine::getFrequency(ACS::doubleSeq& freq) const { freq.length(m_inputsNumber); for (int i=0;i<m_inputsNumber;i++) { freq.length(m_sectionsNumber); for (int i=0;i<m_sectionsNumber;i++) { freq[i]=m_frequency[i]; } } Loading @@ -1094,64 +1130,64 @@ void CCommandLine::getBackendStatus(DWORD& status) const void CCommandLine::getSampleRate(ACS::doubleSeq& sr) const { sr.length(m_inputsNumber); for (int i=0;i<m_inputsNumber;i++) { sr.length(m_sectionsNumber); for (int i=0;i<m_sectionsNumber;i++) { sr[i]=m_sampleRate[i]; } } void CCommandLine::getTsys(ACS::doubleSeq& tsys) const { tsys.length(m_inputsNumber); for (int i=0;i<m_inputsNumber;i++) { tsys.length(m_sectionsNumber); for (int i=0;i<m_sectionsNumber;i++) { tsys[i]=m_tsys[i]; } } void CCommandLine::getKCRatio(ACS::doubleSeq& ratio) const { ratio.length(m_inputsNumber); for (int i=0;i<m_inputsNumber;i++) { ratio.length(m_sectionsNumber); for (int i=0;i<m_sectionsNumber;i++) { ratio[i]=m_KCratio[i]; } } void CCommandLine::getBins(ACS::longSeq& bins) const { bins.length(m_inputsNumber); for (int i=0;i<m_inputsNumber;i++) { bins.length(m_sectionsNumber); for (int i=0;i<m_sectionsNumber;i++) { bins[i]=m_bins[i]; } } void CCommandLine::getPolarization(ACS::longSeq& pol) const { pol.length(m_inputsNumber); for (int i=0;i<m_inputsNumber;i++) { pol.length(m_sectionsNumber); for (int i=0;i<m_sectionsNumber;i++) { pol[i]=(long)m_polarization[i]; } } void CCommandLine::getFeed(ACS::longSeq& feed) const { feed.length(m_inputsNumber); for (int i=0;i<m_inputsNumber;i++) { feed.length(m_sectionsNumber); for (int i=0;i<m_sectionsNumber;i++) { feed[i]=m_feedNumber[i]; } } void CCommandLine::getIFs(ACS::longSeq& ifs) const { ifs.length(m_inputsNumber); for (int i=0;i<m_inputsNumber;i++) { ifs.length(m_sectionsNumber); for (int i=0;i<m_sectionsNumber;i++) { ifs[i]=m_ifNumber[i]; } } void CCommandLine::getInputSection(ACS::longSeq& inpSection) const { inpSection.length(m_inputsNumber); for (int i=0;i<m_inputsNumber;i++) { inpSection.length(m_sectionsNumber); for (int i=0;i<m_sectionsNumber;i++) { inpSection[i]=m_inputSection[i]; } } Loading @@ -1166,8 +1202,8 @@ void CCommandLine::getBandWidth(ACS::doubleSeq& bw) throw (ComponentErrors::Sock } res=getConfiguration(); if (res>0) { // load OK bw.length(m_inputsNumber); for (int i=0;i<m_inputsNumber;i++) { bw.length(m_sectionsNumber); for (int i=0;i<m_sectionsNumber;i++) { bw[i]=m_bandWidth[i]; } } Loading @@ -1194,7 +1230,7 @@ void CCommandLine::fillMainHeader(Backends::TMainHeader& bkd) long chs=0; long intTime; // count the available channels....... for(int i=0;i<m_inputsNumber;i++) { for(int i=0;i<m_sectionsNumber;i++) { if (m_enabled[i]) chs++; } bkd.sections=chs; Loading @@ -1208,7 +1244,7 @@ void CCommandLine::fillMainHeader(Backends::TMainHeader& bkd) void CCommandLine::fillChannelHeader(Backends::TSectionHeader *chHr,const long& size) { long index=0; for (int i=0;i<m_inputsNumber;i++) { for (int i=0;i<m_sectionsNumber;i++) { if (m_enabled[i]) { if (index<size) { chHr[index].id=i; Loading @@ -1231,13 +1267,13 @@ void CCommandLine::fillChannelHeader(Backends::TSectionHeader *chHr,const long& void CCommandLine::saveTsys(const ACS::doubleSeq& tsys,const ACS::doubleSeq& ratio) { if (tsys.length()==(unsigned)m_inputsNumber) { for (int i=0;i<m_inputsNumber;i++) { if (tsys.length()==(unsigned)m_sectionsNumber) { for (int i=0;i<m_sectionsNumber;i++) { m_tsys[i]=tsys[i]; } } if (ratio.length()==(unsigned)m_inputsNumber) { for (int i=0;i<m_inputsNumber;i++) { if (ratio.length()==(unsigned)m_sectionsNumber) { for (int i=0;i<m_sectionsNumber;i++) { m_KCratio[i]=ratio[i]; } ACS_LOG(LM_FULL_INFO,"CCommandLine::saveTsys()",(LM_INFO,"KELVIN_COUNTS_CONVERSION_FACTOR_SET")); Loading Loading @@ -1403,7 +1439,7 @@ int CCommandLine::getConfiguration() if ((Res=sendBuffer(sBuff,len))==SUCCESS) { rBytes=receiveBuffer(rBuff,RECBUFFERSIZE); if (rBytes>0) { if (CProtocol::decodeBackendConfiguration(rBuff,m_inputsNumber,m_configuration->getBoardsNumber(),m_attenuation,m_bandWidth,m_input,m_backendTime,m_currentSampleRate,m_boards)) { if (CProtocol::decodeBackendConfiguration(rBuff,m_sectionsNumber,m_configuration->getBoardsNumber(),m_attenuation,m_bandWidth,m_input,m_backendTime,m_currentSampleRate,m_boards)) { CIRATools::getTime(m_lastUpdate); } else { Loading Loading @@ -1482,22 +1518,27 @@ bool CCommandLine::checkConnection() } } bool CCommandLine::initializeConfiguration(const IRA::CString & config) bool CCommandLine::initializeConfiguration(const IRA::CString & config) throw (ComponentErrors::CDBAccessExImpl) { int i; CConfiguration::TBackendSetup setup; if (m_configuration->getSetupFromID(config,setup)) { m_inputsNumber=setup.sections; m_defaultInput=setup.inputPort; if (m_configuration->getSetupFromID(config,setup)) { // throw (ComponentErrors::CDBAccessExImpl) m_sectionsNumber=setup.sections; for (WORD k=0;k<MAX_BOARDS_NUMBER;k++) { m_defaultInput[k]=setup.inputPort[k]; m_sections[k]=-1; } m_defaultInputSize=setup.inputPorts; // this should be 1 or the number of installed boards m_beams=setup.beams; m_calSwitchingEnabled=setup.calSwitchEnabled; for (i=0;i<m_inputsNumber;i++) { m_input[i]=m_defaultInput; for (i=0;i<m_sectionsNumber;i++) { m_boards[i]=setup.section_boards[i]; m_sections[m_boards[i]]=i; m_input[i]=m_defaultInput[m_boards[i]]; m_polarization[i]=setup.polarizations[i]; m_ifNumber[i]=setup.ifs[i]; m_feedNumber[i]=setup.feed[i]; m_inputSection[i]=i; // input 0 belongs to section 0 and so on..... m_boards[i]=setup.section_boards[i]; m_attenuation[i]=setup.attenuation; m_bandWidth[i]=setup.bandWidth; } Loading @@ -1511,7 +1552,7 @@ bool CCommandLine::initializeConfiguration(const IRA::CString & config) m_sampleSize=SAMPLESIZE; m_commonSampleRate=DEFAULT_SAMPLE_RATE; m_calPeriod=DEFAULT_DIODE_SWITCH_PERIOD; for (i=0;i<m_inputsNumber;i++) { for (i=0;i<m_sectionsNumber;i++) { m_sampleRate[i]=DEFAULT_SAMPLE_RATE; m_frequency[i]=STARTFREQUENCY; m_bins[i]=BINSNUMBER; Loading Common/Servers/TotalPower/src/Configuration.cpp +37 −9 Original line number Diff line number Diff line Loading @@ -41,9 +41,40 @@ CConfiguration::~CConfiguration() } } bool CConfiguration::getSetupFromID(const IRA::CString setupID,TBackendSetup& setup) bool CConfiguration::getInputPorts(const IRA::CString& conf,CProtocol::TInputs* inputPort,WORD& size) { int start=0; IRA::CString ret; size=0; while (IRA::CIRATools::getNextToken(conf,start,' ',ret)) { if (size>=MAX_BOARDS_NUMBER) return false; if (ret=="PRIMARY") { inputPort[size]=CProtocol::PRIMARY; } else if (ret=="BWG") { inputPort[size]=CProtocol::BWG; } else if (ret=="GREGORIAN") { // GREGORIAN inputPort[size]=CProtocol::GREGORIAN; } else { return false; } size++; } if ((size!=1) && (size!=m_dwBoardsNumber)) return false; // the size of inputs vector should be 1 or equal to the number of boards if ((size==1)) { // if the provided list of input ports is one element, i'll fill everything up to the maximum number of boards for (WORD k=1;k<MAX_BOARDS_NUMBER;k++) { inputPort[k]=inputPort[0]; } } return true; } bool CConfiguration::getSetupFromID(const IRA::CString setupID,TBackendSetup& setup) throw (ComponentErrors::CDBAccessExImpl) { bool done=false; CString inputPorts; m_configurationTable->First(); for (int i=0;i<m_configurationTable->recordCount();i++) { CString id((*m_configurationTable)["configurationID"]->asString()); Loading @@ -65,14 +96,11 @@ bool CConfiguration::getSetupFromID(const IRA::CString setupID,TBackendSetup& se else { setup.calSwitchEnabled=false; } if ((*m_configurationTable)["inputPort"]->asString()=="PRIMARY") { setup.inputPort=CProtocol::PRIMARY; } else if ((*m_configurationTable)["inputPort"]->asString()=="BWG") { setup.inputPort=CProtocol::BWG; } else { // GREGORIAN setup.inputPort=CProtocol::GREGORIAN; inputPorts=(*m_configurationTable)["inputPort"]->asString(); if (!getInputPorts(inputPorts,setup.inputPort,setup.inputPorts)) { _EXCPT(ComponentErrors::CDBAccessExImpl,impl,""); impl.setFieldName("Configuration.inputPort"); throw impl; } setup.beams=(*m_configurationTable)["beams"]->asLongLong(); setup.bandWidth=(*m_configurationTable)["bandWidth"]->asDouble(); Loading Loading
Common/Servers/TotalPower/config/CDB/schemas/TotalPowerSetup.xsd +10 −2 Original line number Diff line number Diff line Loading @@ -56,6 +56,12 @@ </xs:restriction> </xs:simpleType> <xs:element name="inputPort"> <xs:simpleType> <xs:list itemType="SelectedPortType" /> </xs:simpleType> </xs:element> <xs:complexType name="TTableHeader"> <xs:sequence> <xs:element name="configurationID" type="xs:string"> Loading @@ -73,9 +79,11 @@ true if the calibration mark switching could be used </xs:documentation></xs:annotation> </xs:element> <xs:element name="inputPort" type="SelectedPortType"> <xs:element ref="inputPort" minOccurs="1" maxOccurs="unbounded"> <xs:annotation><xs:documentation> selects from which port the RF inputs has to be taken for the present configuration selects from which port the RF inputs has to be taken for the present configuration, if more than one value is provided the inputs are configured on sinble board basis. The numbero of enties shoudl be less than the numebr of installed boards. The board not directly involved in the configuration (i.e stated on the section_boards section) will be configured with 0 attenuation andd full bandwidth </xs:documentation></xs:annotation> </xs:element> <xs:element name="beams" type="xs:long"> Loading
Common/Servers/TotalPower/include/CommandLine.h +17 −9 Original line number Diff line number Diff line Loading @@ -57,12 +57,14 @@ public: * @throw BackendsErrors::NakExImpl */ void Init(CConfiguration *config) throw (ComponentErrors::SocketErrorExImpl, ComponentErrors::ValidationErrorExImpl,ComponentErrors::TimeoutExImpl,BackendsErrors::ConnectionExImpl,BackendsErrors::NakExImpl); ComponentErrors::ValidationErrorExImpl,ComponentErrors::TimeoutExImpl,BackendsErrors::ConnectionExImpl,BackendsErrors::NakExImpl, ComponentErrors::CDBAccessExImpl); /** * Call this function to get the milliseconds of integration time * Call this function to get the number of inputs * In this implementation the inputs number is the same of the number of section (SIMPLE_SECTION) */ inline void getInputsNumber(long &in) const { in=m_inputsNumber; } inline void getInputsNumber(long &in) const { in=m_sectionsNumber; } /** * Call this function to get the milliseconds of integration time Loading Loading @@ -227,7 +229,7 @@ public: * @param conf identifier of the configuration to be loaded */ void setup(const char *conf) throw (BackendsErrors::BackendBusyExImpl,BackendsErrors::ConfigurationErrorExImpl,ComponentErrors::TimeoutExImpl,BackendsErrors::ConnectionExImpl, ComponentErrors::SocketErrorExImpl,BackendsErrors::NakExImpl); ComponentErrors::SocketErrorExImpl,BackendsErrors::NakExImpl,ComponentErrors::CDBAccessExImpl); /** * This function can be used to set up an input of the backend. The input is identified by its numeric value. If a configuration Loading Loading @@ -427,7 +429,7 @@ public: */ long *boardsMapping() { return m_boards; } long sectionNumber() { return m_inputsNumber; } long sectionNumber() { return m_sectionsNumber; } /** * Computes the resulting integration time considering the sample rate and the integration time. Loading Loading @@ -504,6 +506,11 @@ private: * allows to link a section to its proper board number */ long m_boards[MAX_SECTION_NUMBER]; /** * Allows to link a board number to its section */ long m_sections[MAX_BOARDS_NUMBER]; /** * the polarization of each backend input */ Loading @@ -513,7 +520,7 @@ private: */ long m_bins[MAX_SECTION_NUMBER]; /** * input type for each backend input * input type for each backend section */ CProtocol::TInputs m_input[MAX_SECTION_NUMBER]; /** Loading @@ -535,7 +542,8 @@ private: /** * input type for the initial configuration */ CProtocol::TInputs m_defaultInput; CProtocol::TInputs m_defaultInput[MAX_BOARDS_NUMBER]; WORD m_defaultInputSize; /** * That's the clock of the backend. Is has the precision of one second */ Loading @@ -551,7 +559,7 @@ private: /** * reports for the number of inputs, for this implementation it happens that number of inputs is equal to the number of sections. */ long m_inputsNumber; long m_sectionsNumber; /** * reports the number of beams (in the current configuration) that the backend deal with Loading Loading @@ -631,7 +639,7 @@ private: * @param config name of the configuration to be loaded * @return false if the configuration name is not coded or known */ bool initializeConfiguration(const IRA::CString & config); bool initializeConfiguration(const IRA::CString & config) throw (ComponentErrors::CDBAccessExImpl); /** * Check if the connection is still up and ready. If a previuos call timed out it will check the status of the connection. Loading
Common/Servers/TotalPower/include/Configuration.h +11 −3 Original line number Diff line number Diff line Loading @@ -32,7 +32,8 @@ public: IRA::CString setupID; long sections; bool calSwitchEnabled; CProtocol::TInputs inputPort; CProtocol::TInputs inputPort[MAX_SECTION_NUMBER]; WORD inputPorts; long beams; long section_boards[MAX_SECTION_NUMBER]; Backends::TPolarization polarizations[MAX_SECTION_NUMBER]; Loading Loading @@ -154,10 +155,10 @@ public: /** * This function returns the setups of the backend given the setup ID. * @param setupID setup identifier or mnemonic * @param setup structure containinig the setup parameters. * @param setup structure containing the setup parameters. * @return true if the setup is present, false if not present or the configuration from the CDB is not correct */ bool getSetupFromID(const IRA::CString setupID,TBackendSetup& setup); bool getSetupFromID(const IRA::CString setupID,TBackendSetup& setup) throw (ComponentErrors::CDBAccessExImpl); private: WORD m_wPort; Loading @@ -182,6 +183,13 @@ private: * This is the table used to load from the CDB the backend configurations */ IRA::CDBTable* m_configurationTable; /* * Parse the inputs string in order to extract and check the inputs port configuration for each board * @param conf input string * @param inputPort resulting port configuration * @param size dimension of the inputPort array */ bool getInputPorts(const IRA::CString& conf,CProtocol::TInputs* inputPort,WORD& size); }; #endif /*CONFIGURATION_H_*/
Common/Servers/TotalPower/src/CommandLine.cpp +113 −72 Original line number Diff line number Diff line Loading @@ -57,11 +57,11 @@ CCommandLine::~CCommandLine() } void CCommandLine::Init(CConfiguration *config) throw (ComponentErrors::SocketErrorExImpl, ComponentErrors::ValidationErrorExImpl,ComponentErrors::TimeoutExImpl,BackendsErrors::ConnectionExImpl,BackendsErrors::NakExImpl) ComponentErrors::ValidationErrorExImpl,ComponentErrors::TimeoutExImpl,BackendsErrors::ConnectionExImpl,BackendsErrors::NakExImpl,ComponentErrors::CDBAccessExImpl) { AUTO_TRACE("CCommandLine::Init()"); m_configuration=config; if (!initializeConfiguration(m_configuration->getConfiguration())) { if (!initializeConfiguration(m_configuration->getConfiguration())) { // throw (ComponentErrors::CDBAccessExImpl) IRA::CString msg; _EXCPT(ComponentErrors::ValidationErrorExImpl,impl,"CCommandLine::Init()"); msg.Format("the requested configuration %s is not known",(const char *)m_configuration->getConfiguration()); Loading Loading @@ -374,7 +374,7 @@ void CCommandLine::setAttenuation(const long&inputId, const double& attenuation) throw impl; } if (inputId>=0) { if (inputId>=m_inputsNumber) { if (inputId>=m_sectionsNumber) { _EXCPT(ComponentErrors::ValidationErrorExImpl,impl,"CCommandLine::setAttenuation()"); impl.setReason("the input identifier is out of range"); throw impl; Loading Loading @@ -449,7 +449,7 @@ void CCommandLine::setConfiguration(const long& inputId,const double& freq,const throw impl; } if (inputId>=0) { //check the section id is in valid rages if (inputId>=m_inputsNumber) { if (inputId>=m_sectionsNumber) { _EXCPT(ComponentErrors::ValidationErrorExImpl,impl,"CCommandLine::setConfiguration()"); impl.setReason("the section identifier is out of range"); throw impl; Loading Loading @@ -503,7 +503,7 @@ void CCommandLine::setConfiguration(const long& inputId,const double& freq,const _THROW_EXCPT(BackendsErrors::NakExImpl,"CCommandLine::setConfiguration()"); } m_bandWidth[inputId]=newBW; for (int j=0;j<m_inputsNumber;j++) m_sampleRate[j]=newSR; //the given sample rate is taken also for all the others for (int j=0;j<m_sectionsNumber;j++) m_sampleRate[j]=newSR; //the given sample rate is taken also for all the others m_commonSampleRate=newSR; m_integration=0; // log warning about configuration that are ignored. Loading Loading @@ -628,10 +628,10 @@ void CCommandLine::getZeroTPI(DWORD *tpi) throw (ComponentErrors::TimeoutExImpl, res=receiveBuffer(rBuff,RECBUFFERSIZE); } if (res>0) { // operation was ok. if (!CProtocol::decodeData(rBuff,tpi,m_configuration->getBoardsNumber(),m_inputsNumber,m_boards)) { if (!CProtocol::decodeData(rBuff,tpi,m_configuration->getBoardsNumber(),m_sectionsNumber,m_boards)) { _THROW_EXCPT(BackendsErrors::MalformedAnswerExImpl,"CCommandLine::getZeroTPI()"); } for (int j=0;j<m_inputsNumber;j++) { for (int j=0;j<m_sectionsNumber;j++) { m_tpiZero[j]=(double)tpi[j]/(double)integration; } } Loading Loading @@ -702,8 +702,8 @@ void CCommandLine::getSample(ACS::doubleSeq& tpi,bool zero) throw (ComponentErro if (busy) { // if the backend is sampling data if (zero) { // if the zero tpi....i can only return the last available measure...since i cannot change the configuration and switch to 50Ohm tpi.length(m_inputsNumber); for (int j=0;j<m_inputsNumber;j++) { tpi.length(m_sectionsNumber); for (int j=0;j<m_sectionsNumber;j++) { tpi[j]=m_tpiZero[j]; //it should already be normalized to 1 millisec of integration } return; Loading Loading @@ -780,11 +780,11 @@ void CCommandLine::getSample(ACS::doubleSeq& tpi,bool zero) throw (ComponentErro } if (res>0) { // operation was ok. DWORD data[MAX_SECTION_NUMBER]; if (!CProtocol::decodeData(rBuff,data,m_configuration->getBoardsNumber(),m_inputsNumber,m_boards)) { if (!CProtocol::decodeData(rBuff,data,m_configuration->getBoardsNumber(),m_sectionsNumber,m_boards)) { _THROW_EXCPT(BackendsErrors::MalformedAnswerExImpl,"CCommandLine::getSample()"); } tpi.length(m_inputsNumber); for (int j=0;j<m_inputsNumber;j++) { tpi.length(m_sectionsNumber); for (int j=0;j<m_sectionsNumber;j++) { tpi[j]=(double)data[j]/(double)integration; if (zero) m_tpiZero[j]=tpi[j]; // in case of tpiZero we store it...... } Loading Loading @@ -841,7 +841,8 @@ void CCommandLine::setDefaultConfiguration() throw (ComponentErrors::TimeoutExIm if (!checkConnection()) { _THROW_EXCPT(BackendsErrors::ConnectionExImpl,"CCommandLine::setDefaultConfiguration()"); } len=CProtocol::setConfiguration_broadcast(sBuff,m_defaultInput,m_attenuation[0],m_bandWidth[0]); // get the buffer if (m_defaultInputSize==1) { len=CProtocol::setConfiguration_broadcast(sBuff,m_defaultInput[0],m_attenuation[0],m_bandWidth[0]); // get the buffer if ((res=sendBuffer(sBuff,len))==SUCCESS) { res=receiveBuffer(rBuff,RECBUFFERSIZE); } Loading @@ -849,7 +850,6 @@ void CCommandLine::setDefaultConfiguration() throw (ComponentErrors::TimeoutExIm if (!CProtocol::isAck(rBuff)) { _THROW_EXCPT(BackendsErrors::NakExImpl,"CCommandLine::setDefaultConfiguration()"); } ACS_LOG(LM_FULL_INFO,"CCommandLine::setDefaultConfiguration()",(LM_INFO,"DEFAULTS_ARE_SET")); } else if (res==FAIL) { _EXCPT_FROM_ERROR(ComponentErrors::IRALibraryResourceExImpl,dummy,m_Error); Loading @@ -864,6 +864,41 @@ void CCommandLine::setDefaultConfiguration() throw (ComponentErrors::TimeoutExIm else { _THROW_EXCPT(BackendsErrors::ConnectionExImpl,"CCommandLine::setDefaultConfiguration()"); } } else { for (DWORD k=0;k<m_defaultInputSize;k++) { if (m_sections[k]==-1) { //*************************************************************************** // This should be changed in order to read the Attenuation on board basis and to apply proper db for each board //**************************************************************************** len=CProtocol::setConfiguration(sBuff,(long)k,m_defaultInput[k],13.0,2350.0); } else { len=CProtocol::setConfiguration(sBuff,(long)k,m_defaultInput[k],m_attenuation[m_sections[k]],m_bandWidth[m_sections[k]]); } if ((res=sendBuffer(sBuff,len))==SUCCESS) { res=receiveBuffer(rBuff,RECBUFFERSIZE); } if (res>0) { // operation was ok. if (!CProtocol::isAck(rBuff)) { _THROW_EXCPT(BackendsErrors::NakExImpl,"CCommandLine::setDefaultConfiguration()"); } } else if (res==FAIL) { _EXCPT_FROM_ERROR(ComponentErrors::IRALibraryResourceExImpl,dummy,m_Error); dummy.setCode(m_Error.getErrorCode()); dummy.setDescription((const char*)m_Error.getDescription()); m_Error.Reset(); _THROW_EXCPT_FROM_EXCPT(ComponentErrors::SocketErrorExImpl,dummy,"CCommandLine::setDefaultConfiguration()"); } else if (res==WOULDBLOCK) { _THROW_EXCPT(ComponentErrors::TimeoutExImpl,"CCommandLine::setDefaultConfiguration()"); } else { _THROW_EXCPT(BackendsErrors::ConnectionExImpl,"CCommandLine::setDefaultConfiguration()"); } } } IRA::CIRATools::Wait(0,200000); long integration=(long)round(1.0/ (m_commonSampleRate*1000.0)); len=CProtocol::setIntegrationTime(sBuff,integration); // get the buffer Loading @@ -888,12 +923,13 @@ void CCommandLine::setDefaultConfiguration() throw (ComponentErrors::TimeoutExIm else { _THROW_EXCPT(BackendsErrors::ConnectionExImpl,"CCommandLine::setDefaultConfiguration()"); } ACS_LOG(LM_FULL_INFO,"CCommandLine::setDefaultConfiguration()",(LM_INFO,"DEFAULTS_ARE_SET")); m_setTpiIntegration=false; } void CCommandLine::setup(const char *conf) throw (BackendsErrors::BackendBusyExImpl,BackendsErrors::ConfigurationErrorExImpl,ComponentErrors::TimeoutExImpl,BackendsErrors::ConnectionExImpl, ComponentErrors::SocketErrorExImpl,BackendsErrors::NakExImpl) ComponentErrors::SocketErrorExImpl,BackendsErrors::NakExImpl,ComponentErrors::CDBAccessExImpl) { AUTO_TRACE("CCommandLine::setup()"); if (getIsBusy()) { Loading Loading @@ -1027,8 +1063,8 @@ void CCommandLine::setEnabled(const ACS::longSeq& en) throw (BackendsErrors::Bac _EXCPT(BackendsErrors::BackendBusyExImpl,impl,"CCommandLine::setEnabled()"); throw impl; } if ((long)en.length()>=m_inputsNumber) { bound=m_inputsNumber; if ((long)en.length()>=m_sectionsNumber) { bound=m_sectionsNumber; } else { bound=en.length(); Loading Loading @@ -1071,8 +1107,8 @@ void CCommandLine::getAttenuation(ACS::doubleSeq& att) throw (ComponentErrors::S } res=getConfiguration(); if (res>0) { // load OK att.length(m_inputsNumber); for (int i=0;i<m_inputsNumber;i++) { att.length(m_sectionsNumber); for (int i=0;i<m_sectionsNumber;i++) { att[i]=m_attenuation[i]; } } Loading @@ -1081,8 +1117,8 @@ void CCommandLine::getAttenuation(ACS::doubleSeq& att) throw (ComponentErrors::S void CCommandLine::getFrequency(ACS::doubleSeq& freq) const { freq.length(m_inputsNumber); for (int i=0;i<m_inputsNumber;i++) { freq.length(m_sectionsNumber); for (int i=0;i<m_sectionsNumber;i++) { freq[i]=m_frequency[i]; } } Loading @@ -1094,64 +1130,64 @@ void CCommandLine::getBackendStatus(DWORD& status) const void CCommandLine::getSampleRate(ACS::doubleSeq& sr) const { sr.length(m_inputsNumber); for (int i=0;i<m_inputsNumber;i++) { sr.length(m_sectionsNumber); for (int i=0;i<m_sectionsNumber;i++) { sr[i]=m_sampleRate[i]; } } void CCommandLine::getTsys(ACS::doubleSeq& tsys) const { tsys.length(m_inputsNumber); for (int i=0;i<m_inputsNumber;i++) { tsys.length(m_sectionsNumber); for (int i=0;i<m_sectionsNumber;i++) { tsys[i]=m_tsys[i]; } } void CCommandLine::getKCRatio(ACS::doubleSeq& ratio) const { ratio.length(m_inputsNumber); for (int i=0;i<m_inputsNumber;i++) { ratio.length(m_sectionsNumber); for (int i=0;i<m_sectionsNumber;i++) { ratio[i]=m_KCratio[i]; } } void CCommandLine::getBins(ACS::longSeq& bins) const { bins.length(m_inputsNumber); for (int i=0;i<m_inputsNumber;i++) { bins.length(m_sectionsNumber); for (int i=0;i<m_sectionsNumber;i++) { bins[i]=m_bins[i]; } } void CCommandLine::getPolarization(ACS::longSeq& pol) const { pol.length(m_inputsNumber); for (int i=0;i<m_inputsNumber;i++) { pol.length(m_sectionsNumber); for (int i=0;i<m_sectionsNumber;i++) { pol[i]=(long)m_polarization[i]; } } void CCommandLine::getFeed(ACS::longSeq& feed) const { feed.length(m_inputsNumber); for (int i=0;i<m_inputsNumber;i++) { feed.length(m_sectionsNumber); for (int i=0;i<m_sectionsNumber;i++) { feed[i]=m_feedNumber[i]; } } void CCommandLine::getIFs(ACS::longSeq& ifs) const { ifs.length(m_inputsNumber); for (int i=0;i<m_inputsNumber;i++) { ifs.length(m_sectionsNumber); for (int i=0;i<m_sectionsNumber;i++) { ifs[i]=m_ifNumber[i]; } } void CCommandLine::getInputSection(ACS::longSeq& inpSection) const { inpSection.length(m_inputsNumber); for (int i=0;i<m_inputsNumber;i++) { inpSection.length(m_sectionsNumber); for (int i=0;i<m_sectionsNumber;i++) { inpSection[i]=m_inputSection[i]; } } Loading @@ -1166,8 +1202,8 @@ void CCommandLine::getBandWidth(ACS::doubleSeq& bw) throw (ComponentErrors::Sock } res=getConfiguration(); if (res>0) { // load OK bw.length(m_inputsNumber); for (int i=0;i<m_inputsNumber;i++) { bw.length(m_sectionsNumber); for (int i=0;i<m_sectionsNumber;i++) { bw[i]=m_bandWidth[i]; } } Loading @@ -1194,7 +1230,7 @@ void CCommandLine::fillMainHeader(Backends::TMainHeader& bkd) long chs=0; long intTime; // count the available channels....... for(int i=0;i<m_inputsNumber;i++) { for(int i=0;i<m_sectionsNumber;i++) { if (m_enabled[i]) chs++; } bkd.sections=chs; Loading @@ -1208,7 +1244,7 @@ void CCommandLine::fillMainHeader(Backends::TMainHeader& bkd) void CCommandLine::fillChannelHeader(Backends::TSectionHeader *chHr,const long& size) { long index=0; for (int i=0;i<m_inputsNumber;i++) { for (int i=0;i<m_sectionsNumber;i++) { if (m_enabled[i]) { if (index<size) { chHr[index].id=i; Loading @@ -1231,13 +1267,13 @@ void CCommandLine::fillChannelHeader(Backends::TSectionHeader *chHr,const long& void CCommandLine::saveTsys(const ACS::doubleSeq& tsys,const ACS::doubleSeq& ratio) { if (tsys.length()==(unsigned)m_inputsNumber) { for (int i=0;i<m_inputsNumber;i++) { if (tsys.length()==(unsigned)m_sectionsNumber) { for (int i=0;i<m_sectionsNumber;i++) { m_tsys[i]=tsys[i]; } } if (ratio.length()==(unsigned)m_inputsNumber) { for (int i=0;i<m_inputsNumber;i++) { if (ratio.length()==(unsigned)m_sectionsNumber) { for (int i=0;i<m_sectionsNumber;i++) { m_KCratio[i]=ratio[i]; } ACS_LOG(LM_FULL_INFO,"CCommandLine::saveTsys()",(LM_INFO,"KELVIN_COUNTS_CONVERSION_FACTOR_SET")); Loading Loading @@ -1403,7 +1439,7 @@ int CCommandLine::getConfiguration() if ((Res=sendBuffer(sBuff,len))==SUCCESS) { rBytes=receiveBuffer(rBuff,RECBUFFERSIZE); if (rBytes>0) { if (CProtocol::decodeBackendConfiguration(rBuff,m_inputsNumber,m_configuration->getBoardsNumber(),m_attenuation,m_bandWidth,m_input,m_backendTime,m_currentSampleRate,m_boards)) { if (CProtocol::decodeBackendConfiguration(rBuff,m_sectionsNumber,m_configuration->getBoardsNumber(),m_attenuation,m_bandWidth,m_input,m_backendTime,m_currentSampleRate,m_boards)) { CIRATools::getTime(m_lastUpdate); } else { Loading Loading @@ -1482,22 +1518,27 @@ bool CCommandLine::checkConnection() } } bool CCommandLine::initializeConfiguration(const IRA::CString & config) bool CCommandLine::initializeConfiguration(const IRA::CString & config) throw (ComponentErrors::CDBAccessExImpl) { int i; CConfiguration::TBackendSetup setup; if (m_configuration->getSetupFromID(config,setup)) { m_inputsNumber=setup.sections; m_defaultInput=setup.inputPort; if (m_configuration->getSetupFromID(config,setup)) { // throw (ComponentErrors::CDBAccessExImpl) m_sectionsNumber=setup.sections; for (WORD k=0;k<MAX_BOARDS_NUMBER;k++) { m_defaultInput[k]=setup.inputPort[k]; m_sections[k]=-1; } m_defaultInputSize=setup.inputPorts; // this should be 1 or the number of installed boards m_beams=setup.beams; m_calSwitchingEnabled=setup.calSwitchEnabled; for (i=0;i<m_inputsNumber;i++) { m_input[i]=m_defaultInput; for (i=0;i<m_sectionsNumber;i++) { m_boards[i]=setup.section_boards[i]; m_sections[m_boards[i]]=i; m_input[i]=m_defaultInput[m_boards[i]]; m_polarization[i]=setup.polarizations[i]; m_ifNumber[i]=setup.ifs[i]; m_feedNumber[i]=setup.feed[i]; m_inputSection[i]=i; // input 0 belongs to section 0 and so on..... m_boards[i]=setup.section_boards[i]; m_attenuation[i]=setup.attenuation; m_bandWidth[i]=setup.bandWidth; } Loading @@ -1511,7 +1552,7 @@ bool CCommandLine::initializeConfiguration(const IRA::CString & config) m_sampleSize=SAMPLESIZE; m_commonSampleRate=DEFAULT_SAMPLE_RATE; m_calPeriod=DEFAULT_DIODE_SWITCH_PERIOD; for (i=0;i<m_inputsNumber;i++) { for (i=0;i<m_sectionsNumber;i++) { m_sampleRate[i]=DEFAULT_SAMPLE_RATE; m_frequency[i]=STARTFREQUENCY; m_bins[i]=BINSNUMBER; Loading
Common/Servers/TotalPower/src/Configuration.cpp +37 −9 Original line number Diff line number Diff line Loading @@ -41,9 +41,40 @@ CConfiguration::~CConfiguration() } } bool CConfiguration::getSetupFromID(const IRA::CString setupID,TBackendSetup& setup) bool CConfiguration::getInputPorts(const IRA::CString& conf,CProtocol::TInputs* inputPort,WORD& size) { int start=0; IRA::CString ret; size=0; while (IRA::CIRATools::getNextToken(conf,start,' ',ret)) { if (size>=MAX_BOARDS_NUMBER) return false; if (ret=="PRIMARY") { inputPort[size]=CProtocol::PRIMARY; } else if (ret=="BWG") { inputPort[size]=CProtocol::BWG; } else if (ret=="GREGORIAN") { // GREGORIAN inputPort[size]=CProtocol::GREGORIAN; } else { return false; } size++; } if ((size!=1) && (size!=m_dwBoardsNumber)) return false; // the size of inputs vector should be 1 or equal to the number of boards if ((size==1)) { // if the provided list of input ports is one element, i'll fill everything up to the maximum number of boards for (WORD k=1;k<MAX_BOARDS_NUMBER;k++) { inputPort[k]=inputPort[0]; } } return true; } bool CConfiguration::getSetupFromID(const IRA::CString setupID,TBackendSetup& setup) throw (ComponentErrors::CDBAccessExImpl) { bool done=false; CString inputPorts; m_configurationTable->First(); for (int i=0;i<m_configurationTable->recordCount();i++) { CString id((*m_configurationTable)["configurationID"]->asString()); Loading @@ -65,14 +96,11 @@ bool CConfiguration::getSetupFromID(const IRA::CString setupID,TBackendSetup& se else { setup.calSwitchEnabled=false; } if ((*m_configurationTable)["inputPort"]->asString()=="PRIMARY") { setup.inputPort=CProtocol::PRIMARY; } else if ((*m_configurationTable)["inputPort"]->asString()=="BWG") { setup.inputPort=CProtocol::BWG; } else { // GREGORIAN setup.inputPort=CProtocol::GREGORIAN; inputPorts=(*m_configurationTable)["inputPort"]->asString(); if (!getInputPorts(inputPorts,setup.inputPort,setup.inputPorts)) { _EXCPT(ComponentErrors::CDBAccessExImpl,impl,""); impl.setFieldName("Configuration.inputPort"); throw impl; } setup.beams=(*m_configurationTable)["beams"]->asLongLong(); setup.bandWidth=(*m_configurationTable)["bandWidth"]->asDouble(); Loading