Commit 2dd92007 authored by Giuseppe Carboni's avatar Giuseppe Carboni Committed by GitHub
Browse files

Fix issue 394 (#409)

* Fix #392, delayed coordinates request from FitsWriter::getFakeDump (#393)

* Fix #392, delayed coordinates request from FitsWriter::getFakeDump

* Fix #392, moved the delay parameter into CDB

* Fix #394, added a way to save coordinates into a text file

* Fix #394, updated with requested modifications
parent 15bf2022
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -93,6 +93,7 @@
        		<xs:attribute name="Satellite" type="xs:string" use="required"/>
        		<xs:attribute name="SolarSystemBody" type="xs:string" use="required"/>
                <xs:attribute name="Otf" type="xs:string" use="required"/>
                <xs:attribute name="CoordinatesFilename" type="xs:string" use="optional" default="" />
            </xs:extension>
        </xs:complexContent>
	</xs:complexType>
+3 −0
Original line number Diff line number Diff line
@@ -34,6 +34,7 @@
#include "Callback.h"
#include "SlewCheck.h"
#include <FrequencyTracking.h>
#include <fstream>

using namespace IRA;
using namespace maci;
@@ -836,6 +837,8 @@ private:
	 */
	Antenna::TTrackingParameters m_lastScanParameters;

	std::fstream outFile;

	/** 
	 * This method loads into the mount a coordinate for a given time. It uses the commanded generator in order to provide the required coordinates.
	 * The coordinates are corrected for pointing model and refraction (if <i>m_correctionEnable</i> is set) then commanded to the mount (if the flag
+6 −0
Original line number Diff line number Diff line
@@ -127,6 +127,11 @@ public:
	*/
	const CString& getSatelliteInterface() const { return m_satelliteInterface; }

	/**
	 * @return the name of the text file in which to save every set of ACU received coordinates
	*/
	const CString& getCoordinatesFilename() const { return m_coordinatesFile; }
	
	/**
	 * @return  the maximum speed in azimuth (rad/sec)
	*/
@@ -220,6 +225,7 @@ private:
	double m_maxElevationAvoidance;
	double m_skydipElDown;
	double m_skydipElUp;
	CString m_coordinatesFile;
};

#endif /*CONFIGURATION_H_*/
+27 −11
Original line number Diff line number Diff line
@@ -113,6 +113,15 @@ void CBossCore::initialize() throw (ComponentErrors::UnexpectedExImpl)
	m_generatorFlux=Antenna::EphemGenerator::_nil();
	m_mountError=false;
	m_siderealGenerator=m_otfGenerator=m_moonGenerator=m_sunGenerator=m_satelliteGenerator=m_solarBodyGenerator=Antenna::EphemGenerator::_nil();
	IRA::CString coordinatesFile = m_config->getCoordinatesFilename();
	if(coordinatesFile != "")
	{
		outFile.open((const char *)coordinatesFile, std::fstream::out | std::fstream::app);
		if(!outFile.is_open())
		{
			ACS_LOG(LM_FULL_INFO,"CBossCore::initialize()", (LM_ERROR,"Cannot open '%s' text file to write coordinates!", (const char *)coordinatesFile));
		}
	}
}

