RedaElMakroum / lecture-spring-2024

Following through live demo in open source energy modeling course.
Apache License 2.0
0 stars 1 forks source link

Review #1

Open danielhuppmann opened 6 months ago

danielhuppmann commented 6 months ago

Please review, @MilicaKov

MilicaKov commented 5 months ago

Description of repository

Python code is designed to minimize the electricity cost associated with charging an electric vehicle (EV) battery over 24 hours. The function takes as input the prices of electricity throughout the day, the arrival time of the EV, the state of charge (SOC) of the EV battery upon arrival, and the hours needed to fully charge the battery (H). It utilizes the PuLP library for linear programming to optimize the charging schedule, aiming to minimize the total cost while ensuring that the battery is fully charged by the specified time.

The code begins by defining the problem as a linear programming minimization task. Decision variables are created to represent whether the EV is charging during each time slot. The objective function is formulated to minimize the total electricity cost based on the charging schedule and electricity prices. Constraints are imposed to ensure that the battery is fully charged by the required time and that the charging operation occurs only when needed, taking into account the current SOC.

Once the optimization problem is defined, it is solved using the PuLP solver. The optimal charging schedule and total cost are then extracted from the solution. Finally, the code generates a visual representation of the electricity prices and the optimal charging schedule using Matplotlib, with the prices plotted on one y-axis and the charging schedule on another, providing a clear visualization of the optimized charging strategy.

Tests

MilicaKov commented 5 months ago

Submission of second homework assignment, @danielhuppmann