From b032153d6cfd0a20948a06b56734d1d0f56b4fa7 Mon Sep 17 00:00:00 2001 From: Andrea Orlat Date: Fri, 29 Jul 2016 13:32:32 +0000 Subject: [PATCH] AntennaBoss offset handling modified --- .../AntennaInterface/idl/AntennaBoss.midl | 63 ++++++++--- .../config/CDB/schemas/AntennaBoss.xsd | 13 ++- .../AntennaBoss/include/AntennaBossImpl.h | 73 ++++++++++--- Common/Servers/AntennaBoss/include/BossCore.h | 68 +++++++++--- .../AntennaBoss/include/DevIOOffFrame.h | 54 ++++++++++ .../AntennaBoss/include/DevIOOffsets.h | 30 +++--- Common/Servers/AntennaBoss/include/Offset.h | 25 ++++- .../AntennaBoss/src/AntennaBossImpl.cpp | 60 +++++++++-- Common/Servers/AntennaBoss/src/BossCore.cpp | 82 ++++++++------ .../AntennaBoss/src/BossCore_prepareScan.i | 34 +++--- .../AntennaBoss/src/BossCore_startScan.i | 19 ++-- Common/Servers/AntennaBoss/src/Offset.cpp | 101 +++++++++++------- .../Servers/AntennaBoss/tests/Offset_test.i | 47 ++++---- Common/Servers/AntennaBoss/tests/unittest.cpp | 5 +- .../CDB/alma/ANTENNA/Boss/Boss.xml | 11 +- 15 files changed, 470 insertions(+), 215 deletions(-) create mode 100644 Common/Servers/AntennaBoss/include/DevIOOffFrame.h diff --git a/Common/Interfaces/AntennaInterface/idl/AntennaBoss.midl b/Common/Interfaces/AntennaInterface/idl/AntennaBoss.midl index 62c23cf1e..b2f0dad0c 100644 --- a/Common/Interfaces/AntennaInterface/idl/AntennaBoss.midl +++ b/Common/Interfaces/AntennaInterface/idl/AntennaBoss.midl @@ -208,31 +208,58 @@ module Antenna { * This attribute reports which is the definition of radial velocity of the target */ readonly attribute Antenna::ROTVradDefinition vradDefinition; + /** + * This attribute stores the frame of the current offset for the ongoing sub scan + */ + readonly attribute Antenna::ROTCoordinateFrame subScanOffsetFrame; + /** + * This attribute stores the offset (along then longitude) for the ongoing sub scan. It can be changed by an explicit call to + * setSubScanOffsets() or under the control of the schedule. Both methods override the previous commanded value. + */ + readonly attribute ACS::ROdouble subScanLonOffset; + /** + * This attribute stores the offset (along then latitude) for the ongoing sub scan. It can be changed by an explicit call to + * setSubScanOffsets() or under the control of the schedule. Both methods override the previous commanded value. + */ + readonly attribute ACS::ROdouble subScanLatOffset; + + /** + * This attribute stores the azimuth system offset.This value is controlled by the method setSystemOffset() + */ + readonly attribute ACS::ROdouble systemAzimuthOffset; + + /** + * This attribute stores the elevation system offset.This value is controlled by the method setSystemOffset() + */ + readonly attribute ACS::ROdouble systemElevationOffset; + /** * This attribute reports the present user sky offset(radians) commanded for the azimuth. Offset can be reset by calling setup or esplicitly by calling the * setHorizontalOffsets() method. The offset can be laso changed by the startScan() method. */ - readonly attribute ACS::ROdouble azimuthOffset; + //readonly attribute ACS::ROdouble azimuthOffset; /** * This attribute reports the present user offset(radians) commanded for the elevation. */ - readonly attribute ACS::ROdouble elevationOffset; + //readonly attribute ACS::ROdouble elevationOffset; /** * This attribute reports the present user sky offset(radians) commanded for the rightAscension. */ - readonly attribute ACS::ROdouble rightAscensionOffset; + //readonly attribute ACS::ROdouble rightAscensionOffset; /** * This attribute reports the present user offset(radians) commanded for the declination. */ - readonly attribute ACS::ROdouble declinationOffset; + //readonly attribute ACS::ROdouble declinationOffset; /** * This attribute reports the present user sky offset(radians) commanded for the galactic longitude. */ - readonly attribute ACS::ROdouble longitudeOffset; + //readonly attribute ACS::ROdouble longitudeOffset; /** * This attribute reports the present user offset(radians) commanded for the galactic latitude. */ - readonly attribute ACS::ROdouble latitudeOffset; + //readonly attribute ACS::ROdouble latitudeOffset; + + /** * This attribute reports the raw azimuth in radians. Raw coordinates are coordinates with all the correction required as * the pointing model or refraction. The coordinate reported here refers to the current time. @@ -554,22 +581,30 @@ module Antenna { /** * This method is used to add user offset to the current pointing of the antenna. The offset will be added in the given frame. - * A call to startScan could overwrite the offset given by this command. In case a new tracking is started (either changing the generator or not) the offsets are not reset. - * An offset given for a frame will also cause the offsets relatve to other frames to be cleared. - * Depending on the particular generator the offsets could be ignored. In taht case ar error is thrown. The longitude is sky offset so it will be corrected for the cosine of latitude. - * The values can be read back from the azimuthOffset , elevationOffset, rightAscensionOffset, declinationOffset, longitudeOffset and latitudeOffset - * attributes accordingly. + * A call to startScan could override the offset given by this command (under the control of the schedule). + * In case a new tracking is started (either changing the generator or not) the offsets are not reset. + * The longitude is sky offset so it will be corrected for the cosine of latitude. * @throw CORBA::SystemException * @throw AntennaErrors::AntennaErrorsEx * @throw ComponentErrors::ComponentErrorsEx * @arg \c ComponentErrors::UnexpectedEx * @arg \c ComponentErrors::CORBAProblemEx - * @param lonOff new offset to be added to the azimuth (radians) - * @param latOff new offset to be added to the elevation (radians) + * @param lonOff new offset to be added to the longitude (radians) + * @param latOff new offset to be added to the latitude (radians) * @param frame frame the offesets refer to */ - void setOffsets(in double lonOff,in double latOff,in TCoordinateFrame frame) raises (ComponentErrors::ComponentErrorsEx, + void setSubScanOffsets(in TCoordinateFrame frame,in double lonOff,in double latOff) raises (ComponentErrors::ComponentErrorsEx, AntennaErrors::AntennaErrorsEx); + + /** + * This method allows to set the "fine-tuning" pointing offsets. + * @throw CORBA::SystemException + * @throw AntennaErrors::AntennaErrorsEx + * @throw ComponentErrors::ComponentErrorsEx + * @param azimuth azimuth correction (radians) + * @param elevation elevation correction (radians) + */ + void setSystemOffsets(in double azimuth,in double elevation) raises (ComponentErrors::ComponentErrorsEx,AntennaErrors::AntennaErrorsEx); /** * This method can be used by clients in order to get a reference to the generator currently in use within the boss. diff --git a/Common/Servers/AntennaBoss/config/CDB/schemas/AntennaBoss.xsd b/Common/Servers/AntennaBoss/config/CDB/schemas/AntennaBoss.xsd index af5e1ec7f..e748e7f1d 100644 --- a/Common/Servers/AntennaBoss/config/CDB/schemas/AntennaBoss.xsd +++ b/Common/Servers/AntennaBoss/config/CDB/schemas/AntennaBoss.xsd @@ -30,13 +30,12 @@ - - - - - - - + + + + + + diff --git a/Common/Servers/AntennaBoss/include/AntennaBossImpl.h b/Common/Servers/AntennaBoss/include/AntennaBossImpl.h index c7f561bce..02bbbaf6e 100644 --- a/Common/Servers/AntennaBoss/include/AntennaBossImpl.h +++ b/Common/Servers/AntennaBoss/include/AntennaBossImpl.h @@ -273,49 +273,67 @@ public: * Returns a reference to the pointingElevationCorrection property implementation of IDL interface. * @return pointer to read-only double property pointingElevationCorrection */ - virtual ACS::ROdouble_ptr pointingElevationCorrection () throw (CORBA::SystemException); + virtual ACS::ROdouble_ptr pointingElevationCorrection() throw (CORBA::SystemException); /** * Returns a reference to the refractionCorrection property implementation of IDL interface. * @return pointer to read-only double property refractionCorrection */ virtual ACS::ROdouble_ptr refractionCorrection() throw (CORBA::SystemException); + + /** + * Returns a reference to the subScanOffsetFrame property implementation of IDL interface. + * @return pointer to read-only TCoordinateFrame property subScanOffsetFrame + */ + virtual Antenna::ROTCoordinateFrame_ptr subScanOffsetFrame() throw (CORBA::SystemException); /** - * Returns a reference to the azimuthOffset property implementation of IDL interface. - * @return pointer to read-only double property azimuthOffset + * Returns a reference to the systemAzimuthOffset property implementation of IDL interface. + * @return pointer to read-only double property systemAzimuthOffset */ - virtual ACS::ROdouble_ptr azimuthOffset() throw (CORBA::SystemException); + virtual ACS::ROdouble_ptr systemAzimuthOffset() throw (CORBA::SystemException); /** - * Returns a reference to the elevationOffset property implementation of IDL interface. - * @return pointer to read-only double property elevationOffset + * Returns a reference to the systemElevationOffset property implementation of IDL interface. + * @return pointer to read-only double property systemElevationOffset */ - virtual ACS::ROdouble_ptr elevationOffset() throw (CORBA::SystemException); - + virtual ACS::ROdouble_ptr systemElevationOffset() throw (CORBA::SystemException); + + /** + * Returns a reference to the subScanLonOffset property implementation of IDL interface. + * @return pointer to read-only double property subScanLonOffset + */ + virtual ACS::ROdouble_ptr subScanLonOffset() throw (CORBA::SystemException); + + /** + * Returns a reference to the subScanLatOffset property implementation of IDL interface. + * @return pointer to read-only double property subScanLatOffset + */ + virtual ACS::ROdouble_ptr subScanLatOffset() throw (CORBA::SystemException); + /** * Returns a reference to the rightAscensionOffset property implementation of IDL interface. * @return pointer to read-only double property rightAscensionOffset */ - virtual ACS::ROdouble_ptr rightAscensionOffset() throw (CORBA::SystemException); + //virtual ACS::ROdouble_ptr rightAscensionOffset() throw (CORBA::SystemException); /** * Returns a reference to the declinationOffset property implementation of IDL interface. * @return pointer to read-only double property declinationOffset */ - virtual ACS::ROdouble_ptr declinationOffset() throw (CORBA::SystemException); + //virtual ACS::ROdouble_ptr declinationOffset() throw (CORBA::SystemException); /** * Returns a reference to the longitudeOffset property implementation of IDL interface. * @return pointer to read-only double property longitudeOffset */ - virtual ACS::ROdouble_ptr longitudeOffset() throw (CORBA::SystemException); + //virtual ACS::ROdouble_ptr longitudeOffset() throw (CORBA::SystemException); /** * Returns a reference to the latitudeOffset property implementation of IDL interface. * @return pointer to read-only double property latitudeOffset */ - virtual ACS::ROdouble_ptr latitudeOffset() throw (CORBA::SystemException); + //virtual ACS::ROdouble_ptr latitudeOffset() throw (CORBA::SystemException); /** * Returns a reference to the FWHM property implementation of IDL interface. @@ -543,7 +561,7 @@ public: //virtual char * command(const char *cmd) throw (CORBA::SystemException,ManagementErrors::CommandLineErrorEx); /** - * This method allows the user to set the offsets for the given frame. The offset are considered only if a tracking has already + * This method allows the user to set the sub scan offsets for the given frame. The offset are considered only if a tracking has already * been started, otherwise they are stored for next scan. * The longitude offset will be corrected for the cosine of latitude. * @param lonOff new offsets for azimuth (radians) @@ -555,8 +573,22 @@ public: * @arg \c ComponentErrors::UnexpectedExImp * @arg \c ComponentErrors::CORBAProblemExImpl */ - virtual void setOffsets(CORBA::Double lonOff,CORBA::Double latOff,Antenna::TCoordinateFrame frame) throw (CORBA::SystemException,ComponentErrors::ComponentErrorsEx,AntennaErrors::AntennaErrorsEx); - + virtual void setSubScanOffsets(Antenna::TCoordinateFrame frame,CORBA::Double lonOff,CORBA::Double latOff) throw (CORBA::SystemException,ComponentErrors::ComponentErrorsEx,AntennaErrors::AntennaErrorsEx); + + /** + * This method allows to set system offsets for the horizontal frame. + * The azimuth offset will be corrected for the cosine of latitude. + * @param lonOff new offsets for azimuth (radians) + * @param latOff new offsets for elevation (radians) + * @param frame reference frame + * @throw CORBA::SystemException + * @throw AntennaErrors::AntennaErrorsEx + * @throw ComponentErrors::ComponentErrorsEx + * @arg \c ComponentErrors::UnexpectedExImp + * @arg \c ComponentErrors::CORBAProblemExImpl + */ + virtual void setSystemOffsets(CORBA::Double az, CORBA::Double el) throw (CORBA::SystemException,ComponentErrors::ComponentErrorsEx,AntennaErrors::AntennaErrorsEx); + /** * This function is used internally. It permits to access the generator currently used by the boss in order to produce new coordinates. * A client can read the computed (apparent) coordinates by getting the componet which has the returned CURL.. @@ -667,12 +699,19 @@ private: SmartPropertyPointer m_ptargetVrad; SmartPropertyPointer< ROEnumImpl > m_pvradReferenceFrame; SmartPropertyPointer< ROEnumImpl > m_pvradDefinition; - SmartPropertyPointer m_pazimuthOffset; + /*SmartPropertyPointer m_pazimuthOffset; SmartPropertyPointer m_pelevationOffset; SmartPropertyPointer m_prightAscensionOffset; SmartPropertyPointer m_pdeclinationOffset; SmartPropertyPointer m_plongitudeOffset; - SmartPropertyPointer m_platitudeOffset; + SmartPropertyPointer m_platitudeOffset;*/ + + SmartPropertyPointer< ROEnumImpl > m_psubScanOffsetFrame; + SmartPropertyPointer m_psubScanLonOffset; + SmartPropertyPointer m_psubScanLatOffset; + SmartPropertyPointer m_psystemAzimuthOffset; + SmartPropertyPointer m_psystemElevationOffset; + IRA::CSecureArea *m_core; CWorkingThread *m_workingThread; CWatchingThread *m_watchingThread; diff --git a/Common/Servers/AntennaBoss/include/BossCore.h b/Common/Servers/AntennaBoss/include/BossCore.h index a56f670b5..bfb14da55 100644 --- a/Common/Servers/AntennaBoss/include/BossCore.h +++ b/Common/Servers/AntennaBoss/include/BossCore.h @@ -34,6 +34,7 @@ #include "Callback.h" #include "SlewCheck.h" #include +#include "Offset.h" using namespace IRA; using namespace maci; @@ -474,41 +475,71 @@ public: */ inline double getRefractionOffset() const { return m_refractionOffset; } + /** + * This function returns the value of the current lon offset for next sub scan + * @return the requested offset in radians + */ + inline double getSubScanLonOff() const { return (m_offsets.isScanSet())?m_offsets.getScanOffset().lon:0.0; } + + /** + * This function returns the value of the current lat offset for next sub scan + * @return the requested offset in radians + */ + inline double getSubScanLatOff() const { return (m_offsets.isScanSet())?m_offsets.getScanOffset().lat:0.0; } + + /** + * This function returns the value of the current sub scan offset frame + * @return the requested offset in radians + */ + inline Antenna::TCoordinateFrame getSubScanOffFrame() const { return (m_offsets.isScanSet())?m_offsets.getScanOffset().frame:Antenna::ANT_HORIZONTAL; } + + /** + * This function returns the value of the current system azimuth offset. + * @return the requested offset in radians + */ + inline double getSystemAzOff() const { return (m_offsets.isSystemSet())?m_offsets.getSystemAzimuth():0.0; } + + /** + * This function returns the value of the current system elevation offset. + * @return the requested offset in radians + */ + inline double getSystemElOff() const { return (m_offsets.isScanSet())?m_offsets.getSystemElevation():0.0; } + /** * This function returns the value of the current azimuth offset, * @return the azimuth offset in radians */ - inline double getAzimuthOffset() const { return (m_offsetFrame==Antenna::ANT_HORIZONTAL)?m_longitudeOffset:0.0; } + //inline double getAzimuthOffset() const { return (m_offsetFrame==Antenna::ANT_HORIZONTAL)?m_longitudeOffset:0.0; } /** * This function returns the value of the current elevation offset, * @return the elevation offset in radians */ - inline double getElevationOffset() const { return (m_offsetFrame==Antenna::ANT_HORIZONTAL)?m_latitudeOffset:0.0; } + //inline double getElevationOffset() const { return (m_offsetFrame==Antenna::ANT_HORIZONTAL)?m_latitudeOffset:0.0; } /** * This function returns the value of the current rightAscension offset, * @return the rightAscension offset in radians */ - inline double getRightAscensionOffset() const { return (m_offsetFrame==Antenna::ANT_EQUATORIAL)?m_longitudeOffset:0.0; } + //inline double getRightAscensionOffset() const { return (m_offsetFrame==Antenna::ANT_EQUATORIAL)?m_longitudeOffset:0.0; } /** * This function returns the value of the current declination offset, * @return the declination offset in radians */ - inline double getDeclinationOffset() const { return (m_offsetFrame==Antenna::ANT_EQUATORIAL)?m_latitudeOffset:0.0; } + //inline double getDeclinationOffset() const { return (m_offsetFrame==Antenna::ANT_EQUATORIAL)?m_latitudeOffset:0.0; } /** * This function returns the value of the current longitude offset, * @return the longitude offset in radians */ - inline double getLongitudeOffset() const { return (m_offsetFrame==Antenna::ANT_GALACTIC)?m_longitudeOffset:0.0; } + //inline double getLongitudeOffset() const { return (m_offsetFrame==Antenna::ANT_GALACTIC)?m_longitudeOffset:0.0; } /** * This function returns the value of the current latitude offset, * @return the latitude offset in radians */ - inline double getLatitudeOffset() const { return (m_offsetFrame==Antenna::ANT_GALACTIC)?m_latitudeOffset:0.0; } + //inline double getLatitudeOffset() const { return (m_offsetFrame==Antenna::ANT_GALACTIC)?m_latitudeOffset:0.0; } /** * This functions returns the name of the current target, if it exists. @@ -580,7 +611,7 @@ public: private: - class TOffset { + /*class TOffset { public: TOffset() : lon(0.0), lat(0.0), frame(Antenna::ANT_HORIZONTAL) { }; TOffset(const double& ln,const double& lt,const Antenna::TCoordinateFrame& fr): lon(ln), lat(lt), frame(fr) { }; @@ -589,7 +620,7 @@ private: double lon; double lat; Antenna::TCoordinateFrame frame; - } ; + };*/ /** * Stores the sequence of observed horizontal,equatorial and galactic coorddintes, sorted by the time of observation @@ -660,13 +691,17 @@ private: double m_refractionOffset; /** The resulting offset*/ - double m_longitudeOffset; - double m_latitudeOffset; - Antenna::TCoordinateFrame m_offsetFrame; + //double m_longitudeOffset; + //double m_latitudeOffset; + //Antenna::TCoordinateFrame m_offsetFrame; /** The offset coming from the current scan */ - TOffset m_scanOffset; + //TOffset m_scanOffset; /** The offset coming from the user input */ - TOffset m_userOffset; + //TOffset m_userOffset; + + /** + * This object stores and manage all the offset supported by the component */ + COffset m_offsets; /** * This field reports the type of the current generator @@ -1023,6 +1058,7 @@ private: * @param lon output parameter galactic longitude,radians * @param lat output parameter galactic latitude, radians * @param vrad output radial velocity of the target, in Km/s + * @param offset handling object * @param velFrame reference frame of the radial velocity * @param velDef definition of the radial velocity * @param timeToStop expected time the scan is expected to be completed, zero means no need to wait @@ -1033,8 +1069,8 @@ private: * @return the reference of the current generator, the caller must free it */ Antenna::EphemGenerator_ptr prepareScan(bool useInternals,ACS::Time& startUT,const Antenna::TTrackingParameters& _prim,const Antenna::TTrackingParameters& _sec, - const TOffset& userOffset,Antenna::TGeneratorType& generatorType,Antenna::TTrackingParameters& lastPar,Antenna::TSections& section,double& ra,double& dec,double& lon, - double& lat,double& vrad,Antenna::TReferenceFrame& velFrame,Antenna::TVradDefinition& velDef,ACS::Time& timeToStop,IRA::CString& sourceName,TOffset& scanOffset, + /*const TOffset& userOffset,*/Antenna::TGeneratorType& generatorType,Antenna::TTrackingParameters& lastPar,Antenna::TSections& section,double& ra,double& dec,double& lon, + double& lat,double& vrad,COffset& offset,Antenna::TReferenceFrame& velFrame,Antenna::TVradDefinition& velDef,ACS::Time& timeToStop,IRA::CString& sourceName,/*TOffset& scanOffset,*/ Management::TScanAxis& axis,Antenna::EphemGenerator_out generatorFlux) throw (ComponentErrors::CouldntCallOperationExImpl,ComponentErrors::UnexpectedExImpl, ComponentErrors::CORBAProblemExImpl,AntennaErrors::ScanErrorExImpl,AntennaErrors::SecondaryScanErrorExImpl,AntennaErrors::MissingTargetExImpl,AntennaErrors::LoadGeneratorErrorExImpl); @@ -1062,7 +1098,7 @@ private: */ void computeFlux(); - void addOffsets(double &lon,double& lat,Antenna::TCoordinateFrame& frame,const TOffset& userOffset,const TOffset& scanOffset) const; + /*void addOffsets(double &lon,double& lat,Antenna::TCoordinateFrame& frame,const TOffset& userOffset,const TOffset& scanOffset) const;*/ void copyTrack(Antenna::TTrackingParameters& dest,const Antenna::TTrackingParameters& source,bool copyOffs=true) const; diff --git a/Common/Servers/AntennaBoss/include/DevIOOffFrame.h b/Common/Servers/AntennaBoss/include/DevIOOffFrame.h new file mode 100644 index 000000000..e3b7bb750 --- /dev/null +++ b/Common/Servers/AntennaBoss/include/DevIOOffFrame.h @@ -0,0 +1,54 @@ +#ifndef DEVIOOFFFRAME_H_ +#define DEVIOOFFFRAME_H_ + + +/* ************************************************************************************************************* */ +/* IRA Istituto di Radioastronomia */ +/* */ +/* This code is under GNU General Public Licence (GPL). */ +/* */ +/* Who When What */ +/* Andrea Orlati(aorlati@ira.inaf.it) 14/04/2014 Creation */ + +#include + +/** + * This class is derived from the template DevIO. It is used by the VradReferenceFrame property. + * @author Andrea Orlati, + * Istituto di Radioastronomia, Italia
+ */ +class DevIOOffFrame: public virtual DevIO +{ + +public: + + DevIOOffFrame(IRA::CSecureArea* core): m_core(core) { + AUTO_TRACE("DevIOOffFrame::DevIOOffFrame()"); + } + + ~DevIOOffFrame() { + AUTO_TRACE("DevIOOffFrame::~DevIOOffFrame()"); + } + + bool initializeValue(){ + return false; + } + + Antenna::TCoordinateFrame read(ACS::Time& timestamp) throw (ACSErr::ACSbaseExImpl) { + CSecAreaResourceWrapper resource=m_core->Get(); + AUTO_TRACE("DevIOOffFrame::read()"); + timestamp=getTimeStamp(); + return resource->getSubScanOffFrame(); + } + + void write(const CORBA::Long& value, ACS::Time& timestamp) throw (ACSErr::ACSbaseExImpl) { + AUTO_TRACE("DevIOOffFrame::write()"); + } + +private: + IRA::CSecureArea *m_core; + +}; + + +#endif /*DEVIOOFFFRAME_H_*/ diff --git a/Common/Servers/AntennaBoss/include/DevIOOffsets.h b/Common/Servers/AntennaBoss/include/DevIOOffsets.h index 42b038cb2..2ec9402df 100644 --- a/Common/Servers/AntennaBoss/include/DevIOOffsets.h +++ b/Common/Servers/AntennaBoss/include/DevIOOffsets.h @@ -26,12 +26,10 @@ class DevIOOffsets: public virtual DevIO public: enum TOffsets { - AZIMUTHOFF, - ELEVATIONOFF, - RIGHTASCENSIONOFF, - DECLINATIONOFF, - LONGITUDEOFF, - LATITUDEOFF + SSLONOFF, + SSLATOFF, + SAZOFF, + SELOFF }; DevIOOffsets(IRA::CSecureArea* core,const TOffsets& e): m_core(core), m_corr(e) { @@ -50,24 +48,24 @@ public: CSecAreaResourceWrapper resource=m_core->Get(); AUTO_TRACE("DevIOOffsets::read()"); double val=0.0; - if (m_corr==AZIMUTHOFF) { - val=resource->getAzimuthOffset(); + if (m_corr==SSLONOFF) { + val=resource->getSubScanLonOff(); } - else if (m_corr==ELEVATIONOFF) { - val=resource->getElevationOffset(); + else if (m_corr==SSLATOFF) { + val=resource->getSubScanLatOff(); } - else if (m_corr==RIGHTASCENSIONOFF) { - val=resource->getRightAscensionOffset(); + else if (m_corr==SAZOFF) { + val=resource->getSystemAzOff(); } - else if (m_corr==DECLINATIONOFF) { - val=resource->getDeclinationOffset(); + else if (m_corr==SELOFF) { + val=resource->getSystemElOff(); } - else if (m_corr==LONGITUDEOFF) { + /*else if (m_corr==LONGITUDEOFF) { val=resource->getLongitudeOffset(); } else if (m_corr==LATITUDEOFF) { val=resource->getLatitudeOffset(); - } + }*/ timestamp=getTimeStamp(); return (CORBA::Double)val; } diff --git a/Common/Servers/AntennaBoss/include/Offset.h b/Common/Servers/AntennaBoss/include/Offset.h index c3bc43a56..7e51eb2f7 100644 --- a/Common/Servers/AntennaBoss/include/Offset.h +++ b/Common/Servers/AntennaBoss/include/Offset.h @@ -34,12 +34,12 @@ public: ~COffset(); void reset(); - void setUserOffset(const double& lon,const double& lat,const Antenna::TCoordinateFrame& frame); + /*void setUserOffset(const double& lon,const double& lat,const Antenna::TCoordinateFrame& frame); void setUserOffset(const TOffset& off); void resetUser(); bool isUserSet() const { return userOffset.isSet; } const TOffset& getUserOffset() const; - TOffset& getUserOffset(); + TOffset& getUserOffset();*/ void setScanOffset(const double& lon,const double& lat,const Antenna::TCoordinateFrame& frame); void setScanOffset(const TOffset& off); @@ -53,6 +53,12 @@ public: bool isSystemSet() const { return systemOffset.isSet; } double getSystemAzimuth() const; double getSystemElevation() const; + + void setFeedOffset(const double& lon,const double& lat); + void resetFeed(); + bool isFeedSet() const { return feedOffset.isSet; } + double getFeedAzimuth() const; + double getFeedElevation() const; /** * This function returns the offsets setup for the ephemeris generator components. The offset returned are the @@ -61,10 +67,21 @@ public: * @return the offset structure containing the resulting offset * @param true if the scan user offset has been masked by the scan offset */ - TOffset ephemGeneratorOffsets(bool &override) const; + //TOffset ephemGeneratorOffsets(bool &override) const; + + /** + * This list of methods is required to manage the correction to be applied and to be compensated when commanding and reading the coordinate to/from the telescope. + * Essentially the latter set of methods differs from the former for the feed offset. This offset has to be applied when forming the commanded coordinate, but + * not compensated when the reading out the observed coordinate (the reference coordinated are always referred to the central beam, per convenction). + */ + double getAzimuthCorrection() const; + double getElevationCorrection() const; + double getAzimuthCompensation() const; + double getElevationCompensation() const; + + COffset& operator= (const COffset & obj); private: - TOffset userOffset; TOffset scanOffset; TOffset systemOffset; TOffset feedOffset; diff --git a/Common/Servers/AntennaBoss/src/AntennaBossImpl.cpp b/Common/Servers/AntennaBoss/src/AntennaBossImpl.cpp index 6250cbdf5..20b70c47d 100644 --- a/Common/Servers/AntennaBoss/src/AntennaBossImpl.cpp +++ b/Common/Servers/AntennaBoss/src/AntennaBossImpl.cpp @@ -18,6 +18,7 @@ #include "DevIOLambda.h" #include "DevIOVradDefinition.h" #include "DevIOVradReferenceFrame.h" +#include "DevIOOffFrame.h" /*static char *rcsId="@(#) $Id: AntennaBossImpl.cpp,v 1.29 2011-06-05 14:44:40 a.orlati Exp $"; static void *use_rcsId = ((void)&use_rcsId,(void *) &rcsId);*/ @@ -50,12 +51,18 @@ AntennaBossImpl::AntennaBossImpl(const ACE_CString &CompName,maci::ContainerServ m_ptargetVrad(this), m_pvradReferenceFrame(this), m_pvradDefinition(this), - m_pazimuthOffset(this), + m_psubScanOffsetFrame(this), + m_psubScanLonOffset(this), + m_psubScanLatOffset(this), + m_psystemAzimuthOffset(this), + m_psystemElevationOffset(this), + + /*m_pazimuthOffset(this), m_pelevationOffset(this), m_prightAscensionOffset(this), m_pdeclinationOffset(this), m_plongitudeOffset(this), - m_platitudeOffset(this), + m_platitudeOffset(this),*/ m_core(NULL) { AUTO_TRACE("AntennaBossImpl::AntennaBossImpl()"); @@ -129,7 +136,19 @@ void AntennaBossImpl::initialize() throw (ACSErr::ACSbaseExImpl) getContainerServices()->getName()+":vradDefinition",getComponent(),new DevIOVradDefinition(m_core),true) ; m_ptargetFlux=new ROdouble(getContainerServices()->getName()+":targetFlux",getComponent(), new DevIOTargetCoordinate(m_core,DevIOTargetCoordinate::FLUX),true); - m_pazimuthOffset=new ROdouble(getContainerServices()->getName()+":azimuthOffset",getComponent(), + + m_psubScanOffsetFrame=new ROEnumImpl( + getContainerServices()->getName()+":subScanOffsetFrame",getComponent(),new DevIOOffFrame(m_core),true); + m_psubScanLonOffset=new ROdouble(getContainerServices()->getName()+":subScanLonOffset",getComponent(), + new DevIOOffsets(m_core,DevIOOffsets::SSLONOFF),true); + m_psubScanLatOffset=new ROdouble(getContainerServices()->getName()+":subScanLatOffset",getComponent(), + new DevIOOffsets(m_core,DevIOOffsets::SSLATOFF),true); + m_psystemAzimuthOffset=new ROdouble(getContainerServices()->getName()+":systemAzimuthOffset",getComponent(), + new DevIOOffsets(m_core,DevIOOffsets::SAZOFF),true); + m_psystemElevationOffset=new ROdouble(getContainerServices()->getName()+":systemElevationOffset",getComponent(), + new DevIOOffsets(m_core,DevIOOffsets::SELOFF),true); + + /*m_pazimuthOffset=new ROdouble(getContainerServices()->getName()+":azimuthOffset",getComponent(), new DevIOOffsets(m_core,DevIOOffsets::AZIMUTHOFF),true); m_pelevationOffset=new ROdouble(getContainerServices()->getName()+":elevationOffset",getComponent(), new DevIOOffsets(m_core,DevIOOffsets::ELEVATIONOFF),true); @@ -140,7 +159,7 @@ void AntennaBossImpl::initialize() throw (ACSErr::ACSbaseExImpl) m_plongitudeOffset=new ROdouble(getContainerServices()->getName()+":longitudeOffset",getComponent(), new DevIOOffsets(m_core,DevIOOffsets::LONGITUDEOFF),true); m_platitudeOffset=new ROdouble(getContainerServices()->getName()+":latitudeOffset",getComponent(), - new DevIOOffsets(m_core,DevIOOffsets::LATITUDEOFF),true); + new DevIOOffsets(m_core,DevIOOffsets::LATITUDEOFF),true);*/ // create the parser for command line execution m_parser = new SimpleParser::CParser(boss,10); @@ -304,10 +323,10 @@ CORBA::Boolean AntennaBossImpl::command(const char *cmd,CORBA::String_out answer return res; } -void AntennaBossImpl::setOffsets(CORBA::Double lonOff,CORBA::Double latOff,Antenna::TCoordinateFrame frame) throw ( +void AntennaBossImpl::setSubScanOffsets(Antenna::TCoordinateFrame frame,CORBA::Double lonOff,CORBA::Double latOff) throw ( CORBA::SystemException,ComponentErrors::ComponentErrorsEx,AntennaErrors::AntennaErrorsEx) { - AUTO_TRACE("AntennaBossImpl::setOffsets()"); + AUTO_TRACE("AntennaBossImpl::setSubScanOffsets()"); CSecAreaResourceWrapper resource=m_core->Get(); try { resource->setOffsets(lonOff,latOff,frame); @@ -322,6 +341,23 @@ void AntennaBossImpl::setOffsets(CORBA::Double lonOff,CORBA::Double latOff,Anten } } +void AntennaBossImpl::setSystemOffsets(CORBA::Double az,CORBA::Double el) throw (CORBA::SystemException,ComponentErrors::ComponentErrorsEx,AntennaErrors::AntennaErrorsEx) +{ + AUTO_TRACE("AntennaBossImpl::setSystemOffset()"); + CSecAreaResourceWrapper resource=m_core->Get(); + try { + //resource->setOffsets(lonOff,latOff,frame); + } + catch (AntennaErrors::AntennaErrorsExImpl& ex) { + ex.log(LM_DEBUG); + throw ex.getAntennaErrorsEx(); + } + catch (ComponentErrors::ComponentErrorsExImpl& ex) { + ex.log(LM_DEBUG); + throw ex.getComponentErrorsEx(); + } +} + void AntennaBossImpl::stop() throw (CORBA::SystemException, ComponentErrors::ComponentErrorsEx) { AUTO_TRACE("AntennaBossImpl::stop()"); @@ -650,12 +686,20 @@ _PROPERTY_REFERENCE_CPP(AntennaBossImpl,ACS::ROdouble,m_ptargetVrad,targetVrad); _PROPERTY_REFERENCE_CPP(AntennaBossImpl,Antenna::ROTReferenceFrame,m_pvradReferenceFrame,vradReferenceFrame); _PROPERTY_REFERENCE_CPP(AntennaBossImpl,Antenna::ROTVradDefinition,m_pvradDefinition,vradDefinition); _PROPERTY_REFERENCE_CPP(AntennaBossImpl,ACS::ROdouble,m_ptargetFlux,targetFlux); -_PROPERTY_REFERENCE_CPP(AntennaBossImpl,ACS::ROdouble,m_pazimuthOffset,azimuthOffset); + +_PROPERTY_REFERENCE_CPP(AntennaBossImpl,Antenna::ROTCoordinateFrame,m_psubScanOffsetFrame,subScanOffsetFrame); +_PROPERTY_REFERENCE_CPP(AntennaBossImpl,ACS::ROdouble,m_psubScanLonOffset,subScanLonOffset); +_PROPERTY_REFERENCE_CPP(AntennaBossImpl,ACS::ROdouble,m_psubScanLatOffset,subScanLatOffset); +_PROPERTY_REFERENCE_CPP(AntennaBossImpl,ACS::ROdouble,m_psystemAzimuthOffset,systemAzimuthOffset); +_PROPERTY_REFERENCE_CPP(AntennaBossImpl,ACS::ROdouble,m_psystemElevationOffset,systemElevationOffset); + + +/*_PROPERTY_REFERENCE_CPP(AntennaBossImpl,ACS::ROdouble,m_pazimuthOffset,azimuthOffset); _PROPERTY_REFERENCE_CPP(AntennaBossImpl,ACS::ROdouble,m_pelevationOffset,elevationOffset); _PROPERTY_REFERENCE_CPP(AntennaBossImpl,ACS::ROdouble,m_prightAscensionOffset,rightAscensionOffset); _PROPERTY_REFERENCE_CPP(AntennaBossImpl,ACS::ROdouble,m_pdeclinationOffset,declinationOffset); _PROPERTY_REFERENCE_CPP(AntennaBossImpl,ACS::ROdouble,m_plongitudeOffset,longitudeOffset); -_PROPERTY_REFERENCE_CPP(AntennaBossImpl,ACS::ROdouble,m_platitudeOffset,latitudeOffset); +_PROPERTY_REFERENCE_CPP(AntennaBossImpl,ACS::ROdouble,m_platitudeOffset,latitudeOffset);*/ /* --------------- [ MACI DLL support functions ] -----------------*/ #include diff --git a/Common/Servers/AntennaBoss/src/BossCore.cpp b/Common/Servers/AntennaBoss/src/BossCore.cpp index bb5bddd9a..9134c0cbb 100644 --- a/Common/Servers/AntennaBoss/src/BossCore.cpp +++ b/Common/Servers/AntennaBoss/src/BossCore.cpp @@ -81,10 +81,11 @@ void CBossCore::initialize() throw (ComponentErrors::UnexpectedExImpl) m_vradDefinition=Antenna::ANT_UNDEF_DEF; m_vradReferenceFrame=Antenna::ANT_UNDEF_FRAME; m_pointingAzOffset=m_pointingElOffset=m_refractionOffset=0.0; - m_longitudeOffset=m_latitudeOffset=0.0; - m_offsetFrame=Antenna::ANT_HORIZONTAL; - m_userOffset.lon=m_userOffset.lat=0.0; m_userOffset.frame=Antenna::ANT_HORIZONTAL; - m_scanOffset.lon=m_scanOffset.lat=0.0; m_scanOffset.frame=Antenna::ANT_HORIZONTAL; + //m_longitudeOffset=m_latitudeOffset=0.0; + //m_offsetFrame=Antenna::ANT_HORIZONTAL; + //m_userOffset.lon=m_userOffset.lat=0.0; m_userOffset.frame=Antenna::ANT_HORIZONTAL; + //m_scanOffset.lon=m_scanOffset.lat=0.0; m_scanOffset.frame=Antenna::ANT_HORIZONTAL; + m_offsets.reset(); m_lastScanParameters.type=Antenna::ANT_NONE; m_lastScanParameters.applyOffsets=false; m_lastScanParameters.secondary=false; @@ -339,9 +340,10 @@ void CBossCore::stow() throw (ManagementErrors::ParkingErrorExImpl) m_vradDefinition=Antenna::ANT_UNDEF_DEF; m_vradReferenceFrame=Antenna::ANT_UNDEF_FRAME; // clear all user and scan offsets - m_userOffset=TOffset(0.0,0.0,Antenna::ANT_HORIZONTAL); + /*m_userOffset=TOffset(0.0,0.0,Antenna::ANT_HORIZONTAL); m_scanOffset=TOffset(0.0,0.0,Antenna::ANT_HORIZONTAL); - addOffsets(m_longitudeOffset,m_latitudeOffset,m_offsetFrame,m_userOffset,m_scanOffset); + addOffsets(m_longitudeOffset,m_latitudeOffset,m_offsetFrame,m_userOffset,m_scanOffset);*/ + m_offsets.reset(); m_lastScanParameters.type=Antenna::ANT_NONE; m_lastScanParameters.applyOffsets=false; m_lastScanParameters.secondary=false; @@ -477,14 +479,15 @@ void CBossCore::setup(const char *config) throw (ManagementErrors::Configuration manImpl.setReason("Could not unstow the antenna"); throw manImpl; } - m_userOffset.lon=m_userOffset.lat=0.0; m_userOffset.frame=Antenna::ANT_HORIZONTAL; - m_scanOffset.lon=m_scanOffset.lat=0.0; m_scanOffset.frame=Antenna::ANT_HORIZONTAL; + //m_userOffset.lon=m_userOffset.lat=0.0; m_userOffset.frame=Antenna::ANT_HORIZONTAL; + //m_scanOffset.lon=m_scanOffset.lat=0.0; m_scanOffset.frame=Antenna::ANT_HORIZONTAL; + m_offsets.reset(); m_lastScanParameters.type=Antenna::ANT_NONE; m_lastScanParameters.applyOffsets=false; m_lastScanParameters.secondary=false; m_lastScanParameters.paramNumber=0; - m_longitudeOffset=m_latitudeOffset=0.0; //reset offsets - m_offsetFrame=Antenna::ANT_HORIZONTAL; + //m_longitudeOffset=m_latitudeOffset=0.0; //reset offsets + //m_offsetFrame=Antenna::ANT_HORIZONTAL; m_FWHM=0.0; m_waveLength=0.0; m_currentObservingFrequency=0.0; @@ -510,7 +513,7 @@ void CBossCore::enableCorrection() { if (!m_correctionEnable) { m_correctionEnable=true; - ACS_LOG(LM_FULL_INFO,"CBossCore::enableCorrection()",(LM_NOTICE,"AntennaBoss::CORRECTIONS_ENABLED")); + CUSTOM_LOG(LM_FULL_INFO,"CBossCore::enableCorrection()",(LM_NOTICE,"Pointing corrections enabled")); } } @@ -518,7 +521,7 @@ void CBossCore::disableCorrection() { if (m_correctionEnable) { m_correctionEnable=false; - ACS_LOG(LM_FULL_INFO,"CBossCore::disableCorrection()",(LM_NOTICE,"AntennaBoss::CORRECTIONS_DISABLED")); + CUSTOM_LOG(LM_FULL_INFO,"CBossCore::disableCorrection()",(LM_NOTICE,"Pointing corrections disabled")); } } @@ -610,21 +613,19 @@ void CBossCore::getTopocentricFrequency(const ACS::doubleSeq& rest,ACS::doubleSe void CBossCore::setOffsets(const double& lonOff,const double& latOff,const Antenna::TCoordinateFrame& frame) throw(ComponentErrors::UnexpectedExImpl,ComponentErrors::CORBAProblemExImpl,ComponentErrors::OperationErrorExImpl) { + m_offsets.setScanOffset(lonOff,latOff,frame); + if (frame==Antenna::ANT_HORIZONTAL) { + CUSTOM_LOG(LM_FULL_INFO,"CBossCore::setOffsets()",(LM_NOTICE,"New horizontal user offsets %lf rad, %lf rad",lonOff,latOff)); + } + else if (frame==Antenna::ANT_EQUATORIAL) { + CUSTOM_LOG(LM_FULL_INFO,"CBossCore::setOffsets()",(LM_NOTICE,"New equatorial user offsets %lf rad, %lf rad",lonOff,latOff)); + } + else if (frame==Antenna::ANT_GALACTIC) { + CUSTOM_LOG(LM_FULL_INFO,"CBossCore::setOffsets()",(LM_NOTICE,"New galactic user offsets %lfrad, %lf rad",lonOff,latOff)); + } if ((!CORBA::is_nil(m_generator)) && (m_generatorType!=Antenna::ANT_NONE)) { try { m_generator->setOffsets(lonOff,latOff,frame); - if (frame==Antenna::ANT_HORIZONTAL) { - ACS_LOG(LM_FULL_INFO,"CBossCore::setOffsets()", - (LM_NOTICE,"NEW_HORIZONTAL_OFFSETS %lf %lf",lonOff,latOff)); - } - else if (frame==Antenna::ANT_EQUATORIAL) { - ACS_LOG(LM_FULL_INFO,"CBossCore::setOffsets()", - (LM_NOTICE,"NEW_EQUATORIAL_OFFSETS %lf %lf",lonOff,latOff)); - } - else if (frame==Antenna::ANT_GALACTIC) { - ACS_LOG(LM_FULL_INFO,"CBossCore::setOffsets()", - (LM_NOTICE,"NEW_GALACTIC_OFFSETS %lf %lf",lonOff,latOff)); - } } catch (CORBA::SystemException& ex) { _EXCPT(ComponentErrors::CORBAProblemExImpl,impl,"CBossCore::setOffsets()"); @@ -645,14 +646,17 @@ void CBossCore::setOffsets(const double& lonOff,const double& latOff,const Anten throw ex; } } - m_userOffset=TOffset(lonOff,latOff,frame); + /*m_userOffset=TOffset(lonOff,latOff,frame); m_scanOffset=TOffset(0.0,0.0,frame); - addOffsets(m_longitudeOffset,m_latitudeOffset,m_offsetFrame,m_userOffset,m_scanOffset); + addOffsets(m_longitudeOffset,m_latitudeOffset,m_offsetFrame,m_userOffset,m_scanOffset);*/ } void CBossCore::getAllOffsets(double& azOff,double& elOff,double& raOff,double& decOff,double& lonOff,double& latOff) const { - if (m_offsetFrame==Antenna::ANT_HORIZONTAL) { + /*****************************************************************************************************************************************/ + /** TO BE FIXED */ + /*****************************************************************************************************************************************/ + /*if (m_offsetFrame==Antenna::ANT_HORIZONTAL) { azOff=m_longitudeOffset; elOff=m_latitudeOffset; raOff=0.0; @@ -675,7 +679,7 @@ void CBossCore::getAllOffsets(double& azOff,double& elOff,double& raOff,double& decOff=0.0; lonOff=m_longitudeOffset; latOff=m_latitudeOffset; - } + }*/ } void CBossCore::stop() throw (ComponentErrors::UnexpectedExImpl,ComponentErrors::CouldntCallOperationExImpl, @@ -692,9 +696,10 @@ void CBossCore::stop() throw (ComponentErrors::UnexpectedExImpl,ComponentErrors: m_vradDefinition=Antenna::ANT_UNDEF_DEF; m_vradReferenceFrame=Antenna::ANT_UNDEF_FRAME; // clear all user and scan offsets - m_userOffset=TOffset(0.0,0.0,Antenna::ANT_HORIZONTAL); + /*m_userOffset=TOffset(0.0,0.0,Antenna::ANT_HORIZONTAL); m_scanOffset=TOffset(0.0,0.0,Antenna::ANT_HORIZONTAL); - addOffsets(m_longitudeOffset,m_latitudeOffset,m_offsetFrame,m_userOffset,m_scanOffset); + addOffsets(m_longitudeOffset,m_latitudeOffset,m_offsetFrame,m_userOffset,m_scanOffset);*/ + m_offsets.reset(); m_lastScanParameters.type=Antenna::ANT_NONE; m_lastScanParameters.applyOffsets=false; m_lastScanParameters.secondary=false; @@ -756,13 +761,15 @@ bool CBossCore::checkScan(const ACS::Time& startUt,const Antenna::TTrackingParam Antenna::TReferenceFrame velFrame; Antenna::TVradDefinition velDef; //Management::TScanAxis axis; - TOffset scanOff; + //TOffset scanOff; + COffset tempOffset; + tempOffset=m_offsets; Antenna::TTrackingParameters lastScan; IRA::CString name; copyTrack(lastScan,m_lastScanParameters); // startUt is changed by preparescan just in case of an OTF scan - generator=prepareScan(true,startTime,par,secondary,m_userOffset,generatorType,lastScan,section,ra,dec,lon,lat,vrad,velFrame, - velDef,antennaInfo->timeToStop,name,scanOff,antennaInfo->axis,generatorFlux.out()); + generator=prepareScan(true,startTime,par,secondary/*,m_userOffset*/,generatorType,lastScan,section,ra,dec,lon,lat,vrad,tempOffset,velFrame, + velDef,antennaInfo->timeToStop,name/*,scanOff*/,antennaInfo->axis,generatorFlux.out()); antennaInfo->targetName=CORBA::string_dup((const char *)name); if (generatorType==Antenna::ANT_OTF) { double pangle; @@ -1030,6 +1037,8 @@ void CBossCore::updateAttributes() throw (ComponentErrors::CORBAProblemExImpl,Co throw impl; } el-=m_refractionOffset; + el-=m_offsets.getElevationCompensation(); + az-=m_offsets.getAzimuthCompensation(); try { m_pointingModel->getAzElOffsets(az,el,m_pointingAzOffset,m_pointingElOffset); } @@ -1228,6 +1237,9 @@ void CBossCore::loadTrackingPoint(const TIMEVALUE& time,bool restart) throw (Com } az+=azOff; el+=elOff; + // now apply other corrections + az+=m_offsets.getAzimuthCorrection(); // that should include system offsets (pointing) and feed offsets (if necessary) + el+=m_offsets.getElevationCorrection(); refOff=0.0; try { if (el>0.0) { @@ -1670,7 +1682,7 @@ void CBossCore::freeGenerator(Antenna::EphemGenerator_ptr& generator) throw (Com } } -void CBossCore::addOffsets(double &lon,double& lat,Antenna::TCoordinateFrame& frame,const TOffset& userOffset,const TOffset& scanOffset) const +/*void CBossCore::addOffsets(double &lon,double& lat,Antenna::TCoordinateFrame& frame,const TOffset& userOffset,const TOffset& scanOffset) const { if (userOffset.frame==scanOffset.frame) { // if the frames differ the scanOffset prevails lon=userOffset.lon+scanOffset.lon; @@ -1681,7 +1693,7 @@ void CBossCore::addOffsets(double &lon,double& lat,Antenna::TCoordinateFrame& fr lat=scanOffset.lat; } frame=scanOffset.frame; -} +}*/ void CBossCore::computeFlux() { diff --git a/Common/Servers/AntennaBoss/src/BossCore_prepareScan.i b/Common/Servers/AntennaBoss/src/BossCore_prepareScan.i index 059cc731a..7f602c472 100644 --- a/Common/Servers/AntennaBoss/src/BossCore_prepareScan.i +++ b/Common/Servers/AntennaBoss/src/BossCore_prepareScan.i @@ -48,7 +48,7 @@ Antenna::EphemGenerator_ptr CBossCore::prepareScan( ACS::Time& startUT, const Antenna::TTrackingParameters& _prim, const Antenna::TTrackingParameters& _sec, - const TOffset& userOffset, + /*const TOffset& userOffset*/ Antenna::TGeneratorType& generatorType, Antenna::TTrackingParameters& lastPar, Antenna::TSections& section, @@ -57,19 +57,20 @@ Antenna::EphemGenerator_ptr CBossCore::prepareScan( double& lon, double& lat, double& vrad, + COffset& offset, Antenna::TReferenceFrame& velFrame, Antenna::TVradDefinition& velDef, ACS::Time& timeToStop, IRA::CString& sourceName, - TOffset& scanOffset, + /*TOffset& scanOffset,*/ Management::TScanAxis& axis, Antenna::EphemGenerator_out generatorFlux) throw (ComponentErrors::CouldntCallOperationExImpl,ComponentErrors::UnexpectedExImpl,ComponentErrors::CORBAProblemExImpl, AntennaErrors::ScanErrorExImpl,AntennaErrors::SecondaryScanErrorExImpl,AntennaErrors::MissingTargetExImpl,AntennaErrors::LoadGeneratorErrorExImpl) { - double latOffTmp,lonOffTmp; + /*double latOffTmp,lonOffTmp; TOffset scanOffTmp(0.0,0.0,Antenna::ANT_HORIZONTAL); - Antenna::TCoordinateFrame offFrameTmp; + Antenna::TCoordinateFrame offFrameTmp;*/ Antenna::TTrackingParameters primary,secondary,prim,sec; double secRa,secDec,secLon,secLat,secVrad; Antenna::TReferenceFrame secVelFrame; @@ -253,22 +254,24 @@ Antenna::EphemGenerator_ptr CBossCore::prepareScan( throw impl; } if (primary.applyOffsets) { //offsets are newer overloaded by the secondary track offsets...because the secondary offsets are always ignored! - ACS_LOG(LM_FULL_INFO,"CBossCore::prepareScan()",(LM_DEBUG,"APPLYING_OFFSETS: %lf %lf",primary.longitudeOffset,primary.latitudeOffset)); - scanOffTmp=TOffset(primary.longitudeOffset,primary.latitudeOffset,primary.offsetFrame); + ACS_LOG(LM_FULL_INFO,"CBossCore::prepareScan()",(LM_DEBUG,"APPLYING_SCAN_OFFSETS: %lf %lf",primary.longitudeOffset,primary.latitudeOffset)); + offset.setScanOffset(primary.longitudeOffset,primary.latitudeOffset,primary.offsetFrame); + /*scanOffTmp=TOffset(primary.longitudeOffset,primary.latitudeOffset,primary.offsetFrame); addOffsets(lonOffTmp,latOffTmp,offFrameTmp,userOffset,scanOffTmp); - ACS_LOG(LM_FULL_INFO,"CBossCore::prepareScan()",(LM_DEBUG,"TOTAL_OFFSETS: %lf %lf",lonOffTmp,latOffTmp)); + ACS_LOG(LM_FULL_INFO,"CBossCore::prepareScan()",(LM_DEBUG,"TOTAL_OFFSETS: %lf %lf",lonOffTmp,latOffTmp));*/ } - else { //keep the originals + else { ACS_LOG(LM_FULL_INFO,"CBossCore::prepareScan()",(LM_DEBUG,"KEEP_ORIGINAL_OFFSETS")); - latOffTmp=userOffset.lat; + /*latOffTmp=userOffset.lat; lonOffTmp=userOffset.lon; offFrameTmp=userOffset.frame; // the addOffsets is the frame of user and scan offset are different uses the scan offset, in that case the scan offset are null so I want to make sure that // the composition of user and scan offset is equal to user offsets in that case. - scanOffTmp.frame=userOffset.frame; + scanOffTmp.frame=userOffset.frame;*/ } try { - currentGenerator->setOffsets(lonOffTmp,latOffTmp,offFrameTmp); //could throw an AntennaErrorsEx exception + TOffset off=offset.getScanOffset(); + currentGenerator->setOffsets(off.lon,off.lat,off.frame); //could throw an AntennaErrorsEx exception } catch (CORBA::SystemException& ex) { _EXCPT(ComponentErrors::CORBAProblemExImpl,impl,"CBossCore::prepareScan()"); @@ -481,7 +484,7 @@ Antenna::EphemGenerator_ptr CBossCore::prepareScan( /* lonOff=lonOffTmp; offFrame=offFrameTmp;*/ - scanOffset=scanOffTmp; + //scanOffset=scanOffTmp; generatorFlux=currentGeneratorFlux._retn(); return currentGenerator._retn(); } @@ -491,7 +494,8 @@ Antenna::EphemGenerator_ptr CBossCore::prepareOTFSecondary(const bool& useIntern { ACS::Time inputTime; TIMEVALUE now; - TOffset scanOff; + //TOffset scanOff; + COffset off; IRA::CString name; Antenna::TSections section; Antenna::TTrackingParameters nullScan,lastScan; @@ -523,8 +527,8 @@ Antenna::EphemGenerator_ptr CBossCore::prepareOTFSecondary(const bool& useIntern try { ACS_LOG(LM_FULL_INFO,"CBossCore::prepareOTFSecondary()",(LM_DEBUG,"PREPARE_SECONDARY_FOR OTF")); - tmp=prepareScan(useInternal,inputTime,sec,nullScan,m_userOffset,genType,lastScan,section,ra,dec,lon,lat,vrad,velFrame,velDef,timeToStop, - sourceName,scanOff,axis,tmpFlux.out()); + tmp=prepareScan(useInternal,inputTime,sec,nullScan/*,m_userOffset*/,genType,lastScan,section,ra,dec,lon,lat,vrad,off,velFrame,velDef,timeToStop, + sourceName/*,scanOff*/,axis,tmpFlux.out()); } catch (ACSErr::ACSbaseExImpl& ex) { ex.log(LM_DEBUG); diff --git a/Common/Servers/AntennaBoss/src/BossCore_startScan.i b/Common/Servers/AntennaBoss/src/BossCore_startScan.i index b0b8b7871..5dbe5f980 100644 --- a/Common/Servers/AntennaBoss/src/BossCore_startScan.i +++ b/Common/Servers/AntennaBoss/src/BossCore_startScan.i @@ -16,17 +16,18 @@ void CBossCore::startScan(ACS::Time& startUt,const Antenna::TTrackingParameters& //Temporarily stop the working thread m_workingThread->suspend(); //make sure that scan offset are reset - m_scanOffset=TOffset(0.0,0.0,m_userOffset.frame); - addOffsets(m_longitudeOffset,m_latitudeOffset,m_offsetFrame,m_userOffset,m_scanOffset); + /*m_scanOffset=TOffset(0.0,0.0,m_userOffset.frame); + addOffsets(m_longitudeOffset,m_latitudeOffset,m_offsetFrame,m_userOffset,m_scanOffset);*/ + m_offsets.resetScan(); try { m_generatorType=Antenna::ANT_NONE; m_generator=Antenna::EphemGenerator::_nil(); // it also releases the previous reference. m_generatorFlux=Antenna::EphemGenerator::_nil(); // it also releases the previous reference. - m_generator=prepareScan(false,startUt,parameters,secondary,m_userOffset,m_generatorType,m_lastScanParameters,section,ra,dec,lon,lat,vrad,velFrame,velDef,m_timeToStop, - name,m_scanOffset,axis,m_generatorFlux.out()); + m_generator=prepareScan(false,startUt,parameters,secondary/*,m_userOffset*/,m_generatorType,m_lastScanParameters,section,ra,dec,lon,lat,vrad,m_offsets, + velFrame,velDef,m_timeToStop,name,/*m_scanOffset,*/axis,m_generatorFlux.out()); //computes the resulting offset, coming from the user and the scan - addOffsets(m_longitudeOffset,m_latitudeOffset,m_offsetFrame,m_userOffset,m_scanOffset); - ACS_LOG(LM_FULL_INFO,"CBossCore::prepareScan()",(LM_DEBUG,"TOTAL_OFFSETS: %lf %lf",m_longitudeOffset,m_latitudeOffset)); + /*addOffsets(m_longitudeOffset,m_latitudeOffset,m_offsetFrame,m_userOffset,m_scanOffset);*/ + ACS_LOG(LM_FULL_INFO,"CBossCore::prepareScan()",(LM_DEBUG,"TOTAL_OFFSETS: %lf %lf",m_offsets.getScanOffset().lon,m_offsets.getScanOffset().lat)); } catch (ComponentErrors::CouldntCallOperationExImpl& ex) { //catch just to update the component status and to unload the generator! m_generatorType=Antenna::ANT_NONE; @@ -86,7 +87,7 @@ void CBossCore::startScan(ACS::Time& startUt,const Antenna::TTrackingParameters& } m_correctionEnable_scan=parameters.enableCorrection; if (!m_correctionEnable_scan) { - ACS_LOG(LM_FULL_INFO,"CBossCore::startScan()",(LM_NOTICE,"POINTING_CORRECTIONS_DISABLED_FOR_CURRENT_SCAN")); + CUSTOM_LOG(LM_FULL_INFO,"CBossCore::startScan()",(LM_NOTICE,"Pointing corrections are disabled for next sub scan")); } /*try { ACS_LOG(LM_FULL_INFO,"CBossCore::startScan()",(LM_DEBUG,"LOADING_TRACKING_CURVE")); @@ -99,10 +100,10 @@ void CBossCore::startScan(ACS::Time& startUt,const Antenna::TTrackingParameters& if (startUt!=0) { IRA::CString out; IRA::CIRATools::timeToStr(startUt,out); - ACS_LOG(LM_FULL_INFO,"CBossCore::startScan()",(LM_NOTICE,"NEW_SCAN_WILL_START_AT: %s",(const char *)out)); + CUSTOM_LOG(LM_FULL_INFO,"CBossCore::startScan()",(LM_NOTICE,"Next antenna sub scan starts at: %s",(const char *)out)); } else { - ACS_LOG(LM_FULL_INFO,"CBossCore::startScan()",(LM_NOTICE,"NEW_SCAN_IMMEDIATELY_STARTED")); + CUSTOM_LOG(LM_FULL_INFO,"CBossCore::startScan()",(LM_NOTICE,"Next antenna sub scan starts now")); } m_targetName=name; m_targetRA=ra; diff --git a/Common/Servers/AntennaBoss/src/Offset.cpp b/Common/Servers/AntennaBoss/src/Offset.cpp index 6204e8aaa..ad08b55cf 100644 --- a/Common/Servers/AntennaBoss/src/Offset.cpp +++ b/Common/Servers/AntennaBoss/src/Offset.cpp @@ -10,47 +10,22 @@ COffset::~COffset() } +COffset& COffset::operator= (const COffset & obj) +{ + scanOffset=obj.scanOffset; + systemOffset=obj.systemOffset; + feedOffset=obj.feedOffset; + return *this; +} + void COffset::reset() { - userOffset.lon=userOffset.lat=0.0; scanOffset.lon=scanOffset.lat=0.0; systemOffset.lon=systemOffset.lat=0.0; systemOffset.frame=Antenna::ANT_HORIZONTAL; feedOffset.lon=feedOffset.lat=0.0; feedOffset.frame=Antenna::ANT_HORIZONTAL; - userOffset.isSet=scanOffset.isSet=systemOffset.isSet=feedOffset.isSet=false; -} - -//USER -void COffset::setUserOffset(const double& lon,const double& lat,const Antenna::TCoordinateFrame& frame) -{ - userOffset.lon=lon; - userOffset.lat=lat; - userOffset.frame=frame; - userOffset.isSet=true; -} -void COffset::setUserOffset(const TOffset& off) -{ - userOffset.lon=off.lon; - userOffset.lat=off.lat; - userOffset.frame=off.frame; - userOffset.isSet=true; -} -void COffset::resetUser() -{ - userOffset.isSet=false; - userOffset.lon=userOffset.lat=0.0; - userOffset.frame=Antenna::ANT_HORIZONTAL; -} - -const TOffset& COffset::getUserOffset() const -{ - return userOffset; -} - -TOffset& COffset::getUserOffset() -{ - return userOffset; + scanOffset.isSet=systemOffset.isSet=feedOffset.isSet=false; } //SCAN @@ -61,6 +36,7 @@ void COffset::setScanOffset(const double& lon,const double& lat,const Antenna::T scanOffset.frame=frame; scanOffset.isSet=true; } + void COffset::setScanOffset(const TOffset& off) { scanOffset.lon=off.lon; @@ -68,20 +44,24 @@ void COffset::setScanOffset(const TOffset& off) scanOffset.frame=off.frame; scanOffset.isSet=true; } + void COffset::resetScan() { scanOffset.isSet=false; scanOffset.lon=scanOffset.lat=0.0; scanOffset.frame=Antenna::ANT_HORIZONTAL; } + const TOffset& COffset::getScanOffset() const { return scanOffset; } + TOffset& COffset::getScanOffset() { return scanOffset; } + //SYSTEM void COffset::setSystemOffset(const double& lon,const double& lat) { @@ -89,23 +69,70 @@ void COffset::setSystemOffset(const double& lon,const double& lat) systemOffset.lat=lat; systemOffset.isSet=true; } + void COffset::resetSystem() { systemOffset.isSet=false; systemOffset.lon=systemOffset.lat=0.0; - scanOffset.frame=Antenna::ANT_HORIZONTAL; + systemOffset.frame=Antenna::ANT_HORIZONTAL; } double COffset::getSystemAzimuth() const { return systemOffset.lon; } + double COffset::getSystemElevation() const { return systemOffset.lat; } -TOffset COffset::ephemGeneratorOffsets(bool &override) const +//FEED +void COffset::setFeedOffset(const double& lon,const double& lat) +{ + feedOffset.lon=lon; + feedOffset.lat=lat; + feedOffset.isSet=true; +} + +void COffset::resetFeed() +{ + feedOffset.isSet=false; + feedOffset.lon=systemOffset.lat=0.0; + feedOffset.frame=Antenna::ANT_HORIZONTAL; +} + +double COffset::getFeedAzimuth() const +{ + return feedOffset.lon; +} + +double COffset::getFeedElevation() const +{ + return feedOffset.lat; +} + +double COffset::getAzimuthCorrection() const +{ + return getSystemAzimuth()+getFeedAzimuth(); +} + +double COffset::getElevationCorrection() const +{ + return getSystemElevation()+getFeedElevation(); +} + +double COffset::getAzimuthCompensation() const +{ + return getSystemAzimuth(); +} + +double COffset::getElevationCompensation() const +{ + return getSystemElevation(); +} + +/*TOffset COffset::ephemGeneratorOffsets(bool &override) const { TOffset out; if (userOffset.isSet && scanOffset.isSet) { // is both user and scan offset are set @@ -146,4 +173,4 @@ TOffset COffset::ephemGeneratorOffsets(bool &override) const override=false; } return out; -} +}*/ diff --git a/Common/Servers/AntennaBoss/tests/Offset_test.i b/Common/Servers/AntennaBoss/tests/Offset_test.i index 2ae738e95..b474a983f 100644 --- a/Common/Servers/AntennaBoss/tests/Offset_test.i +++ b/Common/Servers/AntennaBoss/tests/Offset_test.i @@ -6,8 +6,8 @@ namespace AntennaBossTest { class AntennaBoss_Offset : public ::testing::Test { public: - ::testing::AssertionResult offset_scanUserCombination() { - RecordProperty("description","check if the resulting offset are handle correctly in case both user and scna offset are defined"); + /*::testing::AssertionResult offset_scanUserCombination() { + RecordProperty("description","check if the resulting offset are handle correctly in case both user and scan offset are defined"); COffset test; TOffset user,scan,out; bool override; @@ -52,7 +52,7 @@ public: if (out.frame!=scan.frame) return ::testing::AssertionFailure() << " frame value after a not coherent scan offset"; return ::testing::AssertionSuccess(); - } + }*/ ::testing::AssertionResult offset_isSetCheck() { RecordProperty("description","check if the offsets are correctly flagged"); @@ -62,22 +62,22 @@ public: in.lon=0.1; in.lat=1.55; in.frame=Antenna::ANT_EQUATORIAL; if (test.isScanSet()) return ::testing::AssertionFailure() << " initial scan flag should be false"; - else if (test.isUserSet()) return ::testing::AssertionFailure() << " initial user flag should be false"; + else if (test.isFeedSet()) return ::testing::AssertionFailure() << " initial feed flag should be false"; else if (test.isSystemSet()) return ::testing::AssertionFailure() << " initial system flag should be false"; // now set the offsets; test.setScanOffset(in); - test.setUserOffset(in); test.setSystemOffset(in.lon,in.lat); + test.setFeedOffset(in.lon,in.lat); if (!test.isScanSet()) return ::testing::AssertionFailure() << " scan flag should be set"; - else if (!test.isUserSet()) return ::testing::AssertionFailure() << " user flag should be set"; + else if (!test.isFeedSet()) return ::testing::AssertionFailure() << " feed flag should be set"; else if (!test.isSystemSet()) return ::testing::AssertionFailure() << " system flag should be set"; test.reset(); if (test.isScanSet()) return ::testing::AssertionFailure() << " after a reset, the scan flag should be false"; - else if (test.isUserSet()) return ::testing::AssertionFailure() << " after reset, the user flag should be false"; + else if (test.isFeedSet()) return ::testing::AssertionFailure() << " after reset, the feed flag should be false"; else if (test.isSystemSet()) return ::testing::AssertionFailure() << " after reset, the system flag should be false"; return ::testing::AssertionSuccess(); } @@ -86,18 +86,16 @@ public: RecordProperty("description","check if the data consistency is maintained"); COffset test; TOffset out; - TOffset scan,user; + TOffset scan; scan.lon=0.1; scan.lat=1.55; scan.frame=Antenna::ANT_EQUATORIAL; - user.lon=-0.5; user.lat=0.34; user.frame=Antenna::ANT_HORIZONTAL; test.setScanOffset(scan.lon,scan.lat,scan.frame); - test.setUserOffset(user.lon,user.lat,user.frame); - // check user offsets - out=test.getUserOffset(); - if (out.lon!=user.lon) return ::testing::AssertionFailure() << " user longitude offset does not match"; - else if (out.lat!=user.lat) return ::testing::AssertionFailure() << " user latitude offset does not match"; - if (out.frame!=user.frame) return ::testing::AssertionFailure() << " user longitude offset does not match"; + // check scan offsets + out=test.getScanOffset(); + if (out.lon!=scan.lon) return ::testing::AssertionFailure() << " scan longitude offset does not match"; + else if (out.lat!=scan.lat) return ::testing::AssertionFailure() << " scan latitude offset does not match"; + if (out.frame!=scan.frame) return ::testing::AssertionFailure() << " scan longitude offset does not match"; scan.lon=100; test.setScanOffset(scan); @@ -108,14 +106,8 @@ public: else if (out.lat!=scan.lat) return ::testing::AssertionFailure() << " scan latitude offset does not match"; if (out.frame!=scan.frame) return ::testing::AssertionFailure() << " scan longitude offset does not match"; - // check again user offsets - out=test.getUserOffset(); - if (out.lon!=user.lon) return ::testing::AssertionFailure() << " new user longitude offset does not match"; - else if (out.lat!=user.lat) return ::testing::AssertionFailure() << " new user latitude offset does not match"; - if (out.frame!=user.frame) return ::testing::AssertionFailure() << " new user longitude offset does not match"; - - test.resetUser(); - if (test.isSystemSet()) return ::testing::AssertionFailure() << " user offsets should not be set"; + test.resetScan(); + if (test.isScanSet()) return ::testing::AssertionFailure() << " scan offsets should not be set"; return ::testing::AssertionSuccess(); } @@ -130,10 +122,10 @@ public: test.setScanOffset(scan); //RValue - out=test.getUserOffset(); + out=test.getScanOffset(); out.lon=100; out.lat=300; - out1=test.getUserOffset(); + out1=test.getScanOffset(); //check the internal values are unchanged if (out1.lon==out.lon) return ::testing::AssertionFailure() << " Rvalue test, the object values should have not be changed"; @@ -142,8 +134,8 @@ public: //LVALUE out.lon=100; out.lat=300; - changeValue(test.getUserOffset(),out.lon,out.lat); - out1=test.getUserOffset(); + changeValue(test.getScanOffset(),out.lon,out.lat); + out1=test.getScanOffset(); //cout << out1.lon << " " << out1.lat << endl; //cout << out.lon << " " << out.lat << endl; @@ -154,7 +146,6 @@ public: return ::testing::AssertionSuccess(); } - protected: virtual void SetUp() { } diff --git a/Common/Servers/AntennaBoss/tests/unittest.cpp b/Common/Servers/AntennaBoss/tests/unittest.cpp index ed95be396..e042bda47 100644 --- a/Common/Servers/AntennaBoss/tests/unittest.cpp +++ b/Common/Servers/AntennaBoss/tests/unittest.cpp @@ -8,7 +8,6 @@ TEST_F(AntennaBoss_Offset, offset_isSetCheck){ EXPECT_TRUE(offset_isSetCheck()); } - TEST_F(AntennaBoss_Offset, offset_AssignAndReadout){ EXPECT_TRUE(offset_AssignAndReadout()); } @@ -17,7 +16,7 @@ TEST_F(AntennaBoss_Offset, offset_LValueAndRValue){ EXPECT_TRUE(offset_LValueAndRValue()); } -TEST_F(AntennaBoss_Offset, offset_scanUserCombination){ +/*TEST_F(AntennaBoss_Offset, offset_scanUserCombination){ EXPECT_TRUE(offset_scanUserCombination()); -} +}*/ diff --git a/Medicina/Configuration/CDB/alma/ANTENNA/Boss/Boss.xml b/Medicina/Configuration/CDB/alma/ANTENNA/Boss/Boss.xml index a5a52c6cc..ec1dde308 100644 --- a/Medicina/Configuration/CDB/alma/ANTENNA/Boss/Boss.xml +++ b/Medicina/Configuration/CDB/alma/ANTENNA/Boss/Boss.xml @@ -35,12 +35,11 @@ - - - - - - + + + + + -- GitLab