Jack Tang
Jack Tang

Reputation: 59

How to export to grid in pypsa model

I created a pv station model using pypsa, here is the code:

index = pd.date_range("2024-01-01 00:00", "2024-01-01 23:00", freq="H")

network = pypsa.Network(snapshots=index)

network.add("Bus", "main_bus")
network.add("Bus", "grid_bus")

pv_pu = pd.Series([
    0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
    0.1, 0.3, 0.5, 0.7, 0.9, 0.9,
    1.0, 1.0, 0.9, 0.8, 0.5, 0.5,
    0.2, 0.1, 0.0, 0.0, 0.0, 0.0
], index)

demand = pd.Series([
    0.3, 0.3, 0.3, 0.3, 0.3, 0.5,
    1.0, 2.0, 1.5, 0.8, 0.6, 0.7,
    0.8, 0.7, 0.6, 0.7, 0.8, 1.5,
    2.5, 2.0, 1.5, 1.0, 0.5, 0.3
], index)

network.add("Generator", "PV",
    bus="main_bus",
    p_nom_extendable=True,    
    p_nom_min=5,              
    p_nom_max=15,             
    p_max_pu=pv_pu,          
    capital_cost=400,         
    marginal_cost=0)         

network.add("Link", "grid_export",
    bus0="main_bus",         
    bus1="grid_bus",         
    p_nom_extendable=True,   
    p_nom_min=0,            
    p_nom_max=10,           
    efficiency=1,
    capital_cost=0,         
    marginal_cost=-5.0)     

network.add("Load", "grid_sink",
    bus="grid_bus",
    p_set=0)               

network.add("Load", "demand",
    bus="main_bus",
    p_set=demand)

network.add("StorageUnit", "battery",
    bus="main_bus",
    p_nom_extendable=True,     
    max_hours=4,               
    capital_cost=150,          
    efficiency_store=0.95,     
    efficiency_dispatch=0.95,  
    standing_loss=0.01,
    cyclic_state_of_charge=True)

And the optimization result is below: no grid exporting

I found the pv station or the battery never export to the grid. Because the default objective function or my model is wrong? Please give me your suggestions!

Upvotes: 0

Views: 14

Answers (0)

Related Questions