Simulating out-of-energy occurrences for an electric car

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.

Getting ready

To execute this recipe, you will need SimPy and NumPy. No other prerequisites are required.

How to do it…

As in the previous recipe, ...

Get Practical Data Analysis Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.