Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ repos:
- id: mixed-line-ending
- id: check-case-conflict
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.13.0 # must match uv.lock
rev: v0.14.9 # must match uv.lock
hooks:
- id: ruff-check
- id: ruff-format
3 changes: 2 additions & 1 deletion stubs/pandapower-stubs/auxiliary.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@ class pandapowerNet(ADict[pd.DataFrame]):
res_ward: pd.DataFrame
res_xward: pd.DataFrame
res_protection: pd.DataFrame # Optional?
@classmethod
def create_dataframes(cls, data): ...
@deprecated("Use copy.deepcopy(net) instead of net.deepcopy()")
def deepcopy(self) -> Self: ...

Expand Down Expand Up @@ -161,7 +163,6 @@ class LoadflowNotConverged(ppException): ...
class ControllerNotConverged(ppException): ...
class NetCalculationNotConverged(ppException): ...
class OPFNotConverged(ppException): ...
class MapboxTokenMissing(ppException): ...

def get_indices(
selection: Iterable[Int], lookup: Mapping[Int, Int] | Mapping[str, Mapping[Int, Int]], fused_indices: bool = True
Expand Down
4 changes: 2 additions & 2 deletions stubs/pandapower-stubs/build_bus.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class DisjointSet(dict[_T, _T]):
def find(self, item: _T) -> _T: ...
def union(self, item1: _T, item2: _T) -> None: ...

def create_consecutive_bus_lookup(net: pandapowerNet, bus_index: Collection[Int]) -> Array1D[np.int64]: ...
def create_consecutive_bus_lookup(bus_index: Collection[Int]) -> Array1D[np.int64]: ...
def create_bus_lookup_numpy(
net: pandapowerNet, bus_index: Collection[Int], closed_bb_switch_mask: NDArray[np.bool]
) -> tuple[Array1D[np.int64], Array1D[np.bool]]: ...
Expand All @@ -45,4 +45,4 @@ def get_voltage_init_vector(
net: pandapowerNet, init_v, mode: Literal["magnitude", "angle"], sequence: Incomplete | None = None
): ...
def set_reference_buses(net: pandapowerNet, ppc, bus_lookup, mode: str) -> None: ...
def set_reference_buses_dc(net: pandapowerNet, ppc, bus_lookup, mode: str) -> None: ...
def set_reference_buses_dc(net: pandapowerNet, ppc, bus_lookup) -> None: ...
5 changes: 3 additions & 2 deletions stubs/pandapower-stubs/control/basic_controller.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ from pandapower.io_utils import JSONSerializableClass

class BasicCtrl(JSONSerializableClass):
index: int
def __init__(self, container: pandapowerNet, index: Int | None = None, **kwargs) -> None: ...
def __init__(self, container: pandapowerNet, index: Int | None = None) -> None: ...
def time_step(self, container: pandapowerNet, time: Any) -> None: ...
def initialize_control(self, container: pandapowerNet) -> None: ...
def is_converged(self, container: pandapowerNet): ...
Expand All @@ -25,6 +25,7 @@ class Controller(BasicCtrl):
def __init__(
self,
net: pandapowerNet,
name: str | None = None,
in_service: bool = True,
order: Int = 0,
level: Int = 0,
Expand All @@ -34,11 +35,11 @@ class Controller(BasicCtrl):
initial_run: bool = True,
overwrite: bool = False,
matching_params: dict[str, Any] | None = None,
**kwargs,
) -> None: ...
def add_controller_to_net(
self,
net: pandapowerNet,
name: str | None,
in_service: bool,
initial_run: bool,
order: Int,
Expand Down
19 changes: 19 additions & 0 deletions stubs/pandapower-stubs/control/controller/dmr_control.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
from pandapower.auxiliary import pandapowerNet
from pandapower.control.basic_controller import Controller

class DmrControl(Controller):
def __init__(
self,
net: pandapowerNet,
dmr_line: int,
dc_plus_line: int,
dc_minus_line: int,
in_service=True,
order=0,
level=0,
drop_same_existing_ctrl=False,
matching_params=None,
**kwargs,
): ...
def is_converged(self, net: pandapowerNet) -> bool: ...
def finalize_control(self, net: pandapowerNet) -> None: ...
30 changes: 29 additions & 1 deletion stubs/pandapower-stubs/control/controller/station_control.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ class BinarySearchControl(Controller):
input_element_index,
set_point,
voltage_ctrl,
name="",
input_inverted=[],
gen_Q_response=[],
bus_idx=None,
tol=0.001,
in_service=True,
Expand All @@ -37,18 +40,43 @@ class DroopControl(Controller):
net: pandapowerNet,
q_droop_mvar,
bus_idx,
vm_set_pu,
controller_idx,
voltage_ctrl,
tol=1e-6,
q_set_mvar_bsc=None,
in_service=True,
order=-1,
level=0,
name="",
drop_same_existing_ctrl=False,
matching_params=None,
vm_set_pu_bsc=None,
vm_set_lb=None,
vm_set_ub=None,
**kwargs,
) -> None: ...
def is_converged(self, net: pandapowerNet) -> bool | np.bool: ...
def control_step(self, net: pandapowerNet) -> None: ...

class VDroopControl_local(Controller):
def __init__(
self,
net: pandapowerNet,
q_droop_mvar,
controller_idx,
bus_idx,
tol=1e-6,
in_service=True,
order=-1,
level=0,
name="",
drop_same_existing_ctrl=False,
matching_params=None,
q_set_mvar=None,
vm_set_pu_bsc=None,
vm_set_lb=None,
vm_set_ub=None,
**kwargs,
): ...
def is_converged(self, net: pandapowerNet) -> bool | np.bool: ...
def control_step(self, net: pandapowerNet) -> None: ...
2 changes: 1 addition & 1 deletion stubs/pandapower-stubs/control/util/auxiliary.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ def plot_characteristic(characteristic, start, stop, num: int = 20, xlabel=None,
def create_trafo_characteristic_object(net: pandapowerNet) -> None: ...
def _create_trafo_characteristics(net: pandapowerNet, trafotable, trafo_index, variable, x_points, y_points) -> None: ...
def create_shunt_characteristic_object(net: pandapowerNet) -> None: ...
def create_q_capability_curve_characteristics_object(net: pandapowerNet) -> None: ...
def create_q_capability_characteristics_object(net: pandapowerNet) -> None: ...
109 changes: 87 additions & 22 deletions stubs/pandapower-stubs/create.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,10 @@ def create_load(
bus: Int,
p_mw: Float,
q_mvar: Float = 0,
const_z_percent: Float = 0,
const_i_percent: Float = 0,
const_z_p_percent: Float = 0,
const_i_p_percent: Float = 0,
const_z_q_percent: Float = 0,
const_i_q_percent: Float = 0,
sn_mva: Float = ...,
name: str | None = None,
scaling: Float = 1.0,
Expand All @@ -96,8 +98,10 @@ def create_loads(
buses: Collection[Int],
p_mw: ScalarOrVector[Float],
q_mvar: ScalarOrVector[Float] = 0,
const_z_percent: ScalarOrVector[Float] = 0,
const_i_percent: ScalarOrVector[Float] = 0,
const_z_p_percent: ScalarOrVector[Float] = 0,
const_i_p_percent: ScalarOrVector[Float] = 0,
const_z_q_percent: ScalarOrVector[Float] = 0,
const_i_q_percent: ScalarOrVector[Float] = 0,
sn_mva: ScalarOrVector[Float] = ...,
name: ScalarOrVector[str] | None = None,
scaling: ScalarOrVector[Float] = 1.0,
Expand Down Expand Up @@ -149,7 +153,7 @@ def create_sgen(
controllable: Bool | float = ..., # float because default value is nan
k: Float = ...,
rx: Float = ...,
id_q_capability_curve_characteristic: Int | None = None,
id_q_capability_characteristic: Int | None = None,
reactive_capability_curve: Bool = False,
curve_style: str | None = None,
current_source: Bool = True,
Expand Down Expand Up @@ -177,7 +181,7 @@ def create_sgens(
controllable: ScalarOrVector[Bool] | float = ..., # float because default value is nan
k: ScalarOrVector[Float] = ...,
rx: ScalarOrVector[Float] = ...,
id_q_capability_curve_characteristic: ScalarOrVector[Int] | float | None = ..., # float because default value is nan
id_q_capability_characteristic: ScalarOrVector[Int] | None = None,
reactive_capability_curve: ScalarOrVector[Bool] = False,
curve_style: ScalarOrVector[str] | None = None,
current_source: ScalarOrVector[Bool] = True,
Expand Down Expand Up @@ -266,7 +270,7 @@ def create_gen(
scaling: Float = 1.0,
type: str | None = None,
slack: Bool = False,
id_q_capability_curve_characteristic: Int | None = None,
id_q_capability_characteristic: Int | None = None,
reactive_capability_curve: Bool = False,
curve_style: str | None = None,
controllable: Bool | float = ..., # float because default value is nan
Expand Down Expand Up @@ -297,7 +301,7 @@ def create_gens(
scaling: ScalarOrVector[Float] = 1.0,
type: ScalarOrVector[str] | None = None,
slack: ScalarOrVector[Bool] = False,
id_q_capability_curve_characteristic: ScalarOrVector[Int] | None | float = ..., # float because default value is nan
id_q_capability_characteristic: ScalarOrVector[Int] | None = None,
reactive_capability_curve: ScalarOrVector[Bool] = False,
curve_style: ScalarOrVector[str] | None = None,
controllable: ScalarOrVector[Bool] | float = ..., # float because default value is nan
Expand Down Expand Up @@ -521,10 +525,10 @@ def create_transformer(
parallel: Int = 1,
df: Float = 1.0,
tap_changer_type: Literal["Ratio", "Symmetrical", "Ideal", "Tabular"] | None = None,
tap_dependency_table: Bool | float = ..., # float because default value is nan
id_characteristic_table: Int | float = ..., # float because default value is nan
tap_dependency_table: Bool = False,
id_characteristic_table: Int | None = None,
pt_percent: Float = ...,
oltc: Bool | float = ..., # float because default value is nan
oltc: Bool = False,
xn_ohm: Float = ...,
tap2_pos: Int | float = ..., # float because default value is nan
**kwargs,
Expand All @@ -549,7 +553,7 @@ def create_transformer_from_parameters(
tap_step_degree: Float = ...,
tap_pos: Int | float = ..., # float because default value is nan
tap_changer_type: Literal["Ratio", "Symmetrical", "Ideal", "Tabular"] | None = None,
id_characteristic_table: Int | float = ..., # float because default value is nan
id_characteristic_table: Int | None = None,
in_service: Bool = True,
name: str | None = None,
vector_group: str | None = None,
Expand All @@ -563,7 +567,7 @@ def create_transformer_from_parameters(
mag0_rx: Float = ...,
si0_hv_partial: Float = ...,
pt_percent: Float = ...,
oltc: Bool | float = ..., # float because default value is nan
oltc: Bool = False,
tap_dependency_table: Bool = False,
xn_ohm: Float = ...,
tap2_side: Literal["hv", "lv"] | None = None,
Expand Down Expand Up @@ -596,7 +600,7 @@ def create_transformers_from_parameters(
tap_step_degree: ScalarOrVector[Float] = ...,
tap_pos: ScalarOrVector[Int] | float = ..., # float because default value is nan
tap_changer_type: ScalarOrVector[Literal["Ratio", "Symmetrical", "Ideal", "Tabular"]] | None = None,
id_characteristic_table: ScalarOrVector[Int] | float = ..., # float because default value is nan
id_characteristic_table: ScalarOrVector[Int] | None = None,
in_service: ScalarOrVector[Bool] = True,
name: ScalarOrVector[str] | None = None,
vector_group: ScalarOrVector[str] | None = None,
Expand All @@ -610,7 +614,7 @@ def create_transformers_from_parameters(
mag0_rx: ScalarOrVector[Float] = ...,
si0_hv_partial: ScalarOrVector[Float] = ...,
pt_percent: ScalarOrVector[Float] = ...,
oltc: ScalarOrVector[Bool] | float = ..., # float because default value is nan
oltc: ScalarOrVector[Bool] = False,
tap_dependency_table: ScalarOrVector[Bool] = False,
xn_ohm: ScalarOrVector[Float] = ...,
tap2_side: ScalarOrVector[Literal["hv", "lv"]] | None = None,
Expand All @@ -636,8 +640,8 @@ def create_transformer3w(
max_loading_percent: Float = ...,
tap_changer_type: Literal["Ratio", "Symmetrical", "Ideal", "Tabular"] | None = None,
tap_at_star_point: Bool = False,
tap_dependency_table: Bool | float = ..., # float because default value is nan
id_characteristic_table: Int | float = ..., # float because default value is nan
tap_dependency_table: Bool = False,
id_characteristic_table: Int | None = None,
**kwargs,
) -> np.int64: ...
def create_transformer3w_from_parameters(
Expand Down Expand Up @@ -682,7 +686,7 @@ def create_transformer3w_from_parameters(
vkr0_lv_percent: Float = ...,
vector_group: str | None = None,
tap_dependency_table: Bool = False,
id_characteristic_table: Int | float = ..., # float because default value is nan
id_characteristic_table: Int | None = None,
**kwargs,
) -> np.int64: ...
def create_transformers3w_from_parameters(
Expand Down Expand Up @@ -727,7 +731,7 @@ def create_transformers3w_from_parameters(
vkr0_lv_percent: ScalarOrVector[Float] = ...,
vector_group: ScalarOrVector[str] | None = None,
tap_dependency_table: ScalarOrVector[Bool] = False,
id_characteristic_table: ScalarOrVector[Int] | float = ..., # float because default value is nan
id_characteristic_table: ScalarOrVector[Int] | None = None,
**kwargs,
) -> Array1D[np.int64]: ...
def create_switch(
Expand Down Expand Up @@ -766,7 +770,7 @@ def create_shunt(
max_step: Int = 1,
name: str | None = None,
step_dependency_table: Bool = False,
id_characteristic_table: Int | float = ..., # float because default value is nan
id_characteristic_table: Int | None = None,
in_service: Bool = True,
index: Int | None = None,
**kwargs,
Expand All @@ -781,7 +785,7 @@ def create_shunts(
max_step: ScalarOrVector[Int] = 1,
name: ScalarOrVector[str] | None = None,
step_dependency_table: ScalarOrVector[Bool] = False,
id_characteristic_table: ScalarOrVector[Int] | float = ..., # float because default value is nan
id_characteristic_table: ScalarOrVector[Int] | None = None,
in_service: ScalarOrVector[Bool] = True,
index: Collection[Int] | None = None,
**kwargs,
Expand All @@ -798,11 +802,33 @@ def create_shunt_as_capacitor(
max_step: Int = 1,
name: str | None = None,
step_dependency_table: Bool = False,
id_characteristic_table: Int = ...,
id_characteristic_table: Int | None = None,
in_service: Bool = True,
index: Int | None = None,
**kwargs,
) -> np.int64: ...
def create_source_dc(
net: pandapowerNet,
bus_dc: Int,
vm_pu: Float = 1.0,
index: Int | None = None,
name: str | None = None,
in_service: Bool = True,
type: str | None = None,
**kwargs,
) -> np.int64: ...
def create_load_dc(
net: pandapowerNet,
bus_dc: Int,
p_dc_mw: Float,
scaling: Float = 1.0,
type: str | None = None,
index: Int | None = None,
name: str | None = None,
in_service: Bool = True,
controllable: Bool = False,
**kwargs,
) -> np.int64: ...
def create_svc(
net: pandapowerNet,
bus: Int,
Expand Down Expand Up @@ -832,6 +858,44 @@ def create_ssc(
index: Int | None = None,
**kwargs,
) -> np.int64: ...
def create_b2b_vsc(
net: pandapowerNet,
bus: Int,
bus_dc_plus: Int,
bus_dc_minus: Int,
r_ohm: Float,
x_ohm: Float,
r_dc_ohm: Float,
pl_dc_mw: Float = 0.0,
control_mode_ac: Literal["vm_pu", "q_mvar", "slack"] = "vm_pu",
control_value_ac: Float = 1.0,
control_mode_dc: Literal["vm_pu", "p_mw"] = "p_mw",
control_value_dc: Float = 0.0,
name: str | None = None,
controllable: Bool = True,
in_service: Bool = True,
index: Int | None = None,
**kwargs,
) -> np.int64: ...
def create_bi_vsc(
net: pandapowerNet,
bus: Int,
bus_dc_plus: Int,
bus_dc_minus: Int,
r_ohm: Float,
x_ohm: Float,
r_dc_ohm: Float,
pl_dc_mw: Float = 0.0,
control_mode_ac: Literal["vm_pu", "q_mvar", "slack"] = "vm_pu",
control_value_ac: Float = 1.0,
control_mode_dc: Literal["vm_pu", "p_mw"] = "p_mw",
control_value_dc: Float = 0.0,
name: str | None = None,
controllable: Bool = True,
in_service: Bool = True,
index: Int | None = None,
**kwargs,
) -> np.int64: ...
def create_vsc(
net: pandapowerNet,
bus: Int,
Expand All @@ -848,6 +912,7 @@ def create_vsc(
controllable: Bool = True,
in_service: Bool = True,
index: Int | None = None,
ref_bus: Int | None = None,
**kwargs,
) -> np.int64: ...
def create_impedance(
Expand Down
Loading