Hello community,
I want to check, if all parameters are on the right place in oemof. Therefore, I am using the function:
solph.processing.convert_keys_to_strings(solph.processing.parameter_as_dict(model))
The function works fine, if I use the DSM-Method “oemof”. However, changing the DSM-Method to “DLR” following error occurs: ValueError: arrays must all be same length.
I found out that the error disappears when changing the parameter “demand” in SinkDSM to a fix number. However, I need a time series for modelling my energy system. I appreciate any help! Thanks!
Br, Alex
from oemof import solph
import pandas as pd
# Create profiles
pv_timeseries = [0, 0, 0, 0, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 0, 0, 0, 0, 0] * 365
demand_timeseries = [1, 1, 1, 1, 1, 1, 1, 1, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 1, 1, 1, 1, 1, 1] * 365
# Create Energy System
datetimeindex = pd.date_range(start='1/1/2013', periods=8760, freq='H')
es = solph.EnergySystem(timeindex=datetimeindex)
# Create bus for electricity
b_elec = solph.Bus(label='electricity_bus')
# Create a back supply
grid = solph.Source(label='grid_source',
outputs={
b_elec: solph.Flow(
nominal_value=10000,
variable_costs=5000000)}
)
# Create a wind supply
wind = solph.Source(label='wind_source',
outputs={
b_elec: solph.Flow(
fix = pv_timeseries,
nominal_value = 50)}
)
# Create DSM Sink - DLR
es.add(solph.custom.SinkDSM(label="DSM",
approach="DLR",
inputs={b_elec: solph.Flow()},
demand = 5 * demand_timeseries,
#demand = 5,
capacity_down = 3,
capacity_up = 3,
delay_time = 24,
shift_time = 8760,
max_capacity_down = 1,
max_demand = 1,
max_capacity_up = 1,
shed_eligibility = False,
))
# Create Sink for excess electricity
excess = solph.Sink(label="excess",
inputs={b_elec: solph.Flow()}
)
# Add buses, sources and sinks to the model
es.add(b_elec, grid, wind, excess)
# Initialise the model
model = solph.Model(es)
# Solve the model
model.solve(solver="gurobi", solve_kwargs={"tee": True})
# Results
Ergebnisse = solph.processing.convert_keys_to_strings(solph.processing.results(model))
Parameter = solph.processing.convert_keys_to_strings(solph.processing.parameter_as_dict(model))