oemof-solph
oemof-solph copied to clipboard
Use common investment rule function
There are duplicated rule formulations in the investment blocks of flows
, _generic_storage
and SinkDSM
which only differ slightly with their indexes and constraint name. This counts for:
- _old_storage_capacity_rule_end
- _old_dsm_capacity_rule_end (for every SinkDSM approach)
- _old_capacity_rule_end
Is there a way to define a common function which is called inside and indexes
and constraint
are passed. The advantage would be, that if anything changes, not five different code-locations have to be changed and checked. I just encountered this problem in #957
Thanks for bringing this up. I'd suggest to split _options.py into a submodule. The constraints would then be formulated in options/_investment.py that bundles the class Investment
and the constraints (and analogue for NonConvex
).
There are duplicated rule formulations in the investment blocks of
flows
,_generic_storage
andSinkDSM
which only differ slightly with their indexes and constraint name. This counts for:
- _old_storage_capacity_rule_end
- _old_dsm_capacity_rule_end (for every SinkDSM approach)
- _old_capacity_rule_end
Is there a way to define a common function which is called inside and
indexes
andconstraint
are passed. The advantage would be, that if anything changes, not five different code-locations have to be changed and checked. I just encountered this problem in #957
I agree that this would be sensible and facilitate code maintenance as well as development of new functionality.