def _(e, om, block): """Method containing the constraints for commodity Comoodity are modeled with a fixed output value set for the variable of the output. Parameters ---------- See :func:`assembler`. Returns ------- See :func:`assembler`. """ lc.add_global_output_limit(om, block) return om
def _(e, om, block): """ Method creates bus balance for all buses. The bus model creates all full balance around the energy buses using the :func:`lc.generic_bus_constraint` function. Additionally it sets constraints to model limits over the timehorizon for resource buses using :func:`lc.generic_limit` Parameters ---------- see :func:`assembler`. Returns ------- om : The optimization model passed in as an argument, with additional bus balances. """ # slack variables that assures a feasible problem # get uids for busses that allow excess block.excess_uids = [b.uid for b in block.objs if b.excess == True] # get uids for busses that allow shortage block.shortage_uids = [b.uid for b in block.objs if b.shortage == True] # create variables for 'slack' of shortage and excess if block.excess_uids: block.excess_slack = po.Var(block.excess_uids, om.timesteps, within=po.NonNegativeReals) if block.shortage_uids: block.shortage_slack = po.Var(block.shortage_uids, om.timesteps, within=po.NonNegativeReals) print('Creating bus balance constraints ...') # bus balance constraint for energy bus objects lc.add_bus_balance(om, block) # set limits for buses lc.add_global_output_limit(om, block) return om