Changeset 79 in tmcsimulator
- Timestamp:
- 10/05/2017 12:51:23 PM (9 years ago)
- Files:
-
- 29 added
- 31 edited
- 6 copied
-
branches/ATMSDriver/build/built-jar.properties (modified) (1 diff)
-
branches/ATMSDriver/build/classes/atmsdriver/ATMSDriver.class (modified) (previous)
-
branches/ATMSDriver/build/classes/atmsdriver/NetworkReader.class (modified) (previous)
-
branches/ATMSDriver/build/classes/atmsdriver/network/model/FEPLine$XML_TAGS.class (modified) (previous)
-
branches/ATMSDriver/build/classes/atmsdriver/network/model/FEPLine.class (modified) (previous)
-
branches/ATMSDriver/build/classes/atmsdriver/network/model/LoopDetector$XML_TAGS.class (modified) (previous)
-
branches/ATMSDriver/build/classes/atmsdriver/network/model/LoopDetectorStation$DIRECTION.class (modified) (previous)
-
branches/ATMSDriver/build/classes/atmsdriver/network/model/LoopDetectorStation$XML_TAGS.class (modified) (previous)
-
branches/ATMSDriver/build/classes/atmsdriver/network/model/LoopDetectorStation.class (modified) (previous)
-
branches/ATMSDriver/build/classes/atmsdriver/network/model/Network$XML_TAGS.class (modified) (previous)
-
branches/ATMSDriver/build/classes/atmsdriver/network/model/Network.class (modified) (previous)
-
branches/ATMSDriver/dist/ATMSDriver.jar (modified) (previous)
-
branches/ATMSDriver/nbproject/private/private.xml (modified) (1 diff)
-
branches/fep_rpc_client/DataPacker.cpp (added)
-
branches/fep_rpc_client/DataPacker.h (added)
-
branches/fep_rpc_client/FEPClient.cpp (modified) (6 diffs)
-
branches/fep_rpc_client/FEPClient.h (modified) (2 diffs)
-
branches/fep_rpc_client/NetworkReader.cpp (modified) (3 diffs)
-
branches/fep_rpc_client/NetworkReader.h (modified) (4 diffs)
-
branches/fep_rpc_client/build/Debug/GNU-Linux-x86/DataPacker.o.d (added)
-
branches/fep_rpc_client/build/Debug/GNU-Linux-x86/FEPClient.o.d (modified) (2 diffs)
-
branches/fep_rpc_client/build/Debug/GNU-Linux-x86/NetworkReader.o.d (modified) (2 diffs)
-
branches/fep_rpc_client/dist/Debug/GNU-Linux-x86/fep_rpc_client (modified) (previous)
-
branches/fep_rpc_client/nbproject/Makefile-Debug.mk (modified) (3 diffs)
-
branches/fep_rpc_client/nbproject/Makefile-Release.mk (modified) (2 diffs)
-
branches/fep_rpc_client/nbproject/configurations.xml (modified) (4 diffs)
-
branches/fep_rpc_client/nbproject/private/private.xml (modified) (1 diff)
-
branches/fep_rpc_client/network.h (modified) (4 diffs)
-
branches/fep_rpc_client/tinyxml/tinystr.cpp (added)
-
branches/fep_rpc_client/tinyxml/tinystr.o (added)
-
branches/fep_rpc_client/tinyxml/tinyxml.a (added)
-
branches/fep_rpc_client/tinyxml/tinyxml.cpp (added)
-
branches/fep_rpc_client/tinyxml/tinyxml.o (added)
-
branches/fep_rpc_client/tinyxml/tinyxmlerror.cpp (added)
-
branches/fep_rpc_client/tinyxml/tinyxmlerror.o (added)
-
branches/fep_rpc_client/tinyxml/tinyxmlparser.cpp (added)
-
branches/fep_rpc_client/tinyxml/tinyxmlparser.o (added)
-
branches/fep_rpc_client/tinyxml/xmltest.cpp (added)
-
branches/fep_rpc_client/tinyxml/xmltest.o (added)
-
trunk/IDE_metadata/NetBeans/TMCSim/nbproject/build-impl.xml (modified) (24 diffs)
-
trunk/IDE_metadata/NetBeans/TMCSim/nbproject/configs/ATMSDriver.properties (added)
-
trunk/IDE_metadata/NetBeans/TMCSim/nbproject/genfiles.properties (modified) (1 diff)
-
trunk/IDE_metadata/NetBeans/TMCSim/nbproject/project.properties (modified) (1 diff)
-
trunk/IDE_metadata/NetBeans/TMCSim/nbproject/project.xml (modified) (1 diff)
-
trunk/camera_status.log (added)
-
trunk/config/atms_driver_config.properties (added)
-
trunk/config/paramics_simulator_config.properties (modified) (1 diff)
-
trunk/config/vds_data (added)
-
trunk/config/vds_data/lds.txt (added)
-
trunk/config/vds_data/loop.txt (added)
-
trunk/exchange.xml (added)
-
trunk/networkFile.txt (added)
-
trunk/paramics_communicator.log (added)
-
trunk/paramics_status.log (added)
-
trunk/paramics_status.xml (added)
-
trunk/src/atmsdriver (added)
-
trunk/src/atmsdriver/ATMSDriver.java (copied) (copied from branches/ATMSDriver/src/atmsdriver/ATMSDriver.java) (1 diff)
-
trunk/src/atmsdriver/ExchangeInfo.java (added)
-
trunk/src/atmsdriver/ExchangeReader.java (added)
-
trunk/src/atmsdriver/NetworkLoader.java (copied) (copied from branches/ATMSDriver/src/atmsdriver/NetworkReader.java) (4 diffs)
-
trunk/src/atmsdriver/model (added)
-
trunk/src/atmsdriver/model/FEPLine.java (copied) (copied from branches/ATMSDriver/src/atmsdriver/network/model/FEPLine.java) (1 diff)
-
trunk/src/atmsdriver/model/LoopDetector.java (copied) (copied from branches/ATMSDriver/src/atmsdriver/network/model/LoopDetector.java) (1 diff)
-
trunk/src/atmsdriver/model/LoopDetectorStation.java (copied) (copied from branches/ATMSDriver/src/atmsdriver/network/model/LoopDetectorStation.java) (1 diff)
-
trunk/src/atmsdriver/model/Network.java (copied) (copied from branches/ATMSDriver/src/atmsdriver/network/model/Network.java) (4 diffs)
-
trunk/src/tmcsim/application.properties (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/ATMSDriver/build/built-jar.properties
r77 r79 1 # Wed, 13 Sep 2017 17:07:03-07001 #Mon, 02 Oct 2017 13:41:31 -0700 2 2 3 3 4 /home/andrew/ branches/ATMSDriver=4 /home/andrew/tmcsimulator/branches/ATMSDriver= -
branches/ATMSDriver/nbproject/private/private.xml
r77 r79 3 3 <editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/> 4 4 <open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2"> 5 <group> 6 <file>file:/home/andrew/branches/ATMSDriver/src/atmsdriver/ATMSDriver.java</file> 7 <file>file:/home/andrew/branches/ATMSDriver/src/atmsdriver/NetworkReader.java</file> 8 <file>file:/home/andrew/branches/ATMSDriver/src/atmsdriver/network/model/Network.java</file> 9 </group> 5 <group/> 10 6 </open-files> 11 7 </project-private> -
branches/fep_rpc_client/FEPClient.cpp
r78 r79 7 7 * @param networkFile the xml network file 8 8 */ 9 FEPClient::FEPClient(char * host, char * networkFile) 10 { 11 createClient(host); 12 networkReader = new NetworkReader(networkFile); 13 updateATMS(); 9 FEPClient::FEPClient(char * host, char * networkFile) { 10 networkReader = new NetworkReader(networkFile); 11 createClient(host); 12 updateATMS(); 14 13 } 15 14 … … 17 16 * Destructor 18 17 */ 19 FEPClient::~FEPClient() 20 { 21 cout << "Destroying client..." << endl; 22 clnt_destroy(clnt); 18 FEPClient::~FEPClient() { 19 cout << "Destroying client..." << endl; 20 clnt_destroy(clnt); 23 21 } 24 22 … … 27 25 * @param response pointer to fep_reply struct 28 26 */ 29 void FEPClient::handleCallResponse(void *response) 30 { 31 /* If ATMS reply call fails */ 32 if (response == NULL) 33 { 34 clnt_perror(clnt, "RPC call failed"); 35 } 36 /* If ATMS reply is successful */ 37 else 38 { 39 cout << "Successful RPC call to ATMS..." << endl; 40 } 27 void FEPClient::handleCallResponse(void *response) { 28 /* If ATMS reply call fails */ 29 if (response == NULL) { 30 clnt_perror(clnt, "RPC call failed"); 31 } /* If ATMS reply is successful */ 32 else { 33 cout << "Successful RPC call to ATMS..." << endl; 34 } 41 35 } 42 36 … … 44 38 * Sends an fep_reply for every line in the FEP. 45 39 */ 46 void FEPClient::updateATMS() 47 { 48 int i, j; // i == line_index, j == lds_index 49 void *rv; 40 void FEPClient::updateATMS() { 41 int i, j; // i == line_index, j == lds_index 42 void *rv; 50 43 51 vector<FEP_LINE > lines = networkReader->getLines();52 vector<LDS_LOOP > ldsMap = networkReader->getStations();44 vector<FEP_LINE*> lines = networkReader->getLines(); 45 vector<LDS_LOOP*> ldsMap = networkReader->getStations(); 53 46 54 // Send one reply for every "line" in the FEP 55 for (i = 0; i < lines.size(); i++) 56 { 57 fep_reply fepReply; 58 cout << "Sending fepReply for line #" << lines.at(i).lineNum << endl; 59 // populate reply 60 fepReply.reply = SHORTPOLL; 61 fepReply.schedule = lines.at(i).schedule; 62 fepReply.lineinfo = lines.at(i).lineInfo; 63 fepReply.kind = (enum polltype) 0; 64 fepReply.flag = (enum replykind) 0; 47 // Send one reply for every "line" in the FEP 48 for (i = 0; i < lines.size(); i++) { 49 fep_reply fepReply; 50 cout << "Sending fepReply for line #" << lines.at(i)->lineNum << endl; 51 // populate reply 52 fepReply.reply = SHORTPOLL; 53 fepReply.schedule = lines.at(i)->schedule; 54 fepReply.lineinfo = lines.at(i)->lineInfo; 55 fepReply.kind = (enum polltype) 0; 56 fepReply.flag = (enum replykind) 0; 65 57 66 /***********************************67 This is an update to an extern, this should happen on the Java driver side??68 lines.at(i).schedleSeq += 1;69 lines.at(i).globalSeq += 51;70 */58 /*********************************** 59 This is an update to an extern, this should happen on the Java driver side?? 60 lines.at(i).schedleSeq += 1; 61 lines.at(i).globalSeq += 51; 62 */ 71 63 72 fepReply.schedule_sequence = lines.at(i).schedleSeq;73 fepReply.global_sequence = lines.at(i).globalSeq;74 /************************************75 Need to find out what appropriate schedule time is: look at uci_unix_simulation_time src code76 fepReply.schedule_time =77 uci_unix_simulation_time(uci_simulation_time()); // GMT time78 */79 fepReply.schedule_time = time(NULL);64 fepReply.schedule_sequence = lines.at(i)->schedleSeq; 65 fepReply.global_sequence = lines.at(i)->globalSeq; 66 /************************************ 67 Need to find out what appropriate schedule time is: look at uci_unix_simulation_time src code 68 fepReply.schedule_time = 69 uci_unix_simulation_time(uci_simulation_time()); // GMT time 70 */ 71 fepReply.schedule_time = time(NULL); 80 72 81 fepReply.user_info1 = lines.at(i).lineNum;82 fepReply.user_info2 = lines.at(i).lineNum;83 fepReply.system_key = lines.at(i).systemKey;73 fepReply.user_info1 = lines.at(i)->lineNum; 74 fepReply.user_info2 = lines.at(i)->lineNum; 75 fepReply.system_key = lines.at(i)->systemKey; 84 76 85 fepReply.answers.size = 1;86 fepReply.answers.fep_answer_list_u.shortp.count = 1;77 fepReply.answers.size = 1; 78 fepReply.answers.fep_answer_list_u.shortp.count = 1; 87 79 88 /* for each LDS in the Line.... (constructs the short_answer message) */ 89 for (j = 0; j < lines.at(i).lds.size(); j++) 90 { 91 fep_shortanswer fsa; 92 int index = lines.at(i).ldsIndex.at(j); 93 cout << "LDS index: " << index << endl; 94 // msg: oa, od, ldsMap.at(index).dataPack, od, ff 95 fsa.msg.message_len = ldsMap.at(index).length + 2; 96 fsa.msg.message[0] = 0x0d; 97 fsa.msg.message[1] = 0x0a; 98 for (int k = 0; k < ldsMap.at(index).length; k++) 99 fsa.msg.message[2 + k] = ldsMap.at(index).dataPack[k]; 100 int aa = ldsMap.at(index).length; 101 fsa.msg.message[2 + aa] = 0x0d; 102 fsa.msg.message[3 + aa] = 0xff; //????????????? warning ????? 80 /* for each LDS in the Line.... (constructs the short_answer message) */ 81 for (j = 0; j < lines.at(i)->lds.size(); j++) { 82 fep_shortanswer fsa; 83 int index = lines.at(i)->ldsIndex.at(j); 84 cout << "LDS index: " << index << endl; 85 // msg: oa, od, ldsMap.at(index).dataPack, od, ff 86 fsa.msg.message_len = ldsMap.at(index)->length + 2; 87 fsa.msg.message[0] = 0x0d; 88 fsa.msg.message[1] = 0x0a; 89 for (int k = 0; k < ldsMap.at(index)->length; k++) 90 fsa.msg.message[2 + k] = ldsMap.at(index)->dataPack[k]; 91 int aa = ldsMap.at(index)->length; 92 fsa.msg.message[2 + aa] = 0x0d; 93 fsa.msg.message[3 + aa] = 0xff; //????????????? warning ????? 103 94 104 // info105 fsa.info.poll_error_count = 0;106 /***************************************107 Need to find out polltime uci time function src code108 fsa.info.poll_time = uci_unix_simulation_time(uci_simulation_time());109 */110 fsa.info.poll_user_info1 = ldsMap.at(index).drop;// drop number111 fsa.info.poll_user_info2 = 1;//always 1112 fsa.info.retries = 0;113 fsa.info.status = (enum replystatus) 1;95 // info 96 fsa.info.poll_error_count = 0; 97 /*************************************** 98 Need to find out polltime uci time function src code 99 fsa.info.poll_time = uci_unix_simulation_time(uci_simulation_time()); 100 */ 101 fsa.info.poll_user_info1 = ldsMap.at(index)->drop; // drop number 102 fsa.info.poll_user_info2 = 1; //always 1 103 fsa.info.retries = 0; 104 fsa.info.status = (enum replystatus) 1; 114 105 115 //fepReply.answers.fep_answer_list_u.shortp.answers[j] = fsa;116 fepReply.answers.fep_answer_list_u.shortp.answers[0] = fsa;106 //fepReply.answers.fep_answer_list_u.shortp.answers[j +1] = fsa; 107 fepReply.answers.fep_answer_list_u.shortp.answers[0] = fsa; 117 108 118 // send out data119 printf("Transferring line=%d, lds_drop_no=%d...\n", lines.at(i).lineNum, ldsMap.at(index).drop);120 rv = fep_reply_xfer_32(&fepReply, clnt);109 // send out data 110 printf("Transferring line=%d, lds_drop_no=%d...\n", lines.at(i)->lineNum, ldsMap.at(index)->drop); 111 rv = fep_reply_xfer_32(&fepReply, clnt); 121 112 122 /* Handle ATMS response to RPC Call */123 printf("Handling ATMS response...\n");124 handleCallResponse(rv);125 }126 }113 /* Handle ATMS response to RPC Call */ 114 printf("Handling ATMS response...\n"); 115 handleCallResponse(rv); 116 } 117 } 127 118 } 128 119 … … 131 122 * @param host rpc server ip 132 123 */ 133 void FEPClient::createClient(char * host) 134 { 135 /* Create RPC Client to communicate with ATMS */ 136 cout << "Creating RPC Client" << endl; 137 clnt = clnt_create(host, /*100090,*/ 103121, 32, "tcp"); 138 cout << "Client created" << endl; 139 /* Check if client creation failed */ 140 if (clnt == (CLIENT *) NULL) 141 { 142 cerr << "Can't create client to " << host << endl; 143 exit(1); 144 } 124 void FEPClient::createClient(char * host) { 125 /* Create RPC Client to communicate with ATMS */ 126 cout << "Creating RPC Client" << endl; 127 clnt = clnt_create(host, /*100090,*/ 103121, 32, "tcp"); 128 cout << "Client created" << endl; 129 /* Check if client creation failed */ 130 if (clnt == (CLIENT *) NULL) { 131 cerr << "Can't create client to " << host << endl; 132 exit(1); 133 } 145 134 } 146 135 … … 153 142 int main(int argc, char *argv[]) { 154 143 155 char *host;156 char *networkFile;144 char *host; 145 char *networkFile; 157 146 158 if (argc < 3) 159 { 160 cout << "usage: " << argv[0] << " server_host networkFile" << endl; 161 exit(1); 162 } 147 if (argc < 3) { 148 cout << "usage: " << argv[0] << " server_host networkFile" << endl; 149 exit(1); 150 } 163 151 164 /* Create RPC Client to send an fep_reply to ATMS */165 host = argv[1];166 networkFile = argv[2];152 /* Create RPC Client to send an fep_reply to ATMS */ 153 host = argv[1]; 154 networkFile = argv[2]; 167 155 168 FEPClient *client = new FEPClient(host, networkFile);169 delete client;156 FEPClient *client = new FEPClient(host, networkFile); 157 delete client; 170 158 171 return 0;159 return 0; 172 160 } -
branches/fep_rpc_client/FEPClient.h
r77 r79 1 /* The FEPClient is an RPC Client which transfers network data to the 1 /* 2 * File: FEPClient.h 3 * 4 * The FEPClient is an RPC Client which transfers network data to the 2 5 * ATMS Server. 3 6 * … … 14 17 * @version 9/8/2017 15 18 */ 19 16 20 // Include guard 17 21 #ifndef __FEPCLIENT_H_INCLUDED__ -
branches/fep_rpc_client/NetworkReader.cpp
r78 r79 10 10 } 11 11 12 LOOP * NetworkReader::parseLoop(TiXmlElement * loopElem) { 13 LOOP *loop = new LOOP; 14 15 TiXmlElement *subLoopElem = loopElem->FirstChildElement(); 16 loop->loopID = atoi(subLoopElem->GetText()); 17 cout << "LOOPID: " << subLoopElem->GetText() << endl; 18 subLoopElem = subLoopElem->NextSiblingElement(); 19 loop->loop_loc = (char *) subLoopElem->GetText(); 20 subLoopElem = subLoopElem->NextSiblingElement(); 21 loop->vol = atoi(subLoopElem->GetText()); 22 subLoopElem = subLoopElem->NextSiblingElement(); 23 loop->occ = atof(subLoopElem->GetText()); 24 subLoopElem = subLoopElem->NextSiblingElement(); 25 loop->spd = atof(subLoopElem->GetText()); 26 27 return loop; 28 } 29 12 30 /** 13 31 * Parses a station xml element into an "LDS_LOOP" … … 17 35 * @return the new station 18 36 */ 19 LDS_LOOP NetworkReader::parseStation(TiXmlElement *stationElem, FEP_LINE *line) {20 LDS_LOOP station;21 37 LDS_LOOP * NetworkReader::parseStation(TiXmlElement *stationElem, FEP_LINE *line) { 38 LDS_LOOP *station = new LDS_LOOP; 39 22 40 TiXmlElement *stationSubElem = stationElem->FirstChildElement(); 23 cout << "Station id: " << stationSubElem->GetText() << endl; 24 station.lds = atol(stationSubElem->GetText()); 25 line->lds.push_back(station.lds); 41 station->lds = atol(stationSubElem->GetText()); 42 line->lds.push_back(station->lds); 26 43 line->ldsIndex.push_back(ldsIndex++); 27 44 stationSubElem = stationSubElem->NextSiblingElement(); 28 station .line_num = atoi(stationSubElem->GetText());45 station->line_num = atoi(stationSubElem->GetText()); 29 46 stationSubElem = stationSubElem->NextSiblingElement(); 30 station .drop = atoi(stationSubElem->GetText());47 station->drop = atoi(stationSubElem->GetText()); 31 48 stationSubElem = stationSubElem->NextSiblingElement(); 32 49 stationSubElem = stationSubElem->NextSiblingElement(); // skip location … … 34 51 stationSubElem = stationSubElem->NextSiblingElement(); // skip direction 35 52 stationSubElem = stationSubElem->NextSiblingElement(); // skip freeway 36 station .MlTotVol = atoi(stationSubElem->GetText());53 station->MlTotVol = atoi(stationSubElem->GetText()); 37 54 stationSubElem = stationSubElem->NextSiblingElement(); 38 station .OppTotVol = atoi(stationSubElem->GetText());55 station->OppTotVol = atoi(stationSubElem->GetText()); 39 56 40 station.pos = 0; 57 station->pos = 0; // NOT SURE WHY WE NEED THIS? 58 41 59 // Add loops to station 42 TiXmlElement *loopsElem = stationSubElem->NextSiblingElement(); 43 TiXmlElement *loopElem = loopsElem->FirstChildElement(); 44 TiXmlElement *saveLoopElem = loopElem; 45 // get number of loops in station and assign to station.num 46 station.num = 0; 60 TiXmlElement *loopElem = stationSubElem->NextSiblingElement()->FirstChildElement(); 47 61 for (loopElem; loopElem; loopElem = loopElem->NextSiblingElement()) { 48 station.num += 1; 62 LOOP *loop = parseLoop(loopElem); 63 station->loops.push_back(loop); 49 64 } 50 65 51 // get loopIDS and locations 52 long int loopIDS[station.num]; 53 char * loopLocs[station.num]; 54 int index = 0; 55 for (saveLoopElem; saveLoopElem; saveLoopElem = saveLoopElem->NextSiblingElement()) { 56 TiXmlElement *subLoopElem = saveLoopElem->FirstChildElement(); 57 loopIDS[index] = atoi(subLoopElem->GetText()); 58 subLoopElem = subLoopElem->NextSiblingElement(); 59 loopLocs[index++] = (char *) subLoopElem->GetText(); 66 // Data pack ATMS message 67 station->length = station->loops.size() * 2 + CONTROL_DATA_LEN; 68 cout << station->loops.size() << endl; 69 station->dataPack = DataPacker::packData(station); 70 71 return station; 72 } 73 74 /** 75 * Parses a "Line" xml element into an FEP_LINE 76 * @param lineElem the xml element 77 * @return FEP_LINE 78 */ 79 FEP_LINE * NetworkReader::parseLine(TiXmlElement * lineElem) { 80 FEP_LINE *line = new FEP_LINE; 81 82 TiXmlElement *lineSubElem = lineElem->FirstChildElement(); 83 line->lineNum = atoi(lineSubElem->GetText()); 84 cout << "Line: " << line->lineNum << endl; 85 lineSubElem = lineSubElem->NextSiblingElement(); 86 line->count = atoi(lineSubElem->GetText()); 87 lineSubElem = lineSubElem->NextSiblingElement(); 88 line->schedule = atoi(lineSubElem->GetText()); 89 lineSubElem = lineSubElem->NextSiblingElement(); 90 line->lineInfo = atoi(lineSubElem->GetText()); 91 lineSubElem = lineSubElem->NextSiblingElement(); 92 line->systemKey = atol(lineSubElem->GetText()); 93 lineSubElem = lineSubElem->NextSiblingElement(); 94 line->globalSeq = atol(lineSubElem->GetText()); 95 lineSubElem = lineSubElem->NextSiblingElement(); 96 line->schedleSeq = atol(lineSubElem->GetText()); 97 98 TiXmlElement *stationsElem = lineSubElem->NextSiblingElement(); 99 TiXmlElement *stationElem = stationsElem->FirstChildElement(); 100 for (stationElem; stationElem; stationElem = stationElem->NextSiblingElement()) { 101 stations.push_back(parseStation(stationElem, line)); 60 102 } 61 station.loopID = loopIDS;62 station.loop_loc = loopLocs; 103 return line; 104 } 63 105 64 // Data pack ATMS message 65 station.length = station.num * 2 + CONTROL_DATA_LEN; 66 station.dataPack = staticDataPack(station); 67 /* 68 // fill in dynamic data to dataPack[] 69 for (i = 0; i < g_ldsNum; i++) { 70 // Loop detector data 71 int pos = 26; 72 pos = pp_data_packing(i, 5, pos); 73 pos = pp_data_packing(i, 6, pos); 74 pos = pp_data_packing(i, 7, pos); 75 pos = pp_data_packing(i, 8, pos); 76 77 // Update data for BYTE 9, 16, 21, 22, 23, 24 78 79 // what is the current metering rate? 80 // check each LDS, if there is demand detector, the downstream node the 81 // ldsMap[i].dataPack[22-1] = ldsMap[i].dataPack[9-1] = ; 82 83 // will need to check if queue override is enabled (Currently, no queue 84 // ldsMap[i].dataPack[16-1] = ; 85 86 // byte 23: MAINLINE total volume 87 ldsMap[i].dataPack[23 - 1] = ldsMap[i].MlTotVol; 88 89 // byte 24: opposite total volume 90 ldsMap[i].dataPack[24 - 1] = ldsMap[i].OppTotVol; 91 92 // last BYTE: checksum 93 ldsMap[i].dataPack[ldsMap[i].length - 1] = 94 chksum(ldsMap[i].dataPack, ldsMap[i].length - 1 - 1); 95 96 // print out 97 // print out 98 for (j = 0; j < ldsMap[i].length; j++) { 99 fprintf(fi_lds, "%02X", ldsMap[i].dataPack[j]); 100 } 101 fprintf(fi_lds, "\n"); 102 fflush(fi_lds); 103 */ 104 105 return station; 106 /** 107 * Loads FEPLines from a specified xml file 108 * @param networkFileName the input xml file 109 */ 110 void NetworkReader::loadLines(const char * networkFileName) { 111 // Load network xml file 112 TiXmlDocument doc(networkFileName); 113 if (!doc.LoadFile()) { 114 cerr << "TiXmlDocument did not load network file..." << endl; 115 return; 106 116 } 107 117 108 /** 109 * Parses a "Line" xml element into an FEP_LINE 110 * @param lineElem the xml element 111 * @return FEP_LINE 112 */ 113 FEP_LINE NetworkReader::parseLine(TiXmlElement * lineElem) { 114 FEP_LINE line; 115 TiXmlElement *lineSubElem = lineElem->FirstChildElement(); 116 line.lineNum = atoi(lineSubElem->GetText()); 117 cout << "Line: " << line.lineNum << endl; 118 lineSubElem = lineSubElem->NextSiblingElement(); 119 line.count = atoi(lineSubElem->GetText()); 120 lineSubElem = lineSubElem->NextSiblingElement(); 121 line.schedule = atoi(lineSubElem->GetText()); 122 lineSubElem = lineSubElem->NextSiblingElement(); 123 line.lineInfo = atoi(lineSubElem->GetText()); 124 lineSubElem = lineSubElem->NextSiblingElement(); 125 line.systemKey = atol(lineSubElem->GetText()); 126 lineSubElem = lineSubElem->NextSiblingElement(); 127 line.globalSeq = atol(lineSubElem->GetText()); 128 lineSubElem = lineSubElem->NextSiblingElement(); 129 line.schedleSeq = atol(lineSubElem->GetText()); 118 // grab <Network> element 119 TiXmlHandle hDoc(&doc); 120 TiXmlElement *networkElem = hDoc.FirstChildElement().Element(); 130 121 131 TiXmlElement *stationsElem = lineSubElem->NextSiblingElement();132 TiXmlElement *stationElem = stationsElem->FirstChildElement();133 for (stationElem; stationElem; stationElem = stationElem->NextSiblingElement()) { 134 stations.push_back(parseStation(stationElem, &line));135 }136 return line;122 // grab first <Line> element 123 TiXmlElement *lineElem = networkElem->FirstChildElement(); 124 125 // iterate through each line element to create FEP_LINE list 126 for (lineElem; lineElem; lineElem = lineElem->NextSiblingElement()) { 127 lines.push_back(parseLine(lineElem)); 137 128 } 129 } 138 130 139 /** 140 * Loads FEPLines from a specified xml file 141 * @param networkFileName the input xml file 142 */ 143 void NetworkReader::loadLines(const char * networkFileName) { 144 // Load network xml file 145 TiXmlDocument doc(networkFileName); 146 if (!doc.LoadFile()) { 147 cerr << "TiXmlDocument did not load network file..." << endl; 148 return; 149 } 131 /** 132 * Getter for lines 133 * @return List of FEP_LINES 134 */ 135 vector<FEP_LINE*> NetworkReader::getLines() { 150 136 151 // grab <Network> element 152 TiXmlHandle hDoc(&doc); 153 TiXmlElement *networkElem = hDoc.FirstChildElement().Element(); 137 return lines; 138 } 154 139 155 // grab first <Line> element 156 TiXmlElement *lineElem = networkElem->FirstChildElement(); 140 /** 141 * Getter for stations 142 * @return List of LDS_LOOPs 143 */ 144 vector<LDS_LOOP*> NetworkReader::getStations() { 157 145 158 // iterate through each line element to create FEP_LINE list 159 for (lineElem; lineElem; lineElem = lineElem->NextSiblingElement()) { 160 lines.push_back(parseLine(lineElem)); 161 } 162 } 146 return stations; 147 } 163 148 164 // determine if a loop has data based on lane config data 149 NetworkReader::~NetworkReader() { 165 150 166 bool NetworkReader::DataAvail(char flag, int num) { 167 int mag, fel; 168 169 // find mask value 170 if (num == 1) 171 mag = 0x01; 172 else if (num == 2) 173 mag = 0x02; 174 else if (num == 3) 175 mag = 0x04; 176 else if (num == 4) 177 mag = 0x08; 178 else if (num == 5) 179 mag = 0x10; 180 else if (num == 6) 181 mag = 0x20; 182 else if (num == 7) 183 mag = 0x40; 184 else if (num == 8) 185 mag = 0x80; 186 187 fel = flag & mag; 188 fel = fel >> (num - 1); 189 190 if (fel == 1) 191 return true; 192 else 193 return false; 194 } 195 /* 196 int pp_data_packing(int index, int packNo, int pos) { 197 int i, j, k, vol, occ, lane, haveData; 198 LOOPAGG in; 199 DETECTOR *aaa; 200 VOLOCC bbb; 201 long loop; 202 203 i = index; 204 205 //used for data byte 23 and 24 206 ldsMap[i].MlTotVol = 0; 207 ldsMap[i].OppTotVol = 0; 208 209 for (j = 1; j <= 8; j++) { 210 if (DataAvail(ldsMap[i].dataPack[packNo - 1], j)) { 211 // loop at bit j has data 212 for (k = 0; k < ldsMap[i].num; k++) { 213 // what's the corresponding loop of bit j 214 if (packNo == 5) 215 haveData = strcmp(ldsMap[i].loop_loc[k], dp5[j - 1]); 216 else if (packNo == 6) 217 haveData = strcmp(ldsMap[i].loop_loc[k], dp6[j - 1]); 218 else if (packNo == 7) 219 haveData = strcmp(ldsMap[i].loop_loc[k], dp7[j - 1]); 220 else if (packNo == 8) 221 haveData = strcmp(ldsMap[i].loop_loc[k], dp8[j - 1]); 222 else 223 return -1; 224 225 if (haveData == 0) { 226 loop = ldsMap[i].loopID[k]; 227 if (strcmp(chu[loop].paramicsName, "?") == 0) { 228 { 229 vol = 0; 230 occ = 900; 231 } else { 232 aaa = qpg_NET_detector(chu[loop].paramicsName); 233 Bool status = uci_loop_aggregation(qpg_DTC_index(aaa), POLLING 234 if (status) { 235 if (chu[loop].paramicsLane == 0) 236 lane = 0; 237 else 238 lane = chu[loop].paramicsLane - 1; 239 vol = in.vol[lane]; 240 occ = (int) (in.occ[lane] * 900 + 0.5); 241 // qps_GUI_printf("%d(%s), lane=%d, vol=%d(%d), occ=%.3f(%.3f, 242 // qpg_DTC_index(aaa), chu[loop].paramicsName, in.lane, in. 243 // vol, in.g_occ, in.occ[lane], occ); 244 } else 245 qps_GUI_printf("Data query error for %s\n", chu[loop].param 246 } 247 248 bbb = pp_vol_occ_word(vol, occ); 249 pos++; 250 ldsMap[i].dataPack[pos - 1] = bbb.high; 251 pos++; 252 ldsMap[i].dataPack[pos - 1] = bbb.low; 253 254 if (packNo == 5) { 255 ldsMap[i].MlTotVol += vol; 256 } else if (packNo == 6) { 257 258 ldsMap[i].OppTotVol += vol; 259 } 260 261 fprintf(fi_lds, "lds=%d, loop=%d, paramics=%s, lane=%d, vol=%d(%X 262 ldsMap[i].lds, loop, chu[loop].paramicsName, chu[loop].paramic 263 bbb.high, occ, bbb.low); 264 fflush(fi_lds); 265 } 266 } 267 } 268 } 269 270 return pos; 271 } 272 */ 273 // Initializes the LDS_LOOP dataPack with all necessary static data and default dynamic data 274 unsigned char * NetworkReader::staticDataPack(LDS_LOOP loop) { 275 int j; 276 // Allocate memory for dataPack 277 unsigned char *dataPack = (unsigned char *) calloc(1, sizeof (unsigned char) * loop.length); 278 279 // dataPack 5-8: lane config 280 char d5 = 0, d6 = 0, d7 = 0, d8 = 0; 281 for (j = 0; j < loop.num; j++) { 282 for (int k = 0; k < 8; k++) { 283 if (strcmp(loop.loop_loc[j], dp5[k]) == 0) 284 d5 += pow(2, k); 285 if (strcmp(loop.loop_loc[j], dp6[k]) == 0) 286 d6 += pow(2, k); 287 if (strcmp(loop.loop_loc[j], dp7[k]) == 0) 288 d7 += pow(2, k); 289 if (strcmp(loop.loop_loc[j], dp8[k]) == 0) 290 d8 += pow(2, k); 291 } 292 } 293 dataPack[5 - 1] = d5; 294 dataPack[6 - 1] = d6; 295 dataPack[7 - 1] = d7; 296 dataPack[8 - 1] = d8; 297 298 // dataPack 1: Drop number, i.e. station address 299 dataPack[1 - 1] = loop.drop; 300 301 // dataPack2 (2 bytes per loop) 302 dataPack[2 - 1] = loop.num * 2 + Fixed_Byte_To_Checksum; 303 304 // dataPacket 3 (lowbyte: # of mainline loops, highbyte: # of opposite loops) 305 int low = 0, high = 0; 306 for (j = 1; j <= 6; j++) { 307 low += DataAvail(dataPack[5 - 1], j); 308 high += DataAvail(dataPack[6 - 1], j); 309 } 310 high = high << 4; 311 dataPack[3 - 1] = high | low; 312 313 // dataPack4 (Miscl. flags: samples are: 80, A0, E0, 00) 314 dataPack[4 - 1] = 0xA0; 315 316 // dataPack 9: initialized as 00 (meaning no metering); need to be updated every 30 sec 317 dataPack[9 - 1] = 0; 318 319 // datadataPack 10-13: lane malfunction? Assuming all functional 320 dataPack[10 - 1] = 0; 321 dataPack[11 - 1] = 0; 322 dataPack[12 - 1] = 0; 323 dataPack[13 - 1] = 0; 324 325 // dataPack 14-22: ramp metering data 326 // BYTE 16 and 22 need to be updated every 30 sec 327 bool found = false; 328 for (j = 0; j < loop.num; j++) { 329 if (strcmp(loop.loop_loc[j], "DEMAND") == 0) { 330 found = true; 331 break; 332 } 333 } 334 if (found) { 335 // BYTE 14: mostly 07, some are 05, 03, 00 336 dataPack[14 - 1] = 0x07; 337 // mostly 06(TOD table 1); some are 0B (No metering) or 05(traffic responsive) 338 dataPack[15 - 1] = 0x06; 339 // most 00, some are 01 (queue override) or 80(Meter ON sign) 340 dataPack[16 - 1] = 0x00; 341 // Field Manual Rate 342 dataPack[17 - 1] = 0xFF; 343 // TOC Manual Rate 344 dataPack[18 - 1] = 0xFF; 345 // PSO Manual Rate 346 dataPack[19 - 1] = 0xFF; 347 // CORM Rate 348 dataPack[20 - 1] = 0xFF; 349 // Local Responsive Rate. DON'T UNDERSTAND YET 350 dataPack[21 - 1] = 0x00; 351 // TOD Rate: need to query RAMP plugin! 352 dataPack[22 - 1] = 0x00; 353 } // LDS: NO Metering 354 else { 355 dataPack[14 - 1] = 0x00; 356 dataPack[15 - 1] = 0x0B; 357 dataPack[16 - 1] = 0x00; 358 dataPack[17 - 1] = 0xFF; 359 dataPack[18 - 1] = 0xFF; 360 dataPack[19 - 1] = 0xFF; 361 dataPack[20 - 1] = 0xFF; 362 dataPack[21 - 1] = 0x00; 363 dataPack[22 - 1] = 0x00; 364 } 365 366 // dataPack 23-24: sum of mainline/Oppsite traffic data; need to be updated every 30 sec 367 loop.MlTotVol = 0; 368 loop.OppTotVol = 0; 369 dataPack[23 - 1] = loop.MlTotVol; 370 dataPack[24 - 1] = loop.OppTotVol; 371 372 // dataPack 25-26: BYTE 25 is fixed, i.e. 03; BYTE 26 is either 0xA2 or 0x84 373 dataPack[25 - 1] = 0x03; 374 dataPack[26 - 1] = 0x84; 375 376 return dataPack; 377 } 378 379 /** 380 * Getter for lines 381 * @return List of FEP_LINES 382 */ 383 vector<FEP_LINE> NetworkReader::getLines() { 384 385 return lines; 386 } 387 388 /** 389 * Getter for stations 390 * @return List of LDS_LOOPs 391 */ 392 vector<LDS_LOOP> NetworkReader::getStations() { 393 394 return stations; 395 } 396 397 NetworkReader::~NetworkReader() { 398 399 } 151 } -
branches/fep_rpc_client/NetworkReader.h
r78 r79 1 /** A NetworkReader reads in data about the traffic network from a specified 1 /** 2 * File: NetworkReader.h 3 * 4 * A NetworkReader reads in data about the traffic network from a specified 2 5 * xml file. 3 6 * … … 5 8 * which are getters for the list of FEP_LINES, and LDS_LOOPS, respectively. 6 9 * 7 * Example xmlfile:10 * Example XML file: 8 11 * <code> 9 12 * <Network> … … 47 50 #define __NETWORKREADER_H_INCLUDED__ 48 51 49 // Forward declared dependencies50 51 52 // Included dependencies 52 53 #include "network.h" 53 54 #include <vector> 54 #include <string>55 55 #include <string.h> 56 56 #include <iostream> 57 57 #include "tinyxml.h" 58 #include "DataPacker.h" 58 59 59 60 class NetworkReader … … 63 64 ~NetworkReader(); // Destructor 64 65 65 vector<FEP_LINE > getLines(); // Getter for FEP_LINE list66 vector<LDS_LOOP > getStations(); // Getter for LDS_LOOP list66 vector<FEP_LINE*> getLines(); // Getter for FEP_LINE list 67 vector<LDS_LOOP*> getStations(); // Getter for LDS_LOOP list 67 68 private: 68 vector<FEP_LINE > lines;69 vector<LDS_LOOP > stations;69 vector<FEP_LINE*> lines; 70 vector<LDS_LOOP*> stations; 70 71 int ldsIndex; 71 72 72 73 void loadLines(const char * networkFileName); 73 LDS_LOOP parseStation(TiXmlElement *stationElem, FEP_LINE *line); 74 FEP_LINE parseLine(TiXmlElement *lineElem); 75 76 bool DataAvail(char flag, int num); // Helper function for msgDataPack 77 unsigned char * staticDataPack(LDS_LOOP loop); // Packs the static data in message sent to ATMS 78 // int pp_data_packing(int index, int packNo, int pos); // Packs dynamic data in message sent to ATMS 74 LOOP * parseLoop(TiXmlElement * loopElem); 75 LDS_LOOP * parseStation(TiXmlElement *stationElem, FEP_LINE *line); 76 FEP_LINE * parseLine(TiXmlElement *lineElem); 79 77 }; 80 78 -
branches/fep_rpc_client/build/Debug/GNU-Linux-x86/FEPClient.o.d
r77 r79 1 1 build/Debug/GNU-Linux-x86/FEPClient.o: FEPClient.cpp FEPClient.h fep.h \ 2 NetworkReader.h network.h tinyxml/tinyxml.h tinyxml/tinystr.h 2 NetworkReader.h network.h tinyxml/tinyxml.h tinyxml/tinystr.h \ 3 DataPacker.h 3 4 4 5 FEPClient.h: … … 13 14 14 15 tinyxml/tinystr.h: 16 17 DataPacker.h: -
branches/fep_rpc_client/build/Debug/GNU-Linux-x86/NetworkReader.o.d
r77 r79 1 1 build/Debug/GNU-Linux-x86/NetworkReader.o: NetworkReader.cpp \ 2 NetworkReader.h network.h tinyxml/tinyxml.h tinyxml/tinystr.h 2 NetworkReader.h network.h tinyxml/tinyxml.h tinyxml/tinystr.h \ 3 DataPacker.h 3 4 4 5 NetworkReader.h: … … 9 10 10 11 tinyxml/tinystr.h: 12 13 DataPacker.h: -
branches/fep_rpc_client/nbproject/Makefile-Debug.mk
r77 r79 36 36 # Object Files 37 37 OBJECTFILES= \ 38 ${OBJECTDIR}/DataPacker.o \ 38 39 ${OBJECTDIR}/FEPClient.o \ 39 40 ${OBJECTDIR}/NetworkReader.o \ … … 56 57 57 58 # Link Libraries and Options 58 LDLIBSOPTIONS=tinyxml/ libtinyxml.a59 LDLIBSOPTIONS=tinyxml/tinyxml.a 59 60 60 61 # Build Targets … … 62 63 "${MAKE}" -f nbproject/Makefile-${CND_CONF}.mk ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/fep_rpc_client 63 64 64 ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/fep_rpc_client: tinyxml/ libtinyxml.a65 ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/fep_rpc_client: tinyxml/tinyxml.a 65 66 66 67 ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/fep_rpc_client: ${OBJECTFILES} 67 68 ${MKDIR} -p ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM} 68 69 ${LINK.cc} -o ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/fep_rpc_client ${OBJECTFILES} ${LDLIBSOPTIONS} 70 71 ${OBJECTDIR}/DataPacker.o: DataPacker.cpp 72 ${MKDIR} -p ${OBJECTDIR} 73 ${RM} "$@.d" 74 $(COMPILE.cc) -g -Itinyxml -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/DataPacker.o DataPacker.cpp 69 75 70 76 ${OBJECTDIR}/FEPClient.o: FEPClient.cpp -
branches/fep_rpc_client/nbproject/Makefile-Release.mk
r77 r79 36 36 # Object Files 37 37 OBJECTFILES= \ 38 ${OBJECTDIR}/DataPacker.o \ 38 39 ${OBJECTDIR}/FEPClient.o \ 39 40 ${OBJECTDIR}/NetworkReader.o \ … … 65 66 ${MKDIR} -p ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM} 66 67 ${LINK.cc} -o ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/fep_rpc_client ${OBJECTFILES} ${LDLIBSOPTIONS} 68 69 ${OBJECTDIR}/DataPacker.o: DataPacker.cpp 70 ${MKDIR} -p ${OBJECTDIR} 71 ${RM} "$@.d" 72 $(COMPILE.cc) -O2 -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/DataPacker.o DataPacker.cpp 67 73 68 74 ${OBJECTDIR}/FEPClient.o: FEPClient.cpp -
branches/fep_rpc_client/nbproject/configurations.xml
r77 r79 5 5 displayName="Header Files" 6 6 projectFiles="true"> 7 <itemPath>DataPacker.h</itemPath> 7 8 <itemPath>FEPClient.h</itemPath> 8 9 <itemPath>NetworkReader.h</itemPath> … … 17 18 displayName="Source Files" 18 19 projectFiles="true"> 20 <itemPath>DataPacker.cpp</itemPath> 19 21 <itemPath>FEPClient.cpp</itemPath> 20 22 <itemPath>NetworkReader.cpp</itemPath> … … 50 52 <linkerTool> 51 53 <linkerLibItems> 52 <linkerLibFileItem>tinyxml/ libtinyxml.a</linkerLibFileItem>54 <linkerLibFileItem>tinyxml/tinyxml.a</linkerLibFileItem> 53 55 </linkerLibItems> 54 56 </linkerTool> 55 57 </compileType> 58 <item path="DataPacker.cpp" ex="false" tool="1" flavor2="0"> 59 </item> 60 <item path="DataPacker.h" ex="false" tool="3" flavor2="0"> 61 </item> 56 62 <item path="FEPClient.cpp" ex="false" tool="1" flavor2="0"> 57 63 </item> … … 91 97 </asmTool> 92 98 </compileType> 99 <item path="DataPacker.cpp" ex="false" tool="1" flavor2="0"> 100 </item> 101 <item path="DataPacker.h" ex="false" tool="3" flavor2="0"> 102 </item> 93 103 <item path="FEPClient.cpp" ex="false" tool="1" flavor2="0"> 94 104 </item> -
branches/fep_rpc_client/nbproject/private/private.xml
r78 r79 8 8 <open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2"> 9 9 <group> 10 <file>file:/home/andrew/tmcsim/branches/fep_rpc_client/NetworkReader.h</file> 11 <file>file:/home/andrew/tmcsim/branches/fep_rpc_client/FEPClient.cpp</file> 12 <file>file:/home/andrew/tmcsim/branches/fep_rpc_client/network.h</file> 13 <file>file:/home/andrew/tmcsim/branches/fep_rpc_client/fep.h</file> 14 <file>file:/home/andrew/tmcsim/branches/fep_rpc_client/NetworkReader.cpp</file> 10 <file>file:/home/andrew/tmcsimulator/branches/fep_rpc_client/NetworkReader.cpp</file> 11 <file>file:/home/andrew/tmcsimulator/branches/fep_rpc_client/NetworkReader.h</file> 12 <file>file:/home/andrew/tmcsimulator/branches/fep_rpc_client/network.h</file> 13 <file>file:/home/andrew/tmcsimulator/branches/fep_rpc_client/FEPClient.cpp</file> 14 <file>file:/home/andrew/tmcsimulator/branches/fep_rpc_client/fep.h</file> 15 <file>file:/home/andrew/tmcsimulator/branches/fep_rpc_client/DataPacker.h</file> 16 <file>file:/home/andrew/tmcsimulator/branches/fep_rpc_client/DataPacker.cpp</file> 17 <file>file:/home/andrew/tmcsimulator/branches/fep_rpc_client/FEPClient.h</file> 15 18 </group> 16 19 </open-files> -
branches/fep_rpc_client/network.h
r77 r79 11 11 const int Fixed_Byte_To_Checksum = 25; // the first byte is not considered in the calculation of "BYTE 2" 12 12 const int CONTROL_DATA_LEN = 27; 13 13 14 char * const dp5[8] = { "ML_1", "ML_2", "ML_3", "ML_4", "ML_5", 14 15 "ML_6", "HOV_Lane", "FYW_Conn"}; … … 20 21 "SD_6", "Pass_Vol_Count", "X"}; 21 22 22 /*** NETWORK STRUCTS ***/23 typedef struct loopagg LOOPAGG;24 struct loopagg25 {26 int index;27 char lane; // how namy lanes at the detector station28 long time;29 int interval;30 int g_vol;31 float g_occ;32 double g_spd;33 int *vol;34 float *occ;35 double *spd;36 };37 38 23 // FEP line: has several lds 39 24 typedef struct fep_line FEP_LINE; 40 25 struct fep_line 41 26 { 42 int lineNum; 43 vector<long> lds; 44 vector<long> ldsIndex; // location in ldsMap 45 short ldsNum; // actual number of lds on the line 27 int lineNum; 28 vector<long> lds; 29 vector<long> ldsIndex; // location in ldsMap 46 30 47 short count; // actual count from caltrans48 int schedule;49 int lineInfo;31 short count; // actual count from caltrans 32 int schedule; 33 int lineInfo; 50 34 long systemKey; 51 35 long globalSeq; 52 36 long schedleSeq; 37 }; 38 39 // Loop detector 40 typedef struct loop LOOP; 41 struct loop 42 { 43 long loopID; 44 char *loop_loc; 45 46 int vol; 47 float occ; 48 double spd; 53 49 }; 54 50 … … 61 57 short line_num; 62 58 short drop; 63 64 int num; // number of loops 65 long *loopID; 66 char **loop_loc; 59 60 vector<LOOP*> loops; 67 61 68 62 // LDS data … … 74 68 }; 75 69 70 typedef struct volOcc VOLOCC; 71 struct volOcc 72 { 73 char high; 74 char low; 75 }; 76 77 76 78 #endif -
trunk/IDE_metadata/NetBeans/TMCSim/nbproject/build-impl.xml
r12 r79 55 55 </target> 56 56 <target depends="-pre-init,-init-private,-init-user,-init-project,-init-macrodef-property" name="-do-init"> 57 <j2seproject1:property name="platform.home" value="platforms.${platform.active}.home"/> 58 <j2seproject1:property name="platform.bootcp" value="platforms.${platform.active}.bootclasspath"/> 59 <j2seproject1:property name="platform.compiler" value="platforms.${platform.active}.compile"/> 60 <j2seproject1:property name="platform.javac.tmp" value="platforms.${platform.active}.javac"/> 61 <condition property="platform.javac" value="${platform.home}/bin/javac"> 62 <equals arg1="${platform.javac.tmp}" arg2="$${platforms.${platform.active}.javac}"/> 63 </condition> 64 <property name="platform.javac" value="${platform.javac.tmp}"/> 65 <j2seproject1:property name="platform.java.tmp" value="platforms.${platform.active}.java"/> 66 <condition property="platform.java" value="${platform.home}/bin/java"> 67 <equals arg1="${platform.java.tmp}" arg2="$${platforms.${platform.active}.java}"/> 68 </condition> 69 <property name="platform.java" value="${platform.java.tmp}"/> 70 <j2seproject1:property name="platform.javadoc.tmp" value="platforms.${platform.active}.javadoc"/> 71 <condition property="platform.javadoc" value="${platform.home}/bin/javadoc"> 72 <equals arg1="${platform.javadoc.tmp}" arg2="$${platforms.${platform.active}.javadoc}"/> 73 </condition> 74 <property name="platform.javadoc" value="${platform.javadoc.tmp}"/> 75 <condition property="platform.invalid" value="true"> 76 <or> 77 <contains string="${platform.javac}" substring="$${platforms."/> 78 <contains string="${platform.java}" substring="$${platforms."/> 79 <contains string="${platform.javadoc}" substring="$${platforms."/> 80 </or> 81 </condition> 82 <fail unless="platform.home">Must set platform.home</fail> 83 <fail unless="platform.bootcp">Must set platform.bootcp</fail> 84 <fail unless="platform.java">Must set platform.java</fail> 85 <fail unless="platform.javac">Must set platform.javac</fail> 86 <fail if="platform.invalid"> 87 The J2SE Platform is not correctly set up. 88 Your active platform is: ${platform.active}, but the corresponding property "platforms.${platform.active}.home" is not found in the project's properties files. 89 Either open the project in the IDE and setup the Platform with the same name or add it manually. 90 For example like this: 91 ant -Duser.properties.file=<path_to_property_file> jar (where you put the property "platforms.${platform.active}.home" in a .properties file) 92 or ant -Dplatforms.${platform.active}.home=<path_to_JDK_home> jar (where no properties file is used) 93 </fail> 57 <property name="platform.java" value="${java.home}/bin/java"/> 94 58 <available file="${manifest.file}" property="manifest.available"/> 95 59 <condition property="splashscreen.available"> … … 109 73 </and> 110 74 </condition> 111 <condition property="manifest.available+main.class"> 112 <and> 113 <isset property="manifest.available"/> 114 <isset property="main.class.available"/> 75 <condition property="profile.available"> 76 <and> 77 <isset property="javac.profile"/> 78 <length length="0" string="${javac.profile}" when="greater"/> 79 <matches pattern="1\.[89](\..*)?" string="${javac.source}"/> 115 80 </and> 116 81 </condition> 117 82 <condition property="do.archive"> 118 <not> 119 <istrue value="${jar.archive.disabled}"/> 120 </not> 83 <or> 84 <not> 85 <istrue value="${jar.archive.disabled}"/> 86 </not> 87 <istrue value="${not.archive.disabled}"/> 88 </or> 121 89 </condition> 122 90 <condition property="do.mkdist"> … … 129 97 </and> 130 98 </condition> 131 <condition property="manifest.available+main.class+mkdist.available">132 <and>133 <istrue value="${manifest.available+main.class}"/>134 <isset property="do.mkdist"/>135 </and>136 </condition>137 99 <condition property="do.archive+manifest.available"> 138 100 <and> … … 153 115 </and> 154 116 </condition> 155 <condition property="do.archive+ manifest.available+main.class">156 <and> 157 <is true value="${manifest.available+main.class}"/>117 <condition property="do.archive+profile.available"> 118 <and> 119 <isset property="profile.available"/> 158 120 <istrue value="${do.archive}"/> 159 121 </and> 160 </condition>161 <condition property="manifest.available-mkdist.available">162 <or>163 <istrue value="${manifest.available}"/>164 <isset property="do.mkdist"/>165 </or>166 </condition>167 <condition property="manifest.available+main.class-mkdist.available">168 <or>169 <istrue value="${manifest.available+main.class}"/>170 <isset property="do.mkdist"/>171 </or>172 122 </condition> 173 123 <condition property="have.tests"> … … 224 174 <path id="endorsed.classpath.path" path="${endorsed.classpath}"/> 225 175 <condition else="" property="endorsed.classpath.cmd.line.arg" value="-Xbootclasspath/p:'${toString:endorsed.classpath.path}'"> 226 <length length="0" string="${endorsed.classpath}" when="greater"/> 227 </condition> 176 <and> 177 <isset property="endorsed.classpath"/> 178 <not> 179 <equals arg1="${endorsed.classpath}" arg2="" trim="true"/> 180 </not> 181 </and> 182 </condition> 183 <condition else="" property="javac.profile.cmd.line.arg" value="-profile ${javac.profile}"> 184 <isset property="profile.available"/> 185 </condition> 186 <condition else="false" property="jdkBug6558476"> 187 <and> 188 <matches pattern="1\.[56]" string="${java.specification.version}"/> 189 <not> 190 <os family="unix"/> 191 </not> 192 </and> 193 </condition> 194 <property name="javac.fork" value="${jdkBug6558476}"/> 228 195 <property name="jar.index" value="false"/> 229 196 <property name="jar.index.metainf" value="${jar.index}"/> … … 294 261 <mkdir dir="${empty.dir}"/> 295 262 <mkdir dir="@{apgeneratedsrcdir}"/> 296 <javac debug="@{debug}" deprecation="${javac.deprecation}" destdir="@{destdir}" encoding="${source.encoding}" excludes="@{excludes}" executable="${platform.javac}" fork="yes" includeantruntime="false" includes="@{includes}" source="${javac.source}" sourcepath="@{sourcepath}" srcdir="@{srcdir}" target="${javac.target}" tempdir="${java.io.tmpdir}">263 <javac debug="@{debug}" deprecation="${javac.deprecation}" destdir="@{destdir}" encoding="${source.encoding}" excludes="@{excludes}" fork="${javac.fork}" includeantruntime="false" includes="@{includes}" source="${javac.source}" sourcepath="@{sourcepath}" srcdir="@{srcdir}" target="${javac.target}" tempdir="${java.io.tmpdir}"> 297 264 <src> 298 265 <dirset dir="@{gensrcdir}" erroronmissingdir="false"> … … 304 271 </classpath> 305 272 <compilerarg line="${endorsed.classpath.cmd.line.arg}"/> 273 <compilerarg line="${javac.profile.cmd.line.arg}"/> 306 274 <compilerarg line="${javac.compilerargs}"/> 307 275 <compilerarg value="-processorpath"/> … … 333 301 <property location="${build.dir}/empty" name="empty.dir"/> 334 302 <mkdir dir="${empty.dir}"/> 335 <javac debug="@{debug}" deprecation="${javac.deprecation}" destdir="@{destdir}" encoding="${source.encoding}" excludes="@{excludes}" executable="${platform.javac}" fork="yes" includeantruntime="false" includes="@{includes}" source="${javac.source}" sourcepath="@{sourcepath}" srcdir="@{srcdir}" target="${javac.target}" tempdir="${java.io.tmpdir}">303 <javac debug="@{debug}" deprecation="${javac.deprecation}" destdir="@{destdir}" encoding="${source.encoding}" excludes="@{excludes}" fork="${javac.fork}" includeantruntime="false" includes="@{includes}" source="${javac.source}" sourcepath="@{sourcepath}" srcdir="@{srcdir}" target="${javac.target}" tempdir="${java.io.tmpdir}"> 336 304 <src> 337 305 <dirset dir="@{gensrcdir}" erroronmissingdir="false"> … … 343 311 </classpath> 344 312 <compilerarg line="${endorsed.classpath.cmd.line.arg}"/> 313 <compilerarg line="${javac.profile.cmd.line.arg}"/> 345 314 <compilerarg line="${javac.compilerargs}"/> 346 315 <customize/> … … 413 382 <sequential> 414 383 <property name="junit.forkmode" value="perTest"/> 415 <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" jvm="${platform.java}"showoutput="true" tempdir="${build.dir}">384 <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" showoutput="true" tempdir="${build.dir}"> 416 385 <test methods="@{testmethods}" name="@{testincludes}" todir="${build.test.results.dir}"/> 417 386 <syspropertyset> … … 436 405 <sequential> 437 406 <property name="junit.forkmode" value="perTest"/> 438 <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" jvm="${platform.java}"showoutput="true" tempdir="${build.dir}">407 <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" showoutput="true" tempdir="${build.dir}"> 439 408 <batchtest todir="${build.test.results.dir}"> 440 409 <fileset dir="${test.src.dir}" excludes="@{excludes},${excludes}" includes="@{includes}"> … … 475 444 </union> 476 445 <taskdef classname="org.testng.TestNGAntTask" classpath="${run.test.classpath}" name="testng"/> 477 <testng classfilesetref="test.set" failureProperty="tests.failed" jvm="${platform.java}" methods="${testng.methods.arg}" mode="${testng.mode}" outputdir="${build.test.results.dir}" suitename="TMCSim" testname="TestNG tests" workingDir="${work.dir}">446 <testng classfilesetref="test.set" failureProperty="tests.failed" listeners="org.testng.reporters.VerboseReporter" methods="${testng.methods.arg}" mode="${testng.mode}" outputdir="${build.test.results.dir}" suitename="TMCSim" testname="TestNG tests" workingDir="${work.dir}"> 478 447 <xmlfileset dir="${build.test.classes.dir}" includes="@{testincludes}"/> 479 448 <propertyset> … … 555 524 <sequential> 556 525 <property name="junit.forkmode" value="perTest"/> 557 <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" jvm="${platform.java}"showoutput="true" tempdir="${build.dir}">526 <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" showoutput="true" tempdir="${build.dir}"> 558 527 <test methods="@{testmethods}" name="@{testincludes}" todir="${build.test.results.dir}"/> 559 528 <syspropertyset> … … 580 549 <sequential> 581 550 <property name="junit.forkmode" value="perTest"/> 582 <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" jvm="${platform.java}"showoutput="true" tempdir="${build.dir}">551 <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" showoutput="true" tempdir="${build.dir}"> 583 552 <batchtest todir="${build.test.results.dir}"> 584 553 <fileset dir="${test.src.dir}" excludes="@{excludes},${excludes}" includes="@{includes}"> … … 760 729 <path path="@{classpath}"/> 761 730 </classpath> 762 <bootclasspath>763 <path path="${platform.bootcp}"/>764 </bootclasspath>765 731 </nbjpdastart> 766 732 </sequential> … … 778 744 </target> 779 745 <target name="-init-debug-args"> 780 <exec executable="${platform.java}" outputproperty="version-output"> 781 <arg value="-version"/> 782 </exec> 746 <property name="version-output" value="java version "${ant.java.version}"/> 783 747 <condition property="have-jdk-older-than-1.4"> 784 748 <or> … … 805 769 <element name="customize" optional="true"/> 806 770 <sequential> 807 <java classname="@{classname}" dir="${work.dir}" fork="true" jvm="${platform.java}">771 <java classname="@{classname}" dir="${work.dir}" fork="true"> 808 772 <jvmarg line="${endorsed.classpath.cmd.line.arg}"/> 809 773 <jvmarg line="${debug-args-line}"/> … … 832 796 <element name="customize" optional="true"/> 833 797 <sequential> 834 <java classname="@{classname}" dir="${work.dir}" fork="true" jvm="${platform.java}">798 <java classname="@{classname}" dir="${work.dir}" fork="true"> 835 799 <jvmarg line="${endorsed.classpath.cmd.line.arg}"/> 836 800 <jvmarg value="-Dfile.encoding=${runtime.encoding}"/> … … 871 835 </pathconvert> 872 836 <taskdef classname="org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs" classpath="${libs.CopyLibs.classpath}" name="copylibs"/> 873 <copylibs compress="${jar.compress}" index="${jar.index}" indexMetaInf="${jar.index.metainf}" jarfile="${dist.jar}" manifest="@{manifest}" rebase="${copylibs.rebase}" runtimeclasspath="${run.classpath.without.build.classes.dir}">874 <fileset dir="${build.classes.dir}" />837 <copylibs compress="${jar.compress}" excludeFromCopy="${copylibs.excludes}" index="${jar.index}" indexMetaInf="${jar.index.metainf}" jarfile="${dist.jar}" manifest="@{manifest}" rebase="${copylibs.rebase}" runtimeclasspath="${run.classpath.without.build.classes.dir}"> 838 <fileset dir="${build.classes.dir}" excludes="${dist.archive.excludes}"/> 875 839 <manifest> 876 840 <attribute name="Class-Path" value="${jar.classpath}"/> … … 884 848 <presetdef name="jar" uri="http://www.netbeans.org/ns/j2se-project/1"> 885 849 <jar compress="${jar.compress}" index="${jar.index}" jarfile="${dist.jar}"> 886 <j2seproject1:fileset dir="${build.classes.dir}" />850 <j2seproject1:fileset dir="${build.classes.dir}" excludes="${dist.archive.excludes}"/> 887 851 </jar> 888 852 </presetdef> … … 1000 964 <!-- You can override this target in the ../build.xml file. --> 1001 965 </target> 1002 <target depends="init,compile,-pre-pre-jar,-pre-jar" if="do.archive" name="-do-jar-without-manifest" unless="manifest.available-mkdist.available"> 1003 <j2seproject1:jar/> 1004 </target> 1005 <target depends="init,compile,-pre-pre-jar,-pre-jar" if="do.archive+manifest.available" name="-do-jar-with-manifest" unless="manifest.available+main.class-mkdist.available"> 1006 <j2seproject1:jar manifest="${manifest.file}"/> 1007 </target> 1008 <target depends="init,compile,-pre-pre-jar,-pre-jar" if="do.archive+manifest.available+main.class" name="-do-jar-with-mainclass" unless="manifest.available+main.class+mkdist.available"> 1009 <j2seproject1:jar manifest="${manifest.file}"> 1010 <j2seproject1:manifest> 1011 <j2seproject1:attribute name="Main-Class" value="${main.class}"/> 1012 </j2seproject1:manifest> 1013 </j2seproject1:jar> 966 <target depends="init" if="do.archive" name="-do-jar-create-manifest" unless="manifest.available"> 967 <tempfile deleteonexit="true" destdir="${build.dir}" property="tmp.manifest.file"/> 968 <touch file="${tmp.manifest.file}" verbose="false"/> 969 </target> 970 <target depends="init" if="do.archive+manifest.available" name="-do-jar-copy-manifest"> 971 <tempfile deleteonexit="true" destdir="${build.dir}" property="tmp.manifest.file"/> 972 <copy file="${manifest.file}" tofile="${tmp.manifest.file}"/> 973 </target> 974 <target depends="init,-do-jar-create-manifest,-do-jar-copy-manifest" if="do.archive+main.class.available" name="-do-jar-set-mainclass"> 975 <manifest file="${tmp.manifest.file}" mode="update"> 976 <attribute name="Main-Class" value="${main.class}"/> 977 </manifest> 978 </target> 979 <target depends="init,-do-jar-create-manifest,-do-jar-copy-manifest" if="do.archive+profile.available" name="-do-jar-set-profile"> 980 <manifest file="${tmp.manifest.file}" mode="update"> 981 <attribute name="Profile" value="${javac.profile}"/> 982 </manifest> 983 </target> 984 <target depends="init,-do-jar-create-manifest,-do-jar-copy-manifest" if="do.archive+splashscreen.available" name="-do-jar-set-splashscreen"> 985 <basename file="${application.splash}" property="splashscreen.basename"/> 986 <mkdir dir="${build.classes.dir}/META-INF"/> 987 <copy failonerror="false" file="${application.splash}" todir="${build.classes.dir}/META-INF"/> 988 <manifest file="${tmp.manifest.file}" mode="update"> 989 <attribute name="SplashScreen-Image" value="META-INF/${splashscreen.basename}"/> 990 </manifest> 991 </target> 992 <target depends="init,-init-macrodef-copylibs,compile,-pre-pre-jar,-pre-jar,-do-jar-create-manifest,-do-jar-copy-manifest,-do-jar-set-mainclass,-do-jar-set-profile,-do-jar-set-splashscreen" if="do.mkdist" name="-do-jar-copylibs"> 993 <j2seproject3:copylibs manifest="${tmp.manifest.file}"/> 1014 994 <echo level="info">To run this application from the command line without Ant, try:</echo> 995 <property location="${dist.jar}" name="dist.jar.resolved"/> 996 <echo level="info">java -jar "${dist.jar.resolved}"</echo> 997 </target> 998 <target depends="init,compile,-pre-pre-jar,-pre-jar,-do-jar-create-manifest,-do-jar-copy-manifest,-do-jar-set-mainclass,-do-jar-set-profile,-do-jar-set-splashscreen" if="do.archive" name="-do-jar-jar" unless="do.mkdist"> 999 <j2seproject1:jar manifest="${tmp.manifest.file}"/> 1015 1000 <property location="${build.classes.dir}" name="build.classes.dir.resolved"/> 1016 1001 <property location="${dist.jar}" name="dist.jar.resolved"/> … … 1019 1004 <map from="${build.classes.dir.resolved}" to="${dist.jar.resolved}"/> 1020 1005 </pathconvert> 1021 <echo level="info">${platform.java} -cp "${run.classpath.with.dist.jar}" ${main.class}</echo> 1022 </target> 1023 <target depends="init" if="do.archive" name="-do-jar-with-libraries-create-manifest" unless="manifest.available"> 1024 <tempfile deleteonexit="true" destdir="${build.dir}" property="tmp.manifest.file"/> 1025 <touch file="${tmp.manifest.file}" verbose="false"/> 1026 </target> 1027 <target depends="init" if="do.archive+manifest.available" name="-do-jar-with-libraries-copy-manifest"> 1028 <tempfile deleteonexit="true" destdir="${build.dir}" property="tmp.manifest.file"/> 1029 <copy file="${manifest.file}" tofile="${tmp.manifest.file}"/> 1030 </target> 1031 <target depends="init,-do-jar-with-libraries-create-manifest,-do-jar-with-libraries-copy-manifest" if="do.archive+main.class.available" name="-do-jar-with-libraries-set-main"> 1032 <manifest file="${tmp.manifest.file}" mode="update"> 1033 <attribute name="Main-Class" value="${main.class}"/> 1034 </manifest> 1035 </target> 1036 <target depends="init,-do-jar-with-libraries-create-manifest,-do-jar-with-libraries-copy-manifest" if="do.archive+splashscreen.available" name="-do-jar-with-libraries-set-splashscreen"> 1037 <basename file="${application.splash}" property="splashscreen.basename"/> 1038 <mkdir dir="${build.classes.dir}/META-INF"/> 1039 <copy failonerror="false" file="${application.splash}" todir="${build.classes.dir}/META-INF"/> 1040 <manifest file="${tmp.manifest.file}" mode="update"> 1041 <attribute name="SplashScreen-Image" value="META-INF/${splashscreen.basename}"/> 1042 </manifest> 1043 </target> 1044 <target depends="init,-init-macrodef-copylibs,compile,-pre-pre-jar,-pre-jar,-do-jar-with-libraries-create-manifest,-do-jar-with-libraries-copy-manifest,-do-jar-with-libraries-set-main,-do-jar-with-libraries-set-splashscreen" if="do.mkdist" name="-do-jar-with-libraries-pack"> 1045 <j2seproject3:copylibs manifest="${tmp.manifest.file}"/> 1046 <echo level="info">To run this application from the command line without Ant, try:</echo> 1047 <property location="${dist.jar}" name="dist.jar.resolved"/> 1048 <echo level="info">${platform.java} -jar "${dist.jar.resolved}"</echo> 1049 </target> 1050 <target depends="-do-jar-with-libraries-pack" if="do.archive" name="-do-jar-with-libraries-delete-manifest"> 1006 <condition else="" property="jar.usage.message" value="To run this application from the command line without Ant, try:${line.separator}${platform.java} -cp ${run.classpath.with.dist.jar} ${main.class}"> 1007 <isset property="main.class.available"/> 1008 </condition> 1009 <condition else="debug" property="jar.usage.level" value="info"> 1010 <isset property="main.class.available"/> 1011 </condition> 1012 <echo level="${jar.usage.level}" message="${jar.usage.message}"/> 1013 </target> 1014 <target depends="-do-jar-copylibs" if="do.archive" name="-do-jar-delete-manifest"> 1051 1015 <delete> 1052 1016 <fileset file="${tmp.manifest.file}"/> 1053 1017 </delete> 1054 1018 </target> 1055 <target depends="init,compile,-pre-pre-jar,-pre-jar,-do-jar-with-libraries-create-manifest,-do-jar-with-libraries-copy-manifest,-do-jar-with-libraries-set-main,-do-jar-with-libraries-set-splashscreen,-do-jar-with-libraries-pack,-do-jar-with-libraries-delete-manifest" name="-do-jar-with-libraries"/> 1019 <target depends="init,compile,-pre-pre-jar,-pre-jar,-do-jar-create-manifest,-do-jar-copy-manifest,-do-jar-set-mainclass,-do-jar-set-profile,-do-jar-set-splashscreen,-do-jar-jar,-do-jar-delete-manifest" name="-do-jar-without-libraries"/> 1020 <target depends="init,compile,-pre-pre-jar,-pre-jar,-do-jar-create-manifest,-do-jar-copy-manifest,-do-jar-set-mainclass,-do-jar-set-profile,-do-jar-set-splashscreen,-do-jar-copylibs,-do-jar-delete-manifest" name="-do-jar-with-libraries"/> 1056 1021 <target name="-post-jar"> 1057 1022 <!-- Empty placeholder for easier customization. --> 1058 1023 <!-- You can override this target in the ../build.xml file. --> 1059 1024 </target> 1060 <target depends="init,compile,-pre-jar,-do-jar-with-manifest,-do-jar-without-manifest,-do-jar-with-mainclass,-do-jar-with-libraries,-post-jar" description="Build JAR." name="jar"/> 1025 <target depends="init,compile,-pre-jar,-do-jar-without-libraries,-do-jar-with-libraries,-post-jar" name="-do-jar"/> 1026 <target depends="init,compile,-pre-jar,-do-jar,-post-jar" description="Build JAR." name="jar"/> 1061 1027 <!-- 1062 1028 ================= … … 1237 1203 </and> 1238 1204 </condition> 1239 <javadoc additionalparam="${javadoc.additionalparam}" author="${javadoc.author}" charset="UTF-8" destdir="${dist.javadoc.dir}" docencoding="UTF-8" encoding="${javadoc.encoding.used}" executable="${platform.javadoc}" failonerror="true" noindex="${javadoc.noindex}" nonavbar="${javadoc.nonavbar}" notree="${javadoc.notree}" private="${javadoc.private}" source="${javac.source}" splitindex="${javadoc.splitindex}" use="${javadoc.use}" useexternalfile="true" version="${javadoc.version}" windowtitle="${javadoc.windowtitle}"> 1205 <condition else="" property="bug5101868workaround" value="*.java"> 1206 <matches pattern="1\.[56](\..*)?" string="${java.version}"/> 1207 </condition> 1208 <javadoc additionalparam="-J-Dfile.encoding=${file.encoding} ${javadoc.additionalparam}" author="${javadoc.author}" charset="UTF-8" destdir="${dist.javadoc.dir}" docencoding="UTF-8" encoding="${javadoc.encoding.used}" failonerror="true" noindex="${javadoc.noindex}" nonavbar="${javadoc.nonavbar}" notree="${javadoc.notree}" private="${javadoc.private}" source="${javac.source}" splitindex="${javadoc.splitindex}" use="${javadoc.use}" useexternalfile="true" version="${javadoc.version}" windowtitle="${javadoc.windowtitle}"> 1240 1209 <classpath> 1241 1210 <path path="${javac.classpath}"/> 1242 1211 </classpath> 1243 <fileset dir="${src.dir}" excludes=" *.java,${excludes}" includes="${includes}">1212 <fileset dir="${src.dir}" excludes="${bug5101868workaround},${excludes}" includes="${includes}"> 1244 1213 <filename name="**/*.java"/> 1245 1214 </fileset> … … 1315 1284 </target> 1316 1285 <target depends="init,compile-test,-pre-test-run" if="have.tests" name="-do-test-run"> 1317 <j2seproject3:test testincludes="**/*Test.java"/>1286 <j2seproject3:test includes="${includes}" testincludes="**/*Test.java"/> 1318 1287 </target> 1319 1288 <target depends="init,compile-test,-pre-test-run,-do-test-run" if="have.tests" name="-post-test-run"> -
trunk/IDE_metadata/NetBeans/TMCSim/nbproject/genfiles.properties
r12 r79 4 4 # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. 5 5 # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. 6 nbproject/build-impl.xml.data.CRC32= e14f63c17 nbproject/build-impl.xml.script.CRC32=5 3f7f34a8 nbproject/build-impl.xml.stylesheet.CRC32= c6d2a60f@1.56.1.466 nbproject/build-impl.xml.data.CRC32=6c7221c6 7 nbproject/build-impl.xml.script.CRC32=5cb245d6 8 nbproject/build-impl.xml.stylesheet.CRC32=876e7a8f@1.75.2.48 -
trunk/IDE_metadata/NetBeans/TMCSim/nbproject/project.properties
r59 r79 72 72 meta.inf.dir=${src.dir}/META-INF 73 73 mkdist.disabled=false 74 platform.active= JDK_1.774 platform.active=default_platform 75 75 run.classpath=\ 76 76 ${javac.classpath}:\ -
trunk/IDE_metadata/NetBeans/TMCSim/nbproject/project.xml
r12 r79 5 5 <data xmlns="http://www.netbeans.org/ns/j2se-project/3"> 6 6 <name>TMCSim</name> 7 <explicit-platform explicit-source-supported="true"/>8 7 <source-roots> 9 8 <root id="src.dir"/> -
trunk/config/paramics_simulator_config.properties
r60 r79 1 WorkingDirectory = C:/paramics/2 #WorkingDirectory = .\/1 #WorkingDirectory = C:/paramics/ 2 WorkingDirectory = ./ 3 3 IncidentUpdateFile = exchange.xml 4 4 ParamicsStatusFile = paramics_status.xml -
trunk/src/atmsdriver/ATMSDriver.java
r77 r79 1 1 package atmsdriver; 2 2 3 import atmsdriver. network.model.Network;3 import atmsdriver.model.Network; 4 4 import java.io.File; 5 import java.io.FileInputStream; 6 import java.util.Properties; 5 7 import java.util.logging.Level; 6 8 import java.util.logging.Logger; 7 9 8 /** 10 /** 9 11 * 10 12 * @author John A. Torres 11 13 * @version 09/10/2017 12 14 */ 13 public class ATMSDriver { 14 final private String ldsFileName = "./lds_data/lookup_lds"; 15 final private String loopFileName = "./lds_data/lookup_loop"; 16 final private String networkFileName = "./networkFile.txt"; 15 public class ATMSDriver implements Runnable { 16 17 /** ATMSDriver Error logger. */ 18 private static Logger ATMSDriverLogger = Logger.getLogger("atmsdriver"); 19 20 private static final String CONFIG_FILE_NAME = "atms_driver_config.properties"; 21 22 /** Properties object for the CADClient class. */ 23 private Properties ATMSDriverProperties; 24 25 /** 26 * Enumeration containing properties name values. See ATMSDriver class 27 * description for more information. 28 * 29 * @author John Torres 30 * @see ATMSDriver 31 */ 32 private static enum PROPERTIES { 33 34 LDS_FILE_NAME("LDSFileName"), 35 LOOP_FILE_NAME("LoopFileName"), 36 NETWORK_FILE_NAME("NetworkFileName"), 37 EXCHANGE_FILE_NAME("ExchangeFileName"); 38 39 public String name; 40 41 private PROPERTIES(String n) { 42 name = n; 43 } 44 } 45 46 /** Network model. */ 17 47 final private Network network; 18 48 19 public ATMSDriver() 20 { 21 File ldsFile = new File(ldsFileName); 22 File loopFile = new File(loopFileName); 23 File networkFile = new File(networkFileName); 24 network = new Network(ldsFile, loopFile, networkFile); 25 try { 49 /** Sleep Time (10 seconds). **/ 50 private static final int SLEEP_TIME = 10000; 51 52 /** Exchange Reader */ 53 private ExchangeReader exchangeReader; 54 55 @Override 56 public void run() { 57 // Check for packets and update the simulator 58 for (;;) { 59 // Flush the input file 60 ExchangeInfo exInfo = exchangeReader.parse(ATMSDriverProperties 61 .getProperty(PROPERTIES.EXCHANGE_FILE_NAME.name)); 26 62 network.toXML(); 27 } catch (Exception ex) { 28 Logger.getLogger(ATMSDriver.class.getName()).log(Level.SEVERE, null, ex); 63 // Update if packet is recieved 64 if (exInfo != null) { 65 System.out.println("Grabbed"); 66 } 67 68 // Sleep 69 try { 70 Thread.sleep(SLEEP_TIME); 71 } catch (InterruptedException ie) { 72 73 } 29 74 } 30 75 } 31 76 77 public ATMSDriver(String propertiesFile) { 78 79 if (!verifyProperties(propertiesFile)) { 80 System.exit(0); 81 } 82 83 network = new Network( 84 new File(ATMSDriverProperties.getProperty( 85 PROPERTIES.LDS_FILE_NAME.name)), 86 new File(ATMSDriverProperties.getProperty( 87 PROPERTIES.LOOP_FILE_NAME.name)), 88 new File(ATMSDriverProperties.getProperty( 89 PROPERTIES.NETWORK_FILE_NAME.name))); 90 network.toXML(); 91 exchangeReader = new ExchangeReader(); 92 } 93 94 private boolean verifyProperties(String propertiesFile) { 95 // Load the properties file. 96 try { 97 ATMSDriverProperties = new Properties(); 98 ATMSDriverProperties.load(new FileInputStream(propertiesFile)); 99 } catch (Exception e) { 100 ATMSDriverLogger.logp(Level.SEVERE, "ATMSDriver", 101 "Constructor", "Exception in reading properties file.", e); 102 } 103 104 return true; 105 } 106 32 107 /** 33 * @param args the command line arguments108 * Runs the Paramics simulator. 34 109 */ 35 110 public static void main(String[] args) { 36 ATMSDriver driver = new ATMSDriver(); 111 try { 112 if (System.getProperty("ATMSDRIVER_PROPERTIES") != null) { 113 new Thread(new ATMSDriver(System.getProperty( 114 "ATMSDRIVER_PROPERTIES"))).start(); 115 } else { 116 throw new Exception("ATMSDRIVER_PROPERTIES system property not defined."); 117 } 118 } catch (Exception e) { 119 ATMSDriverLogger.logp(Level.SEVERE, "ATMSDriver", "Main", 120 "Error occured initializing application", e); 121 System.exit(-1); 122 } 37 123 } 38 39 124 } -
trunk/src/atmsdriver/NetworkLoader.java
r77 r79 1 1 package atmsdriver; 2 2 3 import atmsdriver. network.model.FEPLine;4 import atmsdriver. network.model.LoopDetectorStation;5 import atmsdriver. network.model.LoopDetector;6 import atmsdriver. network.model.LoopDetectorStation.DIRECTION;3 import atmsdriver.model.FEPLine; 4 import atmsdriver.model.LoopDetectorStation; 5 import atmsdriver.model.LoopDetector; 6 import atmsdriver.model.LoopDetectorStation.DIRECTION; 7 7 import java.io.File; 8 8 import java.io.FileNotFoundException; … … 30 30 * @version 09/10/2017 31 31 */ 32 public class Network Reader {32 public class NetworkLoader { 33 33 // Two network config files 34 34 private final File LDSFile; … … 43 43 * @param loopFile contains individual LoopDetector static data 44 44 */ 45 public Network Reader(File LDSFile, File loopFile)45 public NetworkLoader(File LDSFile, File loopFile) 46 46 { 47 47 this.LDSFile = LDSFile; … … 176 176 } 177 177 } catch (FileNotFoundException ex) { 178 Logger.getLogger(Network Reader.class.getName()).log(Level.SEVERE, null, ex);178 Logger.getLogger(NetworkLoader.class.getName()).log(Level.SEVERE, null, ex); 179 179 } 180 180 } -
trunk/src/atmsdriver/model/FEPLine.java
r77 r79 1 package atmsdriver. network.model;1 package atmsdriver.model; 2 2 3 3 import java.util.List; -
trunk/src/atmsdriver/model/LoopDetector.java
r77 r79 1 package atmsdriver. network.model;1 package atmsdriver.model; 2 2 3 3 import java.util.ArrayList; -
trunk/src/atmsdriver/model/LoopDetectorStation.java
r77 r79 1 package atmsdriver. network.model;1 package atmsdriver.model; 2 2 3 3 import java.util.List; -
trunk/src/atmsdriver/model/Network.java
r77 r79 1 package atmsdriver. network.model;1 package atmsdriver.model; 2 2 3 import atmsdriver.Network Reader;3 import atmsdriver.NetworkLoader; 4 4 import java.io.File; 5 5 import java.io.FileWriter; 6 import java.io.IOException; 6 7 import java.io.StringWriter; 7 8 import java.io.Writer; … … 14 15 import javax.xml.transform.OutputKeys; 15 16 import javax.xml.transform.Transformer; 17 import javax.xml.transform.TransformerConfigurationException; 18 import javax.xml.transform.TransformerException; 16 19 import javax.xml.transform.TransformerFactory; 17 20 import javax.xml.transform.dom.DOMSource; … … 31 34 { 32 35 lines = (ArrayList<FEPLine>) 33 new Network Reader(LDSFile, loopFile).getFEPLines();36 new NetworkLoader(LDSFile, loopFile).getFEPLines(); 34 37 this.networkFile = networkFile; 35 38 } 36 39 37 public void toXML() throws Exception40 public void toXML() 38 41 { 39 42 try { … … 66 69 67 70 68 } catch ( ParserConfigurationException ex) {71 } catch (Exception ex) { 69 72 Logger.getLogger(Network.class.getName()).log(Level.SEVERE, null, ex); 70 73 } -
trunk/src/tmcsim/application.properties
r66 r79 1 #Thu, 16 Mar 2017 12:41:52-07001 #Thu, 05 Oct 2017 10:44:21 -0700 2 2 3 Application.revision=6 53 Application.revision=67 4 4 5 5 Application.buildnumber=46
Note: See TracChangeset
for help on using the changeset viewer.
