Index: trunk/FACT++/scripts/Main.js
===================================================================
--- trunk/FACT++/scripts/Main.js	(revision 15016)
+++ trunk/FACT++/scripts/Main.js	(revision 15026)
@@ -649,21 +649,42 @@
         dim.wait("DRIVE_CONTROL", "OnTrack", 300000);
 
+        OpenLid();
+
+        service_feedback.voltageOn();
+        service_feedback.waitForVoltageOn();
+
         // Checking if system is Ready for Data Taking, which is in this case 
         // the same as Ready for RateScan.
-        //
-        // this part might be simply wrong here, since I should be able to expect
-        // the system to be able for data taking. And if not, then it is not here,
-        // to bring the system into a better state, correct?
-
-        // [TB] Either here the system have to be brought to the correct state, or
-        //      it has to be ensured that the previous code brought the system to a correct
-        //      state. In this case checkStates could be used (but is a bit of obsolete)
-        //      Doing non-throwing checks without checking the return value does not make
-        //      sense at all.
-        dim.wait("FEEDBACK", "CurrentControl", -100);
-        dim.wait("BIAS_CONTROL", "VoltageOn", -100);
-        dim.wait("FAD_CONTROL", "Connected", -100);
-
-        dim.wait("RATE_SCAN","Connected", 5000);
+        console.out("  Checking states [ratescan]");
+        var table =
+            [
+             [ "TNG_WEATHER"   ],
+             [ "MAGIC_WEATHER" ],
+             [ "CHAT"          ],
+             [ "SMART_FACT"    ],
+             [ "DATA_LOGGER",     [ "NightlyFileOpen", "WaitForRun", "Logging" ] ],
+             [ "FSC_CONTROL",     [ "Connected"                ] ],
+             [ "MCP",             [ "Idle"                     ] ],
+             [ "TIME_CHECK",      [ "Valid"                    ] ],
+             [ "PWR_CONTROL",     [ "SystemOn"                 ] ],
+             [ "AGILENT_CONTROL", [ "VoltageOn"                ] ],
+             [ "BIAS_CONTROL",    [ "VoltageOn", "Ramping"     ] ],
+             [ "FEEDBACK",        [ "CurrentControl"           ] ],
+             [ "RATE_SCAN",       [ "Connected"                ] ],
+             [ "RATE_CONTROL",    [ "Connected", "InProgress"  ] ],
+             [ "LID_CONTROL",     [ "Open"                     ] ],
+             [ "DRIVE_CONTROL",   [ "Tracking", "OnTrack"      ] ],
+             [ "FTM_CONTROL",     [ "Idle",                    ] ],
+             [ "FAD_CONTROL",     [ "Connected", "WritingData" ] ],
+            ];
+
+        if (!checkStates(table))
+        {
+            throw new Error("Something unexpected has happened. One of the servers"+
+                            "is in a state in which it should not be. Please,"+
+                            "try to find out what happened...");
+        }
+
+        // Start rate scan
         dim.send("RATE_SCAN/START_THRESHOLD_SCAN", 50, 1000, -10);
 
