Skip to content

Commit 1d49c69

Browse files
committed
doc string updates
1 parent d620b47 commit 1d49c69

6 files changed

Lines changed: 13 additions & 126 deletions

File tree

build_log.txt

-345 KB
Binary file not shown.

docs/reference/api.md

Lines changed: 0 additions & 39 deletions
This file was deleted.

mkdocs.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,5 @@ nav:
115115
- Preloaded Database: data/preloaded_database.md
116116
- Reference:
117117
- Performance Metrics: reference/performance_metrics.md
118-
- API Reference: reference/api.md
119118
- Troubleshooting: reference/troubleshooting.md
120119
- Citation: reference/citation.md

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ dependencies = [
2121
"pyomo==6.4.2",
2222
"tqdm",
2323
"jupyter",
24+
"mkdocstrings-python"
2425

2526
]
2627
classifiers = [

src/wecgrid/modelers/power_system/psse.py

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -245,21 +245,16 @@ def add_wec_farm(self, farm: WECFarm) -> bool:
245245
ValueError: If the WEC farm cannot be added due to invalid parameters.
246246
247247
Notes:
248-
The following PSS®E API calls are used:
248+
Uses these PSS®E API calls:
249+
250+
- ``busdat()``: Get base voltage of connecting bus [kV].
251+
- ``bus_data_4()``: Create new PV bus for the WEC.
252+
- ``plant_data_4()``: Add plant data to the WEC bus.
253+
- ``machine_data_4()``: Add a generator (W{farm_id}) at the bus.
254+
- ``branch_data_3()``: Add a line between the WEC bus and grid (R/X set; rating not set).
249255
250-
- ``busdat()``: Get base voltage of connecting bus
251-
Returns: Base voltage [kV]
252-
- ``bus_data_4()``: Add new WEC bus (PV type)
253-
- Base voltage [kV]
254-
- ``plant_data_4()``: Add plant data to WEC bus
255-
- ``machine_data_4()``: Add WEC generator to bus
256-
- PG: Active power generation [MW]
257-
- ``branch_data_3()``: Add transmission line from WEC bus to grid
258-
- R: Resistance [pu]
259-
- X: Reactance [pu]
260-
- RATEA: Rating A [MVA]
261256
TODO:
262-
Fix the hardcoded line R, X, and RATEA values
257+
Expose the line R/X and rating as configuration.
263258
"""
264259

265260
ierr, rval = self.psspy.busdat(farm.connecting_bus, "BASE")

src/wecgrid/modelers/power_system/pypsa.py

Lines changed: 4 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -696,32 +696,9 @@ def take_snapshot(self, timestamp: datetime) -> None:
696696
def snapshot_buses(self) -> pd.DataFrame:
697697
"""Capture current bus state from PyPSA.
698698
699-
Builds a Pandas DataFrame of the current bus state for the loaded PyPSA network.
700-
The DataFrame is formatted according to the GridState specification and includes
701-
bus voltage, power injection, and control data.
702-
703699
Returns:
704-
pd.DataFrame: DataFrame with columns: bus, bus_name, type, p, q, v_mag,
705-
angle_deg, Vbase. Index represents individual buses.
706-
707-
Notes:
708-
The following PyPSA network data is used to create bus snapshots:
709-
710-
link - https://pypsa.readthedocs.io/en/stable/user-guide/components.html#bus
711-
712-
Bus Information:
713-
- Bus names and numbers "name" (converted from string indices) [dimensionless]
714-
- Bus control types "type"(PQ, PV, Slack) [string]
715-
- Base voltage levels "v_nom" [kV]
716-
717-
Electrical Quantities:
718-
- Active and reactive power injections "p", "q" [MW], [MVAr] → [pu]
719-
- Voltage magnitude "v_mag_pu" [pu] of v_nom
720-
- Voltage angle "v_ang" [radians] → [degrees]
721-
722-
Time Series Data:
723-
- Uses latest snapshot from network.snapshots
724-
- Defaults to steady-state values if no time series available
700+
DataFrame with columns: bus, bus_name, type, p, q, v_mag,
701+
angle_deg, vbase.
725702
"""
726703
n = self.network
727704
buses = n.buses # index = bus names (strings)
@@ -785,30 +762,8 @@ def snapshot_buses(self) -> pd.DataFrame:
785762
def snapshot_generators(self) -> pd.DataFrame:
786763
"""Capture current generator state from PyPSA.
787764
788-
Builds a Pandas DataFrame of the current generator state for the loaded PyPSA network.
789-
The DataFrame includes generator power output, base power, and status information.
790-
791765
Returns:
792-
pd.DataFrame: DataFrame with columns: gen, bus, p, q, base, status.
793-
Generator names are formatted as "bus_count" (e.g., "1_1", "1_2").
794-
795-
Notes:
796-
The following PyPSA network data is used to create generator snapshots:
797-
link - https://pypsa.readthedocs.io/en/stable/user-guide/components.html#generator
798-
799-
Generator Information:
800-
- Generator names and bus assignments [dimensionless]
801-
- Active and reactive power output [MW], [MVAr] → [pu]
802-
- Generator status and availability [dimensionless]
803-
804-
Time Series Data:
805-
- Uses latest snapshot from generators_t for power values
806-
- Uses generator 'active' attribute for status if available
807-
- Per-bus counter for consistent naming convention
808-
809-
Power Conversion:
810-
- All power values converted to per-unit on system base
811-
- System base MVA used for normalization [MVA]
766+
DataFrame with columns: gen, gen_name, bus, p, q, Mbase, status.
812767
"""
813768

814769
n = self.network
@@ -980,32 +935,8 @@ def snapshot_lines(self) -> pd.DataFrame:
980935
def snapshot_loads(self) -> pd.DataFrame:
981936
"""Capture current load state from PyPSA.
982937
983-
Builds a Pandas DataFrame of the current load state for the loaded PyPSA network.
984-
The DataFrame includes load power consumption and status information for all
985-
buses with loads.
986-
987938
Returns:
988-
pd.DataFrame: DataFrame with columns: load, bus, p, q, base, status.
989-
Load names are formatted as "Load_bus_count".
990-
991-
Notes:
992-
The following PyPSA network data is used to create load snapshots:
993-
994-
link - https://pypsa.readthedocs.io/en/stable/user-guide/components.html#load
995-
996-
Load Information:
997-
- Load names and bus assignments [dimensionless]
998-
- Active and reactive power consumption [MW], [MVAr] → [pu]
999-
- Load status from 'active' attribute [dimensionless]
1000-
1001-
Time Series Data:
1002-
- Uses latest snapshot from loads_t for power values
1003-
- Defaults to steady-state values if no time series available
1004-
- Per-bus counter for consistent naming convention
1005-
1006-
Power Conversion:
1007-
- All power values converted to per-unit on system base
1008-
- System base MVA used for normalization [MVA]
939+
DataFrame with columns: load, load_name, bus, p, q, status.
1009940
"""
1010941
n = self.network
1011942
sbase = float(self.sbase)

0 commit comments

Comments
 (0)