I am new to this forum so I hope that I can explain my problem in compliance with the rules here.
I want to add capex funding to each member of the NonConvex_InvestmentFlows. In the investment class of each object, I have defined a “maximum_funding” attribute that represents the maximum capex funding. Then I have included the new attribute in the “options_Investment class”. Furthermore, I have added a new binary variable to the investment_flow_block that states whether the funding may be active or not. I have then adjusted the objective expression like so:
# adjusted investment cost reduced by capex funding for i, o in self.NON_CONVEX_INVESTFLOWS: investment_costs += ( self.invest[i, o] * ((m.flows[i, o].investment.ep_costs)-m.flows[i,o].investment.max_funding*self.funding_status[i,o]) + self.invest_status[i, o]*self.K_status[i, o]* m.flows[i, o].investment.offset ) self.investment_costs = Expression(expr=investment_costs) return investment_costs
I have added the new attribute and the binary variable in the main code instead of just reducing the ep_costs because I want to include an upper funding limit. For that, I have written the following constraint within the Investment_Flow_Block:
# assures that funding is within limits of BEW budget of 100 Mil. €, the funding per technology can only be exactly 40% of total capex or 0 def _funding_rule(block,i,o): expr=0 for i, o in self.NON_CONVEX_INVESTFLOWS: expr+=self.invest[i, o] *(m.flows[i, o].investment.max_funding)*self.funding_status[i,o] return expr <=100000000 self.funding=Constraint(self.NON_CONVEX_INVESTFLOWS,rule=_funding_rule)
Everything is working so far but I want to include the funding of the storage technologies in the upper funding limit as well. However, the storage class has its own objective function and the investment_costs of the storage are calculated within the GenericInvestmentStorageBlock. So far, I have added an additional binary variable in the storage class and included it in the storage objective function, too.
My problem is now to access the funding binary variable of the GenericInvestmentStorageBlock in my upper limit constraint that I have placed in the InvestmentFlowBlock. Is there a way to retrieve the binary variable from the GenericInvestmentStorageBlock and use it within the constraint? Or is there another place where I should formulate the constraint so I can access all binary variables?
I appreciate your help with this very much!