Changeset 190 in tmcsimulator for trunk/src/atmsdriver


Ignore:
Timestamp:
10/29/2017 10:51:53 PM (9 years ago)
Author:
jtorres
Message:

vds_data/highways_fullmap.txt: removed lane num field, not necessary. ATMSDriver.java: removed System.out statement. FEPLine.java: renamed lineNum member to lineID. Highways.java: added example output for toCondensedFormat(boolean) method in method comments. LoopDetector?.java: removed spd member, not necessary, as we calculate speed form occ and vol. Station.java: conformed to above changes.

Location:
trunk/src/atmsdriver
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/atmsdriver/ATMSDriver.java

    r186 r190  
    116116                Integer.parseInt(ATMSDriverProperties.getProperty( 
    117117                                PROPERTIES.FEP_WRITER_PORT.name))); 
    118         System.out.println(highways.toCondensedFormat(false)); 
    119118        // create the exchange reader 
    120119        exchangeReader = new ExchangeReader(); 
  • trunk/src/atmsdriver/model/FEPLine.java

    r186 r190  
    1919{ 
    2020    /* Static FEPLine meta data */ 
    21     final public int lineNum; 
     21    final public int lineID; 
    2222    final public List<Station> stations; 
    2323    final private int count; 
     
    3030     * @param count  
    3131     */ 
    32     FEPLine(int lineNum, ArrayList<Station> stations, int count) 
     32    FEPLine(int lineID, ArrayList<Station> stations, int count) 
    3333    { 
    34         this.lineNum = lineNum; 
     34        this.lineID = lineID; 
    3535        this.stations = stations; 
    3636        this.count = count; 
     
    5555    { 
    5656        StringBuilder build = new StringBuilder(); 
    57         build.append(Integer.toString(this.lineNum)); 
     57        build.append(Integer.toString(this.lineID)); 
    5858        build.append(" "); 
    5959        build.append(Integer.toString(this.count)); 
     
    8181 
    8282        Element lineNumElement = theDoc.createElement(XML_TAGS.LINE_NUM.tag); 
    83         lineNumElement.appendChild(theDoc.createTextNode(String.valueOf(this.lineNum))); 
     83        lineNumElement.appendChild(theDoc.createTextNode(String.valueOf(this.lineID))); 
    8484        lineElement.appendChild(lineNumElement); 
    8585 
  • trunk/src/atmsdriver/model/Highways.java

    r186 r190  
    6161        // configure and load highways 
    6262        this.highways = configureHighways(); 
    63          
     63 
    6464        // write to FEP host and port number 
    6565        this.FEPHostName = FEPHostName; 
     
    278278 
    279279        int loopID = scline.nextInt(); 
    280         int laneNum = scline.nextInt(); 
    281         String loopLoc = getLoopLoc(line); // NEED GET LOOPLOC 
     280        String loopLoc = getLoopLoc(line); 
    282281        scline.close(); 
    283         return new LoopDetector(loopID, loopLoc, laneNum); 
     282        return new LoopDetector(loopID, loopLoc); 
    284283    } 
    285284 
     
    293292    { 
    294293        Scanner sc = new Scanner(line); 
    295         sc.nextInt(); 
    296294        sc.nextInt(); 
    297295 
     
    343341             
    344342            // Write the highways data over the socket 
    345             out.println(this.toXML()); 
     343            out.println(this.toCondensedFormat(false)); 
    346344             
    347345            // close the socket 
     
    369367     * @param MetaDataOnly Whether you want meta data, or a full dump for FEPSim 
    370368     * @return String, highways data in condensed format 
     369     *  
     370     * Example toCondensedFormat(MetaDataOnly = false) output: 
     371     *  
     372     * 43                   // "number of lines" 
     373     * 32 0 13              // "line id" "count num" "number of stations" 
     374     * 1210831 1 5 S 0.9 8  // "station id" "drop num" "route num"... 
     375     *                      //      ..."direction" "postmile" "number of loops" 
     376     * 1210832  0.0 0       // "loop id" "occ" "vol" 
     377     * 1210833  0.0 0       // .. 
     378     * 1210834  0.0 0       // .. 
     379     * 1210835  0.0 0       // .. 
     380     * 1210836  0.0 0       // .. 
     381     * 1210837  0.0 0       // .. 
     382     * 1210838  0.0 0       // .. 
     383     * 1210839  0.0 0       // .. 
     384     * ... 
     385     *  
     386     * Example toCondensedFormat(MetaDataOnly = true) output: 
     387     *  
     388     * 43                           // "number of lines" 
     389     * 32 0 13                      // "line id" "count num" "number of stations" 
     390     * 1210831 1 5 S 0.9 8 CALAFIA  // "station id" "drop num" "route num"... 
     391     *                              //      ..."direction" "postmile"... 
     392     *                              //      ..."number of loops" "string location" 
     393     * 1210832 ML_1                 // "loop id" "loop location" 
     394     * 1210833 ML_2                 // "            " 
     395     * 1210834 ML_3                 // "            " 
     396     * 1210835 ML_4                 // "            " 
     397     * 1210836 PASSAGE              // "            " 
     398     * 1210837 DEMAND               // "            " 
     399     * 1210838 QUEUE                // "            " 
     400     * 1210839 RAMP_OFF             // "            " 
     401     * ... 
    371402     */ 
    372403    public String toCondensedFormat(boolean MetaDataOnly) 
  • trunk/src/atmsdriver/model/LoopDetector.java

    r186 r190  
    2020    final public int loopID; 
    2121    final public String loopLocation; 
    22     final public int laneNum; 
    2322     
    2423    /* dynamic data */ 
    2524    public int vol; 
    2625    public float occ; 
    27     private int spd; 
    2826     
    2927    /** 
     
    3432     * @param laneNum  
    3533     */ 
    36     public LoopDetector(int loopID, String loopLocation, int laneNum) 
     34    public LoopDetector(int loopID, String loopLocation) 
    3735    { 
    3836        /* Set static data */ 
    3937        this.loopID = loopID; 
    4038        this.loopLocation = loopLocation; 
    41         this.laneNum = laneNum; 
    4239         
    4340        /* Init dynamic data */ 
    4441        this.vol = 0; 
    45         this.spd = 0; 
    4642        this.occ = 0; 
    4743    } 
     
    5450        LOOP_ID("Loop_ID"), 
    5551        LOOP_LOCATION("Loop_Location"), 
    56         LANE_NUM("Lane_Num"), 
    5752        VOL("Vol"), 
    58         SPD("Spd"), 
    5953        OCC("Occ"), 
    6054        LOOP("Loop"); 
     
    8882        build.append(Integer.toString(this.loopID)); 
    8983        build.append(" "); 
    90         build.append(Integer.toString(this.laneNum)); 
    91         build.append(" "); 
    9284        if(!MetaDataOnly) 
    9385        { 
     
    9688            build.append(" "); 
    9789            build.append(this.vol); 
    98             build.append(" "); 
    99             build.append(this.spd); 
    10090        } 
    10191        else 
     
    113103     * @param spd speed 
    114104     */ 
    115     public void updateLoop(int vol, float occ, int spd) 
     105    public void updateLoop(int vol, float occ) 
    116106    { 
    117107        this.vol = vol; 
    118108        this.occ = occ; 
    119         this.spd = spd; 
    120109    } 
    121110 
     
    140129        loopElement.appendChild(loopLocElement); 
    141130         
    142         Element laneNumElement = theDoc.createElement(XML_TAGS.LANE_NUM.tag); 
    143         laneNumElement.appendChild(theDoc.createTextNode(String.valueOf(this.laneNum))); 
    144         loopElement.appendChild(laneNumElement); 
    145          
    146131        Element volElement = theDoc.createElement(XML_TAGS.VOL.tag); 
    147132        volElement.appendChild(theDoc.createTextNode(String.valueOf(this.vol))); 
     
    151136        occElement.appendChild(theDoc.createTextNode(String.valueOf(this.occ))); 
    152137        loopElement.appendChild(occElement); 
    153          
    154         Element spdElement = theDoc.createElement(XML_TAGS.SPD.tag); 
    155         spdElement.appendChild(theDoc.createTextNode(String.valueOf(this.spd))); 
    156         loopElement.appendChild(spdElement); 
    157138    } 
    158139     
  • trunk/src/atmsdriver/model/Station.java

    r186 r190  
    2222 
    2323    /* Static Station meta data */ 
    24     final public int lineNum; 
     24    final public int lineID; 
    2525    final public int ldsID; // double check 
    2626    final public int drop; 
     
    3636 
    3737    /* Constructor */ 
    38     public Station(int lineNum, int ldsID, int drop, 
     38    public Station(int lineID, int ldsID, int drop, 
    3939            String location, List<LoopDetector> loops, int hwy, 
    4040            DIRECTION direction, double postmile) 
    4141    { 
    42         this.lineNum = lineNum; 
     42        this.lineID = lineID; 
    4343        this.ldsID = ldsID; 
    4444        this.drop = drop; 
     
    186186            { 
    187187                // UPDATE LOOP WITH VALUES 
    188                 int speed = 0; 
    189                 loop.updateLoop(dotColor.volume(), dotColor.occupancy(), speed); 
     188                loop.updateLoop(dotColor.volume(), dotColor.occupancy()); 
    190189            } 
    191190        } 
     
    253252 
    254253        Element lineNumElement = theDoc.createElement(XML_TAGS.LINE_NUM.tag); 
    255         lineNumElement.appendChild(theDoc.createTextNode(String.valueOf(this.lineNum))); 
     254        lineNumElement.appendChild(theDoc.createTextNode(String.valueOf(this.lineID))); 
    256255        stationElement.appendChild(lineNumElement); 
    257256 
Note: See TracChangeset for help on using the changeset viewer.