Index: /branches/green_dot/build
===================================================================
--- /branches/green_dot/build	(revision 164)
+++ /branches/green_dot/build	(revision 165)
@@ -1,5 +1,5 @@
 #!/bin/bash
 # Compile everything and produce the executable client
-g++ -g fep_client.cpp fep_clnt.c fep_xdr.c -o client 
+g++ -g DataPacker.cpp fep_client.cpp fep_clnt.c fep_xdr.c -o client 
 
 
Index: /branches/green_dot/network.h
===================================================================
--- /branches/green_dot/network.h	(revision 138)
+++ /branches/green_dot/network.h	(revision 165)
@@ -9,11 +9,11 @@
 const int CONTROL_DATA_LEN = 27;
 char * const dp5[8] = { "ML_1", "ML_2", "ML_3", "ML_4", "ML_5",
-                                                "ML_6", "HOV_Lane", "FYW_Conn"};
+   "ML_6", "HOV_Lane", "FYW_Conn"};
 char * const dp6[8] = { "OS_1", "OS_2", "OS_3", "OS_4", "OS_5",
-                                                "OS_6", "COLL_DIST_2", "COLL_DIST_OFF"};
+   "OS_6", "COLL_DIST_2", "COLL_DIST_OFF"};
 char * const dp7[8] = { "DEMAND", "PASSAGE", "QUEUE", "RAMP_ON",
-                                                "RAMP_OFF", "RAMP_HOV", "COLL_DIST_1", "COLL_DIST_ON"};
+   "RAMP_OFF", "RAMP_HOV", "COLL_DIST_1", "COLL_DIST_ON"};
 char * const dp8[8] = { "SD_1", "SD_2", "SD_3", "SD_4", "SD_5",
-                                                "SD_6", "Pass_Vol_Count", "X"};
+   "SD_6", "Pass_Vol_Count", "X"};
 
 /*** NETWORK STRUCTS ***/
@@ -21,14 +21,14 @@
 struct loopagg
 {
-	int		index;
-	char	lane;			// how namy lanes at the detector station
-	long	time;
-	int		interval;
-	int 	g_vol;
-	float	g_occ;
-	double	g_spd;
-	int		*vol;
-	float	*occ;
-	double	*spd;
+   int		index;
+   char	lane;			// how namy lanes at the detector station
+   long	time;
+   int		interval;
+   int 	g_vol;
+   float	g_occ;
+   double	g_spd;
+   int		*vol;
+   float	*occ;
+   double	*spd;
 };
 
@@ -37,37 +37,57 @@
 struct  fep_line_lds
 {
-	int		lineNum;
-	vector<long> lds;
-	vector<long> ldsIndex;	// location in ldsMap
-	short	ldsNum;			// actual number of lds on the line
+   int		lineNum;
+   vector<long> lds;
+   vector<long> ldsIndex;	// location in ldsMap
+   short	ldsNum;			// actual number of lds on the line
 
-	short	count;	// actual count from caltrans
-	int		schedule;
-	int		lineInfo;
-	long	systemKey;
-	long	globalSeq;
-	long	schedleSeq;
+   short	count;	// actual count from caltrans
+   int		schedule;
+   int		lineInfo;
+   long	systemKey;
+   long	globalSeq;
+   long	schedleSeq;
+};
+// Loop detector
+typedef struct loop LOOP;
+struct loop
+{
+   long loopID;
+   char *loop_loc;
+
+   int vol;
+   float occ;
+   double spd;
 };
 
 // Loop detector station: has several loops
-typedef struct Lds_loop LDS_LOOP;
-struct  Lds_loop 
+typedef struct Station STATION;
+struct  Station 
 {
-	// Each lds has its own line_num and drop (Caltrans use)
-	long	lds;
-	short	line_num;
-	short	drop;
+   // Each lds has its own line_num and drop (Caltrans use)
+   long	lds;
+   short	line_num;
+   short	drop;
 
-	int		num;	// number of loops
-	long	*loopID;
-	char	**loop_loc;
+   vector<LOOP*> loops;
 
-	// LDS data
-	unsigned char	*dataPack;
-	int		length;		// total length of data (max: 87)
-	int		pos;		// pointer for data preparation
-	int		MlTotVol;	// each 30 sec, the following will be updated
-	int		OppTotVol;	// each 30 sec, the following will be updated
+   int		num;	// number of loops
+   // LDS data
+   unsigned char	*dataPack;
+   int		length;		// total length of data (max: 87)
+   int		pos;		// pointer for data preparation
+   int		MlTotVol;	// each 30 sec, the following will be updated
+   int		OppTotVol;	// each 30 sec, the following will be updated
+};
+// A helper structure used to pack the volume and occupancy at a loop into
+// // a two byte message
+typedef struct volOcc VOLOCC;
+struct  volOcc
+{
+   char high;
+   char low;
 };
 
