Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download

OMEGAlpes tuto test

Views: 37
Kernel: Python 3 (Ubuntu Linux)

STORAGE CAPACITY OPTIMIZATION :

This Module is an example of storage capacity optimisation.

This example describes a simple microgrid with :

  • A load profile known in advance

  • An adjustable production unit, with a maximum power limit

  • A storage system with power in charge and power in discharge

Objective :

The objective consists in minimizing the storage capacity while meeting the load during the whole time horizon. title

Operating steps :

  1. Creates an empty model

  2. Creates the load or the load profile is already known

  3. Creates the production unit - The production profile is unknown

  4. Creates the storage

  5. Objective: Minimize the storage capacity

  6. Creates the energy node

  7. Connect all units on the same energy node

  8. Add node to the model

  9. Optimisation process

#import sys #sys.path.append('D:\dev\Omegalpes')
import pulp from StudyCase2 import storage, print_results_storage

Input parameters :

  • The load profile has to be define by values for each hours of the day. There is no incoherent value as long as you make them relative to each others

  • The maximum power has to be define in kWh

  • The maximum charging and discharging power have to be set in kW

# Load dynamic profile - one value per hour during a day LOAD_PROFILE = [4, 5, 6, 2, 3, 4, 7, 8, 13, 24, 18, 16, 17, 12, 20, 15, 17, 21, 25, 23, 18, 16, 13, 4]
# Maximal power that can be delivered by the production unit PRODUCTION_P_MAX = 15
# Storage maximal charging and discharging powers (STORAGE_PC_MAX, STORAGE_PD_MAX) = 20, 20
# Run main storage(load_profile=LOAD_PROFILE, production_pmax=PRODUCTION_P_MAX, storage_pcharge_max=STORAGE_PC_MAX, storage_pdischarge_max=STORAGE_PD_MAX)
You are studying the period from 2018-01-01 00:00:00 to 2018-01-01 23:00:00 Creating the load. Creating the production. Creating the storage. Creating the energy_node. --- Adding all variables to the model --- Adding variable : load_p Adding variable : load_e_tot Adding variable : load_u Adding variable : production_p Adding variable : production_e_tot Adding variable : production_u Adding variable : storage_p Adding variable : storage_e_tot Adding variable : storage_u Adding variable : storage_capacity Adding variable : storage_e Adding variable : storage_pc Adding variable : storage_pd Adding variable : storage_uc --- Adding all objectives to the model --- Adding objective : storage_min_capacity --- Adding all constraints to the model --- Adding constraint : energy_node_power_balance , exp = -load_p[t]+production_p[t]-storage_p[t] == 0 for t in time.I Adding constraint : load_on_off_max , exp = load_p[t] <= load_u[t] * 100000.0 for t in time.I Adding constraint : load_on_off_min , exp = load_p[t] >= load_u[t] * 1e-05 for t in time.I Adding constraint : load_calc_e_tot , exp = load_e_tot == time.DT * lpSum(load_p[t] for t in time.I) Adding constraint : production_on_off_max , exp = production_p[t] <= production_u[t] * 15 for t in time.I Adding constraint : production_on_off_min , exp = production_p[t] >= production_u[t] * 1e-05 for t in time.I Adding constraint : production_calc_e_tot , exp = production_e_tot == time.DT * lpSum(production_p[t] for t in time.I) Adding constraint : storage_on_off_max , exp = storage_p[t] <= storage_u[t] * 20 for t in time.I Adding constraint : storage_on_off_min , exp = storage_p[t] >= storage_u[t] * -20 for t in time.I Adding constraint : storage_calc_e_tot , exp = storage_e_tot == time.DT * lpSum(storage_p[t] for t in time.I) Adding constraint : storage_set_soc_min , exp = storage_e[t] >= 0 * storage_capacity for t in time.I Adding constraint : storage_set_soc_max , exp = storage_e[t] <= 1 * storage_capacity for t in time.I Adding constraint : storage_calc_e , exp = storage_e[t+1] - storage_e[t] + 0 * storage_capacity + (storage_pd[t]*1/1 - storage_pc[t]*1) * time.DT == 0 for t in time.I[:-1] Adding constraint : storage_calc_p , exp = storage_p[t] == storage_pc[t] - storage_pd[t] for t in time.I Adding constraint : storage_on_off_stock , exp = storage_pc[t] + storage_pd[t] - storage_u[t] * 0.001 >= 0 for t in time.I Adding constraint : storage_def_max_charging , exp = storage_pc[t] - storage_uc[t] * 20 <= 0 for t in time.I Adding constraint : storage_def_max_discharging , exp = storage_pd[t] - (1 - storage_uc[t]) * 20 <= 0 for t in time.I Adding constraint : storage_def_min_charging , exp = storage_pc[t] - storage_uc[t] * 1e-05 >= 0 for t in time.I Adding constraint : storage_def_min_discharging , exp = storage_pd[t] + (storage_uc[t] - storage_u[t]) * 1e-05 >= 0 for t in time.I Adding constraint : storage_def_capacity , exp = storage_e[t] <= storage_capacity for t in time.I - - - - - RUN OPTIMIZATION - - - - - - - - - - UPDATE RESULTS - - - - - Updating unit : energy_node Updating unit : load Quantity : p Quantity : e_tot Quantity : u Updating unit : production Quantity : p Quantity : e_tot Quantity : u Updating unit : storage Quantity : p Quantity : e_tot Quantity : u Quantity : capacity Quantity : e Quantity : pc Quantity : pd Quantity : uc
print_results_storage()
- - - - - OPTIMISATION RESULTS - - - - - The optimal storage capacity is 47.0 kWh Preparing to plot the energetic flows through the node energy_node. Add power from load. Add power from production. Add power from storage.
Image in a Jupyter notebook