-
Book Overview & Buying
-
Table Of Contents
Practical Data Analysis Cookbook
By :
Electric cars are getting more and more popular these days. However, even though they are cheaper to run, the range of the car somewhat limits its use to travel long distance, at least until a sufficient infrastructure is in place to recharge the car along the way.
In this recipe, we will simulate out-of-power situations for an electric car. We start by randomly placing the recharge stations along the way of the car and then simulating the recharge situations. In this recipe, we will allow the driver of the car to drive the car without fully recharging.
To execute this recipe, you will need SimPy and NumPy. No other prerequisites are required.
As in the previous recipe, we start by defining the environment and all its agents (the sim_recharge.py file):
import numpy as np
import simpy
if __name__ == '__main__':
# what is the simulation horizon (in minutes)
SIM_TIME = 10 * 60 * 60 # 10 hours
# create...
Change the font size
Change margin width
Change background colour