Class ModelerUtils


  • public class ModelerUtils
    extends Object
    Modeler utilities.
    • Method Detail

      • generateRxPower

        public static double[][][] generateRxPower​(int sampleSpace,
                                                   int numOfAPs,
                                                   List<Double> apLocX,
                                                   List<Double> apLocY,
                                                   List<Double> txPower)
        Get the RX power over the map for all the APs
        Parameters:
        sampleSpace - the boundary of the space
        numOfAPs - the number of APs
        apLocX - the location x of the APs
        apLocY - the location y of the APs
        txPower - the TX power of the APs
        Returns:
        the RX power of location x, location y, and AP index
      • generateHeatMap

        public static double[][] generateHeatMap​(int sampleSpace,
                                                 int numOfAPs,
                                                 double[][][] rxPower)
        Get the heatmap over the map
        Parameters:
        sampleSpace - the boundary of the space
        numOfAPs - the number of APs
        rxPower - the RX power of location x, location y, and AP index
        Returns:
        the max RX power of location x and location y
      • generateSinr

        public static double[][] generateSinr​(int sampleSpace,
                                              int numOfAPs,
                                              double[][][] rxPower)
        Get the max SINR over the map
        Parameters:
        sampleSpace - the boundary of the space
        numOfAPs - the number of APs
        rxPower - the RX power of location x, location y, and AP index
        Returns:
        the max SINR of location x and location y
      • calculateTPCMetrics

        public static double calculateTPCMetrics​(int sampleSpace,
                                                 double[][] rxPowerBest,
                                                 double[][] sinrDB)
        Get the coverage metrics for the TPC algorithm design
        Parameters:
        sampleSpace - the boundary of the space
        rxPowerBest - the max RX power of location x and location y
        sinrDB - the max SINR of location x and location y
        Returns:
        the combined metric of over and under coverage, infinity if error
      • getAggregatedWifiScans

        public static Map<String,​Map<String,​WifiScanEntry>> getAggregatedWifiScans​(Modeler.DataModel dataModel,
                                                                                               long obsoletionPeriodMs,
                                                                                               Aggregator<Double> agg)
        For each AP, for each other AP that sent a wifiscan entry to that AP, this method calculates an aggregate wifiscan entry with an aggregated RSSI. If no non-obsolete entry exists, the latest wifiscan entry is used instead.
        Parameters:
        dataModel - the data model which includes the latest wifiscan entries
        obsoletionPeriodMs - for each (scanning AP, responding AP) tuple, the maximum amount of time (in milliseconds) it is worth aggregating over, starting from the most recent scan entry for that tuple, and working backwards in time. An entry exactly obsoletionPeriodMs ms earlier than the most recent entry is considered non-obsolete (i.e., the "non-obsolete" window is inclusive). Must be non-negative.
        agg - an aggregator to calculate the aggregated RSSI given recent wifiscan entries' RSSIs.
        Returns:
        a map from AP serial number to a map from BSSID to a WifiScanEntry object. This object is an "aggregated wifiscan entry" unless there is no non-obsolete wifiscan entry, in which case the latest wifiscan entry is used. An aggregated entry is just the latest entry with its signal attribute modified to be the aggregated signal value instead of the value in just the most recent entry for that (AP serial number, BSSID) tuple. The returned map will only map an (AP, BSSID) to an entry if an least one entry from that BSSID to that AP exists in Modeler.DataModel.latestWifiScans
      • getAggregatedStates

        public static Map<String,​Map<String,​List<AggregatedState>>> getAggregatedStates​(Modeler.DataModel dataModel,
                                                                                                    long obsoletionPeriodMs,
                                                                                                    long refTimeMs)
        This method aggregates States by bssid/station key pair and radio info. if two States of the same bssid/station match in channel, channel width and tx_power need to be aggregated to one AggregatedState. Currently only mcs and rssi fields are being aggregated. They are of List<Integer> type in AggregatedState, which list all the values over the time.
        Parameters:
        dataModel - the data model which includes the latest recorded States
        obsoletionPeriodMs - the maximum amount of time (in milliseconds) it is worth aggregating over, starting from the most recent States and working backwards in time. A State exactly obsoletionPeriodMs ms earlier than the most recent State is considered non-obsolete (i.e., the "non-obsolete" window is inclusive). Must be non-negative.
        refTimeMs - the reference time were passed to make testing easier
        Returns:
        map from serial number to a map from bssid_station String pair to a list of AggregatedState
      • getLatestState

        public static Map<String,​StateInfo> getLatestState​(Map<String,​List<StateInfo>> latestStates)
        This method gets the most recent State from latestStates per device.
        Parameters:
        latestStates - list of latest States per device
        Returns:
        map from device String to latest State
      • getBssidStationKeyPair

        public static String getBssidStationKeyPair​(String bssid,
                                                    String station)
        Create a key pair consisted of bssid and station string