Open lensum opened 10 months ago
Shouldn't the Flow
s be created with nominal_value=Investment()
to allow for investments in any case?
That might work (have to try it tomorrow) but it isn't shown like that in any of the examples. And then the _set_flows
function wouldn't make much sense to me? Or is there another reason why the Investment
objects in the flow should be overwritten? Maybe because of the lifetime_inflow
`lifetime_outflow` attributes?
Maybe, it makes sense to rewrite this thing anyway. I'd consider replacing the fixed relations between the investments by a limit to the c-rate. It would be an internal property that exists independent from the nominal values of the flows.
Yeah, you are right about locating this to the _set_flows
method, @lensum , I think.
invest_relation_input_output
is not accounted for here. In my view, a check needs to be added in _set_flows
.flow.investment
is evaluated. I think, this needs to be flow.nominal_value
instead according to the latest structural changes.I see multiple problems with the current implementation. First of all, we create unexpected investment variables. (If the Flows do not have to have one, they are silently created.) Secondly, you can do confusing things. The invest_relation_input_capacity=0.1
will be typically read as "it needs 10 hours to charge the storage". However, you can set a "max" to the flows to bypass that:
electric_storage = cmp.GenericStorage(
label="electric_storage",
inputs={el_bus: solph.Flow(max=10)}, # will be charged in 1 hour
outputs={el_bus: solph.Flow()},
nominal_storage_capacity=solph.Investment(
ep_costs=elstor_epc, existing=1200, maximum=2100
),
invest_relation_input_capacity=0.1,
invest_relation_input_output=0.1,
)
When using the GenericStorage with an investment optimization approach like this:
I get
KeyError: 'Index \'("<oemof.solph.components._generic_storage.GenericStorage: \'electric_storage\'>", "<oemof.solph.buses._bus.Bus: \'el_bus\'>", 0)\' is not valid for indexed component \'InvestmentFlowBlock.total\''
I assume that the error might be in the internal function
_set_flows
. I defined theself.invest_relation_input_capacity
andself.invest_relation_input_output
, but the_set_flows
function only considersself.invest_relation_output_capacity
for the output flows, meaning that my output flows don't get converted intoInvestmentFlow
objects. If I useinvest_relation_output_capacity=0.9375
instead of theinvest_relation_input_output
, the model starts to solve.