/// <summary> /// Tests the probable speed. /// </summary> /// <param name="vehicle"></param> /// <param name="speed"></param> /// <param name="tags"></param> protected void TextProbableSpeed(Vehicle vehicle, double speed, params string[] tags) { // build tags collection. SimpleTagsCollection tagsCollection = new SimpleTagsCollection(); for (int idx = 0; idx < tags.Length; idx = idx + 2) { tagsCollection.Add(tags[idx], tags[idx + 1]); } Assert.AreEqual(speed, vehicle.ProbableSpeed(tagsCollection).Value); }
/// <summary> /// Calculate metrics for a given arc. /// </summary> /// <param name="vehicle"></param> /// <param name="result"></param> /// <param name="arc"></param> private void CalculateArcMetrics(Vehicle vehicle, Dictionary<string, double> result, AggregatedArc arc) { // update the distance. result[DISTANCE_KEY] = result[DISTANCE_KEY] + arc.Distance.Value; // update the time. KilometerPerHour speed = vehicle.ProbableSpeed(arc.Tags); Second time = arc.Distance / speed; // FOR NOW USE A METRIC OF 75% MAX SPEED. // TODO: improve this for a more realistic estimated based on the type of road. result[TIME_KEY] = result[TIME_KEY] + time.Value; }