Problem Description

The Simulation

We want to create a simulation that keeps track of a fleet of 1000 electric vehicles going from a random origin to a random destination, stopping at charging stations along the way.

It'll have 3 major components, and will track some attributes for each:

1. Vehicle, will have the following attributes:

Vehicle.VehicleIdentification.VIN
Remains constant throughout the lifetime of the vehicle. Can be generated randomly at run-time, or set manually for each of the 1000 vehicles, with the format defined by ISO 3779.
Example value: 4Y1SL65848Z411439

Vehicle.Speed
Speed of the vehicle can remain constant (preferable if varied, but not a requirement). If constant, should be different for each vehicle generated randomly.
Example value: 80km/h

Vehicle.CurrentLocation.Latitude
The latitude component of the vehicle's location co-ordinates. Should update every time slice depending on the vehicle's current location.
Example value: 52.519171

Vehicle.CurrentLocation.Longitude
Same as Vehicle.CurrentLocation.Latitude for the longitude component.
Example value: 13.406091

Vehicle.Powertrain.TractionBattery.NetCapacity
Remains constant throughout the lifetime of the vehicle. Represents the maximum capacity of the battery. Randomly generated for each vehicle, but should be in a plausible range.
Example value: 80kWh

Vehicle.Powertrain.TractionBattery.Charging.ChargeLimit
Remains constant throughout the lifetime of the vehicle. Represents the maximum % the battery can be charged to. Randomly generated for each vehicle, but should be in the same range of 80-100%.
Example value: 80%

Vehicle.Powertrain.TractionBattery.StateOfCharge.Current
The current battery %. Should update every time slice depending on how of the battery much the vehicle would have consumed.
Example value: 50%

Vehicle.Powertrain.TractionBattery.Range
The distance the car can go with the remaining battery. Should update every time slice dependent on the battery remaining.
Example value: 123km

Vehicle.Powertrain.TractionBattery.Charging.IsCharging
True if car is at a charging station, False if not.
Example value: False

Vehicle.Powertrain.TractionBattery.Charging.TimeToComplete
The time it'll take for the car to charge up to the ChargeLimit (simulation time).
Example value: 9112s

Vehicle.Cabin.Infotainment.Navigation.DestinationSet.Latitude
The latitude component of the vehicle's destination co-ordinates, should be randomly generated (in Germany) and remain constant for the lifetime of the journey.
Example value: 9112s

Vehicle.Cabin.Infotainment.Navigation.DestinationSet.Longitude
Same as Vehicle.Cabin.Infotainment.Navigation.DestinationSet.Latitude for the longitude component.
Example value: 9112s

  • The simulation should be able to run infinitely unless exited.
  • Vehicle's starting location and destination must both be based in Germany.
  • Every time slice (which should be configurable), vehicle should move or charge for the equivalent of 10min (simulation time).
  • When a vehicle's destination is reached, the vehicle's destination should be randomly re-generated again (in Germany).
  • The 10min (or whatever the simulation time is) doesn't need to be 100% accurate, something around it will be fine.

2. Chargestation, will have the following attributes:

Chargestation.ID
Example value: 4711
A unique identifier for the charging station.

Chargestation.MaxCurrent
Example value: 32A
The maximum current that the charging station is capable of delivering. Should be randomly generated to a plausible value.

Chargestation.MaxVoltage
Example value: 208V
The maximum voltage that the charging station is capable of delivering. Should also be randomly generated to a plausible value.

Chargestation.AveragePower
Example value: 7.68kW
The average power that the charging station is capable of delivering to a vehicle. Should also be randomly generated to a plausible value.

Chargestation.ChargingVehicleID
Example value: 4Y1SL65848Z411439
The VIN of the vehicle that is currently charging at the station. If no vehicle is charging, this value should be an empty string.

Chargestation.Location.Latitude
Example value: 48.775846
The latitude component of the charging station's location coordinates.

Chargestation.Location.Longitude
Example value: 9.182932
The longitude component of the charging station's location coordinates.

  • The chargestations can be prefetched from Google Maps, added as a JSON file with manual attributes to the project, or randomly generated at run-time. Doesn't matter, but should be around 50.
  • A chargestation should only be able to charge one vehicle at a time, any other vehicles that arrive at the station should be queued.

3. Fleet, will have the following attributes:

Fleet.NumberOfMovingVehicles
Example value: 500

Fleet.NumberOfChargingVehicles
Example value: 1000

Fleet.NumberOfParkingVehicles
Example value: 200

Fleet.NumberOfQueuedVehicles
The number of vehicles in the fleet that are currently charging. This attribute appears to be duplicated in the list, so you may want to remove one of the instances.
Example value: 300

Fleet.AverageSpeed
The average speed of the vehicles in the fleet.
Example value: 10

The API

The simulation should be able to be accessed via a read-only REST API, that supports:

  • Any Vehicle or Chargestation (should be two different endpoints) accessible by their ID, with this example response:
    {
        "timestamp": 1234567890,
        "attributes": {
            "Vehicle.VehicleIdentification.VIN": {
                value: "4Y1SL65848Z411439",
                unit: ""
            },
            "Vehicle.Speed": {
                value: 80,
                unit: "km/h"
            },
            ...
        }
    }
    
  • The Fleet, with this example response:
    {
        "timestamp": 1234567890,
        "attributes": {
            "Fleet.NumberOfMovingVehicles": {
                value: 500,
                unit: ""
            },
            ...
        }
    }
    
  • Viewing all Vehicle IDs and Chargestation IDs (different endpoints) in the simulation.

Acceptance Criteria

  • The simulation should be able to run infinitely unless exited.
  • Should be written in Python 3.7+, packaged in an easily reproducible way (with virtualenv if a lot of external libraries are used).
  • Source code should be not be made public.

Preferably:

  • Should save state to disk, so that it can be resumed even if exited.
Edit

Pub: 02 Jan 2023 00:11 UTC

Views: 135