oemof-solph icon indicating copy to clipboard operation
oemof-solph copied to clipboard

Use common investment rule function

Open nailend opened this issue 1 year ago • 2 comments

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

nailend avatar Jul 20 '23 13:07 nailend

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).

p-snft avatar Jul 31 '23 10:07 p-snft

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

I agree that this would be sensible and facilitate code maintenance as well as development of new functionality.

jokochems avatar Oct 15 '23 13:10 jokochems