-
Notifications
You must be signed in to change notification settings - Fork 13
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
Not all (pre-)calculations take DataFrames or Series as input #51
Comments
Which exact function do you mean? import pandas as pd
from oemof.thermal.compression_heatpumps_and_chillers import calc_cops
periods = 24
datetimeindex = pd.date_range('2020-01-01', periods=periods, freq='H')
temp_h = pd.Series([60] * periods, index=datetimeindex)
temp_l = pd.Series([30] * periods, index=datetimeindex)
print(temp_h)
cops = calc_cops(temp_h, temp_l, 0.9, mode='heat_pump')
print(cops) |
But it returns a list, not a Series. Is that what you meant? |
yes, that's the point! You will get a list (without time-index) back from the function. And I did not think about Series when I wrote the function just afterwards I found that it works as well. So when I implemented an input argument check (PR #57) I realized that I need to be aware of other types, as well, apart from list. That is why I like to have a feedback if we want to make oemof.thermal (pre-)calculations capable to handle Series. |
If we find an easy way to allow for Series and lists, that would be a nice feature. |
Let me pick this up even though it's a little off-topic. I discussed this recently with @gplssm and @nailend. oemof's Flow() says |
Are you sure that works with nominal value? I just tested it, and it fails with nominal_value as list or Series. import pandas as pd
from oemof.solph import EnergySystem, Model, Sink, Transformer, Bus, Flow
datetimeindex = pd.date_range(start='2020-01-01', periods=3, freq='H')
es = EnergySystem(timeindex=datetimeindex)
bus_0 = Bus('bus_0', balanced=False)
bus_1 = Bus('bus_1')
nominal_value_trafo = 40
# nominal_value_trafo = [40, 40, 40]
# nominal_value_trafo = pd.Series([40, 40, 40])
transformer = Transformer(
'transformer',
inputs={bus_0: Flow()},
outputs={bus_1: Flow(
nominal_value=nominal_value_trafo,
variable_costs=10)},
conversion_factors={bus_0: 1}
)
sink = Sink(
'sink',
inputs={
bus_1: Flow(
nominal_value=1,
actual_value=[1,2,3],
fixed=True)
}
)
es.add(bus_0, bus_1, transformer, sink)
model = Model(es)
model.solve()
print(model.results()) |
Other parameters like |
Sorry, my bad. I just picked out one of the numeric inputs and this was the very one where it's not allowed. As you say, I mean the sequence type params such as Apparently, all iterable objects are allowed here according to this line in sequence() (except for string). You may check with
The docstring should be something like
|
Do you think it would help to add |
Done in https://github.com/oemof/oemof/issues/673 |
Thanks! |
Just for information, how it is handed in other oemof-thermal components: |
This Issue seems not to be too relevant any more and I thnink we won't find time to work on this any more. |
I was ask if I could make the
compression_heatpumps_and_chillers.py
module take a Pandas.Series (time-indexed) as input and return the COPs as time-indexed Series.Now I wonder, if that would be a good feature.
It seems to be very useful when using the module as stand-alone calculation but when using the calculation to generate input to a solph.component it has to be a List, as far as I know.
The text was updated successfully, but these errors were encountered: