Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • O OMEGAlpes
  • Project information
    • Project information
    • Activity
    • Labels
    • Planning hierarchy
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 33
    • Issues 33
    • List
    • Boards
    • Service Desk
    • Milestones
  • Deployments
    • Deployments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • Value stream
    • Repository
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • OMEGAlpes
  • OMEGAlpes
  • Issues
  • #68

Closed
Open
Created Jul 27, 2021 by EXT HaichengLING@haicheng.lingDeveloper

OMEGALPES Version Bug

Summary

J'ai créé un model simple d'OMEGalpes avec un node unique, un unité de énergy shiftable, un unité de énergy non shiftable, un pv production, import de réseau et export de réseau (voir graphe ci-dessous). J'ai essayé de maximizer le taux d'autoconsommation de ce système. Pour OMEGALPES 0.3.0, mon model marche bien, mais pour OMEGALPES 0.4.0, la somme de l'énergy shiftable est doublé après l'optimization.

image

Steps to reproduce

Code ci-dessous pour mon modèle simple.

from omegalpes.energy.energy_nodes import EnergyNode
from omegalpes.energy.units.consumption_units import VariableConsumptionUnit, \
    FixedConsumptionUnit, \
    ShiftableConsumptionUnit
from omegalpes.energy.units.conversion_units import \
    ElectricalToThermalConversionUnit
from omegalpes.energy.units.production_units import FixedProductionUnit, \
    VariableProductionUnit
from omegalpes.energy.units.storage_units import StorageUnit
from omegalpes.general.optimisation.elements import DynamicConstraint, \
    ActorDynamicConstraint
from omegalpes.general.optimisation.model import OptimisationModel
from omegalpes.general.utils.plots import plt, plot_node_energetic_flows
from omegalpes.general.utils.output_data import save_energy_flows
from omegalpes.general.time import TimeUnit
import time as pytime

ticks=pytime.time()
time=TimeUnit(periods=24*2,dt=0.5)
model = OptimisationModel(time=time, name='test1')

shiftable_profil=[0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.9539886794999997,15.615420819999999,11.920456660000001,11.686931215000001,6.328051115000001,0.0,0.0,0.0,0.0,0.0,0.0,0.0,4.9798052539999995,2.3410368835,1.198254565,5.09158163,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]

non_shiftable_profil=[0.37543609600000005,0.3827568758,0.41772119455,0.41300544539999995,0.37572268635000006,0.45921000115,0.40829399094999996,0.3626934204999999,0.40511711730000005,0.45187492395,0.3541168846,2.0367472584999997,5.593399205000001,3.2283945739999997,1.8756685155000001,5.161145234999999,4.257118335,0.2818472856,0.39048589219999996,0.525636969,0.39893672599999996,0.3304699479,0.35347408525,1.8127138985,19.184854825,9.824261025,2.7618319745,2.8369244629999995,2.8619368235000002,5.112723865,13.10237332,0.422179015,0.50466066,0.3183611662,0.2983260663,0.55899239,0.36345739684999995,0.2980055731,0.41351376185,1.070029914,1.1156348735000001,0.5006441875,0.4488774645,0.3891072421,0.3614403071,0.3448761461,0.38707076985,0.37071801174999996]

pv_production_j1=[0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.524,4.07,4.106,8.404,7.148,10.054,9.658,14.5,4.798,8.348,17.664,8.268,6.598,24.48,28.418,22.656,21.186,10.436,6.79,3.64,2.738,3.93,4.062,5.51,0.608,0.124,0.0,0.0,0.0,0.0,0.0,0.0, 0.0]

non_shiftable_consommation=FixedConsumptionUnit(time, 'non_shiftable_consommation', energy_type='Electrical', p=non_shiftable_profil)
shiftable_consommation= ShiftableConsumptionUnit(time, name='shiftable_consommation',
                                              power_values=shiftable_profil,
                                              energy_type='Electrical')

# Create the electrical grid imports as a production
elec_grid_imports = VariableProductionUnit(time, 'elec_grid_imports',
                                           energy_type='Electrical')

# Create the electrical grid exports as a consumption
elec_grid_exports = VariableConsumptionUnit(time, 'elec_grid_exports',
                                                energy_type='Electrical')
PV_prod_j1 = FixedProductionUnit(time, name='PV_prod_j1',energy_type='Electrical', p= pv_production_j1)

imp_exp = DynamicConstraint(name='imp_exp',
                            exp_t='elec_grid_imports_u[t] + '
                                    'elec_grid_exports_u[t] <= 1.5',
                            parent=elec_grid_imports)

# Add the constraint to the elec_grid_imports model
setattr(elec_grid_imports, 'imp_exp', imp_exp)

elec_grid_imports.minimize_production()
elec_node = EnergyNode(time, 'elec_node', energy_type='Electrical')

elec_node.connect_units(shiftable_consommation,non_shiftable_consommation,elec_grid_imports,
                            elec_grid_exports, PV_prod_j1)
                            
model.add_nodes(elec_node)

new_time = pytime.time()
print('duration =', new_time - ticks)
model.solve_and_update()

flows = elec_node.get_flows
profile_table=pd.Series()

for flow in flows:
     
    
    label = flow.parent.name
    parent = flow.parent

    # Get the power profiles
    if isinstance(flow.value, list):
        energy_flow = flow.value
    elif isinstance(flow.value, dict):
        energy_flow = list(flow.value.values())   
    energy_flow_data=pd.Series(energy_flow,name=label )
    
    profile_table=pd.concat([profile_table,energy_flow_data],axis=1)


print(sum(profile_table['shiftable_consommation']))
print('*'*20)
print(sum(shiftable_profil))

What is the current bug behavior?

Marche bien pour 0.3.0, mais pas pour Omegalpes 0.4.0,la somme de l'énergy shiftable est doublé

Assignee
Assign to
Time tracking