Index: branches/FEPSimulator/FEPSim.cpp
===================================================================
--- branches/FEPSimulator/FEPSim.cpp	(revision 215)
+++ branches/FEPSimulator/FEPSim.cpp	(revision 217)
@@ -7,15 +7,22 @@
     this->FEP_REV = FEP_REV;
     this->SOCK_PORT = SOCK_PORT;
+    
+    // clear log file
+    FEPLogFile.open(FEPLogFileName, ios::trunc);
+    FEPLogFile.close();
 }
 
-FEPSim::~FEPSim() { 
+FEPSim::~FEPSim() {
+    FEPLogFile.close();
 }
 
 void FEPSim::handleCallResponse(void *response) {
     // Failed RPC Call 
-    if (response == NULL) { clnt_perror(clnt, "RPC call failed");
+    if (response == NULL) { 
+        clnt_perror(clnt, "RPC call failed");
     }
     // Successful RPC Call
-    else { cout << "Successful RPC call to ATMS..." << endl;
+    else { 
+        FEPLogFile << "Successful RPC call to ATMS..." << endl;
     }
 }
@@ -30,5 +37,5 @@
     for (int i = 0; i < lines.size(); i++) {
         fep_reply fepReply;
-        cout << "Sending fepReply for line #" << lines.at(i)->lineNum << endl;
+        
         // populate reply
         fepReply.reply = SHORTPOLL;
@@ -37,11 +44,4 @@
         fepReply.kind = (enum polltype) 0;
         fepReply.flag = (enum replykind) 0;
-
-        /***********************************
-         * We might need to handle this on the java side if its an
-         * issue
-        lines.at(i).schedleSeq += 1;
-        lines.at(i).globalSeq += 51;
-         */
 
         fepReply.schedule_sequence = lines.at(i)->schedleSeq;
@@ -90,11 +90,11 @@
             fepReply.answers.fep_answer_list_u.shortp.answers[0] = fsa;
             // send out data
-            //printf("Transferring line=%d, lds_drop_no=%d...\n", lines.at(i)->lineNum, (int)ldsMap.at(index)->drop);
-            // Make RPC Call and handle response
-            // printf("Handling ATMS response...\n");
+            
+            FEPLogFile << "Sending fepReply for line #" << lines.at(i)->lineNum 
+                    << " station number #" 
+                    << ldsMap.at(lines.at(i)->ldsIndex.at(j)) << endl;
+            
             // Transfer the station data to ATMS and listen for response
             handleCallResponse(fep_reply_xfer_32(&fepReply, clnt));
-            unsigned int sleepseconds = 50000;
-            usleep(sleepseconds);
         }
     }
@@ -108,8 +108,8 @@
         // Prepare and send the highway status as FEP replies
         sendReplys(buffer);
-        cout << "Destroying client..." << endl;
+        FEPLogFile << "Destroying client..." << endl;
         clnt_destroy(clnt);
         int startTime = time(NULL);
-        cout << "time is: " << startTime << endl;
+        FEPLogFile << "time is: " << startTime << endl;
     }
 }
@@ -127,5 +127,5 @@
         success = false;
     } else {
-        cout << "Client created" << endl;
+        FEPLogFile << "Client created" << endl;
     }
     return success;
@@ -185,6 +185,4 @@
             totBytes += n;
         }
-        HighwaysParser highwaysParser = HighwaysParser(buffer);
-
 
         if (n < 0) {
@@ -192,7 +190,10 @@
             exit(1);
         }
-
+        
+        FEPLogFile.open(FEPLogFileName, ios::app);
         // send data to atms
         manageClientConnection(buffer);
+        FEPLogFile << "attempt" << endl;
+        FEPLogFile.close();
     }
 }
