Cycle error in the storage
Summary
There is a problem when a storage is create with a number of cycle. Following error: TypeError: slice indices must be integers or None or have an index method I think linked with the creation of the following constraint Adding constraint : storage_set_cycles , exp = storage_e[t] == storage_e[t+1.0] for t in time.I[:-1.0]
Steps to reproduce
from omegalpes.energy.units.consumption_units import *
from omegalpes.energy.units.production_units import *
from omegalpes.energy.energy_nodes import *
from omegalpes.general.time import *
from omegalpes.general.optimisation.model import *
from omegalpes.general.utils.plots import *
from omegalpes.general.utils.output_data import save_energy_flows
from pulp import LpStatus
def main():
time = TimeUnit(periods=24, dt=1)
storage = StorageUnit(time, name='storage', energy_type='Electrical',
cycles=1)
variable_production = VariableProductionUnit(time, name='variable_production', energy_type='Electrical')
node = EnergyNode(time, name='node', energy_type='Electrical')
node.connect_units(variable_production, storage)
model = OptimisationModel(time, name='optimization_model')
model.add_nodes(node)
model.solve_and_update()
return model, time, storage, variable_production, node
if __name__ == '__main__':
MODEL, TIME, STORAGE, VARIABLE_PRODUCTION, NODE = main()
What is the current bug behavior?
Raise an error TypeError: slice indices must be integers or None or have an index method But the cycle indicated is an int. The problem is in the calculation of the cycle
What is the expected correct behavior?
No error