-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
3,907 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 0 additions & 13 deletions
13
src/main/java/com/conveyal/traffic/app/controllers/StatsObject.java
This file was deleted.
Oops, something went wrong.
23 changes: 23 additions & 0 deletions
23
src/main/java/com/conveyal/traffic/app/data/StatsObject.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package com.conveyal.traffic.app.data; | ||
|
||
import com.conveyal.traffic.app.TrafficEngineApp; | ||
|
||
public class StatsObject{ | ||
public Double locationsPerSecond; | ||
public Double samplesPerSecond; | ||
public Long locationsQueued; | ||
public Long locationsProcessed; | ||
public Long samplesProcessed; | ||
public Integer vehicleCount; | ||
public Long lastUpdate; | ||
|
||
public StatsObject() { | ||
locationsPerSecond = TrafficEngineApp.engine.getLocationProcessingRate(); | ||
samplesPerSecond = TrafficEngineApp.engine.getSampleProcessingRate(); | ||
locationsProcessed = TrafficEngineApp.engine.getTotalLocationsProcessed(); | ||
samplesProcessed = TrafficEngineApp.engine.getTotalSamplesProcessed(); | ||
locationsQueued = TrafficEngineApp.engine.getQueueSize(); | ||
vehicleCount = TrafficEngineApp.engine.getVehicleCount(); | ||
lastUpdate = TrafficEngineApp.engine.getLastUpdate(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package com.conveyal.traffic.app.data; | ||
|
||
public class WeekObject { | ||
|
||
public long weekStartTime; | ||
public long weekId; | ||
|
||
} |
48 changes: 48 additions & 0 deletions
48
src/main/java/com/conveyal/traffic/app/data/WeeklyStatsObject.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package com.conveyal.traffic.app.data; | ||
|
||
import com.conveyal.traffic.stats.SegmentStatistics; | ||
|
||
import java.util.Arrays; | ||
|
||
public class WeeklyStatsObject { | ||
|
||
public static double MS_TO_KMH = 3.6d; | ||
|
||
public Double[] dailyStats = new Double[7]; | ||
public Double[] hourlyStats = new Double[7 * 24]; | ||
|
||
public WeeklyStatsObject(SegmentStatistics stats) { | ||
|
||
Arrays.fill(dailyStats, 0.0); | ||
Arrays.fill(hourlyStats, 0.0); | ||
|
||
long dailyCount = 0l; | ||
double dailySum = 0.0; | ||
|
||
int day = 0; | ||
for(int hour = 0; hour < (24 * 7); hour++) { | ||
|
||
if(stats.hourSampleCount[hour] > 0) { | ||
hourlyStats[hour] = (stats.hourSampleSum[hour] / stats.hourSampleCount[hour]) * MS_TO_KMH; | ||
|
||
dailyCount += stats.hourSampleCount[hour]; | ||
dailySum += stats.hourSampleSum[hour]; | ||
} | ||
|
||
if(day != ((hour - (hour % 24)) / 24)) { | ||
|
||
if(dailyCount > 0) | ||
dailyStats[day] = (dailySum / dailyCount) * MS_TO_KMH; | ||
|
||
dailySum = 0.0; | ||
dailyCount = 0l; | ||
|
||
day = ((hour - (hour % 24)) / 24); | ||
} | ||
} | ||
|
||
if(dailyCount > 0) | ||
dailyStats[day] = dailySum / dailyCount * MS_TO_KMH; | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.