Index: trunk/MagicSoft/Cosy/main/MCosy.cc
===================================================================
--- trunk/MagicSoft/Cosy/main/MCosy.cc	(revision 2615)
+++ trunk/MagicSoft/Cosy/main/MCosy.cc	(revision 3897)
@@ -712,6 +712,8 @@
 // velocities are limited to the maximum velocity.
 //
-void MCosy::LimitSpeed(ZdAz *vt, const ZdAz &vcalc) const
-{
+Bool_t MCosy::LimitSpeed(ZdAz *vt, const ZdAz &vcalc) const
+{
+    Bool_t rc = kFALSE;
+
     //
     // How to limit the speed. If the wind comes and blowes
@@ -768,6 +770,7 @@
         if (fabs(vt->Az()) > maxtrack*vraz)
         {
-            lout << "Warning: Azimuth speed limit (" << maxtrack*100 << "%) exceeded... limited." << endl;
+            lout << "Warning: Azimuth speed limit (" << maxtrack*100 << "%) exceeded (" << fabs(vt->Az()) << " > " << maxtrack*vraz << ")... limited." << endl;
             vt->Az(maxtrack*vraz*sgn(vcalc.Az()));
+            rc=kTRUE;
         }
 /*
@@ -782,7 +785,9 @@
  */       if (fabs(vt->Zd()) > maxtrack*vrzd)
         {
-            lout << "Warning: Altitude speed limit (" << maxtrack*100 << "%) exceeded... limited." << endl;
+            lout << "Warning: Altitude speed limit (" << maxtrack*100 << "%) exceeded (" << fabs(vt->Zd()) <<" > " << maxtrack*vrzd << ")... limited." << endl;
             vt->Zd(maxtrack*vrzd*sgn(vcalc.Zd()));
-        }
+            rc=kTRUE;
+        }
+    return rc;
 }
 /*
@@ -829,8 +834,11 @@
         pointing.Zd(-pointing.Zd());
         pointing.Az(pointing.Az()+180);
+        //lout << "ZD=-ZD Az+=180" << endl;
     }
 
     const ZdAz se = GetSePos()*2*TMath::Pi()/16384;   // [rad]
     const ZdAz unbendedse = fBending.CorrectBack(se)*kRad2Deg; // ist pointing
+
+    //lout << "Unbended: " << unbendedse.Zd() << " " << unbendedse.Az() << endl;
 
     do
@@ -839,4 +847,6 @@
         if (d>-180 && d<=180)
             break;
+
+        //lout << "AZ += " << TMath::Sign(360., d) << endl;
 
         pointing.Az(pointing.Az()+TMath::Sign(360., d));
@@ -897,6 +907,4 @@
 void MCosy::TrackPosition(const RaDec &dst) // ra, dec [rad]
 {
-    lout << "Track Position: " << dst.Ra()*kRad2Deg/15 << "h, " << dst.Dec()*kRad2Deg << "deg (Ra/Dec)" << endl;
-
     SlaStars sla(fObservatory);
 
@@ -906,4 +914,6 @@
     sla.Now();
     ZdAz dest = sla.CalcZdAz(dst);
+
+    lout << sla.GetTime() << ": Track Position " << dst.Ra()*kRad2Deg/15 << "h, " << dst.Dec()*kRad2Deg <<"deg" << endl;
 
     // FIXME: Determin tracking start point by star culmination
@@ -958,6 +968,7 @@
 
     sla.Now();
-    lout << sla.GetTime() << " - Start tracking:";
-    lout << " Ra: " << xy.X() << "h  " << "Dec: " << xy.Y() << "\xb0" << endl;
+//    lout << sla.GetTime() << " - Start tracking:";
+//    lout << " Ra: " << xy.X() << "h  " << "Dec: " << xy.Y() << "\xb0" << endl;
+
 /*#ifdef EXPERT
     ofstream fout("coordinates.txt");
@@ -971,4 +982,9 @@
     fBackground = kBgdTracking;
 
+    ZdAz pos = sla.CalcZdAz(fRaDec);
+
+    lout << sla.GetTime() << " - Start Tracking: Ra=" <<xy.X() << "h Dec=";
+    lout << xy.Y() << "\xb0 @ Zd=" << pos.Zd()*kRad2Deg <<"deg Az=" << pos.Az()*kRad2Deg <<"deg" << endl;
+
 //---    ofstream fout("log/cosy.pos");
 //---    fout << "Tracking:";
@@ -987,12 +1003,12 @@
         // Request Target position for this moment
         //
-        sla.Now();
+        sla.Now(dt);
 
         //
         // Request theoretical Position for a time in the future (To+dt) from CPU
         //
-        const Double_t mjd = sla.GetMjd()+dt/(60*60*24);
-        const ZdAz pointing = sla.CalcZdAz(fRaDec, mjd); // soll pointing [deg]
-
+         const ZdAz pointing = sla.CalcZdAz(fRaDec); // soll pointing [rad]
+
+        //lout << sla.GetTime() << pointing.Zd()*kRad2Deg << " " << pointing.Az()*kRad2Deg << endl;
         /*
         ZdAz dest;
@@ -1002,9 +1018,13 @@
         ZdAz dest = AlignTrackingPos(pointing);
 
-        ZdAz vcalc = sla.GetApproxVel(fRaDec) * kGearRatio2*4./60.;  // [re/min]
+        // lout << "DEST: " << dest.Zd()*kRad2Deg << " " <<dest.Az()*kRad2Deg << endl;
+
+        ZdAz vcalc = sla.GetApproxVel(fRaDec) * kGearRatio2*4./60.; 
+        //lout << "Vcalc: " << dest.Zd() << " " << dest.Az() << endl;
+        vcalc *= kGearRatio2*4./60.; // [re/min]
 
         float dtime = -1;
         if (kFALSE /*fUseStarguider*/)
