Beispiel #1
0
def movable(_trip_1, _trip_2):
    is_movable = False
    expected_start_1 = add(_trip_1.end_time,
                           create_mov_trip(_trip_1, _trip_2).get_duration())
    expected_start_2 = add(_trip_2.end_time,
                           create_mov_trip(_trip_2, _trip_1).get_duration())
    if diff(_trip_2.start_time, expected_start_1).valid:
        is_movable = True
    if diff(_trip_1.start_time, expected_start_2).valid:
        is_movable = True
    return is_movable
 def __str__(self):
     if isinstance(self.trip, (MovingTrip, OperatingTrip, Charging)):
         _duration = self.trip.get_duration()
         end_time = add(self.trip.start_time, _duration)
         format_string = self.trip.start_time.time + "-" + end_time.time + " | " + self.trip.__str__(
         )
     else:
         raise InvalidMovementException("Invalid movement type {}".format(
             type(self.trip).__name__))
     return format_string
 def add(self, stat, force_add=True):
     add_stat = self.copy()
     add_stat.duration = add(stat.duration, add_stat.duration)
     add_stat.kwh_energy_consumed += stat.kwh_energy_consumed
     add_stat.gallon_energy_consumed += stat.gallon_energy_consumed
     add_stat.count += stat.count
     add_stat.electric_count += stat.electric_count
     add_stat.gasoline_count += stat.gasoline_count
     if force_add:
         self.map(add_stat)
         return self
     return add_stat
 def __init__(self, start, _diff):
     super(TimeSlot, self).__init__(start, add(start, _diff))
     self.diff = _diff
Beispiel #5
0
 def set_start_time(self, start_time):
     self.start_time = start_time
     self.end_time = add(self.start_time, self.route.duration_est)
Beispiel #6
0
 def add_duration(self, duration_est):
     self.route.add_duration_est(duration_est)
     self.end_time = add(self.start_time, self.route.duration_est)