From 34499c49ebee575e079fb1c9976741b39d3c9560 Mon Sep 17 00:00:00 2001 From: Andrea Orlat <a.orlati@ira.inaf.it> Date: Fri, 30 Sep 2016 14:38:56 +0000 Subject: [PATCH] New Offset management almost complete. Need to fix an compiler issue in External backend. Implementation in OTF still missing --- .../src/AntennaBossTextClient.cpp | 54 ++++++----- .../Servers/FitsWriter/include/FitsWriter.h | 7 +- Common/Servers/FitsWriter/include/MetaData.h | 18 ++-- Common/Servers/FitsWriter/include/Version.h | 5 +- .../Servers/FitsWriter/src/EngineThread.cpp | 89 ++++++++++++------- Common/Servers/FitsWriter/src/FitsWriter.cpp | 24 ++++- Common/Servers/FitsWriter/src/MetaData.cpp | 4 +- Common/Servers/FitsWriter/src/TestWriter.cpp | 5 +- Common/Servers/Scheduler/src/Core.cpp | 6 +- .../Servers/Scheduler/src/Core_Operations.i | 8 +- 10 files changed, 142 insertions(+), 78 deletions(-) diff --git a/Common/Clients/AntennaBossTextClient/src/AntennaBossTextClient.cpp b/Common/Clients/AntennaBossTextClient/src/AntennaBossTextClient.cpp index 2cfe05285..d9edef382 100644 --- a/Common/Clients/AntennaBossTextClient/src/AntennaBossTextClient.cpp +++ b/Common/Clients/AntennaBossTextClient/src/AntennaBossTextClient.cpp @@ -356,19 +356,19 @@ int main(int argc, char *argv[]) { _TW_SET_COMPONENT(targetRA_field,22,1,14,1,CColorPair::WHITE_BLACK,CStyle::BOLD,output_label); _TW_SET_COMPONENT(targetDec_field,37,1,14,1,CColorPair::WHITE_BLACK,CStyle::BOLD,output_label); _TW_SET_COMPONENT(targetFlux_field,52,1,11,1,CColorPair::WHITE_BLACK,CStyle::BOLD,output_label); - _TW_SET_COMPONENT(target_field,0,1,17,1,CColorPair::GREEN_BLACK,CStyle::UNDERLINE,output_label); + _TW_SET_COMPONENT(target_field,0,1,17,1,CColorPair::BLUE_BLACK,CStyle::UNDERLINE|CStyle::BOLD,output_label); _TW_SET_COMPONENT(targetVrad_field,22,2,11,1,CColorPair::WHITE_BLACK,CStyle::BOLD,output_label); _TW_SET_COMPONENT(refFrame_box,34,2,12,1,CColorPair::WHITE_BLACK,CStyle::BOLD,output_label); _TW_SET_COMPONENT(velDef_box,47,2,12,1,CColorPair::WHITE_BLACK,CStyle::BOLD,output_label); - _TW_SET_COMPONENT(scanLonOff_field,22,3,14,1,CColorPair::WHITE_BLACK,CStyle::BOLD,output_label); - _TW_SET_COMPONENT(scanLatOff_field,37,3,14,1,CColorPair::WHITE_BLACK,CStyle::BOLD,output_label); - _TW_SET_COMPONENT(scanFrameOff_box,52,3,12,1,CColorPair::WHITE_BLACK,CStyle::BOLD,output_label); + _TW_SET_COMPONENT(scanLonOff_field,22,3,11,1,CColorPair::WHITE_BLACK,CStyle::BOLD,output_label); + _TW_SET_COMPONENT(scanLatOff_field,34,3,11,1,CColorPair::WHITE_BLACK,CStyle::BOLD,output_label); + _TW_SET_COMPONENT(scanFrameOff_box,47,3,12,1,CColorPair::WHITE_BLACK,CStyle::BOLD,output_label); scanFrameOff_box->setStatusLook(Antenna::ANT_HORIZONTAL); scanFrameOff_box->setStatusLook(Antenna::ANT_EQUATORIAL); scanFrameOff_box->setStatusLook(Antenna::ANT_GALACTIC); - _TW_SET_COMPONENT(sysAzOff_field,22,5,14,1,CColorPair::WHITE_BLACK,CStyle::BOLD,output_label); - _TW_SET_COMPONENT(sysElOff_field,37,5,14,1,CColorPair::WHITE_BLACK,CStyle::BOLD,output_label); + _TW_SET_COMPONENT(sysAzOff_field,22,4,11,1,CColorPair::WHITE_BLACK,CStyle::BOLD,output_label); + _TW_SET_COMPONENT(sysElOff_field,34,4,11,1,CColorPair::WHITE_BLACK,CStyle::BOLD,output_label); /*_TW_SET_COMPONENT(raOff_field,22,4,14,1,CColorPair::WHITE_BLACK,CStyle::BOLD,output_label); _TW_SET_COMPONENT(decOff_field,37,4,14,1,CColorPair::WHITE_BLACK,CStyle::BOLD,output_label); @@ -525,21 +525,21 @@ int main(int argc, char *argv[]) { /* Add all the static labels */ //_TW_ADD_LABEL(":",18,1,1,1,CColorPair::WHITE_BLACK,CStyle::UNDERLINE,window); - _TW_ADD_LABEL("Radial Velocity :",0,2,18,1,CColorPair::WHITE_BLACK,CStyle::UNDERLINE,window); - _TW_ADD_LABEL("Horiz. Offs :",0,3,18,1,CColorPair::WHITE_BLACK,CStyle::UNDERLINE,window); - _TW_ADD_LABEL("Equat. Offs :",0,4,18,1,CColorPair::WHITE_BLACK,CStyle::UNDERLINE,window); - _TW_ADD_LABEL("Galac. Offs :",0,5,18,1,CColorPair::WHITE_BLACK,CStyle::UNDERLINE,window); - _TW_ADD_LABEL("Raw Horiz. :",0,6,18,1,CColorPair::WHITE_BLACK,CStyle::UNDERLINE,window); - _TW_ADD_LABEL("Observed Horiz. :",0,7,18,1,CColorPair::WHITE_BLACK,CStyle::UNDERLINE,window); - _TW_ADD_LABEL("Observed Equat. :",0,8,18,1,CColorPair::WHITE_BLACK,CStyle::UNDERLINE,window); - _TW_ADD_LABEL("Observed Galac. :",0,9,18,1,CColorPair::WHITE_BLACK,CStyle::UNDERLINE,window); - _TW_ADD_LABEL("Generator Type : ",0,10,18,1,CColorPair::WHITE_BLACK,CStyle::UNDERLINE,window); - _TW_ADD_LABEL("Corr. az/el/ref : ",0,11,18,1,CColorPair::WHITE_BLACK,CStyle::UNDERLINE,window); - _TW_ADD_LABEL("FWHM : ",0,12,18,1,CColorPair::WHITE_BLACK,CStyle::UNDERLINE,window); - _TW_ADD_LABEL("Enabled : ",0,13,18,1,CColorPair::WHITE_BLACK,CStyle::UNDERLINE,window); - _TW_ADD_LABEL("Tracking : ",0,14,18,1,CColorPair::WHITE_BLACK,CStyle::UNDERLINE,window); - _TW_ADD_LABEL("Correction : ",0,15,18,1,CColorPair::WHITE_BLACK,CStyle::UNDERLINE,window); - _TW_ADD_LABEL("Status : ",0,16,18,1,CColorPair::WHITE_BLACK,CStyle::UNDERLINE,window); + _TW_ADD_LABEL("Radial Velocity :",0,2,18,1,CColorPair::WHITE_BLACK,0,window); + _TW_ADD_LABEL("Scan Offs :",0,3,18,1,CColorPair::WHITE_BLACK,0,window); + _TW_ADD_LABEL("System Offs :",0,4,18,1,CColorPair::WHITE_BLACK,0,window); + //_TW_ADD_LABEL("Galac. Offs :",0,5,18,1,CColorPair::WHITE_BLACK,CStyle::UNDERLINE,window); + _TW_ADD_LABEL("Raw Horiz. :",0,6,18,1,CColorPair::WHITE_BLACK,0,window); + _TW_ADD_LABEL("Observed Horiz. :",0,7,18,1,CColorPair::WHITE_BLACK,0,window); + _TW_ADD_LABEL("Observed Equat. :",0,8,18,1,CColorPair::WHITE_BLACK,0,window); + _TW_ADD_LABEL("Observed Galac. :",0,9,18,1,CColorPair::WHITE_BLACK,0,window); + _TW_ADD_LABEL("Generator Type : ",0,10,18,1,CColorPair::WHITE_BLACK,0,window); + _TW_ADD_LABEL("Corr. az/el/ref : ",0,11,18,1,CColorPair::WHITE_BLACK,0,window); + _TW_ADD_LABEL("FWHM : ",0,12,18,1,CColorPair::WHITE_BLACK,0,window); + _TW_ADD_LABEL("Enabled : ",0,13,18,1,CColorPair::WHITE_BLACK,0,window); + _TW_ADD_LABEL("Tracking : ",0,14,18,1,CColorPair::WHITE_BLACK,0,window); + _TW_ADD_LABEL("Correction : ",0,15,18,1,CColorPair::WHITE_BLACK,0,window); + _TW_ADD_LABEL("Status : ",0,16,18,1,CColorPair::WHITE_BLACK,0,window); _TW_ADD_LABEL(" _______________________________Generator__________________________________________",0,17,WINDOW_WIDTH-2,1,CColorPair::GREEN_BLACK,CStyle::BOLD,window); /* ************************* */ @@ -551,13 +551,19 @@ int main(int argc, char *argv[]) { window.addComponent((CFrameComponent*)targetVrad_field); window.addComponent((CFrameComponent*)refFrame_box); window.addComponent((CFrameComponent*)velDef_box); - window.addComponent((CFrameComponent*)targetFlux_field); - window.addComponent((CFrameComponent*)azOff_field); + window.addComponent((CFrameComponent*)targetFlux_field); + window.addComponent((CFrameComponent*)scanLonOff_field); + window.addComponent((CFrameComponent*)scanLatOff_field); + window.addComponent((CFrameComponent*)scanFrameOff_box); + window.addComponent((CFrameComponent*)sysAzOff_field); + window.addComponent((CFrameComponent*)sysElOff_field); + + /*window.addComponent((CFrameComponent*)azOff_field); window.addComponent((CFrameComponent*)elOff_field); window.addComponent((CFrameComponent*)raOff_field); window.addComponent((CFrameComponent*)decOff_field); window.addComponent((CFrameComponent*)lonOff_field); - window.addComponent((CFrameComponent*)latOff_field); + window.addComponent((CFrameComponent*)latOff_field);*/ window.addComponent((CFrameComponent*)rawAzimuth_field); window.addComponent((CFrameComponent*)rawElevation_field); window.addComponent((CFrameComponent*)observedAzimuth_field); diff --git a/Common/Servers/FitsWriter/include/FitsWriter.h b/Common/Servers/FitsWriter/include/FitsWriter.h index 3370d8b1e..23a757748 100644 --- a/Common/Servers/FitsWriter/include/FitsWriter.h +++ b/Common/Servers/FitsWriter/include/FitsWriter.h @@ -141,6 +141,9 @@ public: * @param skyBandWidth for each backend section it gives the value of the band width (MHz) * @param marks for each RF input gives the value of the noise calibration mark. (°K) * @param sourceFlux for each backend section it reports the estimated source flux computed with section parameters + * @param rest represents the rest frequencies associated with each sections. If the length is 1, any section is linked with the provided value. + * Otherwise if the number of sections and the multiplicity of this sequence do not match as well, the corresponding rest of the section is adjustested + * to be doublenulls. * @param atts attenuation, one for each input of the backend * @param name name of the sections table * @param noData if true the data columns will not be added to the DATATable @@ -148,8 +151,8 @@ public: * @return false if the operation is not successful */ bool addSectionTable(const ACS::longSeq §ionID, const ACS::longSeq& feedsID, const ACS::longSeq& ifsID,const ACS::longSeq& pols,const ACS::doubleSeq& los, - const ACS::doubleSeq& skyFreq,const ACS::doubleSeq& skyBandWidth,const ACS::doubleSeq& marks, - const ACS::doubleSeq& sourceFlux,const ACS::doubleSeq& atts,bool noData,const IRA::CString& name="SECTION TABLE",const IRA::CString& rfName="RF INPUTS"); + const ACS::doubleSeq& skyFreq,const ACS::doubleSeq& skyBandWidth,const ACS::doubleSeq& marks,const ACS::doubleSeq& sourceFlux,const ACS::doubleSeq& rest, + const ACS::doubleSeq& atts,bool noData,const IRA::CString& name="SECTION TABLE",const IRA::CString& rfName="RF INPUTS"); /** * It allows to add the servo table to the file diff --git a/Common/Servers/FitsWriter/include/MetaData.h b/Common/Servers/FitsWriter/include/MetaData.h index f55b85b25..ef9dd516f 100644 --- a/Common/Servers/FitsWriter/include/MetaData.h +++ b/Common/Servers/FitsWriter/include/MetaData.h @@ -157,15 +157,15 @@ public: /** * It allows to set the antenna position offsets as directly returned by the Antenna subsystem */ - void setAntennaOffsets(const double& azOff,const double& elOff,const double& raOff,const double& decOff,const double& lonOff,const double& latOff) { - m_azOff=azOff; m_elOff=elOff; m_raOff=raOff; m_decOff=decOff; m_lonOff=lonOff; m_latOff=latOff; + void setAntennaOffsets(const double& sysAzOff,const double& sysElOff,const double& lonOff,const double& latOff,const Antenna::TCoordinateFrame& offFrame) { + m_sysAzOff=sysAzOff; m_sysElOff=sysElOff; m_lonOff=lonOff; m_latOff=latOff; m_offFrame=offFrame; } - + /** * @return the antenna position offsets */ - void getAntennaOffsets(double& azOff,double& elOff,double& raOff,double& decOff,double& lonOff,double& latOff) const { - azOff=m_azOff; elOff=m_elOff; raOff=m_raOff; decOff=m_decOff; lonOff=m_lonOff; latOff=m_latOff; + void getAntennaOffsets(double& sysAzOff,double& sysElOff,double& lonOff,double& latOff,Antenna::TCoordinateFrame& offFrame) const { + sysAzOff=m_sysAzOff; sysElOff=m_sysElOff; lonOff=m_lonOff; latOff=m_latOff; offFrame=m_offFrame; } /** @@ -200,6 +200,7 @@ public: m_dewarMode=mod; m_dewarPos=pos; } + void setDewarConfiguration() { m_dewarMode=Receivers::RCV_UNDEF_DEROTCONF; m_dewarPos=0.0; @@ -226,7 +227,8 @@ public: m_restFreq=rf; } void setRestFreq() { - m_restFreq.length(0); + m_restFreq.length(1); + m_restFreq[0]=0.0; } void getRestFreq(ACS::doubleSeq& rf) const { rf=m_restFreq; } @@ -293,7 +295,9 @@ private: /** * antenna position offsets */ - double m_azOff,m_elOff,m_raOff,m_decOff,m_lonOff,m_latOff; + double m_sysAzOff,m_sysElOff,m_lonOff,m_latOff; + Antenna::TCoordinateFrame m_offFrame; + /** * stores the estimated source fluxes, one for each section. */ diff --git a/Common/Servers/FitsWriter/include/Version.h b/Common/Servers/FitsWriter/include/Version.h index 50e56ff65..b1e569e7f 100644 --- a/Common/Servers/FitsWriter/include/Version.h +++ b/Common/Servers/FitsWriter/include/Version.h @@ -19,6 +19,7 @@ #define FITS_VERSION7 "V.1.01" #define FITS_VERSION8 "V.1.1" #define FITS_VERSION9 "V.1.11" +#define FITS_VERSION10 "V.1.2" #define CURRENT_VERSION FITS_VERSION9 @@ -32,8 +33,8 @@ #define HISTORY6 FITS_VERSION6" Added new table to store position of subriflector e primary focus receivers: SERVO TABLE" #define HISTORY7 FITS_VERSION7" New keywords in FEED TABLE header to describe derotator configuration" #define HISTORY8 FITS_VERSION8" Summary.fits file included in order to describe the scan configuration" -#define HISTORY9 FITS_VERSION9" added the keyword SIGNAL in main header of each sub scan fits" - +#define HISTORY9 FITS_VERSION9" Added the keyword SIGNAL in main header of each sub scan fits" +#define HISTORY10 FITS_VERSION10" Keywords SScanLatOff,SScanLonOff,SScanOffFrame raplace all offset keywords in main header" #endif /* VERSION_H_ */ diff --git a/Common/Servers/FitsWriter/src/EngineThread.cpp b/Common/Servers/FitsWriter/src/EngineThread.cpp index f6473e686..230dcc326 100644 --- a/Common/Servers/FitsWriter/src/EngineThread.cpp +++ b/Common/Servers/FitsWriter/src/EngineThread.cpp @@ -451,9 +451,6 @@ void CEngineThread::runLoop() return; } if (m_data->isStart() && m_data->isReady() && m_data->isScanHeaderReady() && m_data->isSubScanHeaderReady()) { // //main headers are already saved and file has to be opened - //***************************************************************************************** - ACS_LOG(LM_FULL_INFO,"CEngineThread::runLoop()",(LM_NOTICE,"LETS BEGIN SUBSCAN %ld!",m_data->getSubScanID())); - //************************* ADDDED FOR DEBUGGING NoData/Roach Could be deleted **************** if (!m_fileOpened) { m_data->setStatus(Management::MNG_OK); // create the file and save main headers @@ -472,9 +469,6 @@ void CEngineThread::runLoop() //let's create the summary file, it should be created before the first subscan of the scan....... // the the summary will be valid for the duration of all the subscans..... if (!m_summaryOpened) { - ///********************************************************************************** - ACS_LOG(LM_FULL_INFO,"CEngineThread::runLoop()",(LM_NOTICE,"CREO SUMMARY")); - ///******************* DEBUG ******************************************************** TIMEVALUE currentUT; IRA::CDateTime now; TIMEDIFFERENCE currentLST; @@ -505,9 +499,6 @@ void CEngineThread::runLoop() m_summaryOpened=true; ACS_LOG(LM_FULL_INFO, "CEngineThread::runLoop()",(LM_NOTICE,"SUMMARY_OPENED")); } - ///********************************************************************************** - ACS_LOG(LM_FULL_INFO,"CEngineThread::runLoop()",(LM_NOTICE,"CREO IL FILE")); - ///******************* DEBUG ******************************** m_file = new CFitsWriter(); m_file->setBasePath(""); m_file->setFileName((const char *)m_data->getFileName()); @@ -519,9 +510,6 @@ void CEngineThread::runLoop() m_data->setStatus(Management::MNG_FAILURE); } else { - //***************************************************************************************** - ACS_LOG(LM_FULL_INFO,"CEngineThread::runLoop()",(LM_NOTICE,"OUTPUT_FILE_CREATED_NOW")); - //************************* ADDDED FOR DEBUGGING NoData/Roach Could be deleted **************** m_fileOpened=true; m_data->startRunnigStage(); //get data from receivers boss @@ -548,17 +536,16 @@ void CEngineThread::runLoop() //get the data from the minor servo boss...if subsystem is enabled collectMinorServoData(); - //***************************************************************************************** - ACS_LOG(LM_FULL_INFO,"CEngineThread::runLoop()",(LM_NOTICE,"DATA_COLLECTION_COMPLETED")); - //************************* ADDDED FOR DEBUGGING NoData/Roach Could be deleted **************** - // now creates the file, the tables and the headers Backends::TMainHeader mH=m_data->getMainHeader(); Backends::TSectionHeader const *cH=m_data->getSectionHeader(); IRA::CString siteName; IRA::CString sourceName; double sourceRa,sourceDec,sourceVlsr; - double azOff,elOff,raOff,decOff,lonOff,latOff; + //double azOff,elOff,raOff,decOff,lonOff,latOff; + double sysAzOff,sysElOff,lonOff,latOff; + Antenna::TCoordinateFrame offFrame; + IRA::CString offFrameStr; double dut1; long scanTag; long scanID,subScanID; @@ -574,6 +561,7 @@ void CEngineThread::runLoop() ACS::doubleSeq atts; ACS::longSeq sectionsID; ACS::stringSeq axisName,axisUnit; + ACS::doubleSeq restFrequency; m_data->getSite(site,dut1,siteName); m_info.getLocalOscillator(LocalOscillator); @@ -587,7 +575,9 @@ void CEngineThread::runLoop() m_info.getSourceFlux(fluxes); m_info.getReceiverPolarization(polarizations); m_info.getSource(sourceName,sourceRa,sourceDec,sourceVlsr); - m_info.getAntennaOffsets(azOff,elOff,raOff,decOff,lonOff,latOff); + m_info.getAntennaOffsets(sysAzOff,sysElOff,lonOff,latOff,offFrame); + m_info.getRestFreq(restFrequency); + IRA::CIRATools::coordinateFrameToStr(offFrame,offFrameStr); scanTag=m_data->getScanTag(); scanID=m_data->getScanID(); subScanID=m_data->getSubScanID(); @@ -698,7 +688,28 @@ void CEngineThread::runLoop() impl.log(LM_ERROR); // not filtered, because the user need to know about the problem immediately m_data->setStatus(Management::MNG_FAILURE); } - else if(!m_file->setPrimaryHeaderKey("Azimuth Offset",azOff,"Longitude offset in horizontal frame")) { + else if(!m_file->setPrimaryHeaderKey("SScanLonOff",lonOff,"Longitude offset in sub scan")) { + _EXCPT(ManagementErrors::FitsCreationErrorExImpl,impl,"CEngineThread::runLoop()"); + impl.setFileName((const char *)m_data->getFileName()); + impl.setError(m_file->getLastError()); + impl.log(LM_ERROR); // not filtered, because the user need to know about the problem immediately + m_data->setStatus(Management::MNG_FAILURE); + } + else if(!m_file->setPrimaryHeaderKey("SScanLatOff",latOff,"Latitude offset in sub scan")) { + _EXCPT(ManagementErrors::FitsCreationErrorExImpl,impl,"CEngineThread::runLoop()"); + impl.setFileName((const char *)m_data->getFileName()); + impl.setError(m_file->getLastError()); + impl.log(LM_ERROR); // not filtered, because the user need to know about the problem immediately + m_data->setStatus(Management::MNG_FAILURE); + } + else if(!m_file->setPrimaryHeaderKey("SScanOffFrame",(const char *)offFrameStr,"Offset frame in sub scan")) { + _EXCPT(ManagementErrors::FitsCreationErrorExImpl,impl,"CEngineThread::runLoop()"); + impl.setFileName((const char *)m_data->getFileName()); + impl.setError(m_file->getLastError()); + impl.log(LM_ERROR); // not filtered, because the user need to know about the problem immediately + m_data->setStatus(Management::MNG_FAILURE); + } + /*else if(!m_file->setPrimaryHeaderKey("Azimuth Offset",azOff,"Longitude offset in horizontal frame")) { _EXCPT(ManagementErrors::FitsCreationErrorExImpl,impl,"CEngineThread::runLoop()"); impl.setFileName((const char *)m_data->getFileName()); impl.setError(m_file->getLastError()); @@ -739,7 +750,7 @@ void CEngineThread::runLoop() impl.setError(m_file->getLastError()); impl.log(LM_ERROR); // not filtered, because the user need to know about the problem immediately m_data->setStatus(Management::MNG_FAILURE); - } + }*/ else if(!m_file->setPrimaryHeaderKey("ScanID",scanID,"Scan Identifier")) { _EXCPT(ManagementErrors::FitsCreationErrorExImpl,impl,"CEngineThread::runLoop()"); impl.setFileName((const char *)m_data->getFileName()); @@ -791,7 +802,10 @@ void CEngineThread::runLoop() impl.log(LM_ERROR); // not filtered, because the user need to know about the problem immediately m_data->setStatus(Management::MNG_FAILURE); } - if (!m_file->addSectionTable(sectionsID,feedsID,ifsID,polarizations,LocalOscillator,skyFreq,skyBw,calib,fluxes,atts,m_data->getIsNoData())) { + if ((restFrequency.length()>=1) && (restFrequency.length()!=sectionsID.length())) { + CUSTOM_LOG(LM_FULL_INFO,"CEngineThread::runLoop()",(LM_WARNING,"Provided rest frequencies do not match the number of sections")); + } + if (!m_file->addSectionTable(sectionsID,feedsID,ifsID,polarizations,LocalOscillator,skyFreq,skyBw,calib,fluxes,restFrequency,atts,m_data->getIsNoData())) { _EXCPT(ManagementErrors::FitsCreationErrorExImpl,impl,"CEngineThread::runLoop()"); impl.setFileName((const char *)m_data->getFileName()); impl.setError(m_file->getLastError()); @@ -965,16 +979,31 @@ void CEngineThread::collectAntennaData(FitsWriter_private::CFile* summaryFile) if (!CORBA::is_nil(m_antennaBoss)) { ACSErr::Completion_var comp; CORBA::Double ra=0.0,dec=0.0,vrad=0.0; - CORBA::Double raOff=0.0,decOff=0.0,azOff=0.0,elOff=0.0,lonOff=0.0,latOff=0.0; + //CORBA::Double raOff=0.0,decOff=0.0,azOff=0.0,elOff=0.0,lonOff=0.0,latOff=0.0; + CORBA::Double sysAzOff=0.0,sysElOff=0.0,lonOff=0.0,latOff=0.0; + Antenna::TCoordinateFrame offFrame=Antenna::ANT_HORIZONTAL; IRA::CString sourceName=""; Antenna::TReferenceFrame VFrame=Antenna::ANT_UNDEF_FRAME; Antenna::TVradDefinition VDefinition=Antenna::ANT_UNDEF_DEF; - + + // get the current offsets + try { + m_antennaBoss->getAllOffsets(sysAzOff,sysElOff,lonOff,latOff,offFrame); + } + catch (CORBA::SystemException& ex) { + _EXCPT(ComponentErrors::CORBAProblemExImpl,impl,"CEngineThread::collectAntennaData()"); + impl.setName(ex._name()); + impl.setMinor(ex.minor()); + impl.log(LM_ERROR); + m_data->setStatus(Management::MNG_WARNING); + antennaBossError=true; + } + try { //get the target name and parameters ACS::ROstring_var targetRef; CORBA::String_var target; ACS::ROdouble_var raRef,decRef,vradRef; - ACS::ROdouble_var raOffRef,decOffRef,azOffRef,elOffRef,lonOffRef,latOffRef; + //ACS::ROdouble_var raOffRef,decOffRef,azOffRef,elOffRef,lonOffRef,latOffRef; Antenna::ROTReferenceFrame_var VFrameRef; Antenna::ROTVradDefinition_var VDefinitionRef; @@ -983,15 +1012,14 @@ void CEngineThread::collectAntennaData(FitsWriter_private::CFile* summaryFile) raRef=m_antennaBoss->targetRightAscension(); decRef=m_antennaBoss->targetDeclination(); vradRef=m_antennaBoss->targetVrad(); - azOffRef=m_antennaBoss->azimuthOffset(); + /*azOffRef=m_antennaBoss->azimuthOffset(); elOffRef=m_antennaBoss->elevationOffset(); raOffRef=m_antennaBoss->rightAscensionOffset(); decOffRef=m_antennaBoss->declinationOffset(); lonOffRef=m_antennaBoss->longitudeOffset(); - latOffRef=m_antennaBoss->latitudeOffset(); + latOffRef=m_antennaBoss->latitudeOffset();*/ VFrameRef=m_antennaBoss->vradReferenceFrame(); VDefinitionRef=m_antennaBoss->vradDefinition(); - VDefinition=VDefinitionRef->get_sync(comp.out()); ACSErr::CompletionImpl VDefinitionRefCompl(comp); if (!VDefinitionRefCompl.isErrorFree()) { @@ -1059,7 +1087,7 @@ void CEngineThread::collectAntennaData(FitsWriter_private::CFile* summaryFile) m_data->setStatus(Management::MNG_WARNING); vrad=0.0; } - azOff=azOffRef->get_sync(comp.out()); + /*azOff=azOffRef->get_sync(comp.out()); ACSErr::CompletionImpl azOffCompl(comp); if (!azOffCompl.isErrorFree()) { _ADD_BACKTRACE(ComponentErrors::CouldntGetAttributeExImpl,impl,azOffCompl,"CEngineThread::collectAntennaData()"); @@ -1118,7 +1146,7 @@ void CEngineThread::collectAntennaData(FitsWriter_private::CFile* summaryFile) impl.log(LM_ERROR); m_data->setStatus(Management::MNG_WARNING); latOff=0.0; - } + }*/ } catch (CORBA::SystemException& ex) { _EXCPT(ComponentErrors::CORBAProblemExImpl,impl,"CEngineThread::collectAntennaData()"); @@ -1131,7 +1159,7 @@ void CEngineThread::collectAntennaData(FitsWriter_private::CFile* summaryFile) ra=dec=vrad=0.0; } m_info.setSource(sourceName,ra,dec,vrad); - m_info.setAntennaOffsets(azOff,elOff,raOff,decOff,lonOff,latOff); + m_info.setAntennaOffsets(sysAzOff,sysElOff,lonOff,latOff,offFrame); if (summaryFile) { summaryFile->setKeyword("OBJECT",sourceName); summaryFile->setKeyword("RightAscension",ra); @@ -1194,6 +1222,7 @@ void CEngineThread::collectSchedulerData(FitsWriter_private::CFile* summaryFile) //CCommonTools::map(restFreq,va); //if (summaryFile) summaryFile->setKeyword("RESTFREQ",va); m_info.setRestFreq(restFreq); + Management::TSubScanConfiguration_var conf; try { m_scheduler->getSubScanConfigruation(conf.out()); diff --git a/Common/Servers/FitsWriter/src/FitsWriter.cpp b/Common/Servers/FitsWriter/src/FitsWriter.cpp index 37dcc05a3..5b8ff984f 100644 --- a/Common/Servers/FitsWriter/src/FitsWriter.cpp +++ b/Common/Servers/FitsWriter/src/FitsWriter.cpp @@ -25,6 +25,7 @@ using namespace FitsWriter_private; #define _FITSW_SECTCOL_SR "sampleRate" #define _FITSW_SECTCOL_BINS "bins" #define _FITSW_SECTCOL_FLUX "flux" +#define _FITSW_SECTCOL_REST "restfreq" #define _FITSW_RFCOL_FEED "feed" #define _FITSW_RFCOL_IF "ifChain" @@ -38,6 +39,7 @@ using namespace FitsWriter_private; + CFitsWriter::CFitsWriter() { m_filename = "out.fits"; @@ -57,18 +59,21 @@ CFitsWriter::CFitsWriter() SectColName.push_back(_FITSW_SECTCOL_SR); SectColName.push_back(_FITSW_SECTCOL_BINS); SectColName.push_back(_FITSW_SECTCOL_FLUX); + SectColName.push_back(_FITSW_SECTCOL_REST); SectColForm.push_back("J"); SectColForm.push_back("6A"); SectColForm.push_back("D"); SectColForm.push_back("J"); SectColForm.push_back("D"); + SectColForm.push_back("D"); SectColUnit.push_back(""); SectColUnit.push_back(""); SectColUnit.push_back("MHz"); SectColUnit.push_back(""); SectColForm.push_back("Jy"); + SectColForm.push_back("MHz"); rfColName.push_back(_FITSW_RFCOL_FEED); rfColName.push_back(_FITSW_RFCOL_IF); @@ -223,6 +228,7 @@ bool CFitsWriter::create() if (!CFitsTools::primaryHeaderHistory(pFits,HISTORY7,m_lastError)) return false; if (!CFitsTools::primaryHeaderHistory(pFits,HISTORY8,m_lastError)) return false; if (!CFitsTools::primaryHeaderHistory(pFits,HISTORY9,m_lastError)) return false; + if (!CFitsTools::primaryHeaderHistory(pFits,HISTORY10,m_lastError)) return false; return true; }; @@ -481,8 +487,8 @@ bool CFitsWriter::addFeedTable(const IRA::CString& name) }; bool CFitsWriter::addSectionTable(const ACS::longSeq §ionID, const ACS::longSeq& feedsID, const ACS::longSeq& ifsID,const ACS::longSeq& pols,const ACS::doubleSeq& los, - const ACS::doubleSeq& skyFreq,const ACS::doubleSeq& skyBandWidth,const ACS::doubleSeq& marks,const ACS::doubleSeq& sourceFlux,const ACS::doubleSeq& atts, - bool noData,const IRA::CString& name,const IRA::CString& rfName) + const ACS::doubleSeq& skyFreq,const ACS::doubleSeq& skyBandWidth,const ACS::doubleSeq& marks,const ACS::doubleSeq& sourceFlux,const ACS::doubleSeq& rest, + const ACS::doubleSeq& atts,bool noData,const IRA::CString& name,const IRA::CString& rfName) { std::vector<long> id; std::vector<long> bins; @@ -497,6 +503,7 @@ bool CFitsWriter::addSectionTable(const ACS::longSeq §ionID, const ACS::long std::vector<double> localOscillator; std::vector<double> attenuation; std::vector<double> calib; + std::vector<double> restFreq; std::vector<long> section; long inputsNumber=0; long fluxIterator=0; @@ -534,9 +541,8 @@ bool CFitsWriter::addSectionTable(const ACS::longSeq §ionID, const ACS::long DataColForm.push_back(type.str()); DataColUnit.push_back(""); } - if (m_channels[i].inputs>1) { - tsysType << (m_channels[i].inputs) << "D";; + tsysType << (m_channels[i].inputs) << "D"; tsysColForm.push_back(tsysType.str()); } else { @@ -544,6 +550,15 @@ bool CFitsWriter::addSectionTable(const ACS::longSeq §ionID, const ACS::long } tsysColName.push_back(colName.str()); tsysColUnit.push_back("K"); + if (rest.length()==1) { + restFreq.push_back(rest[0]); + } + else if (rest.length()==sectionID.length()) { + restFreq.push_back(rest[i]); + } + else { + restFreq.push_back(DOUBLENULLVALUE); + } } inputsNumber=sectionID.length(); for (unsigned j=0;j<sectionID.length();j++) { @@ -666,6 +681,7 @@ bool CFitsWriter::addSectionTable(const ACS::longSeq §ionID, const ACS::long section_table->column(_FITSW_SECTCOL_SR).write(sampleRate,1); section_table->column(_FITSW_SECTCOL_BINS).write(bins,1); section_table->column(_FITSW_SECTCOL_FLUX).write(flux,1); + section_table->column(_FITSW_SECTCOL_REST).write(restFreq,1); } catch(FitsException& fe){ m_lastError = fe.message().c_str(); diff --git a/Common/Servers/FitsWriter/src/MetaData.cpp b/Common/Servers/FitsWriter/src/MetaData.cpp index 8ab194632..1ff0d75ca 100644 --- a/Common/Servers/FitsWriter/src/MetaData.cpp +++ b/Common/Servers/FitsWriter/src/MetaData.cpp @@ -24,7 +24,9 @@ CMetaData::CMetaData() m_servoAxisNames.length(0); m_servoAxisNames.length(0); m_restFreq.length(0); - m_azOff=m_elOff=m_raOff=m_decOff=m_lonOff=m_latOff=0.0; + m_sysAzOff=m_sysElOff=m_lonOff=m_latOff=0.0; + m_offFrame=Antenna::ANT_HORIZONTAL; + //m_azOff=m_elOff=m_raOff=m_decOff=m_lonOff=m_latOff=0.0; m_subScanConf.signal=Management::MNG_SIGNAL_NONE; } diff --git a/Common/Servers/FitsWriter/src/TestWriter.cpp b/Common/Servers/FitsWriter/src/TestWriter.cpp index 2230056f3..0a8966e38 100644 --- a/Common/Servers/FitsWriter/src/TestWriter.cpp +++ b/Common/Servers/FitsWriter/src/TestWriter.cpp @@ -26,6 +26,7 @@ int main(int argc, char *argv[]) ACS::longSeq sectionsID; ACS::longSeq feedsID; ACS::longSeq ifsID; + ACS::doubleSeq rest; CFitsWriter *file; IRA::CString fileName; TIMEVALUE now; @@ -59,6 +60,8 @@ int main(int argc, char *argv[]) feedsID.length(inputsNumber); sectionsID.length(inputsNumber); ifsID.length(inputsNumber); + rest.length(1); + rest[0]=22434.54332; tsys=new double[inputsNumber]; for (int i=0;i<SECTIONS;i++) { cH[i].id=i; @@ -120,7 +123,7 @@ int main(int argc, char *argv[]) printf("FITS Error: %s\n",(const char *)file->getLastError()); exit(-1); } - if (!file->addSectionTable(sectionsID,feedsID,ifsID,pols,los,skyFreq,skyBw,calib,flux,atts,false)) { + if (!file->addSectionTable(sectionsID,feedsID,ifsID,pols,los,skyFreq,skyBw,calib,flux,rest,atts,false)) { printf("FITS Error: %s\n",(const char *)file->getLastError()); exit(-1); } diff --git a/Common/Servers/Scheduler/src/Core.cpp b/Common/Servers/Scheduler/src/Core.cpp index 502f70dbb..0f90b8ecb 100644 --- a/Common/Servers/Scheduler/src/Core.cpp +++ b/Common/Servers/Scheduler/src/Core.cpp @@ -144,9 +144,9 @@ void CCore::execute() throw (ComponentErrors::TimerErrorExImpl,ComponentErrors:: m_parser->add("antennaSetup","antenna",1,&CCore::remoteCall); m_parser->add("preset","antenna",1,&CCore::remoteCall); m_parser->add("bwhm","antenna",1,&CCore::remoteCall); - m_parser->add("azelOffsets","antenna",1,&CCore::remoteCall); - m_parser->add("radecOffsets","antenna",1,&CCore::remoteCall); - m_parser->add("lonlatOffsets","antenna",1,&CCore::remoteCall); + m_parser->add("setSysOffsets","antenna",1,&CCore::remoteCall); + m_parser->add("setOffsets","antenna",1,&CCore::remoteCall); + //m_parser->add("lonlatOffsets","antenna",1,&CCore::remoteCall); m_parser->add("antennaReset","antenna",1,&CCore::remoteCall); m_parser->add("radialVelocity","antenna",1,&CCore::remoteCall); //m_parser->add("goOff","antenna",1,&CCore::remoteCall); diff --git a/Common/Servers/Scheduler/src/Core_Operations.i b/Common/Servers/Scheduler/src/Core_Operations.i index 4d99c8af9..3d7d854a6 100644 --- a/Common/Servers/Scheduler/src/Core_Operations.i +++ b/Common/Servers/Scheduler/src/Core_Operations.i @@ -538,7 +538,7 @@ void CCore::_fTrack(const char *dev) throw (ComponentErrors::CouldntGetComponent } //--------------------------------------------------------------------------------------------------- //4) info from antenna-------------------------------------------------------------------------------- - printf("RestFrequency : %lf\n",m_restFrequency[0]); + //printf("RestFrequency : %lf\n",m_restFrequency[0]); try { m_antennaBoss->getTopocentricFrequency(m_restFrequency,topocentricFreq.out()); } @@ -566,7 +566,7 @@ void CCore::_fTrack(const char *dev) throw (ComponentErrors::CouldntGetComponent _EXCPT(ComponentErrors::UnexpectedExImpl,impl,"CCore::_fTrack()"); throw impl; } - for (unsigned t=0;t<topocentricFreq->length();t++) printf("topocentric Freq :%lf\n",topocentricFreq[t]); + //for (unsigned t=0;t<topocentricFreq->length();t++) printf("topocentric Freq :%lf\n",topocentricFreq[t]); // just to make sure the topocentric sequence has the right dimension! if (topocentricFreq->length()!=m_restFrequency.length()) { topocentricFreq->length(m_restFrequency.length()); @@ -628,12 +628,12 @@ void CCore::_fTrack(const char *dev) throw (ComponentErrors::CouldntGetComponent if (topocentricFreq->length()==1) { inputLO[j]=IRA::CIRATools::roundNearest(topocentricFreq[0]-bckinputFreq[j]- (bckinputBW[j]/2.0),digits); - printf("inputLO[j] :%lf\n",inputLO[j]); + //printf("inputLO[j] :%lf\n",inputLO[j]); } else { inputLO[j]=IRA::CIRATools::roundNearest(topocentricFreq[currentSection]-bckinputFreq[j]- (bckinputBW[j]/2.0),digits); - printf("inputLO[j] :%lf\n",inputLO[j]); + //printf("inputLO[j] :%lf\n",inputLO[j]); } //lo[bckinputIF[j]]=inputLO[j]; // local oscillator per IFs } -- GitLab