Index: trunk/BNC/src/combination/bnccomb.cpp
===================================================================
--- trunk/BNC/src/combination/bnccomb.cpp	(revision 11087)
+++ trunk/BNC/src/combination/bnccomb.cpp	(revision 11098)
@@ -1050,4 +1050,12 @@
       }
     }
+    if (AC->numObs[sys] > 0) {
+      if (!AC->presentSince[sys].valid()) {
+        AC->presentSince[sys] = epoTime;
+      }
+    }
+    else {
+      AC->presentSince[sys].reset();
+    }
     out << epoTime.datestr().c_str()    << " "
         << epoTime.timestr().c_str()    << " "
@@ -1086,4 +1094,29 @@
         }
       }
+    }
+  }
+
+  // Switch back to an AC higher in the table (the preferred one) once it
+  // delivers again without interruption for SWITCH_BACK_SEC, so that a single
+  // missing epoch of the preferred AC does not move the orbits permanently
+  // to another AC, and the orbits do not change back and forth
+  // ------------------------------------------------------------------------
+  const double SWITCH_BACK_SEC = 60.0;
+  QListIterator<cmbAC*> icPref(_ACs);
+  while (icPref.hasNext()) {
+    cmbAC* AC = icPref.next();
+    if (AC->name == _masterOrbitAC[sys]) {
+      break;
+    }
+    if (AC->numObs[sys] > 0 && AC->presentSince[sys].valid() &&
+        epoTime - AC->presentSince[sys] >= SWITCH_BACK_SEC) {
+      out <<  epoTime.datestr().c_str()    << " "
+          << epoTime.timestr().c_str()     << " "
+          << "Switching Master " << sys << " "
+          << _masterOrbitAC[sys].toLatin1().data() << " --> "
+          << AC->name.toLatin1().data()   << " (preferred AC delivers again)\n";
+      _masterOrbitAC[sys] = AC->name;
+      _masterIsAPC[sys]   = _cmbCoM ? false : AC->isAPC;
+      break;
     }
   }
