Commit 72a834a3 authored by Marco Buttu's avatar Marco Buttu
Browse files

Added a guard time to the msScan.Epoch returned by the checkScan().

parent 621321d4
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -112,6 +112,15 @@ class ScanTest(ScanBaseTest):
        self.assertGreater(t, getTimeStamp().value)
        self.isAssertScan(t)

    def test_startScan_ASAP_at_checkScan_time(self):
        """Starting time given by checkScan()"""
        startTime = 0
        res, msInfo = self.boss.checkScan(startTime, self.scan, self.antennaInfo)
        startTime = msInfo.startEpoch 
        t = self.boss.startScan(startTime, self.scan, self.antennaInfo)
        self.assertGreater(t, getTimeStamp().value)
        self.isAssertScan(t)

    def test_startScan_at_given_time(self):
        """Start at given time"""
        startTime = getTimeStamp().value + 60*10**7 # Start in one minute 
+14 −13
Original line number Diff line number Diff line
@@ -872,7 +872,8 @@ bool MinorServoBossImpl::checkScanImpl(
        }
    }


    // Add 1.5s in order to consider the time between the check and the start
    min_starting_time += 15000000;
    msParamVar->startEpoch = (startingTime==0) ? min_starting_time : startingTime;
    msParamVar->timeToStop = msParamVar->startEpoch + msScanInfo.total_time;

@@ -1162,7 +1163,7 @@ void MinorServoBossImpl::startScanImpl(
        m_configuration->m_isScanLocked = false;
        string msg("startScanImpl(): unexpected exception getting the axis information");
        _EXCPT(MinorServoErrors::StatusErrorExImpl, impl, msg.c_str());
        impl.log(LM_DEBUG);
        impl.log(LM_ERROR);
        throw impl.getMinorServoErrorsEx();
    }

@@ -1181,7 +1182,7 @@ void MinorServoBossImpl::startScanImpl(
        m_configuration->m_isScanLocked = false;
        string msg("startScanImpl(): cannot get the central scan position");
        _EXCPT(MinorServoErrors::StatusErrorExImpl, impl, msg.c_str());
        impl.log(LM_DEBUG);
        impl.log(LM_ERROR);
        throw impl.getMinorServoErrorsEx();
    }

@@ -1213,7 +1214,7 @@ void MinorServoBossImpl::startScanImpl(
        m_configuration->m_isScanLocked = false;
        string msg("startScanImpl(): cannot get the minimum scan starting time");
        _EXCPT(MinorServoErrors::StatusErrorExImpl, impl, msg.c_str());
        impl.log(LM_DEBUG);
        impl.log(LM_ERROR);
        throw impl.getMinorServoErrorsEx();
    }
 
@@ -1221,9 +1222,9 @@ void MinorServoBossImpl::startScanImpl(
    if(startingTime != 0) {
        if(min_starting_time > startingTime) {
            m_configuration->m_isScanLocked = false;
            string msg("startScanImpl(): the scan is supposed to start to early");
            string msg("startScanImpl(): not enough time to start the scan");
            _EXCPT(MinorServoErrors::StatusErrorExImpl, impl, msg.c_str());
            impl.log(LM_DEBUG);
            impl.log(LM_ERROR);
            throw impl.getMinorServoErrorsEx();
        }
    }
@@ -1240,7 +1241,7 @@ void MinorServoBossImpl::startScanImpl(
        m_configuration->m_isScanLocked = false;
        string msg("startScanImpl(): total time too short for performing the scan.");
        _EXCPT(MinorServoErrors::StatusErrorExImpl, impl, msg.c_str());
        impl.log(LM_DEBUG);
        impl.log(LM_ERROR);
        throw impl.getMinorServoErrorsEx();
    }

@@ -1253,14 +1254,14 @@ void MinorServoBossImpl::startScanImpl(
            if(CORBA::is_nil(component_ref)) {
                string msg("startScanImpl: cannot get the reference of the component.", true);
                _EXCPT(MinorServoErrors::StatusErrorExImpl, impl, msg.c_str());
                impl.log(LM_DEBUG);
                impl.log(LM_ERROR);
                throw impl.getMinorServoErrorsEx();
            }

            if(!component_ref->isReady()) {
                string msg("startScanImpl: the component is not ready", true);
                _EXCPT(MinorServoErrors::StatusErrorExImpl, impl, msg.c_str());
                impl.log(LM_DEBUG);
                impl.log(LM_ERROR);
                throw impl.getMinorServoErrorsEx();
            }

@@ -1271,7 +1272,7 @@ void MinorServoBossImpl::startScanImpl(
            if(axis > number_of_axis - 1) {
                string msg("startScanImpl: axis index error", true);
                _EXCPT(MinorServoErrors::StatusErrorExImpl, impl, msg.c_str());
                impl.log(LM_DEBUG);
                impl.log(LM_ERROR);
                throw impl.getMinorServoErrorsEx();
            }
                                                        
@@ -1286,7 +1287,7 @@ void MinorServoBossImpl::startScanImpl(
            if(user_offset->length() != plainCentralPos.length()) {
                string msg("startScanImpl(): mismatch between offset and central position length");
                _EXCPT(MinorServoErrors::StatusErrorExImpl, impl, msg.c_str());
                impl.log(LM_DEBUG);
                impl.log(LM_ERROR);
                throw impl.getMinorServoErrorsEx();
            }
            else {
@@ -1312,7 +1313,7 @@ void MinorServoBossImpl::startScanImpl(
        else {
            string msg("startScanImpl(): cannot get the component reference.");
            _EXCPT(MinorServoErrors::StatusErrorExImpl, impl, msg.c_str());
            impl.log(LM_DEBUG);
            impl.log(LM_ERROR);
            throw impl.getMinorServoErrorsEx();
        }
        
@@ -1328,7 +1329,7 @@ void MinorServoBossImpl::startScanImpl(
        catch(...) {
            string msg("startScanImpl(): the MinorServoBoss is attempting to execute a previous scan");
            _EXCPT(MinorServoErrors::StatusErrorExImpl, impl, msg.c_str());
            impl.log(LM_DEBUG);
            impl.log(LM_ERROR);
            throw impl.getMinorServoErrorsEx();
        }
        m_configuration->m_isScanActive = true;