+
+
 #endif
Index: /branches/green_dot/DataPacker.cpp
===================================================================
--- /branches/green_dot/DataPacker.cpp	(revision 165)
+++ /branches/green_dot/DataPacker.cpp	(revision 165)
@@ -0,0 +1,269 @@
+#include "DataPacker.h"
+#include <stdio.h>
+
+unsigned char * DataPacker::msg;
+
+unsigned char * DataPacker::packData(STATION *station) {
+    int pos = 26;
+    DataPacker packer;
+    msg = packer.staticDataPack(station);
+    pos = packer.dynamicDataPack(station, 5, pos);    
+    pos = packer.dynamicDataPack(station, 6, pos);
+    pos = packer.dynamicDataPack(station, 7, pos);
+    pos = packer.dynamicDataPack(station, 8, pos);
+    // Update data for BYTE 9, 16, 21, 22, 23, 24
+
+    // what is the current metering rate?
+    // check each LDS, if there is demand detector, the downstream node the
+    // ldsMap[i].dataPack[22-1] = ldsMap[i].dataPack[9-1] = ;
+
+    // will need to check if queue override is enabled (Currently, no queue
+    // ldsMap[i].dataPack[16-1] = ;
+
+    // byte 23: MAINLINE total volume
+    msg[23 - 1] = station->MlTotVol;
+
+    // byte 24: opposite total volume
+    msg[24 - 1] = station->OppTotVol;
+
+    // last BYTE: checksum 
+    msg[station->length - 1] =
+            packer.chksum(msg, station->length - 1 - 1);
+    
+    for (int j = 0; j < station->length; j++) {
+        printf("%02X", msg[j]);
+    }
+    printf("\n");
+
+    return msg;	
+}
+
+int DataPacker::dynamicDataPack(STATION *station, int packNo, int pos) {
+    int i, j, vol, occ, haveData;
+    //used for data byte 23 and 24
+    station->MlTotVol = 0;
+    station->OppTotVol = 0;
+
+    for (j = 1; j <= 8; j++) {
+        
+        if (DataAvail(msg[packNo - 1], j)) {
+            // loop at bit j has data
+            for (int lane = 0; lane < station->loops.size(); lane++) {
+                // what's the corresponding loop of bit j
+                char * currLoopLoc = station->loops.at(lane)->loop_loc;
+                if (packNo == 5)
+                    haveData = strcmp(currLoopLoc, dp5[j - 1]);
+                else if (packNo == 6)
+                    haveData = strcmp(currLoopLoc, dp6[j - 1]);
+                else if (packNo == 7)
+                    haveData = strcmp(currLoopLoc, dp7[j - 1]);
+                else if (packNo == 8)
+                    haveData = strcmp(currLoopLoc, dp8[j - 1]);
+                else
+                    return -1;
+                
+                // if we have data (strcmp returns 0 if a string match)
+                if (haveData == 0) {
+                    LOOP *currLoop = station->loops.at(lane);
+                    vol = currLoop->vol;
+                    occ = (int) (currLoop->occ * 900 + 0.5);
+                    cout << "Volume: " << vol << endl;
+                    cout << "OCC : " << occ << endl;
+                    VOLOCC packedVOLOCC = packVOLOCC(vol, occ);
+                    pos++;
+                    msg[pos - 1] = packedVOLOCC.high;
+                    pos++;
+                    msg[pos - 1] = packedVOLOCC.low;
+                    
+                    if (packNo == 5) {
+                        station->MlTotVol += vol;
+                    } else if (packNo == 6) {
+                        station->OppTotVol += vol;
+                    }
+                }
+            }
+        }
+    }
+    return pos;
+}
+
+unsigned char * DataPacker::staticDataPack(STATION *station) {
+    int j;
+    // Allocate memory for dataPack
+    unsigned char *dataPack = (unsigned char *) calloc(sizeof(unsigned char), station->length);
+
+    // dataPack 5-8: lane config
+    char d5 = 0, d6 = 0, d7 = 0, d8 = 0;
+    for (j = 0; j < station->loops.size(); j++) {
+        for (int k = 0; k < 8; k++) {
+            char * currLoopLoc = station->loops.at(j)->loop_loc;
+            if (strcmp(currLoopLoc, dp5[k]) == 0)
+                d5 += pow(2, k);
+            if (strcmp(currLoopLoc, dp6[k]) == 0)
+                d6 += pow(2, k);
+            if (strcmp(currLoopLoc, dp7[k]) == 0)
+                d7 += pow(2, k);
+            if (strcmp(currLoopLoc, dp8[k]) == 0)
+                d8 += pow(2, k);
+        }
+    }
+    dataPack[5 - 1] = d5;
+    dataPack[6 - 1] = d6;
+    dataPack[7 - 1] = d7;
+    dataPack[8 - 1] = d8;
+
+    // dataPack 1: Drop number, i.e. station address
+    dataPack[1 - 1] = station->drop;
+    // dataPack2 (2 bytes per loop)
+    dataPack[2 - 1] = station->loops.size() * 2 + Fixed_Byte_To_Checksum;
+
+    // dataPacket 3 (lowbyte: # of mainline loops, highbyte: # of opposite loops)
+    int low = 0, high = 0;
+    for (j = 1; j <= 6; j++) {
+        low += DataAvail(dataPack[5 - 1], j);
+        high += DataAvail(dataPack[6 - 1], j);
+    }
+    high = high << 4;
+    dataPack[3 - 1] = high | low;
+
+    // dataPack4 (Miscl. flags: samples are: 80, A0, E0, 00)
+    dataPack[4 - 1] = 0xA0;
+
+    // dataPack 9: initialized as 00 (meaning no metering); need to be updated every 30 sec
+    dataPack[9 - 1] = 0;
+
+    // datadataPack 10-13: lane malfunction? Assuming all functional
+    dataPack[10 - 1] = 0;
+    dataPack[11 - 1] = 0;
+    dataPack[12 - 1] = 0;
+    dataPack[13 - 1] = 0;
+
+    // dataPack 14-22: ramp metering data
+    // BYTE 16 and 22 need to be updated every 30 sec
+    bool found = false;
+    for (j = 0; j < station->loops.size(); j++) {
+        if (strcmp(station->loops.at(j)->loop_loc, "DEMAND") == 0) {
+            found = true;
+            break;
+        }
+    }
+    if (found) {
+        // BYTE 14: mostly 07, some are 05, 03, 00
+        dataPack[14 - 1] = 0x07;
+        // mostly 06(TOD table 1); some are 0B (No metering) or 05(traffic responsive)
+        dataPack[15 - 1] = 0x06;
+        // most 00, some are 01 (queue override) or 80(Meter ON sign)
+        dataPack[16 - 1] = 0x00;
+        // Field Manual Rate
+        dataPack[17 - 1] = 0xFF;
+        // TOC Manual Rate
+        dataPack[18 - 1] = 0xFF;
+        // PSO Manual Rate
+        dataPack[19 - 1] = 0xFF;
+        // CORM Rate
+        dataPack[20 - 1] = 0xFF;
+        // Local Responsive Rate. DON'T UNDERSTAND YET
+        dataPack[21 - 1] = 0x00;
+        // TOD Rate: need to query RAMP plugin!
+        dataPack[22 - 1] = 0x00;
+    }// LDS: NO Metering
+    else {
+        dataPack[14 - 1] = 0x00;
+        dataPack[15 - 1] = 0x0B;
+        dataPack[16 - 1] = 0x00;
+        dataPack[17 - 1] = 0xFF;
+        dataPack[18 - 1] = 0xFF;
+        dataPack[19 - 1] = 0xFF;
+        dataPack[20 - 1] = 0xFF;
+        dataPack[21 - 1] = 0x00;
+        dataPack[22 - 1] = 0x00;
+    }
+
+    // dataPack 23-24: sum of mainline/Opp traffic data; need to be updated every 30 sec
+    station->MlTotVol = 0;
+    station->OppTotVol = 0;
+    dataPack[23 - 1] = station->MlTotVol;
+    dataPack[24 - 1] = station->OppTotVol;
+
+    // dataPack 25-26: BYTE 25 is fixed, i.e. 03; BYTE 26 is either 0xA2 or 0x84
+    dataPack[25 - 1] = 0x03;
+    dataPack[26 - 1] = 0x84;
+
+    return dataPack;
+}
+
+bool DataPacker::DataAvail(char flag, int num) {
+    int mag, fel;
+
+    // find mask value
+    if (num == 1)
+        mag = 0x01;
+    else if (num == 2)
+        mag = 0x02;
+    else if (num == 3)
+        mag = 0x04;
+    else if (num == 4)
+        mag = 0x08;
+    else if (num == 5)
+        mag = 0x10;
+    else if (num == 6)
+        mag = 0x20;
+    else if (num == 7)
+        mag = 0x40;
+    else if (num == 8)
+        mag = 0x80;
+
+    fel = flag & mag;
+    fel = fel >> (num - 1);
+
+    if (fel == 1)
+        return true;
+    else
+        return false;
+}
+
+// checksum based on data from byte 1 (after 0DOA) to the second last byte (the 
+char DataPacker::chksum(unsigned char *dataptr, int len) {
+    int i;
+    unsigned char checksum = 0;
+
+    for (i = 0; i < len; i++)
+        checksum += dataptr[i];
+
+    return checksum;
+}
+
+// convert vol and occ data to a two-byte data packet
+VOLOCC DataPacker::packVOLOCC(int vol, int occ)
+{
+   int bit, i;
+   int   high, low; 
+   int high_high = 0, high_low = 0;
+   VOLOCC com;
+   
+   // occ data: 10 bits
+   low = 0;
+   for (i=9; i>=0; i--) 
+   {
+      if (i >= 8)
+      {
+         bit = ((occ >> i) & 1);
+         high_low += pow(2, (i - 8)) * bit; 
+      }
+      // lower byte
+      else
+      {
+         bit = ((occ >> i) & 1);
+         low += pow(2, i) * bit;
+      }
+   }
+
+   // vol: 6 bits (1. vol, shift to the left for two times; 2. combine data)
+   high_high = vol << 2;
+   high = high_high | high_low;
+
+   com.high = high;
+   com.low = low;
+
+   return com;
+}
Index: /branches/green_dot/network_factory.cpp
===================================================================
--- /branches/green_dot/network_factory.cpp	(revision 164)
+++ /branches/green_dot/network_factory.cpp	(revision 165)
@@ -1,3 +1,4 @@
 #include "network.h"
