Loading Common/Servers/AntennaBoss/include/Offset.h 0 → 100644 +76 −0 Original line number Diff line number Diff line #ifndef OFFSET_H_ #define OFFSET_H_ /* ************************************************************************************************************* */ /* IRA Istituto di Radioastronomia */ /* */ /* This code is under GNU General Public Licence (GPL). */ /* */ /* Who when What */ /* Andrea Orlati(aorlati@ira.inaf.it) 09/06/2016 Creation */ #include <AntennaDefinitionsS.h> class TOffset { public: double lon; double lat; Antenna::TCoordinateFrame frame; bool isSet; } ; /** * This class handles all the supported coordinate offsets. This class is not thread safe. * Feed offset are not implemented yet. * @author <a href=mailto:a.orlati@ira.inaf.it>Orlati Andrea</a> * Istituto di Radioastronomia, Italia * <br> */ class COffset { public: COffset(); ~COffset(); void reset(); 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(); void setScanOffset(const double& lon,const double& lat,const Antenna::TCoordinateFrame& frame); void setScanOffset(const TOffset& off); void resetScan(); bool isScanSet() const { return scanOffset.isSet; } const TOffset& getScanOffset() const; TOffset& getScanOffset(); void setSystemOffset(const double& lon,const double& lat); void resetSystem(); bool isSystemSet() const { return systemOffset.isSet; } double getSystemAzimuth() const; double getSystemElevation() const; /** * This function returns the offsets setup for the ephemeris generator components. The offset returned are the * combination of user and scan offsets. If the frames of both offsets match, the result is the sum of both the * offset, otherwise the scan offset prevails. * @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; private: TOffset userOffset; TOffset scanOffset; TOffset systemOffset; TOffset feedOffset; }; #endif /* OFFSET_H_ */ Common/Servers/AntennaBoss/src/Makefile +1 −1 Original line number Diff line number Diff line Loading @@ -63,7 +63,7 @@ LIBRARIES_L = # # <brief description of lllll library> AntennaBossImpl_OBJECTS = AntennaBossImpl BossCore Configuration \ WorkingThread WatchingThread Callback SlewCheck WorkingThread WatchingThread Callback SlewCheck Offset AntennaBossImpl_LIBS = AntennaDefinitionsStubs AntennaBossStubs MountStubs ObservatoryStubs \ EphemGeneratorStubs ManagmentDefinitionsStubs IRALibrary ComponentErrors ManagementErrors \ AntennaErrors ParserErrors PointingModelStubs RefractionStubs SkySourceStubs OTFStubs MoonStubs acsnc Loading Common/Servers/AntennaBoss/src/Offset.cpp 0 → 100644 +149 −0 Original line number Diff line number Diff line #include "Offset.h" COffset::COffset() { reset(); } COffset::~COffset() { } 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; } //SCAN void COffset::setScanOffset(const double& lon,const double& lat,const Antenna::TCoordinateFrame& frame) { scanOffset.lon=lon; scanOffset.lat=lat; scanOffset.frame=frame; scanOffset.isSet=true; } void COffset::setScanOffset(const TOffset& off) { scanOffset.lon=off.lon; scanOffset.lat=off.lat; 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) { systemOffset.lon=lon; systemOffset.lat=lat; systemOffset.isSet=true; } void COffset::resetSystem() { systemOffset.isSet=false; systemOffset.lon=systemOffset.lat=0.0; scanOffset.frame=Antenna::ANT_HORIZONTAL; } double COffset::getSystemAzimuth() const { return systemOffset.lon; } double COffset::getSystemElevation() const { return systemOffset.lat; } TOffset COffset::ephemGeneratorOffsets(bool &override) const { TOffset out; if (userOffset.isSet && scanOffset.isSet) { // is both user and scan offset are set if (userOffset.frame==scanOffset.frame) { out.lon=userOffset.lon+scanOffset.lon; out.lat=userOffset.lat+scanOffset.lat; out.frame=scanOffset.frame; out.isSet=true; override=false; } else { // if the frames differ the scanOffset prevails out.lon=scanOffset.lon; out.lat=scanOffset.lat; out.frame=scanOffset.frame; out.isSet=true; override=true; } } else if (userOffset.isSet) { out.lon=userOffset.lon; out.lat=userOffset.lat; out.frame=userOffset.frame; out.isSet=true; override=false; } else if (scanOffset.isSet) { out.lon=scanOffset.lon; out.lat=scanOffset.lat; out.frame=scanOffset.frame; out.isSet=true; override=false; } else { out.lon=0.0; out.lat=0.0; out.frame=Antenna::ANT_HORIZONTAL; out.isSet=false; override=false; } return out; } Common/Servers/AntennaBoss/tests/.discos 0 → 100644 +5 −0 Original line number Diff line number Diff line This file is here to differentiate between ACS style test directory and discos-style test. This is a discos test directory DO NOT REMOVE THIS FILE Common/Servers/AntennaBoss/tests/Makefile 0 → 100644 +90 −0 Original line number Diff line number Diff line # CPP UNIT TESTING SETUP #-------------- GTEST_HOME=/usr/local/include/gtest GMOCK_HOME=/usr/local/include/gmock GTEST_LIBS=gtest gtest_main USER_INC=-I$(GTEST_HOME) -I$(GMOCK_HOME) # END OF CPP UNIT TESTING SETUP #--------------------- # DEFINE YOUR CPP UNIT TEST EXECUTABLES HERE as: # # EXECTUABLES_L = unittest # unittest_OBJECTS = unittest # unittest_LIBS = $(GTEST_LIBS) <ComponentNameImpl> EXECUTABLES_L = unittest unittest_OBJECTS = unittest unittest_LIBS = $(GTEST_LIBS) AntennaBossImpl unittest_LDFLAGS = -lstdc++ -lpthread # END OF CUSTOMIZATION # do not edit below this line #---------------------------- CSOURCENAMES = \ $(foreach exe, $(EXECUTABLES) $(EXECUTABLES_L), $($(exe)_OBJECTS)) \ $(foreach rtos, $(RTAI_MODULES) , $($(rtos)_OBJECTS)) \ $(foreach lib, $(LIBRARIES) $(LIBRARIES_L), $($(lib)_OBJECTS)) MAKEDIRTMP := $(shell searchFile include/acsMakefile) ifneq ($(MAKEDIRTMP),\#error\#) MAKEDIR := $(MAKEDIRTMP)/include include $(MAKEDIR)/acsMakefile endif # TEST TARGETS #TODO: unittest(2) discover pyunit do_unit: all @echo "running cpp unit tests" ../bin/unittest --gtest_output=xml:results/cppunittest.xml do_pyunit: @echo "running python unit tests" python -m unittest pyunit do_functional: @echo "running python functional tests" python -m unittest functional do_external: @echo "running python external tests" python -m unittest external clean_test: rm -f results/*.xml rm -f functional/*.pyc rm -f pyunit/*.pyc rm -f external/*.pyc unit: do_unit @echo " . . . 'unit' done" pyunit: do_pyunit @echo " . . . 'pyunit' done" functional: do_functional @echo " . . . 'functional' done" external: do_external @echo " . . . 'external' done" # TARGETS # ------- all: do_all @echo " . . . 'all' done" clean : clean_all clean_test @echo " . . . clean done" clean_dist : clean_all clean_dist_all clean_test @echo " . . . clean_dist done" man : do_man @echo " . . . man page(s) done" install : install_all @echo " . . . installation done" Loading
Common/Servers/AntennaBoss/include/Offset.h 0 → 100644 +76 −0 Original line number Diff line number Diff line #ifndef OFFSET_H_ #define OFFSET_H_ /* ************************************************************************************************************* */ /* IRA Istituto di Radioastronomia */ /* */ /* This code is under GNU General Public Licence (GPL). */ /* */ /* Who when What */ /* Andrea Orlati(aorlati@ira.inaf.it) 09/06/2016 Creation */ #include <AntennaDefinitionsS.h> class TOffset { public: double lon; double lat; Antenna::TCoordinateFrame frame; bool isSet; } ; /** * This class handles all the supported coordinate offsets. This class is not thread safe. * Feed offset are not implemented yet. * @author <a href=mailto:a.orlati@ira.inaf.it>Orlati Andrea</a> * Istituto di Radioastronomia, Italia * <br> */ class COffset { public: COffset(); ~COffset(); void reset(); 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(); void setScanOffset(const double& lon,const double& lat,const Antenna::TCoordinateFrame& frame); void setScanOffset(const TOffset& off); void resetScan(); bool isScanSet() const { return scanOffset.isSet; } const TOffset& getScanOffset() const; TOffset& getScanOffset(); void setSystemOffset(const double& lon,const double& lat); void resetSystem(); bool isSystemSet() const { return systemOffset.isSet; } double getSystemAzimuth() const; double getSystemElevation() const; /** * This function returns the offsets setup for the ephemeris generator components. The offset returned are the * combination of user and scan offsets. If the frames of both offsets match, the result is the sum of both the * offset, otherwise the scan offset prevails. * @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; private: TOffset userOffset; TOffset scanOffset; TOffset systemOffset; TOffset feedOffset; }; #endif /* OFFSET_H_ */
Common/Servers/AntennaBoss/src/Makefile +1 −1 Original line number Diff line number Diff line Loading @@ -63,7 +63,7 @@ LIBRARIES_L = # # <brief description of lllll library> AntennaBossImpl_OBJECTS = AntennaBossImpl BossCore Configuration \ WorkingThread WatchingThread Callback SlewCheck WorkingThread WatchingThread Callback SlewCheck Offset AntennaBossImpl_LIBS = AntennaDefinitionsStubs AntennaBossStubs MountStubs ObservatoryStubs \ EphemGeneratorStubs ManagmentDefinitionsStubs IRALibrary ComponentErrors ManagementErrors \ AntennaErrors ParserErrors PointingModelStubs RefractionStubs SkySourceStubs OTFStubs MoonStubs acsnc Loading
Common/Servers/AntennaBoss/src/Offset.cpp 0 → 100644 +149 −0 Original line number Diff line number Diff line #include "Offset.h" COffset::COffset() { reset(); } COffset::~COffset() { } 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; } //SCAN void COffset::setScanOffset(const double& lon,const double& lat,const Antenna::TCoordinateFrame& frame) { scanOffset.lon=lon; scanOffset.lat=lat; scanOffset.frame=frame; scanOffset.isSet=true; } void COffset::setScanOffset(const TOffset& off) { scanOffset.lon=off.lon; scanOffset.lat=off.lat; 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) { systemOffset.lon=lon; systemOffset.lat=lat; systemOffset.isSet=true; } void COffset::resetSystem() { systemOffset.isSet=false; systemOffset.lon=systemOffset.lat=0.0; scanOffset.frame=Antenna::ANT_HORIZONTAL; } double COffset::getSystemAzimuth() const { return systemOffset.lon; } double COffset::getSystemElevation() const { return systemOffset.lat; } TOffset COffset::ephemGeneratorOffsets(bool &override) const { TOffset out; if (userOffset.isSet && scanOffset.isSet) { // is both user and scan offset are set if (userOffset.frame==scanOffset.frame) { out.lon=userOffset.lon+scanOffset.lon; out.lat=userOffset.lat+scanOffset.lat; out.frame=scanOffset.frame; out.isSet=true; override=false; } else { // if the frames differ the scanOffset prevails out.lon=scanOffset.lon; out.lat=scanOffset.lat; out.frame=scanOffset.frame; out.isSet=true; override=true; } } else if (userOffset.isSet) { out.lon=userOffset.lon; out.lat=userOffset.lat; out.frame=userOffset.frame; out.isSet=true; override=false; } else if (scanOffset.isSet) { out.lon=scanOffset.lon; out.lat=scanOffset.lat; out.frame=scanOffset.frame; out.isSet=true; override=false; } else { out.lon=0.0; out.lat=0.0; out.frame=Antenna::ANT_HORIZONTAL; out.isSet=false; override=false; } return out; }
Common/Servers/AntennaBoss/tests/.discos 0 → 100644 +5 −0 Original line number Diff line number Diff line This file is here to differentiate between ACS style test directory and discos-style test. This is a discos test directory DO NOT REMOVE THIS FILE
Common/Servers/AntennaBoss/tests/Makefile 0 → 100644 +90 −0 Original line number Diff line number Diff line # CPP UNIT TESTING SETUP #-------------- GTEST_HOME=/usr/local/include/gtest GMOCK_HOME=/usr/local/include/gmock GTEST_LIBS=gtest gtest_main USER_INC=-I$(GTEST_HOME) -I$(GMOCK_HOME) # END OF CPP UNIT TESTING SETUP #--------------------- # DEFINE YOUR CPP UNIT TEST EXECUTABLES HERE as: # # EXECTUABLES_L = unittest # unittest_OBJECTS = unittest # unittest_LIBS = $(GTEST_LIBS) <ComponentNameImpl> EXECUTABLES_L = unittest unittest_OBJECTS = unittest unittest_LIBS = $(GTEST_LIBS) AntennaBossImpl unittest_LDFLAGS = -lstdc++ -lpthread # END OF CUSTOMIZATION # do not edit below this line #---------------------------- CSOURCENAMES = \ $(foreach exe, $(EXECUTABLES) $(EXECUTABLES_L), $($(exe)_OBJECTS)) \ $(foreach rtos, $(RTAI_MODULES) , $($(rtos)_OBJECTS)) \ $(foreach lib, $(LIBRARIES) $(LIBRARIES_L), $($(lib)_OBJECTS)) MAKEDIRTMP := $(shell searchFile include/acsMakefile) ifneq ($(MAKEDIRTMP),\#error\#) MAKEDIR := $(MAKEDIRTMP)/include include $(MAKEDIR)/acsMakefile endif # TEST TARGETS #TODO: unittest(2) discover pyunit do_unit: all @echo "running cpp unit tests" ../bin/unittest --gtest_output=xml:results/cppunittest.xml do_pyunit: @echo "running python unit tests" python -m unittest pyunit do_functional: @echo "running python functional tests" python -m unittest functional do_external: @echo "running python external tests" python -m unittest external clean_test: rm -f results/*.xml rm -f functional/*.pyc rm -f pyunit/*.pyc rm -f external/*.pyc unit: do_unit @echo " . . . 'unit' done" pyunit: do_pyunit @echo " . . . 'pyunit' done" functional: do_functional @echo " . . . 'functional' done" external: do_external @echo " . . . 'external' done" # TARGETS # ------- all: do_all @echo " . . . 'all' done" clean : clean_all clean_test @echo " . . . clean done" clean_dist : clean_all clean_dist_all clean_test @echo " . . . clean_dist done" man : do_man @echo " . . . man page(s) done" install : install_all @echo " . . . installation done"