-            dtime = Starguider(mjd, dest);
+            dtime = Starguider(sla.GetMjd(), dest);
 
         if (dtime<0)
@@ -1012,4 +1032,6 @@
             dest = fBending(dest);       // [rad]
 
+            //lout << "DEST-BEND: " << dest.Zd()*kRad2Deg << " " <<dest.Az()*kRad2Deg << endl;
+              
             if (!CheckRange(dest))
                 break;
@@ -1032,4 +1054,10 @@
 
             dtime = dt;
+
+            ZdAz repos = GetRePos();
+    //        lout << "Repos: " << repos.Zd()/kGearRatio.X() << " " << repos.Az()*kGearRatio.Y() << endl;
+   //         repos /= kGearRatio;
+            repos /= 16384/TMath::Pi()/2;
+            repos *= kRad2Deg;
         }
 
@@ -1045,5 +1073,10 @@
         //
         ZdAz vt = v/4;
-        LimitSpeed(&vt, vcalc);
+        if (LimitSpeed(&vt, vcalc))
+        {
+            lout << "Vcalc: " << vcalc.Zd() << " " << vcalc.Az() << "re/min" <<endl;
+            lout << "vt: " << vt.Zd() << " " << vt.Az() << "re/min" << endl;
+            lout << "Dest: " << dest.Zd() << " " << dest.Az() << endl;
+        }              
         vt.Round();
 
Index: trunk/MagicSoft/Cosy/main/MCosy.h
===================================================================
--- trunk/MagicSoft/Cosy/main/MCosy.h	(revision 2615)
+++ trunk/MagicSoft/Cosy/main/MCosy.h	(revision 3897)
@@ -143,5 +143,5 @@
     void InitSync();
     bool InitTracking();
-    void LimitSpeed(ZdAz *vt, const ZdAz &vcalc) const;
+    Bool_t LimitSpeed(ZdAz *vt, const ZdAz &vcalc) const;
 
     void TalkThread();
