Constraint on component store

33 views
Skip to first unread message

DR Mohammed Riadh Habour

unread,
Mar 25, 2024, 8:14:58 PMMar 25
to pypsa
Hi everybody 
I would like to set up a constraint for battery store, to make the minimum of SOC at least 20% of maximum of SOC over all snapshots, here is both of battery subsystem and constraint :
Battery subsystem : 
IES.add("Bus","IE_battery")
IES.add("Store","IE_battery_storage",bus = "IE_battery", e_nom_extendable  = True,
e_cyclic    = True, marginal_cost = Battery_marginal_cost, capital_cost = Battery_capital_cost)

IES.add("Link","IE_battery_charger",bus0= "IE_electricity_system",bus1= "IE_battery",
p_nom_extendable= True, efficiency = Inverter_efficiency,)

IES.add("Link","IE_battery_inverter", bus0 = "IE_battery", bus1= "IE_electricity_system",
p_nom_extendable = True, efficiency= Inverter_efficiency, marginal_cost  = Inverter_marginal_cost, capital_cost = Inverter_capital_cost)

Constraint 
e_stores           = lpmodel.variables['Store-e']
IE_battery_storage_e      = e_stores.loc[:,'IE_battery_storage']  
IE_battery_storage_e_min  = IE_battery_storage_e.groupby(min) 
IE_battery_storage_e_max  = IE_battery_storage_e.groupby(max) 
lpmodel.add_constraints((IE_battery_storage_e_max * 0.2) <= IE_battery_storage_e_min, name='IE_batt')  

However  I got the next error 
--------------------------------------------------------------------------- TypeError Traceback (most recent call last) Cell In[59], line 6 4 IE_battery_storage_e_max = IE_battery_storage_e.groupby(max) #("snapshot") 5 #lpmodel.variables['Store-e'].loc[:,'IE_battery_storage'] ----> 6 lpmodel.add_constraints((IE_battery_storage_e_max * 0.2) <= IE_battery_storage_e_min, name='IE_batt') TypeError: unsupported operand type(s) for *: 'LinearExpressionGroupby' and 'float'

Any support to solve the error is more then welcome.

DR Mohammed Riadh Habour

unread,
Jul 2, 2024, 5:39:57 AM (5 days ago) Jul 2
to pypsa
Could someone assist or provide guidance regarding a question I have about the minimum and maximum battery  charge ? Thank you 
Reply all
Reply to author
Forward
0 new messages