void CBossCore::execute() throw (ComponentErrors::CouldntGetComponentExImpl,
@@ -208,6 +217,7 @@ void CBossCore::cleanUp()
	catch (ComponentErrors::CouldntReleaseComponentExImpl& ex) {
		ex.log(LM_DEBUG);
	}
	if(outFile.is_open()) outFile.close();
	_IRA_LOGFILTER_FLUSH;
	_IRA_LOGFILTER_DESTROY;
	unloadPointingModel(m_pointingModel);
@@ -1005,6 +1015,11 @@ bool CBossCore::updateAttributes() throw (ComponentErrors::CORBAProblemExImpl,Co
	az*=DD2R; el*=DD2R;
	//bring the azimuth inside the 0-2Pi.
	az=slaDranrm(az);
	if (outFile.is_open()) {
		IRA::CString outString;
		CIRATools::timeToStr(time, outString);
		outFile << (const char *)outString << " " << az << " " << el << " ";
	}
	if (m_correctionEnable && m_correctionEnable_scan) {
		loadRefraction(m_refraction); // throw ComponentErrors::CouldntGetComponentExImpl
		loadPointingModel(m_pointingModel); // throw ComponentErrors::CouldntGetComponentExImpl
@@ -1034,14 +1049,16 @@ bool CBossCore::updateAttributes() throw (ComponentErrors::CORBAProblemExImpl,Co
		el-=m_refractionOffset;
		try {
			m_pointingModel->getAzElOffsets(az,el,m_pointingAzOffset,m_pointingElOffset);
			// subtract the offsets coming from the pointing model
			az-=m_pointingAzOffset; el-=m_pointingElOffset;
			// bring the azimuth again in the correct range (0-2PI)
			az=slaDranrm(az);
		}
		catch (AntennaErrors::AntennaErrorsEx& ex) {
			//This error is due to the fact that the pointing model is not configured yet.....so it is not an error itself.
			_ADD_BACKTRACE(ComponentErrors::CouldntCallOperationExImpl,impl,ex,"CBossCore::updateAttributes()");
			impl.setComponentName((const char*)m_pointingModel->name());
			impl.setOperationName("getAzElOffsets()");
			//We just set the pointing offsets to 0.0 and change the boss status to WARNING in order to notify the user in some way
			m_pointingAzOffset=m_pointingElOffset=0.0;
			changeBossStatus(Management::MNG_WARNING);
			throw impl;  // in this case throw the exception......it will be the watching thread to log it
		}
		catch (CORBA::SystemException& ex) {
			_EXCPT(ComponentErrors::CORBAProblemExImpl,impl,"CBossCore::updateAttributes()");
@@ -1055,10 +1072,6 @@ bool CBossCore::updateAttributes() throw (ComponentErrors::CORBAProblemExImpl,Co
			_EXCPT(ComponentErrors::UnexpectedExImpl,impl,"CBossCore::updateAttributes()");
			throw impl;
		}
		// subtract the offsets coming from the pointing model
		az-=m_pointingAzOffset; el-=m_pointingElOffset;
		// bring the azimuth again in the correct range (0-2PI)
		az=slaDranrm(az);
	}
	else {
		m_pointingAzOffset=m_pointingElOffset=m_refractionOffset=0.0;
@@ -1068,6 +1081,9 @@ bool CBossCore::updateAttributes() throw (ComponentErrors::CORBAProblemExImpl,Co
	IRA::CSkySource:: horizontalToEquatorial(dateTime,m_site,az,el,appRa,appDec,pAngle);
	IRA::CSkySource::apparentToJ2000(appRa,appDec,dateTime,ra,dec);
	m_observedEquatorials.addPoint(ra,dec,timeMark);
	if (outFile.is_open()) {
		outFile << az << " " << el << " " << ra << " " << dec << endl;
	}
	IRA::CSkySource::equatorialToGalactic(ra,dec,lng,lat);
	m_observedGalactics.addPoint(lng,lat,timeMark);
	if (m_integrationStartTime==0) { //integration not started...then start it
+1 −0
Original line number Diff line number Diff line
@@ -95,6 +95,7 @@ void CConfiguration::init(maci::ContainerServices *Services) throw (ComponentErr
	_GET_DOUBLE_ATTRIBUTE_E("MaxElevationAvoidance","Suggested upper elevation limit  for source observation(degrees):",m_maxElevationAvoidance,"DataBlock/Mount");
	_GET_DOUBLE_ATTRIBUTE("CutOffElevation","The cut off elevation is (degrees):",m_cutOffElevation);
	_GET_STRING_ATTRIBUTE("SkydipElevationRange","The skydip elevation range is (degrees):",temp);
	_GET_STRING_ATTRIBUTE("CoordinatesFilename", "The text file path in which the received coordinates will be written:", m_coordinatesFile);

	if (sscanf((const char *)temp,"%lf-%lf",&m_skydipElDown,&m_skydipElUp)!=2) {
		_EXCPT(ComponentErrors::CDBAccessExImpl,dummy,"CConfiguration::Init()");
Loading