Implement correct scaling
This commit is contained in:
@@ -13,7 +13,7 @@ from pika.exceptions import AMQPConnectionError
|
||||
|
||||
SWITCHING_TIME = 15
|
||||
# Scale speed of switching by factor x
|
||||
SCALING = 1
|
||||
SCALING = 6
|
||||
|
||||
|
||||
class TrafficLight:
|
||||
|
||||
@@ -19,7 +19,7 @@ STARTING_POINT = geopy.Point(47.89053, 16.20703)
|
||||
# Driving direction in degrees: 0=N, 90=E, 180=S, 270=W
|
||||
BEARING = 2
|
||||
# Scale speed of vehicles by factor x
|
||||
SCALING = 1
|
||||
SCALING = 6
|
||||
# in km/h
|
||||
STARTING_VELOCITY = 130 * SCALING
|
||||
# Interval between status updates in seconds (is not scaled)
|
||||
@@ -170,7 +170,7 @@ class Vehicle:
|
||||
driving_time = (updated_timestamp - old_timestamp).total_seconds()
|
||||
|
||||
# reached distance in kilometers: convert km/h to km/s and multiply by driving time
|
||||
kilometers = self.velocity / 3600 * driving_time * SCALING
|
||||
kilometers = self.velocity / 3600 * driving_time
|
||||
|
||||
# Define a general distance object, initialized with a distance of k km.
|
||||
d = geopy.distance.distance(kilometers=kilometers)
|
||||
@@ -231,6 +231,7 @@ class Vehicle:
|
||||
self._driven_kms = 0
|
||||
self.last_update = datetime.now()
|
||||
self.nce = False
|
||||
self.velocity = STARTING_VELOCITY
|
||||
|
||||
@circuit(failure_threshold=10, expected_exception=AMQPConnectionError)
|
||||
def send_status_update(self):
|
||||
|
||||
Reference in New Issue
Block a user