WEC-Grid
    • IntroductionIntroductionIntroduction
    • Software Design
    • Installation
    • Engine
        • Base
        • Grid State
        • PSS/E
        • PyPSA
        • Runner
      • WEC Module
      • WEC Farm
      • WEC Device
      • Database
      • Time
      • Plot
      • Example 1
      • Example 2
        • WEC Integration and Time Series Analysis
        • Create WEC-Farm with a WEC Devices
        • Review updated Grid
        • Run Time Series Simulation
        • Analyze and Visualize Results
      • Example 3
      • Example 4
      • Grid Models
      • WEC Models
      • Database
    • API Reference
    • Troubleshooting
    • Citation
GitHub
« Previous
Next »
WEC-Grid
  • Examples & Data »
  • Jupyter notebooks

Example 2¶

WEC Integration and Time Series Analysis¶

This notebook demonstrates WEC-Grid's core functionality for wave energy converter integration:

  • Setting up a grid system with WEC devices
  • Running time-domain simulations
  • Analyzing WEC performance and grid impact

This example uses the IEEE 30 case system with RM3 wave energy converters.

In [1]:
Copied!
import wecgrid

example2 = wecgrid.Engine()
example2.case("grid_models/IEEE_30_bus.raw")
example2.load(["pypsa"])
example2
import wecgrid example2 = wecgrid.Engine() example2.case("grid_models/IEEE_30_bus.raw") example2.load(["pypsa"]) example2
Out[1]:
Engine:
├─ Case: IEEE 30 bus
├─ PyPSA: Loaded
├─ PSS/E: Not Loaded
├─ WEC-Farms/WECs: 0 - 0
└─ Buses: 30

Sbase: 100.0 MVA

Create WEC-Farm with a WEC Devices¶

Lets create a WEC Farm with a ten RM3 devices. The RM3 simulation data was pulled from the pre-loaded WEC-Grid database found here. Specifics about the RM3 run can be found in the documentation.

In [2]:
Copied!
#Information about the wec-sim runs in database can accessed using 
example2.database.wecsim_runs()
#Information about the wec-sim runs in database can accessed using example2.database.wecsim_runs()
Out[2]:
wec_sim_id model_type sim_duration_sec delta_time wave_height_m wave_period_sec wave_spectrum wave_class wave_seed simulation_hash created_at
0 2 LUPA 86400.0 0.1 2.5 8.0 PM irregular 8 LUPA_2.5m_8.0s_8 2025-08-19 19:59:49
1 1 RM3 86400.0 0.1 2.5 8.0 PM irregular 94 RM3_2.5m_8.0s_94 2025-08-19 19:45:01
In [3]:
Copied!
example2.apply_wec(
   farm_name = "WEC-Farm-RM3",
   size = 10, # ten RM3 in WEC farm  
   wec_sim_id = 1, # RM3 run id  
   bus_location=31, # create a new bus for farm  
   connecting_bus = 1, # Connect to bus 1 or swing bus
)
example2.apply_wec( farm_name = "WEC-Farm-RM3", size = 10, # ten RM3 in WEC farm wec_sim_id = 1, # RM3 run id bus_location=31, # create a new bus for farm connecting_bus = 1, # Connect to bus 1 or swing bus )
WEC Farm added: WEC-Farm-RM3

Review updated Grid¶

In [4]:
Copied!
grid = example2.pypsa.grid
grid
grid = example2.pypsa.grid grid
Out[4]:
GridState:
├─ Components:
│   ├─ bus:   31 components
│   ├─ gen:   7 components
│   ├─ line:  38 components
│   └─ load:  21 components
├─ Case: IEEE 30 bus
└─ Modeler: pypsa
In [5]:
Copied!
example2.plot.sld()
example2.plot.sld()
SLD Data Summary:
  Buses: 31
  Lines: 38
  Generators: 7
  Loads: 21
No description has been provided for this image

Run Time Series Simulation¶

Execute a time-domain simulation to analyze WEC power injection and grid response over 24 hours.

In [6]:
Copied!
example2.simulate() # takes some time!
example2.pypsa.report
example2.simulate() # takes some time! example2.pypsa.report
PyPSA Simulating: 100%|██████████| 288/288 [02:51<00:00,  1.68step/s]
Out[6]:
SolveReport:
├─ Converged: Successful
├─ Simulation Time: 171.54 s
├─ Num Steps: 288
├─ Case: IEEE 30 bus
└─ Modeler: pypsa

Analyze and Visualize Results¶

Create comprehensive plots to analyze WEC performance and grid impact over time.

In [7]:
Copied!
plot = example2.plot
plot.bus()
plot.bus(bus=['Bus_1']) # Swing Bus
plot.bus(bus=['Bus_31']) # WEC-Farm Bus
plot.bus(parameter='v_mag',bus=['Bus_31'])
plot = example2.plot plot.bus() plot.bus(bus=['Bus_1']) # Swing Bus plot.bus(bus=['Bus_31']) # WEC-Farm Bus plot.bus(parameter='v_mag',bus=['Bus_31'])
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
Out[7]:
(<Figure size 1200x600 with 1 Axes>,
 <AxesSubplot:title={'center':'PYPSA: Bus Voltage Magnitude'}, xlabel='Time', ylabel='Voltage (pu)'>)
In [8]:
Copied!
plot.gen()
plot.gen(gen=['Gen_1']) # Swing Generator 
plot.gen(gen=['Gen_7']) # WEC-Farm Generator
plot.gen() plot.gen(gen=['Gen_1']) # Swing Generator plot.gen(gen=['Gen_7']) # WEC-Farm Generator
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
Out[8]:
(<Figure size 1200x600 with 1 Axes>,
 <AxesSubplot:title={'center':'PYPSA: Generator Active Power'}, xlabel='Time', ylabel='Active Power [pu]'>)
In [9]:
Copied!
plot.wec_analysis()
plot.wec_analysis()
No description has been provided for this image
In [ ]:
Copied!

Previous
Next

Built with MkDocs using Ivory theme.