-
Notifications
You must be signed in to change notification settings - Fork 132
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to define a switching Converter ? #1065
Comments
Hi @mdonat, you have to add the heat_pump = solph.components.Converter(
"heat pump",
inputs={b_electricity: solph.Flow()},
outputs={
b_heat: solph.Flow(min=1, nonconvex=solph.NonConvex(), nominal_value=10), # e.g. 10 kW heat
},
conversion_factors={b_heat: COP}
) |
I tried this, but it seems that it cannot be solved. energysystem = solph.EnergySystem(timeindex=times)
bel = solph.buses.Bus(label='electricity')
b_heat = solph.buses.Bus(label='heat')
# create source object representing the e commodity
energysystem.add(
solph.components.Source(
label="e-in",
outputs={
bel: solph.flows.Flow(variable_costs=50)
},
)
)
# create storage object for heat
nominal_capacity = 4000
nominal_value = 400
heat_storage = solph.components.GenericStorage(
nominal_storage_capacity=nominal_capacity,
label="STORAGE_HEAT",
inputs={b_heat: solph.flows.Flow(nominal_value=nominal_value, variable_costs=0.001)},
outputs={
b_heat: solph.flows.Flow(
nominal_value=nominal_value, variable_costs=0.001
)
},
loss_rate=0.00,
initial_storage_level=0.5,
inflow_conversion_factor=1,
outflow_conversion_factor=1,
)
energysystem.add(heat_storage)
sink = solph.components.Sink(
label="demand_th",
inputs={b_heat: solph.Flow(nominal_value=200, fix=1)}
)
energysystem.add(solph.components.Converter(label="heatPump",
inputs={bel: solph.flows.Flow(
)},
outputs={b_heat: solph.flows.Flow(nominal_value=400,
nonconvex=solph.NonConvex(),
min=1,
)},
conversion_factors={b_heat: 1}
))
energysystem.add(bel, b_heat, sink)
# solve problem
om = solph.Model(energysystem)
om.solve(solver="cbc", solve_kwargs={"tee": True}) If I uncomment "min=1" it solves with constant flow value of 200. |
Your code is a incomplete, e.g. Also, the model might be infeasible, because your heat pump cannot provide 200 units of heat, only 400 or 0. Since your To circumvent that, you could add an additional sink, which takes up any amount of heat but penalizes the model to do so (by giving the flow very high variable cost). Then you can check, why the infeasibility occurs. |
Missing code for today = datetime.date.today()
start_day = today - datetime.timedelta(days=1)
times = pd.date_range(start=start_day, end=today, freq='5T') I have added an additional sink: energysystem.add(
solph.components.Sink(
label="excess_bus_heat",
inputs={b_heat: solph.flows.Flow(variable_costs=100)},
)
) But it does not work. |
Okay, then it was a misunderstanding. I thought the problem was infeasible... After running it, in my opinion, the issue here is, that the problem seems to have an extremely flat optimum: There is basically tons of solutions which all lead to the same objective but are very different in dispatch (the model really is indifferent on when to charge or discharge storage). |
Ok, that's right, there is no clear optimum. |
Due to the storage operation cost the optimum is then very easy to find: never use the storage. ;) |
I would like to add a Converter which can only be on or off.
So output flow value should be 0 or nominal_value.
Is that possible?
If not, how to define for example a pump which converts electrical energy to heat, and can only be on or off?
The text was updated successfully, but these errors were encountered: