Ignore:
Timestamp:
06/23/2019 10:27:35 AM (7 years ago)
Author:
jdalbey
Message:

Remove ATMS functionality. Reworked and simplified the Highway model to use only VDS data from PeMS. Updated all unit tests.

Location:
trunk/src/tmcsim/highwaymodel
Files:
1 added
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/src/tmcsim/highwaymodel/LoopDetector.java

    r343 r422  
    1 package atmsdriver.model; 
     1package tmcsim.highwaymodel; 
    22 
    33import java.util.ArrayList; 
     
    1212 *  occ, and spd. 
    1313 * 
     14 * Lane Type    A string indicating the type of lane. Possible values (and their meaning) are: 
     15 * 
     16 *    CD (Coll/Dist) 
     17 *    CH (Conventional Highway) 
     18 *    FF (Fwy-Fwy connector) 
     19 *    FR (Off Ramp) 
     20 *    HV (HOV) 
     21 *    ML (Mainline) 
     22 *    OR (On Ramp) 
    1423 * @author John A. Torres 
    1524 * @version 09/10/2017 
     
    2837    /** 
    2938     * Constructs a LoopDetector from loopID, loopLocation, and laneNum 
     39     * with initially free flowing traffic. 
    3040     *  
    3141     * @param loopID 
     
    4454    } 
    4555     
     56    /**  
     57     * Setter for loop detector dynamic attributes.  Reserved for future use 
     58     * with "live" highway data. 
     59     * @param vol volume 
     60     * @param occ occupancy 
     61     * @param spd speed not used 
     62     */ 
     63    public void setAttributes(int vol, float occ) 
     64    { 
     65        this.vol = vol; 
     66        this.occ = occ; 
     67    } 
     68    /** Set the attributes of this detector given a color. 
     69     * @param DOTCOLOR of the attributes to assign.  
     70     */ 
     71    public void setAttributes(DOTCOLOR color) 
     72    { 
     73        this.vol = color.volume(); 
     74        this.occ = color.occupancy(); 
     75    } 
    4676    /** 
    4777     * XML tags used for toXML() method. 
     
    100130        return build.toString(); 
    101131    } 
    102      
    103     /**  
    104      * Updates loop detector dynamic attributes. 
    105      * @param vol volume 
    106      * @param occ occupancy 
    107      * @param spd speed 
    108      */ 
    109     public void updateLoop(int vol, float occ) 
    110     { 
    111         this.vol = vol; 
    112         this.occ = occ; 
    113     } 
    114132 
    115133    /** 
     
    144162    /** 
    145163     * Enum for highway status dot colors. Each color has associated volume 
    146      * and occupancy constants. 
     164     * and occupancy constants, single character symbol, and hml color name. 
    147165     * 
    148166     * @author John A. Torres, jdalbey 
     
    151169    public static enum DOTCOLOR { 
    152170 
    153         RED(1, 0.06f),    // "Stopped" is less than 25mph 
    154         YELLOW(3,0.059f), // speed = 26 
    155         GREEN(0,0); 
     171        RED(1, 0.06f,'@',"red"),    // "Stopped" is less than 25mph 
     172        YELLOW(3,0.059f,'+',"yellow"), // speed = 26 
     173        GREEN(0,0,'-',"lime");       // freeflowing 
    156174         
    157175        // All the first letters of the values, in order. 
     
    160178        private int vol;  /* volume */ 
    161179        private float occ;  /* occupancy */       
    162          
    163         private DOTCOLOR(int v, float o) 
     180        private char symbol; /* symbolic representation of this color */ 
     181        private String htmlColor; /* html color name */ 
     182         
     183         
     184        private DOTCOLOR(int v, float o, char symbol, String htmlColor) 
    164185        { 
    165186            vol = v; 
    166187            occ = o; 
     188            this.symbol = symbol; 
     189            this.htmlColor = htmlColor; 
    167190        } 
    168191        /** 
     
    183206            return occ; 
    184207        } 
     208        public char symbol() 
     209        { 
     210            return symbol; 
     211        } 
     212        public String htmlColor() 
     213        { 
     214            return htmlColor; 
     215        } 
    185216        /** 
    186          * Returns a dot color given its first character. 
     217         * Returns a DOTCOLOR given its first character. 
    187218         * 
    188          * @param letter the first character of a dot color 
    189          * @return dot color corresponding to letter 
     219         * @param letter the first character of a DOTCOLOR 
     220         * @return DOTCOLOR corresponding to letter 
    190221         * @pre letter must be one of allLetters 
    191222         */ 
Note: See TracChangeset for help on using the changeset viewer.