+#include "DataPacker.h"
 #include <vector>
 #include <math.h>
@@ -6,152 +7,4 @@
 #include <cstdlib>
 
-// determine if a loop has data based on lane config data
-bool DataAvail(char flag, int num) {
-	int mag, fel;
-
-	// find mask value
-	if (num == 1)
-		mag = 0x01;
-	else if (num == 2)
-		mag = 0x02;
-	else if (num == 3)
-		mag = 0x04;
-	else if (num == 4)
-		mag = 0x08;
-	else if (num == 5)
-		mag = 0x10;
-	else if (num == 6)
-		mag = 0x20;
-	else if (num == 7)
-		mag = 0x40;
-	else if (num == 8)
-		mag = 0x80;
-	
-	fel = flag & mag;
-	fel = fel >> (num - 1);
-	
-	if (fel == 1)
-		return true;
-	else 
-		return false;
-}
-
-// Initializes the LDS_LOOP dataPack with all necessary static data and default dynamic data
-void init_loop_dataPack(LDS_LOOP *loop)
-{
-	int j;
-	// Allocate memory for dataPack
-	loop->dataPack = (unsigned char *) calloc(sizeof(unsigned char), loop->length);
-
-	// dataPack 5-8: lane config
-	char d5 = 0, d6 = 0, d7 = 0, d8 = 0;		
-	for (j = 0; j < loop->num; j++)
-	{
-		for (int k = 0; k < 8; k++)
-		{
-			if (strcmp(loop->loop_loc[j], dp5[k]) == 0)
-				d5 += pow(2, k);
-			if (strcmp(loop->loop_loc[j], dp6[k]) == 0)
-				d6 += pow(2, k);
-			if (strcmp(loop->loop_loc[j], dp7[k]) == 0)
-				d7 += pow(2, k);
-			if (strcmp(loop->loop_loc[j], dp8[k]) == 0)
-				d8 += pow(2, k);
-		}
-	}
-	loop->dataPack[5-1] = d5;
-	loop->dataPack[6-1] = d6;
-	loop->dataPack[7-1] = d7;
-	loop->dataPack[8-1] = d8;
-
-	// dataPack 1: Drop number, i.e. station address
-	loop->dataPack[1-1] = loop->drop;
-
-	// dataPack2 (2 bytes per loop)
-	loop->dataPack[2-1] = loop->num * 2 + Fixed_Byte_To_Checksum;
-
-	// dataPacket 3 (lowbyte: # of mainline loops, highbyte: # of opposite loops)
-	int low = 0, high = 0;
-	for (j = 1; j <= 6; j++)
-	{
-		low += DataAvail(loop->dataPack[5-1], j);
-		high += DataAvail(loop->dataPack[6-1], j);
-	}
-	high = high << 4;
-	loop->dataPack[3-1] = high | low;
-
-	// dataPack4 (Miscl. flags: samples are: 80, A0, E0, 00)
-	loop->dataPack[4-1] = 0xA0;
-
-	// dataPack 9: initialized as 00 (meaning no metering); need to be updated every 30 sec
-	loop->dataPack[9-1] = 0;
-
-	// datadataPack 10-13: lane malfunction? Assuming all functional
-	loop->dataPack[10-1] = 0;
-	loop->dataPack[11-1] = 0;
-	loop->dataPack[12-1] = 0;
-	loop->dataPack[13-1] = 0;
-
-	// dataPack 14-22: ramp metering data
-	// BYTE 16 and 22 need to be updated every 30 sec
-	bool found = false;
-	for (j = 0; j < loop->num; j++)
-	{
-		if (strcmp(loop->loop_loc[j], "DEMAND") == 0)
-		{
-			found = true;
-			break;
-		}
-	}
-	if (found)
-	{
-		// BYTE 14: mostly 07, some are 05, 03, 00
-		loop->dataPack[14-1] = 0x07;
-		// mostly 06(TOD table 1); some are 0B (No metering) or 05(traffic responsive)
-		loop->dataPack[15-1] = 0x06;
-		// most 00, some are 01 (queue override) or 80(Meter ON sign)
-		loop->dataPack[16-1] = 0x00;
-		// Field Manual Rate
-		loop->dataPack[17-1] = 0xFF;
-		// TOC Manual Rate
-		loop->dataPack[18-1] = 0xFF;
-		// PSO Manual Rate
-		loop->dataPack[19-1] = 0xFF;
-		// CORM Rate
-		loop->dataPack[20-1] = 0xFF;
-		// Local Responsive Rate. DON'T UNDERSTAND YET
-		loop->dataPack[21-1] = 0x00;
-		// TOD Rate: need to query RAMP plugin! 
-		loop->dataPack[22-1] = 0x00;
-	}
-	// LDS: NO Metering
-	else
-	{
-		loop->dataPack[14-1] = 0x00;
-		loop->dataPack[15-1] = 0x0B;
-		loop->dataPack[16-1] = 0x00;			
-		loop->dataPack[17-1] = 0xFF;
-		loop->dataPack[18-1] = 0xFF;
-		loop->dataPack[19-1] = 0xFF;
-		loop->dataPack[20-1] = 0xFF;
-		loop->dataPack[21-1] = 0x00;
-		loop->dataPack[22-1] = 0x00;
-	}
-
-	// dataPack 23-24: sum of mainline/Oppsite traffic data; need to be updated every 30 sec
-	loop->MlTotVol = 0;
-	loop->OppTotVol = 0;
-	loop->dataPack[23-1] = loop->MlTotVol;	
-	loop->dataPack[24-1] = loop->OppTotVol;	
-	
-	// dataPack 25-26: BYTE 25 is fixed, i.e. 03; BYTE 26 is either 0xA2 or 0x84
-	loop->dataPack[25-1] = 0x03;
-	loop->dataPack[26-1] = 0x84;
-
-	printf("lds=%d (%d), p1=%2X, p2=%2X, p3=%2X, p5=%2X, p6=%X, p7=%X, p8=%2X\n", 
-		loop->lds, loop->length, loop->dataPack[1-1], loop->dataPack[2-1], 
-		loop->dataPack[3-1], loop->dataPack[5-1], 
-		loop->dataPack[6-1], loop->dataPack[7-1], loop->dataPack[8-1]);
-}
 
 // TEST DATA
