Changeset 79 in tmcsimulator


Ignore:
Timestamp:
10/05/2017 12:51:23 PM (9 years ago)
Author:
jtorres
Message:

new atmsdriver package in trunk. fep_rpc_client dynamic data packing added in branches. fep_rpc_client refactored data packing code into static DataPacker? class. Added vds_data folder into config/. Added new project configuration for ATMSDriver.

Files:
29 added
31 edited
6 copied

Legend:

Unmodified
Added
Removed
  • branches/ATMSDriver/build/built-jar.properties

    r77 r79  
    1 #Wed, 13 Sep 2017 17:07:03 -0700 
     1#Mon, 02 Oct 2017 13:41:31 -0700 
    22 
    33 
    4 /home/andrew/branches/ATMSDriver= 
     4/home/andrew/tmcsimulator/branches/ATMSDriver= 
  • branches/ATMSDriver/nbproject/private/private.xml

    r77 r79  
    33    <editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/> 
    44    <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/> 
    106    </open-files> 
    117</project-private> 
  • branches/fep_rpc_client/FEPClient.cpp

    r78 r79  
    77 * @param networkFile the xml network file 
    88 */ 
    9 FEPClient::FEPClient(char * host, char * networkFile) 
    10 { 
    11         createClient(host); 
    12         networkReader = new NetworkReader(networkFile); 
    13         updateATMS(); 
     9FEPClient::FEPClient(char * host, char * networkFile) { 
     10    networkReader = new NetworkReader(networkFile); 
     11    createClient(host); 
     12    updateATMS(); 
    1413} 
    1514 
     
    1716 * Destructor 
    1817 */ 
    19 FEPClient::~FEPClient() 
    20 { 
    21         cout << "Destroying client..." << endl; 
    22         clnt_destroy(clnt); 
     18FEPClient::~FEPClient() { 
     19    cout << "Destroying client..." << endl; 
     20    clnt_destroy(clnt); 
    2321} 
    2422 
     
    2725 * @param response pointer to fep_reply struct 
    2826 */ 
    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         } 
     27void 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    } 
    4135} 
    4236 
     
    4438 * Sends an fep_reply for every line in the FEP. 
    4539 */ 
    46 void FEPClient::updateATMS() 
    47 { 
    48         int i, j; // i == line_index, j == lds_index 
    49         void *rv; 
     40void FEPClient::updateATMS() { 
     41    int i, j; // i == line_index, j == lds_index 
     42    void *rv; 
    5043 
    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(); 
    5346 
    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; 
    6557 
    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         */ 
    7163 
    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 code 
    76                 fepReply.schedule_time = 
    77                         uci_unix_simulation_time(uci_simulation_time());        // GMT time 
    78                 */ 
    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); 
    8072 
    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; 
    8476 
    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; 
    8779 
    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 ????? 
    10394 
    104                         // info 
    105                         fsa.info.poll_error_count = 0; 
    106                         /*************************************** 
    107                                 Need to find out polltime uci time function src code 
    108                         fsa.info.poll_time = uci_unix_simulation_time(uci_simulation_time()); 
    109                         */ 
    110                         fsa.info.poll_user_info1 = ldsMap.at(index).drop;       // drop number 
    111                         fsa.info.poll_user_info2 = 1;   //always 1 
    112                         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; 
    114105 
    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; 
    117108 
    118                         // send out data 
    119                         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); 
    121112 
    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    } 
    127118} 
    128119 
     
    131122 * @param host rpc server ip 
    132123 */ 
    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         } 
     124void 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    } 
    145134} 
    146135 
     
    153142int main(int argc, char *argv[]) { 
    154143 
    155         char *host; 
    156         char *networkFile; 
     144    char *host; 
     145    char *networkFile; 
    157146 
    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    } 
    163151 
    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]; 
    167155 
    168         FEPClient *client = new FEPClient(host, networkFile); 
    169         delete client; 
     156    FEPClient *client = new FEPClient(host, networkFile); 
     157    delete client; 
    170158 
    171         return 0; 
     159    return 0; 
    172160} 
  • 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 
    25 * ATMS Server. 
    36 * 
     
    1417 * @version 9/8/2017 
    1518 */ 
     19 
    1620// Include guard 
    1721#ifndef __FEPCLIENT_H_INCLUDED__ 
  • branches/fep_rpc_client/NetworkReader.cpp

    r78 r79  
    1010} 
    1111 
     12LOOP * 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 
    1230/** 
    1331 * Parses a station xml element into an "LDS_LOOP" 
     
    1735 * @return the new station 
    1836 */ 
    19 LDS_LOOP NetworkReader::parseStation(TiXmlElement *stationElem, FEP_LINE *line) { 
    20     LDS_LOOP station; 
    21  
     37LDS_LOOP * NetworkReader::parseStation(TiXmlElement *stationElem, FEP_LINE *line) { 
     38    LDS_LOOP *station = new LDS_LOOP; 
     39     
    2240    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); 
    2643    line->ldsIndex.push_back(ldsIndex++); 
    2744    stationSubElem = stationSubElem->NextSiblingElement(); 
    28     station.line_num = atoi(stationSubElem->GetText()); 
     45    station->line_num = atoi(stationSubElem->GetText()); 
    2946    stationSubElem = stationSubElem->NextSiblingElement(); 
    30     station.drop = atoi(stationSubElem->GetText()); 
     47    station->drop = atoi(stationSubElem->GetText()); 
    3148    stationSubElem = stationSubElem->NextSiblingElement(); 
    3249    stationSubElem = stationSubElem->NextSiblingElement(); // skip location 
     
    3451    stationSubElem = stationSubElem->NextSiblingElement(); // skip direction 
    3552    stationSubElem = stationSubElem->NextSiblingElement(); // skip freeway 
    36     station.MlTotVol = atoi(stationSubElem->GetText()); 
     53    station->MlTotVol = atoi(stationSubElem->GetText()); 
    3754    stationSubElem = stationSubElem->NextSiblingElement(); 
    38     station.OppTotVol = atoi(stationSubElem->GetText()); 
     55    station->OppTotVol = atoi(stationSubElem->GetText()); 
    3956 
    40     station.pos = 0; 
     57    station->pos = 0; // NOT SURE WHY WE NEED THIS? 
     58     
    4159    // 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(); 
    4761    for (loopElem; loopElem; loopElem = loopElem->NextSiblingElement()) { 
    48         station.num += 1; 
     62        LOOP *loop = parseLoop(loopElem); 
     63        station->loops.push_back(loop); 
    4964    } 
    5065 
    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 */ 
     79FEP_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)); 
    60102    } 
    61     station.loopID = loopIDS; 
    62     station.loop_loc = loopLocs; 
     103    return line; 
     104} 
    63105 
    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 */ 
     110void 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; 
    106116    } 
    107117 
    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(); 
    130121 
    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)); 
    137128    } 
     129} 
    138130 
    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 */ 
     135vector<FEP_LINE*> NetworkReader::getLines() { 
    150136 
    151         // grab <Network> element 
    152         TiXmlHandle hDoc(&doc); 
    153         TiXmlElement *networkElem = hDoc.FirstChildElement().Element(); 
     137    return lines; 
     138} 
    154139 
    155         // grab first <Line> element 
    156         TiXmlElement *lineElem = networkElem->FirstChildElement(); 
     140/** 
     141 * Getter for stations 
     142 * @return List of LDS_LOOPs 
     143 */ 
     144vector<LDS_LOOP*> NetworkReader::getStations() { 
    157145 
    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} 
    163148 
    164     // determine if a loop has data based on lane config data 
     149NetworkReader::~NetworkReader() { 
    165150 
    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 
    25 * xml file. 
    36 *  
     
    58 * which are getters for the list of FEP_LINES, and LDS_LOOPS, respectively. 
    69 *  
    7  * Example xml file: 
     10 * Example XML file: 
    811 * <code> 
    912 * <Network> 
     
    4750#define __NETWORKREADER_H_INCLUDED__ 
    4851 
    49 // Forward declared dependencies 
    50  
    5152// Included dependencies 
    5253#include "network.h" 
    5354#include <vector> 
    54 #include <string> 
    5555#include <string.h> 
    5656#include <iostream> 
    5757#include "tinyxml.h" 
     58#include "DataPacker.h" 
    5859 
    5960class NetworkReader 
     
    6364        ~NetworkReader(); // Destructor 
    6465         
    65         vector<FEP_LINE> getLines(); // Getter for FEP_LINE list 
    66         vector<LDS_LOOP> getStations(); // Getter for LDS_LOOP list 
     66        vector<FEP_LINE*> getLines(); // Getter for FEP_LINE list 
     67        vector<LDS_LOOP*> getStations(); // Getter for LDS_LOOP list 
    6768    private: 
    68         vector<FEP_LINE> lines; 
    69         vector<LDS_LOOP> stations; 
     69        vector<FEP_LINE*> lines; 
     70        vector<LDS_LOOP*> stations; 
    7071        int ldsIndex; 
    7172 
    7273        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); 
    7977}; 
    8078 
  • branches/fep_rpc_client/build/Debug/GNU-Linux-x86/FEPClient.o.d

    r77 r79  
    11build/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 
    34 
    45FEPClient.h: 
     
    1314 
    1415tinyxml/tinystr.h: 
     16 
     17DataPacker.h: 
  • branches/fep_rpc_client/build/Debug/GNU-Linux-x86/NetworkReader.o.d

    r77 r79  
    11build/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 
    34 
    45NetworkReader.h: 
     
    910 
    1011tinyxml/tinystr.h: 
     12 
     13DataPacker.h: 
  • branches/fep_rpc_client/nbproject/Makefile-Debug.mk

    r77 r79  
    3636# Object Files 
    3737OBJECTFILES= \ 
     38        ${OBJECTDIR}/DataPacker.o \ 
    3839        ${OBJECTDIR}/FEPClient.o \ 
    3940        ${OBJECTDIR}/NetworkReader.o \ 
     
    5657 
    5758# Link Libraries and Options 
    58 LDLIBSOPTIONS=tinyxml/libtinyxml.a 
     59LDLIBSOPTIONS=tinyxml/tinyxml.a 
    5960 
    6061# Build Targets 
     
    6263        "${MAKE}"  -f nbproject/Makefile-${CND_CONF}.mk ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/fep_rpc_client 
    6364 
    64 ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/fep_rpc_client: tinyxml/libtinyxml.a 
     65${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/fep_rpc_client: tinyxml/tinyxml.a 
    6566 
    6667${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/fep_rpc_client: ${OBJECTFILES} 
    6768        ${MKDIR} -p ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM} 
    6869        ${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 
    6975 
    7076${OBJECTDIR}/FEPClient.o: FEPClient.cpp  
  • branches/fep_rpc_client/nbproject/Makefile-Release.mk

    r77 r79  
    3636# Object Files 
    3737OBJECTFILES= \ 
     38        ${OBJECTDIR}/DataPacker.o \ 
    3839        ${OBJECTDIR}/FEPClient.o \ 
    3940        ${OBJECTDIR}/NetworkReader.o \ 
     
    6566        ${MKDIR} -p ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM} 
    6667        ${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 
    6773 
    6874${OBJECTDIR}/FEPClient.o: FEPClient.cpp  
  • branches/fep_rpc_client/nbproject/configurations.xml

    r77 r79  
    55                   displayName="Header Files" 
    66                   projectFiles="true"> 
     7      <itemPath>DataPacker.h</itemPath> 
    78      <itemPath>FEPClient.h</itemPath> 
    89      <itemPath>NetworkReader.h</itemPath> 
     
    1718                   displayName="Source Files" 
    1819                   projectFiles="true"> 
     20      <itemPath>DataPacker.cpp</itemPath> 
    1921      <itemPath>FEPClient.cpp</itemPath> 
    2022      <itemPath>NetworkReader.cpp</itemPath> 
     
    5052        <linkerTool> 
    5153          <linkerLibItems> 
    52             <linkerLibFileItem>tinyxml/libtinyxml.a</linkerLibFileItem> 
     54            <linkerLibFileItem>tinyxml/tinyxml.a</linkerLibFileItem> 
    5355          </linkerLibItems> 
    5456        </linkerTool> 
    5557      </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> 
    5662      <item path="FEPClient.cpp" ex="false" tool="1" flavor2="0"> 
    5763      </item> 
     
    9197        </asmTool> 
    9298      </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> 
    93103      <item path="FEPClient.cpp" ex="false" tool="1" flavor2="0"> 
    94104      </item> 
  • branches/fep_rpc_client/nbproject/private/private.xml

    r78 r79  
    88    <open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2"> 
    99        <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> 
    1518        </group> 
    1619    </open-files> 
  • branches/fep_rpc_client/network.h

    r77 r79  
    1111const int Fixed_Byte_To_Checksum = 25; // the first byte is not considered in the calculation of "BYTE 2" 
    1212const int CONTROL_DATA_LEN = 27; 
     13 
    1314char * const dp5[8] = { "ML_1", "ML_2", "ML_3", "ML_4", "ML_5", 
    1415                                                "ML_6", "HOV_Lane", "FYW_Conn"}; 
     
    2021                                                "SD_6", "Pass_Vol_Count", "X"}; 
    2122 
    22 /*** NETWORK STRUCTS ***/ 
    23 typedef struct loopagg LOOPAGG; 
    24 struct loopagg 
    25 { 
    26         int             index; 
    27         char    lane;                   // how namy lanes at the detector station 
    28         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  
    3823// FEP line: has several lds 
    3924typedef struct fep_line FEP_LINE; 
    4025struct  fep_line 
    4126{ 
    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 
    4630 
    47         short   count;  // actual count from caltrans 
    48         int             schedule; 
    49         int             lineInfo; 
     31        short   count;  // actual count from caltrans 
     32        int     schedule; 
     33        int     lineInfo; 
    5034        long    systemKey; 
    5135        long    globalSeq; 
    5236        long    schedleSeq; 
     37}; 
     38 
     39// Loop detector 
     40typedef struct loop LOOP; 
     41struct loop 
     42{ 
     43    long loopID; 
     44    char *loop_loc; 
     45     
     46    int vol; 
     47    float occ; 
     48    double spd; 
    5349}; 
    5450 
     
    6157        short   line_num; 
    6258        short   drop; 
    63  
    64         int             num;    // number of loops 
    65         long    *loopID; 
    66         char    **loop_loc; 
     59         
     60        vector<LOOP*> loops; 
    6761 
    6862        // LDS data 
     
    7468}; 
    7569 
     70typedef struct volOcc VOLOCC; 
     71struct  volOcc 
     72{ 
     73   char high; 
     74   char low; 
     75}; 
     76 
     77 
    7678#endif 
  • trunk/IDE_metadata/NetBeans/TMCSim/nbproject/build-impl.xml

    r12 r79  
    5555    </target> 
    5656    <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=&lt;path_to_property_file&gt; jar (where you put the property "platforms.${platform.active}.home" in a .properties file) 
    92   or ant -Dplatforms.${platform.active}.home=&lt;path_to_JDK_home&gt; jar (where no properties file is used)  
    93   </fail> 
     57        <property name="platform.java" value="${java.home}/bin/java"/> 
    9458        <available file="${manifest.file}" property="manifest.available"/> 
    9559        <condition property="splashscreen.available"> 
     
    10973            </and> 
    11074        </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}"/> 
    11580            </and> 
    11681        </condition> 
    11782        <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> 
    12189        </condition> 
    12290        <condition property="do.mkdist"> 
     
    12997            </and> 
    13098        </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> 
    13799        <condition property="do.archive+manifest.available"> 
    138100            <and> 
     
    153115            </and> 
    154116        </condition> 
    155         <condition property="do.archive+manifest.available+main.class"> 
    156             <and> 
    157                 <istrue value="${manifest.available+main.class}"/> 
     117        <condition property="do.archive+profile.available"> 
     118            <and> 
     119                <isset property="profile.available"/> 
    158120                <istrue value="${do.archive}"/> 
    159121            </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> 
    172122        </condition> 
    173123        <condition property="have.tests"> 
     
    224174        <path id="endorsed.classpath.path" path="${endorsed.classpath}"/> 
    225175        <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}"/> 
    228195        <property name="jar.index" value="false"/> 
    229196        <property name="jar.index.metainf" value="${jar.index}"/> 
     
    294261                <mkdir dir="${empty.dir}"/> 
    295262                <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}"> 
    297264                    <src> 
    298265                        <dirset dir="@{gensrcdir}" erroronmissingdir="false"> 
     
    304271                    </classpath> 
    305272                    <compilerarg line="${endorsed.classpath.cmd.line.arg}"/> 
     273                    <compilerarg line="${javac.profile.cmd.line.arg}"/> 
    306274                    <compilerarg line="${javac.compilerargs}"/> 
    307275                    <compilerarg value="-processorpath"/> 
     
    333301                <property location="${build.dir}/empty" name="empty.dir"/> 
    334302                <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}"> 
    336304                    <src> 
    337305                        <dirset dir="@{gensrcdir}" erroronmissingdir="false"> 
     
    343311                    </classpath> 
    344312                    <compilerarg line="${endorsed.classpath.cmd.line.arg}"/> 
     313                    <compilerarg line="${javac.profile.cmd.line.arg}"/> 
    345314                    <compilerarg line="${javac.compilerargs}"/> 
    346315                    <customize/> 
     
    413382            <sequential> 
    414383                <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}"> 
    416385                    <test methods="@{testmethods}" name="@{testincludes}" todir="${build.test.results.dir}"/> 
    417386                    <syspropertyset> 
     
    436405            <sequential> 
    437406                <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}"> 
    439408                    <batchtest todir="${build.test.results.dir}"> 
    440409                        <fileset dir="${test.src.dir}" excludes="@{excludes},${excludes}" includes="@{includes}"> 
     
    475444                </union> 
    476445                <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}"> 
    478447                    <xmlfileset dir="${build.test.classes.dir}" includes="@{testincludes}"/> 
    479448                    <propertyset> 
     
    555524            <sequential> 
    556525                <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}"> 
    558527                    <test methods="@{testmethods}" name="@{testincludes}" todir="${build.test.results.dir}"/> 
    559528                    <syspropertyset> 
     
    580549            <sequential> 
    581550                <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}"> 
    583552                    <batchtest todir="${build.test.results.dir}"> 
    584553                        <fileset dir="${test.src.dir}" excludes="@{excludes},${excludes}" includes="@{includes}"> 
     
    760729                        <path path="@{classpath}"/> 
    761730                    </classpath> 
    762                     <bootclasspath> 
    763                         <path path="${platform.bootcp}"/> 
    764                     </bootclasspath> 
    765731                </nbjpdastart> 
    766732            </sequential> 
     
    778744    </target> 
    779745    <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 &quot;${ant.java.version}"/> 
    783747        <condition property="have-jdk-older-than-1.4"> 
    784748            <or> 
     
    805769            <element name="customize" optional="true"/> 
    806770            <sequential> 
    807                 <java classname="@{classname}" dir="${work.dir}" fork="true" jvm="${platform.java}"> 
     771                <java classname="@{classname}" dir="${work.dir}" fork="true"> 
    808772                    <jvmarg line="${endorsed.classpath.cmd.line.arg}"/> 
    809773                    <jvmarg line="${debug-args-line}"/> 
     
    832796            <element name="customize" optional="true"/> 
    833797            <sequential> 
    834                 <java classname="@{classname}" dir="${work.dir}" fork="true" jvm="${platform.java}"> 
     798                <java classname="@{classname}" dir="${work.dir}" fork="true"> 
    835799                    <jvmarg line="${endorsed.classpath.cmd.line.arg}"/> 
    836800                    <jvmarg value="-Dfile.encoding=${runtime.encoding}"/> 
     
    871835                </pathconvert> 
    872836                <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}"/> 
    875839                    <manifest> 
    876840                        <attribute name="Class-Path" value="${jar.classpath}"/> 
     
    884848        <presetdef name="jar" uri="http://www.netbeans.org/ns/j2se-project/1"> 
    885849            <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}"/> 
    887851            </jar> 
    888852        </presetdef> 
     
    1000964        <!-- You can override this target in the ../build.xml file. --> 
    1001965    </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}"/> 
    1014994        <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}"/> 
    10151000        <property location="${build.classes.dir}" name="build.classes.dir.resolved"/> 
    10161001        <property location="${dist.jar}" name="dist.jar.resolved"/> 
     
    10191004            <map from="${build.classes.dir.resolved}" to="${dist.jar.resolved}"/> 
    10201005        </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"> 
    10511015        <delete> 
    10521016            <fileset file="${tmp.manifest.file}"/> 
    10531017        </delete> 
    10541018    </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"/> 
    10561021    <target name="-post-jar"> 
    10571022        <!-- Empty placeholder for easier customization. --> 
    10581023        <!-- You can override this target in the ../build.xml file. --> 
    10591024    </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"/> 
    10611027    <!-- 
    10621028                ================= 
     
    12371203            </and> 
    12381204        </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}"> 
    12401209            <classpath> 
    12411210                <path path="${javac.classpath}"/> 
    12421211            </classpath> 
    1243             <fileset dir="${src.dir}" excludes="*.java,${excludes}" includes="${includes}"> 
     1212            <fileset dir="${src.dir}" excludes="${bug5101868workaround},${excludes}" includes="${includes}"> 
    12441213                <filename name="**/*.java"/> 
    12451214            </fileset> 
     
    13151284    </target> 
    13161285    <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"/> 
    13181287    </target> 
    13191288    <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  
    44# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. 
    55# 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=e14f63c1 
    7 nbproject/build-impl.xml.script.CRC32=53f7f34a 
    8 nbproject/build-impl.xml.stylesheet.CRC32=c6d2a60f@1.56.1.46 
     6nbproject/build-impl.xml.data.CRC32=6c7221c6 
     7nbproject/build-impl.xml.script.CRC32=5cb245d6 
     8nbproject/build-impl.xml.stylesheet.CRC32=876e7a8f@1.75.2.48 
  • trunk/IDE_metadata/NetBeans/TMCSim/nbproject/project.properties

    r59 r79  
    7272meta.inf.dir=${src.dir}/META-INF 
    7373mkdist.disabled=false 
    74 platform.active=JDK_1.7 
     74platform.active=default_platform 
    7575run.classpath=\ 
    7676    ${javac.classpath}:\ 
  • trunk/IDE_metadata/NetBeans/TMCSim/nbproject/project.xml

    r12 r79  
    55        <data xmlns="http://www.netbeans.org/ns/j2se-project/3"> 
    66            <name>TMCSim</name> 
    7             <explicit-platform explicit-source-supported="true"/> 
    87            <source-roots> 
    98                <root id="src.dir"/> 
  • trunk/config/paramics_simulator_config.properties

    r60 r79  
    1 WorkingDirectory    = C:/paramics/ 
    2 #WorkingDirectory    = .\/ 
     1#WorkingDirectory    = C:/paramics/ 
     2WorkingDirectory    = ./ 
    33IncidentUpdateFile  = exchange.xml 
    44ParamicsStatusFile  = paramics_status.xml 
  • trunk/src/atmsdriver/ATMSDriver.java

    r77 r79  
    11package atmsdriver; 
    22 
    3 import atmsdriver.network.model.Network; 
     3import atmsdriver.model.Network; 
    44import java.io.File; 
     5import java.io.FileInputStream; 
     6import java.util.Properties; 
    57import java.util.logging.Level; 
    68import java.util.logging.Logger; 
    79 
    8 /**  
     10/** 
    911 * 
    1012 * @author John A. Torres 
    1113 * @version 09/10/2017 
    1214 */ 
    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"; 
     15public 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. */ 
    1747    final private Network network; 
    1848     
    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)); 
    2662            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            } 
    2974        } 
    3075    } 
    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 
    32107    /** 
    33      * @param args the command line arguments 
     108     * Runs the Paramics simulator. 
    34109     */ 
    35110    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        } 
    37123    } 
    38      
    39124} 
  • trunk/src/atmsdriver/NetworkLoader.java

    r77 r79  
    11package atmsdriver; 
    22 
    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; 
     3import atmsdriver.model.FEPLine; 
     4import atmsdriver.model.LoopDetectorStation; 
     5import atmsdriver.model.LoopDetector; 
     6import atmsdriver.model.LoopDetectorStation.DIRECTION; 
    77import java.io.File; 
    88import java.io.FileNotFoundException; 
     
    3030 * @version 09/10/2017 
    3131 */ 
    32 public class NetworkReader { 
     32public class NetworkLoader { 
    3333    // Two network config files 
    3434    private final File LDSFile; 
     
    4343     * @param loopFile contains individual LoopDetector static data 
    4444     */ 
    45     public NetworkReader(File LDSFile, File loopFile) 
     45    public NetworkLoader(File LDSFile, File loopFile) 
    4646    { 
    4747        this.LDSFile = LDSFile; 
     
    176176            } 
    177177        } catch (FileNotFoundException ex) { 
    178             Logger.getLogger(NetworkReader.class.getName()).log(Level.SEVERE, null, ex); 
     178            Logger.getLogger(NetworkLoader.class.getName()).log(Level.SEVERE, null, ex); 
    179179        } 
    180180    } 
  • trunk/src/atmsdriver/model/FEPLine.java

    r77 r79  
    1 package atmsdriver.network.model; 
     1package atmsdriver.model; 
    22 
    33import java.util.List; 
  • trunk/src/atmsdriver/model/LoopDetector.java

    r77 r79  
    1 package atmsdriver.network.model; 
     1package atmsdriver.model; 
    22 
    33import java.util.ArrayList; 
  • trunk/src/atmsdriver/model/LoopDetectorStation.java

    r77 r79  
    1 package atmsdriver.network.model; 
     1package atmsdriver.model; 
    22 
    33import java.util.List; 
  • trunk/src/atmsdriver/model/Network.java

    r77 r79  
    1 package atmsdriver.network.model; 
     1package atmsdriver.model; 
    22 
    3 import atmsdriver.NetworkReader; 
     3import atmsdriver.NetworkLoader; 
    44import java.io.File; 
    55import java.io.FileWriter; 
     6import java.io.IOException; 
    67import java.io.StringWriter; 
    78import java.io.Writer; 
     
    1415import javax.xml.transform.OutputKeys; 
    1516import javax.xml.transform.Transformer; 
     17import javax.xml.transform.TransformerConfigurationException; 
     18import javax.xml.transform.TransformerException; 
    1619import javax.xml.transform.TransformerFactory; 
    1720import javax.xml.transform.dom.DOMSource; 
     
    3134    { 
    3235        lines = (ArrayList<FEPLine>)  
    33                 new NetworkReader(LDSFile, loopFile).getFEPLines(); 
     36                new NetworkLoader(LDSFile, loopFile).getFEPLines(); 
    3437        this.networkFile = networkFile; 
    3538    } 
    3639     
    37     public void toXML() throws Exception 
     40    public void toXML() 
    3841    { 
    3942        try { 
     
    6669             
    6770             
    68         } catch (ParserConfigurationException ex) { 
     71        } catch (Exception ex) { 
    6972            Logger.getLogger(Network.class.getName()).log(Level.SEVERE, null, ex); 
    7073        } 
  • trunk/src/tmcsim/application.properties

    r66 r79  
    1 #Thu, 16 Mar 2017 12:41:52 -0700 
     1#Thu, 05 Oct 2017 10:44:21 -0700 
    22 
    3 Application.revision=65 
     3Application.revision=67 
    44 
    55Application.buildnumber=46 
Note: See TracChangeset for help on using the changeset viewer.