Index: trunk/MagicSoft/Cosy/main/MCosy.cc
===================================================================
--- trunk/MagicSoft/Cosy/main/MCosy.cc	(revision 1742)
+++ trunk/MagicSoft/Cosy/main/MCosy.cc	(revision 1757)
@@ -391,4 +391,12 @@
 {
     // FIXME: Correct by fOffset ?
+
+    const ZdAz d = dst*kRad2Deg;
+    if (d.Zd()<fMin.Zd() || d.Zd()>fMax.Zd() || d.Az()<fMin.Az() || d.Az()>fMax.Az())
+    {
+        lout << "ERROR: Requested Position not inside allowed range." << endl;
+        return kFALSE;
+    }
+
 
     /*
@@ -724,5 +732,13 @@
         ZdAz dummy = fBending(sla.CalcZdAz(fRaDec));
         dest = CorrectTarget(GetSePos(), dummy); // [se]
+
+        const ZdAz d = dest*360./16384; // [deg]
         dest *= kGearRatio;  // [re]
+
+        if (d.Zd()<fMin.Zd() || d.Zd()>fMax.Zd() || d.Az()<fMin.Az() || d.Az()>fMax.Az())
+        {
+            lout << "ERROR: Calculated position for T+dt not inside allowed range." << endl;
+            break;
+        }
 
         ZdAz vcalc = sla.GetApproxVel(fRaDec) * kGearRatio2*4./60.;  // [re/min]
@@ -1070,4 +1086,17 @@
     TEnv env(".cosyrc");
     cout << "done." << endl;
+
+    cout << "Reading telescope range..." << flush;
+    const Double_t amin = env.GetValue("Az_Min", -90.0);
+    const Double_t zmin = env.GetValue("Zd_Min", -90.0);
+    fMin.Set(zmin, amin);
+
+    cout << " Min: " << zmin << "deg  " << amin << "deg" << endl;
+
+    const Double_t amax = env.GetValue("Az_Max", 318.0);
+    const Double_t zmax = env.GetValue("Zd_Max", 100.0);
+    fMax.Set(zmax, amax);
+
+    cout << " Max: " << zmax << "deg  " << amax << "deg" << endl;
 
     cout << "Reading gear ratios..." << flush;
Index: trunk/MagicSoft/Cosy/main/MCosy.h
===================================================================
--- trunk/MagicSoft/Cosy/main/MCosy.h	(revision 1742)
+++ trunk/MagicSoft/Cosy/main/MCosy.h	(revision 1757)
@@ -83,4 +83,6 @@
     ZdAz  fAccuracy;      // Actual accuracy of Tracking
     ZdAz  fVelocity;      // Actual velocity of Tracking
+    ZdAz  fMin;
+    ZdAz  fMax;
 
     XY kGearRatio;        // describing the gear of the system [re/se]
