Unverified Commit 84cb24de authored by Fabio Vitello's avatar Fabio Vitello Committed by GitHub
Browse files

Merge pull request #609 from discos/fix-issue-595

Fix issue 595
parents 403ede87 344400b4
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -88,6 +88,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/
    issue #518 - KBand receivers cryo temperature read wrongly with connection problems. More information: https://github.com/discos/discos/issues/518#issuecomment-590838480
    issue #533 - New Fitszilla version 1.21 online. The user offsets related keywords added to the primary header.
    issue #556 - Added API to send emails to local system administrators. This feature is now exploted when a servo system oscillation is detected at Noto and Medicina
    issue #595 - Added ifdist command to use IF Distributor (for Nt telescope) from operator input.
## Fixed
    issue #518 - In case of communication error we set a dummy value (100000) for the temperature properties, and the related timestamp keeps the value of the last communication timestamp.
    issue #525 - When in LOCAL mode the receivers can turn on/off the noise mark and LNAs. There is no more MNG_FAILURE logging in case of LOCAL mode: only the LOCAL/REMOTE status (during component activation) and the change of status (LOCAL to REMOTE and viceversa) are written to the logfile.
+30 −0
Original line number Diff line number Diff line
@@ -416,6 +416,36 @@ def help(command):
        print 'e.g. > help(setupCCB)'
        print 'help() (without argument) lists all the available commands'


def ifdist():
    """
    ifdist=input,pol,att
    allowed values for input:
        1 input1 
        2 input2 

    allowed value for pol for input1
        0 nessun ingresso selezionato
        1 ricevitore in vertex Right Pol
        2 ricevitore L Right Pol
        3 ricevitore X Right Pol
        4 ricevitore S Right Pol
        5 spare1
        6 spare2

    allowed value for pol for input2
        0 nessun ingresso selezionato
        1 ricevitore in vertex Left Pol
        2 ricevitore L Left Pol
        3 ricevitore X Left Pol
        4 ricevitore S Left Pol
        5 ricevitore S Right Pol (per oss. geo)
        6 spare1

    allowed values for att:
        from 0 to 63, each step is 0.5 dB
    """

