Comments (7)
Hi @mdonat,
you have to add the NonConvex
on the input or output flow of the Converter
, and the attribute min=1
.
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}
)
from oemof-solph.
I tried this, but it seems that it cannot be solved.
This is the code:
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.
With "min=1" it does not solve, ...only if I set nominal_value to 200, so that the heat pump will be constantly on.
from oemof-solph.
Your code is a incomplete, e.g. times
is never defined, could you add that?
Also, the model might be infeasible, because your heat pump cannot provide 200 units of heat, only 400 or 0. Since your demand_th
takes 200 units fixed at all times, nothing in your system can provide that amount of energy. The storage might be able to buffer that for up to 10 hours, but it is constrained to be cyclic by default. So depending on the number of timesteps you are running the model, it might be infeasible because the storage can never be balanced back to half way full.
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.
from oemof-solph.
Missing code for times
:
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.
I thought that, if the heat pump is working half the time, it provides 200 units of heat to demand_th, and 200 units to the storage. The other half, when it is switched off, the storage provides 200 units of heat to demand_th.
from oemof-solph.
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).
from oemof-solph.
Ok, that's right, there is no clear optimum.
But if I set min=0.5 it is working. Should have even more possible solutions then...
Thank you for the quick support. :-)
from oemof-solph.
But if I set min=0.5 it is working. Should have even more possible solutions then...
Due to the storage operation cost the optimum is then very easy to find: never use the storage. ;)
from oemof-solph.
Related Issues (20)
- Multi-period development HOT 1
- Docs on retreiving constraint values seem to be not correct
- Oemof Installation Test accepts not working cbc
- Decomissioning of exisiting capacity (non-invest) in MultiPeriod HOT 2
- Oemof-network requirement
- Unclear error HOT 1
- Pandas gives a future warning for usage of "H" in a date_range
- Implausible diverging results comparing 1-year-multi-period & multi-period optimization HOT 6
- v0.4.x TypeError on Transformer init with basic example HOT 2
- GenericCHP component example is broken HOT 2
- Allow multiple outputs at OffsetConverter HOT 4
- Results processing should check if optimisation succeeded
- Using `custom_attributes` of `Source` and `Sink` classes fails HOT 1
- Add periodic values to invest relation of generic storage
- Implement alternative back-end to Pyomo (e.g. linopy) HOT 9
- The `OffsetConverter` is broken in the new implementation HOT 4
- The basic_example.py is broken HOT 1
- Aggregate all sorts of tools configurations in `pyproject.toml` HOT 1
- The online documentation could have a more appealing/modern look
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from oemof-solph.