@@ -190,8 +43,8 @@
 
 //55	S	6.88	1203103	1203110	1203114	ML	4	ML_4       	55s6.88ml    	1
-LDS_LOOP * load_lds(const char * fName)
+STATION * load_lds(const char * fName)
 {
 	/* Read loop meta data */
-	LDS_LOOP *lds_map = (LDS_LOOP *) calloc(sizeof(LDS_LOOP), 1);
+	STATION *lds_map = (STATION *) calloc(sizeof(STATION), 1);
 	lds_map[0].lds = 1203103;
 	lds_map[0].line_num = 50;
@@ -199,16 +52,17 @@
 	lds_map[0].num = 1;
 
-	// Loop ids
-	long *loopIDs = (long *) calloc(sizeof(long), lds_map[0].num);
-	loopIDs[0] = 1203113;
-	lds_map[0].loopID = loopIDs;
-	
-	// Loop locations
-	char *loc = "ML_3";
-	lds_map[0].loop_loc = &loc;
-
+   LOOP *loop = new LOOP;
+   loop->loopID = 1203113;
+   loop->loop_loc = "ML_3";
+   loop->vol = 40;
+   loop->occ = 10;
+   loop->spd = 10;
+   
+   lds_map[0].loops.push_back(loop);
+   
 	// Init Loop dataPack
 	lds_map[0].length = lds_map[0].num * 2 + CONTROL_DATA_LEN;
- 	init_loop_dataPack(lds_map);
+
+   lds_map[0].dataPack = DataPacker::packData(&lds_map[0]);
 
 	lds_map[0].pos = 0;
Index: /branches/green_dot/DataPacker.h
===================================================================
--- /branches/green_dot/DataPacker.h	(revision 165)
+++ /branches/green_dot/DataPacker.h	(revision 165)
@@ -0,0 +1,49 @@
+/* 
+ * File:   DataPacker.h
+ *
+ * DataPacker has a single static public method packData(..) that returns the
+ * packed data message that is sent to the ATMS Server in the fep_reply struct
+ * via RPC.
+ * 
+ * @author John A. Torres
+ * @version 9/8/2017
+ */
+
+#ifndef DATAPACKER_H
+#define	DATAPACKER_H
+
+// Include dependencies
+#include "network.h"
+#include <iostream>
+#include <string.h>
+#include <stdio.h>
+#include <math.h>
+#include <cstdlib>
+class DataPacker {
+    
+public:
+    /**
+     * Returns packed data message to be sent to ATMS Server in fep_reply via RPC
+     * 
+     * @param station The station for which the message is to be made
+     * @return The packed data message
+     */
+    static unsigned char * packData(STATION *station);
+
+private:
+    static unsigned char *msg;
+    // Packs the static data in message sent to ATMS
+    unsigned char * staticDataPack(STATION *station);
+    // Packs dynamic data in message sent to ATMS
+    int dynamicDataPack(STATION *station, int packNo, int pos);
+    // Sets last byte of message
+    char chksum(unsigned char *dataptr, int len);
+    // Tells whether or not data is available for specified lane
+    bool DataAvail(char flag, int num);
+    // Helper function: packs vol and occ into two byte data packet
+    VOLOCC packVOLOCC(int vol, int occ);
+
+};
+
+#endif	/* DATAPACKER_H */
+
Index: /branches/green_dot/fep_client.cpp
===================================================================
--- /branches/green_dot/fep_client.cpp	(revision 138)
+++ /branches/green_dot/fep_client.cpp	(revision 165)
@@ -28,5 +28,5 @@
 }
 
-void xfer_replys(CLIENT *clnt, FEP_LINE_LDS *lines, int lines_size, LDS_LOOP *ldsMap)
+void xfer_replys(CLIENT *clnt, FEP_LINE_LDS *lines, int lines_size, STATION *ldsMap)
 {
 	int i, j; // i == line_index, j == lds_index
@@ -140,5 +140,5 @@
 	FEP_LINE_LDS *lines = load_lines(&lines_size, "./lines_atms.txt");
 	printf("Loading ldsMap...\n");
-	LDS_LOOP *ldsMap = load_lds("./lds_atms.txt");
+	STATION *ldsMap = load_lds("./lds_atms.txt");
 
 	/* Transfer data to ATMS */
