Exemple #1
0
 def drop_off(self, trip):
     self.mode = 'idle'
     self.charge_state -= self.charge_consumption_dropoff
     self.location = trip.destination
     self.position = find_zone(self.location, zones)
     lg.info(
         f'Vehicle {self.id} drop off the user {trip.id} at {self.env.now}')
Exemple #2
0
 def relocate(self, target_zone):
     distance_duration = self.location.distance(target_zone.centre)
     distance_to_target = distance_duration[0]
     self.location = target_zone.centre
     self.time_to_relocate = distance_duration[1]
     self.charge_consumption_relocate = self.SOC_consumption(
         distance_to_target)
     lg.info(f'Vehicle {self.id} is relocated to the zone {target_zone.id}')
     self.mode = 'relocating'
Exemple #3
0
 def pick_up(self, trip):
     self.mode = 'active'
     lg.info(
         f'Vehicle {self.id} pick up the user {trip.id} at {self.env.now}')
     self.charge_state -= self.charge_consumption_pickup
     trip.info['pickup_time'] = self.env.now
     trip.info['waiting_time'] = trip.info['pickup_time'] - trip.info[
         'arrival_time']
     self.location = trip.origin
Exemple #4
0
 def discharging(self, charging_station):
     self.mode = 'discharging'
     self.charge_state -= self.SOC_consumption(self.distance_to_CS)
     self.discharging_threshold = 50
     discharge_rate = charging_station.power
     self.discharge_duration = (
         ((self.charge_state - self.discharging_threshold) *
          self.battery_capacity / 100) / discharge_rate)
     self.location = charging_station.location
     self.position = find_zone(self.location, zones)
     lg.info(f'Vehicle {self.id} enters the station at {self.env.now}')
Exemple #5
0
 def send_charge(self, charging_station):
     self.mode = 'ertc'
     lg.info(f'Charging state of vehicle {self.id} is {self.charge_state}')
     lg.info(
         f'Vehicle {self.id} is sent to the charging station {charging_station.id} at {self.env.now}'
     )
     distance_duration = self.location.distance(charging_station.location)
     self.distance_to_CS = distance_duration[0]
     self.reward['distance'] = distance_duration[0]
     self.time_to_CS = distance_duration[1]
     self.position = find_zone(self.location, zones)
Exemple #6
0
 def send_parking(self, parking):
     self.mode = 'ertp'
     if self.env.now != 0:
         lg.info(
             f'Vehicle {self.id} is sent to the parking {parking.id} at {self.env.now}'
         )
     distance_duration = self.location.distance(parking.location)
     self.distance_to_parking = distance_duration[0]
     self.time_to_parking = distance_duration[1]
     charge_consumption_to_parking = self.SOC_consumption(
         self.distance_to_parking)
     self.charge_state -= charge_consumption_to_parking
Exemple #7
0
    def send(self, trip):
        self.mode = 'locked'
        distance_duration = self.location.distance(trip.origin)
        distance_to_pickup = distance_duration[0]
        distance_to_dropoff = trip.distance
        self.time_to_pickup = distance_duration[1]
        self.charge_consumption_pickup = self.SOC_consumption(
            distance_to_pickup)
        self.charge_consumption_dropoff = self.SOC_consumption(
            distance_to_dropoff)

        self.rental_time = trip.duration
        lg.info(f'Vehicle {self.id} is sent to the request {trip.id}')
Exemple #8
0
 def finish_discharging(self, charging_station):
     self.mode = 'idle'
     for j in range(0, 24):
         if j * 60 <= self.env.now % 1440 <= (j + 1) * 60:
             h = j
     self.reward['revenue'] = (
         self.charge_state -
         self.discharging_threshold) / 100 * 50 * charging_cost[h] / 100
     if isinstance(self.reward['charging'], np.ndarray):
         self.reward['revenue'] = self.reward['revenue'][0]
     self.charge_state -= (charging_station.power * self.discharge_duration
                           ) / (self.battery_capacity / 100)
     lg.info(
         f'Finished discharging, Charging state of vehicle {self.id} is {self.charge_state} at {self.env.now}'
     )
Exemple #9
0
 def charging(self, charging_station):
     self.mode = 'charging'
     charge_consumption_to_charging = self.SOC_consumption(
         self.distance_to_CS)
     self.charge_state -= charge_consumption_to_charging
     time = self.env.now
     if time % 1440 < 0.25 * 1440:
         self.charging_threshold = 100
     elif time % 1440 < 0.50 * 1440:
         self.charging_threshold = 100
     elif time % 1440 < 0.75 * 1440:
         self.charging_threshold = 100
     else:
         self.charging_threshold = 100
     self.charge_duration = (
         ((self.charging_threshold - self.charge_state) *
          self.battery_capacity / 100) / charging_station.power)
     self.location = charging_station.location
     self.position = find_zone(self.location, zones)
     lg.info(f'Vehicle {self.id} enters the station at {self.env.now}')
Exemple #10
0
 def parking(self, parking):
     self.mode = 'parking'
     self.location = parking.location
     self.position = find_zone(self.location, zones)
     if self.env.now >= 5:
         lg.info(f'Vehicle {self.id} start parking at {self.env.now}')