nirav0906 / lecture-spring-2024

open source energy modeling course Spring 24
Apache License 2.0
0 stars 1 forks source link

Review #1

Open danielhuppmann opened 7 months ago

danielhuppmann commented 7 months ago

Please review, @404milan

404milan commented 6 months ago

Description of repository

Optimize Energy Allocation Function

The single Python function, optimize_energy_allocation, which is found in the optimization.py file, uses linear programming to optimize the allocation of energy from different sources to minimize cost.

Inputs

The function takes three inputs:

Variables

It defines three sets of variables, x_wind, x_pv, and x_fuel_cell, representing the amount of energy allocated from wind, solar, and fuel cell sources respectively for each hour of the day.

Objective Function

The objective of the function is to minimize the total cost of energy, which is calculated as the sum of the cost of energy from each source for each hour. The costs per unit of energy from wind, solar, and fuel cell are assumed to be 0.4, 0.35, and 0.9 respectively.

Constraints

The function imposes constraints to ensure that the total energy allocated meets the load demand for each hour (x_wind[i] + x_pv[i] + x_fuel_cell[i] >= Load[i]) and that the energy allocated from wind and solar does not exceed the available power (x_wind[i] <= Pwind[i] and x_pv[i] <= Ppv[i]).

Solution

The function solves the linear programming problem and returns the optimal energy allocation from each source for each hour of the day.

This function could be used in a microgrid management system to optimally allocate energy from different sources in order to minimize cost while meeting the energy demand. It assumes that the available power from wind and solar and the load demand are known for each hour. The function uses the PuLP library for Python to define and solve the linear programming problem.

Tests

404milan commented 6 months ago

Submission of second homework assignment, @danielhuppmann. Thank you!