diff --git a/CHANGELOG.md b/CHANGELOG.md
index e8149ee6d0bd6b2401cc75e4ceb03329955c5afd..51a0a79fe1b6f796648a6b018533a0eaabe53cd9 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -97,6 +97,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/
## [next release]
## Added
+ issue #655 - ACU Component for Noto and Medicina is now capble to prevent seldom mode changes coming from ACU reset
issue #653 - added a couple of scriptsto ease vnc conection from remote a file copying. The scripts support
linux and macos
## Fixed
diff --git a/Common/Servers/ExternalClients/src/ExternalClientsSocketServer.cpp b/Common/Servers/ExternalClients/src/ExternalClientsSocketServer.cpp
index 23411b2a06c4946fa44dd9790addd5d42d5c1457..2fe3df0f44a2bfca451b3d0a54b7f2da0a230260 100644
--- a/Common/Servers/ExternalClients/src/ExternalClientsSocketServer.cpp
+++ b/Common/Servers/ExternalClients/src/ExternalClientsSocketServer.cpp
@@ -560,17 +560,24 @@ CExternalClientsSocketServer::cmdToScheduler ()
printf("dentro ans==false\n");
}*/
}
+ out.ReplaceAll('\n','-');
+ /*out.Replace('\n','-');
out.Replace('\n','-');
+ out.Replace('\n','-');
+ out.Replace('\n','-');*/
Len = out.GetLength ();
int i;
- for (i = 0; i < Len; i++)
- {
- outBuffer[i] = out.CharAt (i);
- }
+ for (i = 0; i < Len; i++) {
+ //if (out.CharAt(i)=='\n')
+ // break;
+ outBuffer[i] = out.CharAt (i);
+ }
out.Empty();
outBuffer[Len] = '\n';
+ //outBuffer[i] = '\n';
//printf ("Command returned = %s", outBuffer);
Res = sendBuffer (outBuffer, Len + 1);
+ //Res = sendBuffer (outBuffer, i + 1);
if (Res == WOULDBLOCK || Res == FAIL)
{
_EXCPT (SocketErrorExImpl, impl,
diff --git a/Common/Servers/PyCalmux/src/Calmux/PyCalmuxImpl.py b/Common/Servers/PyCalmux/src/Calmux/PyCalmuxImpl.py
index 15fc28aaff9cbc477f895a151a21ae6032c02a83..239419977348828a2ba2a3790da24165c4e66512 100644
--- a/Common/Servers/PyCalmux/src/Calmux/PyCalmuxImpl.py
+++ b/Common/Servers/PyCalmux/src/Calmux/PyCalmuxImpl.py
@@ -139,6 +139,8 @@ class PyCalmuxImpl(CalMux, cc, services, lcycle):
"""
s.sendall(command)
+# time.sleep(0.1)
+
response = s.recv(1024)
response = response.strip().split()
if len(response) == 1:
diff --git a/Medicina/CDB/alma/ANTENNA/Mount/Mount.xml b/Medicina/CDB/alma/ANTENNA/Mount/Mount.xml
index 0dca04b5fb042fc19cbd7d7762322fc8fd34648e..60cdd2868a1b40d8aedea7dd05b1b4a87a43febe 100644
--- a/Medicina/CDB/alma/ANTENNA/Mount/Mount.xml
+++ b/Medicina/CDB/alma/ANTENNA/Mount/Mount.xml
@@ -15,6 +15,7 @@
ControlThreadPeriod="200000"
RepetitionCacheTime="2000000"
RepetitionExpireTime="5000000"
+ CheckMode="false"
CheckOscillation="true"
OscillationThreshold="0.01"
OscillationAlarmDuration="2000000"
diff --git a/Medicina/Configuration/CDB/alma/ANTENNA/Mount/Mount.xml b/Medicina/Configuration/CDB/alma/ANTENNA/Mount/Mount.xml
index 0dca04b5fb042fc19cbd7d7762322fc8fd34648e..60cdd2868a1b40d8aedea7dd05b1b4a87a43febe 100644
--- a/Medicina/Configuration/CDB/alma/ANTENNA/Mount/Mount.xml
+++ b/Medicina/Configuration/CDB/alma/ANTENNA/Mount/Mount.xml
@@ -15,6 +15,7 @@
ControlThreadPeriod="200000"
RepetitionCacheTime="2000000"
RepetitionExpireTime="5000000"
+ CheckMode="false"
CheckOscillation="true"
OscillationThreshold="0.01"
OscillationAlarmDuration="2000000"
diff --git a/Medicina/Servers/MedicinaMinorServo/src/MedMinorServoGeometry.cpp b/Medicina/Servers/MedicinaMinorServo/src/MedMinorServoGeometry.cpp
index db364b60549c0fdfb45cdf0ffcea6730b8e5d54e..3928ac373ceabdb3a76083b1196a1998bcdf40d0 100755
--- a/Medicina/Servers/MedicinaMinorServo/src/MedMinorServoGeometry.cpp
+++ b/Medicina/Servers/MedicinaMinorServo/src/MedMinorServoGeometry.cpp
@@ -325,12 +325,16 @@ double
MedMinorServoGeometry::_check_axis_limit(const double position,
const MedMinorServoAxis axis)
{
- if(position < axis.position_min){
+ int iposition = (int)position;
+
+
+ if(iposition < axis.position_min){
throw MinorServoAxisLimitError("axis too low");
//return axis.position_min;
}
- if(position > axis.position_max){
- throw MinorServoAxisLimitError("axis too high");
+ if(iposition > axis.position_max){
+ std::cout<
+
+
diff --git a/Medicina/Servers/MedicinaMount/include/ACUData.h b/Medicina/Servers/MedicinaMount/include/ACUData.h
index 23d03ac68d829c3363f6b61d4499c90627cdf962..5fbe0031e09d1de7b206290e15642a39f3d24cd3 100644
--- a/Medicina/Servers/MedicinaMount/include/ACUData.h
+++ b/Medicina/Servers/MedicinaMount/include/ACUData.h
@@ -83,6 +83,9 @@ public:
/** Returns the section which the antenna is located in, at present */
CACUInterface::TAntennaSection getSection() const;
+ /** Return true if the driver power is on */
+ bool getDrivePower() const;
+
/**Returns the number of free stack slots reserved for time tagged program track positions */
WORD getFreeStackPositions() const;
diff --git a/Medicina/Servers/MedicinaMount/include/ACUInterface.h b/Medicina/Servers/MedicinaMount/include/ACUInterface.h
index 6e3f8cd926b9752d32f2e4fdb7e9008f64780b17..c765e66440eed8abf776c4b1de76916bbc661e83 100644
--- a/Medicina/Servers/MedicinaMount/include/ACUInterface.h
+++ b/Medicina/Servers/MedicinaMount/include/ACUInterface.h
@@ -186,9 +186,14 @@ public:
static TAxeModes getMode(BYTE mode);
/**
- * This function returns the antenna presnt section given the control word
+ * This function returns the antenna present section given the control word
*/
static TAntennaSection getSection(WORD controlWord);
+
+ /**
+ * This function returns true i drive power is on, false otherwise
+ */
+ static bool getDrivePower(WORD controlWord);
};
diff --git a/Medicina/Servers/MedicinaMount/include/Configuration.h b/Medicina/Servers/MedicinaMount/include/Configuration.h
index dcee4e1e1d239012ec375be0da12c9f44db8851b..84d00bdb16199b8e2ebded15c9d852c1df6d823e 100644
--- a/Medicina/Servers/MedicinaMount/include/Configuration.h
+++ b/Medicina/Servers/MedicinaMount/include/Configuration.h
@@ -99,9 +99,12 @@ public:
/** Gets the number of times the oscillation has to be hit before an oscillation is declared*/
inline DWORD oscillationNumberThreashold() const { return m_dwoscNumberThreshold; }
- /** Flag that indicates whether the oscillation chek must performed or not. */
+ /** Flag that indicates whether the oscillation check must performed or not. */
inline bool checkForOscillation() const { return m_checkOsc; }
+ /** Flag that indicates whether the ACU check mode must performed or not. */
+ inline bool checkForMode() const { return m_checkMode; }
+
/**
* This member function is used to configure component by reading the configuration parameter from the CDB.
* This must be the first call before using any other function of this class.
@@ -139,9 +142,9 @@ private:
DWORD m_dwcontrolThreadPeriod;
/** This is the precision (degree) of the antenna */
//double m_dtrackingPrecision;
- /** This indicates the cache time for the repetion log filter */
+ /** This indicates the cache time for the repetition log filter */
DDWORD m_dwrepetitionCacheTime;
- /** This indicates the expire time for the repetion log filter */
+ /** This indicates the expire time for the repetition log filter */
DDWORD m_dwexpireCacheTime;
/** this number is the separation value between the CW and CCW, if the azimuth is greater than this the section is CW */
double m_cwLimit;
@@ -151,6 +154,7 @@ private:
WORD m_dwoscNumberThreshold;
DDWORD m_dwoscRecoverTime;
bool m_checkOsc;
+ bool m_checkMode;
};
diff --git a/Medicina/Servers/MedicinaMount/include/MedicinaMountSocket.h b/Medicina/Servers/MedicinaMount/include/MedicinaMountSocket.h
index 45f9d1ed5c756312f9a71f3868eadeb7021fbcb7..2089303a5cfc7712ca0c94c9ddddecdc35de3716 100644
--- a/Medicina/Servers/MedicinaMount/include/MedicinaMountSocket.h
+++ b/Medicina/Servers/MedicinaMount/include/MedicinaMountSocket.h
@@ -447,10 +447,33 @@ public:
* 1) if the tracking error is beyond a threashold an alarm condition is triggered. This condition has a certain validity time.
* 2) If more than a number of direction changes (of the tracking error with respect to the zero error) are detected during the alarm time window, the oscillation is declared-
* 3) The alarm condition is cleared if the time validity window of the alarm elapsed and the tracking error is again under the threshold.
- * In case of detection counter mesures are immediately taken.
+ * In case of detection counter measures are immediately taken.
*/
void detectOscillation() throw (AntennaErrors::ConnectionExImpl,ComponentErrors::SocketErrorExImpl,ComponentErrors::TimeoutExImpl,AntennaErrors::NakExImpl,AntennaErrors::AntennaBusyExImpl);
-
+
+ /**
+ * This method has been added to detect the event the ACU mode differs from previously commanded. In case it tries to
+ * recover from this event by commanding the correct mode.
+ * @throw AntennaErrors::ConnectionExImpl
+ * @throw ComponentErrors::SocketErrorExImpl
+ * @throw ComponentErrors::TimeoutExImpl
+ * @throw AntennaErrors::NakExImpl
+ * @throw AntennaErrors::AntennaBusyExImpl
+ */
+ void checkCommandedMode() throw (AntennaErrors::ConnectionExImpl,ComponentErrors::SocketErrorExImpl,
+ ComponentErrors::TimeoutExImpl,AntennaErrors::NakExImpl,AntennaErrors::AntennaBusyExImpl);
+
+ /**
+ * This method has been added to detect a power failure in the servo system. In case it tries to
+ * recover from this event by reseting the servo.
+ * @throw AntennaErrors::ConnectionExImpl
+ * @throw ComponentErrors::SocketErrorExImpl
+ * @throw ComponentErrors::TimeoutExImpl
+ * @throw AntennaErrors::NakExImpl
+ */
+ void checkPowerFailure() throw (ComponentErrors::TimeoutExImpl,AntennaErrors::NakExImpl,
+ AntennaErrors::ConnectionExImpl,ComponentErrors::SocketErrorExImpl);
+
/**
* This member function is used by the control thread in order to check if a long job that was started as completed or not.
* @param job job identifier
@@ -607,6 +630,16 @@ private:
*/
CACUInterface::TAxeModes m_oscMode;
+ /**
+ * this flag indicates that a recovery from mode check in ongoing.....
+ */
+ bool m_modeCheckRecover;
+
+ /**
+ * this flag indicates that a power failure has been detected
+ */
+ bool m_powerFailDetected;
+
/**
* Stores the epoch of the last scan. Used in oscillation prevention
*/
diff --git a/Medicina/Servers/MedicinaMount/src/ACUData.cpp b/Medicina/Servers/MedicinaMount/src/ACUData.cpp
index 07c67df799bc4361bff219a6467def796611fc10..147d5a4f2a9994c03581f093f92ae628223e2af2 100644
--- a/Medicina/Servers/MedicinaMount/src/ACUData.cpp
+++ b/Medicina/Servers/MedicinaMount/src/ACUData.cpp
@@ -114,6 +114,14 @@ CACUInterface::TAntennaSection CACUData::getSection() const
memcpy(&Value,(m_MonitorData+36),2);
return CACUInterface::getSection(Value);
}
+
+bool CACUData::getDrivePower() const
+{
+ WORD val;
+ memcpy(&val,(m_MonitorData+36),2);
+ return CACUInterface::getDrivePower(val);
+}
+
WORD CACUData::getFreeStackPositions() const
{
diff --git a/Medicina/Servers/MedicinaMount/src/ACUInterface.cpp b/Medicina/Servers/MedicinaMount/src/ACUInterface.cpp
index 874ebfe18a440c8ea46667a3a59d329f99894638..7dcb00ad1a5163a37b90f7bf4aa5e816b0b08f66 100644
--- a/Medicina/Servers/MedicinaMount/src/ACUInterface.cpp
+++ b/Medicina/Servers/MedicinaMount/src/ACUInterface.cpp
@@ -247,3 +247,9 @@ CACUInterface::TAntennaSection CACUInterface::getSection(WORD controlWord)
else return CACUInterface::CCW;
}
+bool CACUInterface::getDrivePower(WORD controlWord)
+{
+ if (controlWord & (1 << 15)) return false;
+ else return true;
+}
+
diff --git a/Medicina/Servers/MedicinaMount/src/Configuration.cpp b/Medicina/Servers/MedicinaMount/src/Configuration.cpp
index f7504523db58f2cbb26c7b5b3853cde418ebef2a..b7ec59ded99813e3ff67ca01b248a9c4e300e0df 100644
--- a/Medicina/Servers/MedicinaMount/src/Configuration.cpp
+++ b/Medicina/Servers/MedicinaMount/src/Configuration.cpp
@@ -66,6 +66,13 @@ void CConfiguration::Init(maci::ContainerServices *Services) throw (ComponentErr
_GET_DOUBLE_ATTRIBUTE("cw_ccw_limit","CW/CCW limit (degrees):",m_cwLimit,"DataBlock/Mount");
_GET_STRING_ATTRIBUTE("CheckOscillation","Check oscillation during tracking: ",check,"");
+ check.MakeUpper();
+ m_checkOsc=(check=="TRUE");
+
+ _GET_STRING_ATTRIBUTE("CheckMode","Check ACU mode enabled: ",check,"");
+ check.MakeUpper();
+ m_checkMode=(check=="TRUE");
+
_GET_DOUBLE_ATTRIBUTE("OscillationThreshold","Oscillation theshold (deg):",m_doscThreashold,"");
_GET_DWORD_ATTRIBUTE("OscillationAlarmDuration","Oscillation alarm duration (uSec):",m_dwoscAlarmDuration,"");
_GET_DWORD_ATTRIBUTE("OscillationNumberThreshold","Oscillation number threashold:",m_dwoscNumberThreshold,"");
@@ -74,5 +81,5 @@ void CConfiguration::Init(maci::ContainerServices *Services) throw (ComponentErr
m_dwoscRecoverTime*=10;
m_dwcontrolThreadPeriod*=10;
check.MakeUpper();
- m_checkOsc=(check=="TRUE");
+
}
diff --git a/Medicina/Servers/MedicinaMount/src/MedicinaMountSocket.cpp b/Medicina/Servers/MedicinaMount/src/MedicinaMountSocket.cpp
index 00c5a72f60273e17c634b430836803e5931ebc6f..e018632aaa83c3f751d9a7b023a192c064086f4d 100644
--- a/Medicina/Servers/MedicinaMount/src/MedicinaMountSocket.cpp
+++ b/Medicina/Servers/MedicinaMount/src/MedicinaMountSocket.cpp
@@ -130,6 +130,8 @@ void CMedicinaMountSocket::Init(CConfiguration *config,maci::ContainerServices *
m_oscStopTime=0;
m_oscMode=CACUInterface::STANDBY;
m_lastScanEpoch=0;
+ m_modeCheckRecover=false;
+ m_powerFailDetected=false;
}
CACUInterface::TAxeModes CMedicinaMountSocket::getAzimuthMode() throw (ConnectionExImpl,SocketErrorExImpl,TimeoutExImpl)
@@ -587,8 +589,11 @@ void CMedicinaMountSocket::Mode(CACUInterface::TAxeModes azMode,CACUInterface::T
TIMEVALUE now;
IRA::CIRATools::getTime(now);
m_Data.setLastCommandedMode(azMode);
- m_Data.setAzimuthOffset(0.0);
- m_Data.setElevationOffset(0.0);
+ if (!m_modeCheckRecover) { // need to keep current offsets in case a recovery procedure is ongoing.....
+ m_Data.setAzimuthOffset(0.0);
+ m_Data.setElevationOffset(0.0);
+ m_modeCheckRecover=false;
+ }
m_lastScanEpoch=now.value().value;
}
@@ -844,6 +849,50 @@ double CMedicinaMountSocket::getHWAzimuth(double destination,const CACUInterface
return CIRATools::getHWAzimuth(pos,dest,m_configuration->azimuthLowerLimit(),m_configuration->azimuthUpperLimit(),section,m_configuration->cwLimit());
}
+void CMedicinaMountSocket::checkPowerFailure() throw (ComponentErrors::TimeoutExImpl,AntennaErrors::NakExImpl,
+ AntennaErrors::ConnectionExImpl,ComponentErrors::SocketErrorExImpl)
+{
+ //_IRA_LOGDIKE_COMPLETION(m_logDike,__dummy,LM_DEBUG);
+ if (!m_configuration->checkForMode()) return;
+ if (m_Data.getDrivePower()) { //in case of a power outage of failure.....
+ if (!m_powerFailDetected) { //first detection
+ CUSTOM_LOG(LM_FULL_INFO,"CMedicinaMountSocket::checkPowerFailure()",(LM_CRITICAL,
+ "Servo system power failure detected"));
+ }
+ m_powerFailDetected=true;
+ }
+ else { // no power error
+ if (m_powerFailDetected) { //first detection
+ CUSTOM_LOG(LM_FULL_INFO,"CMedicinaMountSocket::checkPowerFailure()",(LM_NOTICE,
+ "Trying a servo system reset"));
+ failureReset();// throw (TimeoutExImpl,AntennaErrors::NakExImpl,ConnectionExImpl,SocketErrorExImpl)
+ m_powerFailDetected=false;
+ CUSTOM_LOG(LM_FULL_INFO,"CMedicinaMountSocket::checkPowerFailure()",(LM_CRITICAL,
+ "Servo system power failure cleared"));
+ }
+ }
+}
+
+void CMedicinaMountSocket::checkCommandedMode() throw (ConnectionExImpl,SocketErrorExImpl,TimeoutExImpl,AntennaErrors::NakExImpl,AntennaBusyExImpl)
+{
+ CACUInterface::TAxeModes commandedMode, mode;
+ if (!m_configuration->checkForMode()) return;
+ if (m_powerFailDetected) return; // no need to try to recover from mode discrepancy if the cause is a power failure
+ commandedMode=m_Data.getLastCommandedMode();
+ if ((commandedMode!=CACUInterface::STANDBY) && (commandedMode!=CACUInterface::UNSTOW) &&
+ (commandedMode!=CACUInterface::STOW) && (commandedMode!=CACUInterface::STOP)) {
+ mode=getAzimuthMode(); // throw (ConnectionExImpl,SocketErrorExImpl,TimeoutExImpl)
+ if ((mode!=CACUInterface::UNKNOWN)) {
+ if ((commandedMode!=mode)) {
+ CUSTOM_LOG(LM_FULL_INFO,"CMedicinaMountSocket::checkCommandedMode()",
+ (LM_WARNING,"ACU operation mode differs from commanded one, trying to recover..."));
+ m_modeCheckRecover=true;
+ Mode(commandedMode,commandedMode);
+ }
+ }
+ }
+}
+
void CMedicinaMountSocket::detectOscillation() throw (ConnectionExImpl,SocketErrorExImpl,TimeoutExImpl,AntennaErrors::NakExImpl,AntennaBusyExImpl)
{
TIMEVALUE now;
diff --git a/Medicina/Servers/MedicinaMount/src/MedicinaMountThread.cpp b/Medicina/Servers/MedicinaMount/src/MedicinaMountThread.cpp
index 695d389de19c01725a9c09316bf8b19d8cdeb131..4023b11c90b292fdfa17ed858aaca77ec9b8102b 100644
--- a/Medicina/Servers/MedicinaMount/src/MedicinaMountThread.cpp
+++ b/Medicina/Servers/MedicinaMount/src/MedicinaMountThread.cpp
@@ -51,6 +51,8 @@ void CMedicinaMountControlThread::runLoop()
CSecAreaResourceWrapper socket=m_pACUControl->Get();
socket->updateComponent(); // before commenting out or deleting consider that inside this method the flushing of pending event of the log dike object is called
socket->detectOscillation();
+ socket->checkPowerFailure();
+ socket->checkCommandedMode();
if (currentJobID!=0) {
ACSErr::Completion_var comp;
if (socket->updateLongJobs(currentJobID,comp.out())) {
diff --git a/Noto/CDB/alma/ANTENNA/Mount/Mount.xml b/Noto/CDB/alma/ANTENNA/Mount/Mount.xml
index 44c2fc8ea4ff976d3a35d2b81c98b4b32da5a4d3..c909831dd49659319fb5fba34536ad397d602f42 100644
--- a/Noto/CDB/alma/ANTENNA/Mount/Mount.xml
+++ b/Noto/CDB/alma/ANTENNA/Mount/Mount.xml
@@ -15,6 +15,7 @@
ControlThreadPeriod="200000"
RepetitionCacheTime="2000000"
RepetitionExpireTime="5000000"
+ CheckMode="true"
CheckOscillation="true"
OscillationThreshold="0.01"
OscillationAlarmDuration="2000000"
diff --git a/Noto/CDB/alma/Procedures/StationProcedures/StationProcedures.xml b/Noto/CDB/alma/Procedures/StationProcedures/StationProcedures.xml
index a5440f574ab53f018aac51747a77658ae0614a09..95447e60d286546a9360acc346c666dc91707b48 100644
--- a/Noto/CDB/alma/Procedures/StationProcedures/StationProcedures.xml
+++ b/Noto/CDB/alma/Procedures/StationProcedures/StationProcedures.xml
@@ -15,8 +15,10 @@
calOff
setAttenuation=0,15
setAttenuation=1,5
- ifdist=1,1,44
- ifdist=2,1,32
+ ifdist=1,1,-1
+ ifdist=2,1,-1
+ ifdist=1,-1,16
+ ifdist=2,-1,32