def initialize():
    """
    initialize=code 
+225 −206
Original line number Diff line number Diff line
@@ -12,8 +12,7 @@ _IRA_LOGFILTER_IMPORT;

#define SCHED_EXECUTOR_NAME "SCHED_THREAD"

CCore::CCore(ContainerServices *service,CConfiguration *conf,DiscosLocals::StationConfig* stConfig) : 
	m_config(conf), m_stationConf(stConfig), m_services(service)
CCore::CCore(ContainerServices *service, CConfiguration *conf, DiscosLocals::StationConfig *stConfig) : m_config(conf), m_stationConf(stConfig), m_services(service)
{
}

@@ -35,20 +34,24 @@ void CCore::execute() throw (ComponentErrors::TimerErrorExImpl,ComponentErrors::
{
	Antenna::TSiteInformation_var site;
	Antenna::Observatory_var observatory = Antenna::Observatory::_nil();
	try {
	try
	{
		observatory = m_services->getDefaultComponent<Antenna::Observatory>((const char *)m_config->getObservatoryComponent());
	}
	catch (maciErrType::CannotGetComponentExImpl& ex) {
	catch (maciErrType::CannotGetComponentExImpl &ex)
	{
		_ADD_BACKTRACE(ComponentErrors::CouldntGetComponentExImpl, Impl, ex, "CCore::execute()");
		Impl.setComponentName((const char *)m_config->getObservatoryComponent());
		throw Impl;
	}
	catch (maciErrType::NoPermissionExImpl& ex) {
	catch (maciErrType::NoPermissionExImpl &ex)
	{
		_ADD_BACKTRACE(ComponentErrors::CouldntGetComponentExImpl, Impl, ex, "CCore::execute()");
		Impl.setComponentName((const char *)m_config->getObservatoryComponent());
		throw Impl;
	}
	catch (maciErrType::NoDefaultComponentExImpl& ex) {
	catch (maciErrType::NoDefaultComponentExImpl &ex)
	{
		_ADD_BACKTRACE(ComponentErrors::CouldntGetComponentExImpl, Impl, ex, "CCore::execute()");
		Impl.setComponentName((const char *)m_config->getObservatoryComponent());
		throw Impl;
@@ -56,10 +59,12 @@ void CCore::execute() throw (ComponentErrors::TimerErrorExImpl,ComponentErrors::
	/*catch (...) {
	}*/
	ACS_LOG(LM_FULL_INFO, "CCore::execute()", (LM_INFO, "OBSERVATORY_LOCATED"));
	try	{	
	try
	{
		site = observatory->getSiteSummary(); //throw CORBA::SYSTEMEXCEPTION
	}
	catch (CORBA::SystemException& ex)	{
	catch (CORBA::SystemException &ex)
	{
		_EXCPT(ComponentErrors::CORBAProblemExImpl, __dummy, "CCore::updateSite()");
		__dummy.setName(ex._name());
		__dummy.setMinor(ex.minor());
@@ -68,10 +73,12 @@ void CCore::execute() throw (ComponentErrors::TimerErrorExImpl,ComponentErrors::
	m_site = IRA::CSite(site.out());
	m_dut1 = site->DUT1;
	ACS_LOG(LM_FULL_INFO, "CCore::execute()", (LM_INFO, "SITE_INITIALIZED"));
	try {
	try
	{
		m_services->releaseComponent((const char *)observatory->name());
	}
	catch  (maciErrType::CannotReleaseComponentExImpl& ex) {
	catch (maciErrType::CannotReleaseComponentExImpl &ex)
	{
		_ADD_BACKTRACE(ComponentErrors::CouldntReleaseComponentExImpl, Impl, ex, "CCore::execute()");
		Impl.setComponentName((const char *)observatory->name());
		throw Impl;
@@ -81,25 +88,30 @@ void CCore::execute() throw (ComponentErrors::TimerErrorExImpl,ComponentErrors::
	RESOURCE_EXEC;

	// spawn schedule executor thread........
	try {
	try
	{
		CCore *tmp = this;
		m_schedExecuter = m_services->getThreadManager()->create<CScheduleExecutor, CCore *>(SCHED_EXECUTOR_NAME, tmp);
	}
	catch (acsthreadErrType::acsthreadErrTypeExImpl& ex) {
	catch (acsthreadErrType::acsthreadErrTypeExImpl &ex)
	{
		_ADD_BACKTRACE(ComponentErrors::ThreadErrorExImpl, _dummy, ex, "CCore::execute()");
		throw _dummy;
	}
	catch (...) {
	catch (...)
	{
		_THROW_EXCPT(ComponentErrors::UnexpectedExImpl, "CCore::execute()");
	}
	m_schedExecuter->initialize(m_services, m_dut1, m_site, m_config); // throw (ComponentErrors::TimerErrorExImpl)
	ACS::TimeInterval sleepTime = m_config->getScheduleExecutorSleepTime() * 10;
	m_schedExecuter->setSleepTime(sleepTime);

   try {
		m_parser=new CParser<CCore>(this,10,true);\
	try
	{
		m_parser = new CParser<CCore>(this, 10, true);
	}
	catch (...) {
	catch (...)
	{
		_EXCPT(ComponentErrors::MemoryAllocationExImpl, dummy, "CCore::execute()");
		throw dummy;
	}
@@ -117,8 +129,7 @@ void CCore::execute() throw (ComponentErrors::TimerErrorExImpl,ComponentErrors::
	m_parser->add("device", new function1<CCore, non_constant, void_type, I<long_type> >(this, &CCore::_setDevice), 1);
	m_parser->add("chooseBackend", new function1<CCore, non_constant, void_type, I<string_type> >(this, &CCore::_chooseDefaultBackend), 1);
	m_parser->add("chooseRecorder", new function1<CCore, non_constant, void_type, I<string_type> >(this, &CCore::_chooseDefaultDataRecorder), 1);
	m_parser->add("crossScan",new function3<CCore,non_constant,void_type,I<enum_type<AntennaFrame2String,Antenna::TCoordinateFrame > >,I<angleOffset_type<rad> >,
			I<interval_type> >(this,&CCore::crossScan),3);
	m_parser->add("crossScan", new function3<CCore, non_constant, void_type, I<enum_type<AntennaFrame2String, Antenna::TCoordinateFrame> >, I<angleOffset_type<rad> >, I<interval_type> >(this, &CCore::crossScan), 3);
	m_parser->add("peakerScan", new function3<CCore, non_constant, void_type, I<string_type>, I<double_type>, I<interval_type> >(this, &CCore::peakerScan), 3);
	m_parser->add("log", new function1<CCore, non_constant, void_type, I<string_type> >(this, &CCore::_changeLogFile), 1);
	m_parser->add("logMessage", new function1<CCore, non_constant, void_type, I<string_type> >(this, &CCore::_logMessage), 1);
@@ -130,6 +141,8 @@ void CCore::execute() throw (ComponentErrors::TimerErrorExImpl,ComponentErrors::
	// m_parser->add("ifd","_ifd",1,"SRT");
	m_parser->add("calmux", "_calmux", 1);
	m_parser->add("dmed", "_dmed", 1, "Medicina");
	m_parser->add("ifdist", "_ifdist", 3, "Noto");

	m_parser->add("restFrequency", new function1<CCore, non_constant, void_type, I<doubleSeq_type> >(this, &CCore::_setRestFrequency), 1);
	m_parser->add("fTrack", new function1<CCore, non_constant, void_type, I<string_type> >(this, &CCore::_fTrack), 1);
	m_parser->add("peaker", new function3<CCore, non_constant, void_type, I<string_type>, I<double_type>, I<interval_type> >(this, &CCore::_peaker), 3);
@@ -137,9 +150,7 @@ void CCore::execute() throw (ComponentErrors::TimerErrorExImpl,ComponentErrors::
	m_parser->add("latOTF", new function3<CCore, non_constant, void_type, I<enum_type<AntennaFrame2String, Antenna::TCoordinateFrame> >, I<angleOffset_type<rad> >, I<interval_type> >(this, &CCore::_latOTF), 3);
	m_parser->add("skydipOTF", new function3<CCore, non_constant, void_type, I<elevation_type<rad, false> >, I<elevation_type<rad, false> >, I<interval_type> >(this, &CCore::_skydipOTF), 3);
	m_parser->add("moon", new function0<CCore, non_constant, void_type>(this, &CCore::_moon), 0);
	m_parser->add("sidereal",new function5<CCore,non_constant,void_type,I<string_type>,I<rightAscension_type<rad,true> >,
			I<declination_type<rad,true> >,I<enum_type<AntennaEquinox2String,Antenna::TSystemEquinox > >,
			I<enum_type<AntennaSection2String,Antenna::TSections> > >(this,&CCore::_sidereal),5);
	m_parser->add("sidereal", new function5<CCore, non_constant, void_type, I<string_type>, I<rightAscension_type<rad, true> >, I<declination_type<rad, true> >, I<enum_type<AntennaEquinox2String, Antenna::TSystemEquinox> >, I<enum_type<AntennaSection2String, Antenna::TSections> > >(this, &CCore::_sidereal), 5);
	m_parser->add("track", new function1<CCore, non_constant, void_type, I<string_type> >(this, &CCore::_track), 1);
	m_parser->add("goTo", new function2<CCore, non_constant, void_type, I<azimuth_type<rad, false> >, I<elevation_type<rad, false> > >(this, &CCore::_goTo), 2);
	m_parser->add("abort", new function0<CCore, non_constant, void_type>(this, &CCore::_abort), 0);
@@ -229,7 +240,8 @@ void CCore::cleanUp()
	unloadWeatherStation(m_weatherStation);
	unloadDefaultBackend();
	unloadDefaultDataReceiver();
	if (m_schedExecuter!=NULL) m_schedExecuter->suspend();
	if (m_schedExecuter != NULL)
		m_schedExecuter->suspend();
	m_services->getThreadManager()->destroy(m_schedExecuter);
	ACS_LOG(LM_FULL_INFO, "CCore::cleanUp()", (LM_INFO, "THREAD_DESTROYED"));
}
@@ -243,8 +255,10 @@ void CCore::skydip(const double& el1,const double& el2,const ACS::TimeInterval&
	ManagementErrors::RecordingAlreadyActiveExImpl, ManagementErrors::CloseTelescopeScanErrorExImpl)
{
	//no need to get the mutex, because it is already done inside the executor object
	if (m_schedExecuter) {
		if (m_schedExecuter->isScheduleActive()) {
	if (m_schedExecuter)
	{
		if (m_schedExecuter->isScheduleActive())
		{
			_THROW_EXCPT(ManagementErrors::NotAllowedDuringScheduleExImpl, "CCore::skydip()");
		}
	}
@@ -393,8 +407,10 @@ void CCore::peakerScan(const char *axis,const double& span,const ACS::TimeInterv
																									  ComponentErrors::ValidationErrorExImpl, ManagementErrors::TelescopeSubScanErrorExImpl)
{
	//no need to get the mutex, because it is already done inside the executor object
	if (m_schedExecuter) {
		if (m_schedExecuter->isScheduleActive()) {
	if (m_schedExecuter)
	{
		if (m_schedExecuter->isScheduleActive())
		{
			_THROW_EXCPT(ManagementErrors::NotAllowedDuringScheduleExImpl, "CCore::peakerScan()");
		}
	}
@@ -423,8 +439,10 @@ void CCore::crossScan(const Antenna::TCoordinateFrame& scanFrame,const double& s
	ManagementErrors::RecordingAlreadyActiveExImpl, ManagementErrors::CloseTelescopeScanErrorExImpl)
{
	//no need to get the mutex, because it is already done inside the executor object
	if (m_schedExecuter) {
		if (m_schedExecuter->isScheduleActive()) {
	if (m_schedExecuter)
	{
		if (m_schedExecuter->isScheduleActive())
		{
			_THROW_EXCPT(ManagementErrors::NotAllowedDuringScheduleExImpl, "CCore::crossScan()");
		}
	}
@@ -465,14 +483,17 @@ void CCore::clearStatus()

bool CCore::command(const IRA::CString &cmd, IRA::CString &answer)
{
	try {
	try
	{
		m_parser->run(cmd, answer); //parser is already thread safe.....
		return true;
	}
	catch (ParserErrors::ParserErrorsExImpl &ex) {
	catch (ParserErrors::ParserErrorsExImpl &ex)
	{
		return false;
	}
	catch (ACSErr::ACSbaseExImpl& ex) {
	catch (ACSErr::ACSbaseExImpl &ex)
	{
		ex.log(LM_ERROR); // the errors resulting from the execution are logged here as stated in the documentation of CommandInterpreter interface, while the parser errors are never logged.
		return false;
	}
@@ -484,7 +505,6 @@ bool CCore::command(const IRA::CString& cmd,IRA::CString& answer)

/////// PRIVATES


#include "Core_Common.i"

#include "Core_Resource.i"
@@ -492,4 +512,3 @@ bool CCore::command(const IRA::CString& cmd,IRA::CString& answer)
#include "Core_Extra.i"

#include "Core_Basic.i"
+9 −0
Original line number Diff line number Diff line
<?xml version='1.0' encoding='ISO-8859-1'?>

<IFDistConfiguration xmlns="urn:schemas-cosylab-com:IFDistConfiguration:1.0"
             	xmlns:baci="urn:schemas-cosylab-com:BACI:1.0"
				xmlns:cdb="urn:schemas-cosylab-com:CDB:1.0"
				xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
				IP="ifd.noto.ira.inaf.it"
				PORT="5000"
				/>
 No newline at end of file
+75 −6
Original line number Diff line number Diff line
@@ -14,6 +14,8 @@
	calOff
	setAttenuation=0,15
	setAttenuation=1,5
	ifdist=1,1,44
	ifdist=2,1,32
</body>	
</Procedure>

@@ -22,11 +24,14 @@
	antennaSetup=SEC
	initialize=MMC
	receiversSetup=MMC
    asOn
	device=0
	calmux=TotalPower
	calOff
	setAttenuation=0,0
	setAttenuation=1,4
	ifdist=1,1,44
	ifdist=2,1,32
</body>
</Procedure>

@@ -35,9 +40,12 @@
	antennaSetup=SEC
	initialize=KKC
	receiversSetup=KKC
    asOn
	device=0
	calmux=TotalPower
	calOff
	ifdist=1,1,44
	ifdist=2,1,32
</body>
</Procedure>

@@ -46,27 +54,88 @@
	antennaSetup=SEC
	initialize=QQC
    receiversSetup=QQC
    asOn
	device=0
	calmux=TotalPower
	calOff
	ifdist=1,1,44
	ifdist=2,1,32
</body>
</Procedure>

<Procedure name="setupXXP" args="0">
<body>
	antennaSetup=PRIM
	initialize=XXP
    receiversSetup=XXP
    asOn
	device=0
	calmux=TotalPower
	calOff
	ifdist=1,3,44
	ifdist=2,3,32
</body>
</Procedure>

<Procedure name="setupXSP" args="0">
<body>
	antennaSetup=PRIM
	initialize=XXP
    receiversSetup=XXP
    asOff
	device=0
	calmux=TotalPower
	calOff
	ifdist=1,4,44
	ifdist=2,3,32
</body>
</Procedure>

<Procedure name="setupLLP" args="0">
<body>
	antennaSetup=LL
	initialize=LLP
    receiversSetup=LLP
    asOff
	device=0
	calmux=TotalPower
	calOff
	ifdist=1,2,44
	ifdist=2,2,32
</body>
</Procedure>

<Procedure name="setupSSP" args="0">
<body>
	antennaSetup=PRIM
	initialize=SSP
    	receiversSetup=SSP
    	asOff
	device=0
	calmux=TotalPower
	calOff
	ifdist=1,4,44
	ifdist=2,4,32
</body>
</Procedure>

<Procedure name="setupSXP" args="0">
<body>
	antennaSetup=PRIM
	initialize=SXP
	receiversSetup=SXP
	initialize=SSP
    receiversSetup=SSP
    asOff
	device=0
	calmux=TotalPower
	calOff
	ifdist=1,3,44
	ifdist=2,5,32
</body>
</Procedure>

<Procedure name="telescopePark" args="0">
<body>
	goTo=180d,90d
	receiversPark
	antennaPark
	asPark
</body>
</Procedure>
Loading