|
1 | | -from _typeshed import Incomplete |
| 1 | +import logging |
| 2 | +from collections.abc import Collection |
| 3 | +from typing import Any, Literal, overload |
2 | 4 |
|
3 | | -ALGORITHM_MAPPING: Incomplete |
4 | | -ALLOWED_OPT_VAR: Incomplete |
| 5 | +from pandapower.auxiliary import pandapowerNet |
| 6 | +from pandapower.estimation.algorithm.base import BaseAlgorithm |
5 | 7 |
|
| 8 | +ALGORITHM_MAPPING: dict[str, type[BaseAlgorithm]] |
| 9 | +ALLOWED_OPT_VAR: set[str] |
| 10 | + |
| 11 | +@overload |
6 | 12 | def estimate( |
7 | | - net, |
8 | | - algorithm: str = "wls", |
9 | | - init: str = "flat", |
| 13 | + net: pandapowerNet, |
| 14 | + algorithm: Literal["wls", "af-wls"] = "wls", |
| 15 | + init: Literal["flat", "results", "slack"] = "flat", |
10 | 16 | tolerance: float = 1e-06, |
11 | | - maximum_iterations: int = 10, |
12 | | - calculate_voltage_angles: bool = True, |
13 | | - zero_injection: str = "aux_bus", |
14 | | - fuse_buses_with_bb_switch: str = "all", |
| 17 | + maximum_iterations: int = 50, |
| 18 | + zero_injection: Collection[int] | str = "aux_bus", |
| 19 | + fuse_buses_with_bb_switch: Collection[int] | Literal["all"] = "all", |
| 20 | + debug_mode: bool = False, |
15 | 21 | **opt_vars, |
16 | | -): ... |
| 22 | +) -> dict[str, Any]: ... |
| 23 | +@overload |
| 24 | +def estimate( |
| 25 | + net: pandapowerNet, |
| 26 | + algorithm: Literal["wls_with_zero_constraint", "opt", "irwls", "lp"], |
| 27 | + init: Literal["flat", "results", "slack"] = "flat", |
| 28 | + tolerance: float = 1e-06, |
| 29 | + maximum_iterations: int = 50, |
| 30 | + zero_injection: Collection[int] | str = "aux_bus", |
| 31 | + fuse_buses_with_bb_switch: Collection[int] | Literal["all"] = "all", |
| 32 | + debug_mode: bool = False, |
| 33 | + **opt_vars, |
| 34 | +) -> bool: ... |
17 | 35 | def remove_bad_data( |
18 | | - net, |
19 | | - init: str = "flat", |
| 36 | + net: pandapowerNet, |
| 37 | + init: Literal["flat", "results", "slack"] = "flat", |
20 | 38 | tolerance: float = 1e-06, |
21 | 39 | maximum_iterations: int = 10, |
22 | 40 | calculate_voltage_angles: bool = True, |
23 | 41 | rn_max_threshold: float = 3.0, |
24 | | -): ... |
| 42 | +) -> bool: ... |
25 | 43 | def chi2_analysis( |
26 | 44 | net, |
27 | 45 | init: str = "flat", |
28 | 46 | tolerance: float = 1e-06, |
29 | 47 | maximum_iterations: int = 10, |
30 | 48 | calculate_voltage_angles: bool = True, |
31 | 49 | chi2_prob_false: float = 0.05, |
32 | | -): ... |
| 50 | +) -> bool | None: ... |
33 | 51 |
|
34 | 52 | class StateEstimation: |
35 | | - net: Incomplete |
36 | | - solver: Incomplete |
37 | | - ppc: Incomplete |
38 | | - eppci: Incomplete |
39 | | - recycle: Incomplete |
40 | | - delta: Incomplete |
41 | | - bad_data_present: Incomplete |
| 53 | + logger: logging.Logger |
| 54 | + net: pandapowerNet |
| 55 | + solver: BaseAlgorithm |
| 56 | + ppc: dict[str, Any] | None |
| 57 | + eppci: dict[str, Any] | None |
| 58 | + recycle: bool |
| 59 | + algorithm: Literal["wls", "wls_with_zero_constraint", "opt", "irwls", "lp", "af-wls"] |
| 60 | + delta: None # not currently used |
| 61 | + bad_data_present: bool | None |
42 | 62 | def __init__( |
43 | 63 | self, |
44 | | - net, |
| 64 | + net: pandapowerNet, |
45 | 65 | tolerance: float = 1e-06, |
46 | | - maximum_iterations: int = 10, |
47 | | - algorithm: str = "wls", |
48 | | - logger: Incomplete | None = None, |
| 66 | + maximum_iterations: int = 50, |
| 67 | + algorithm: Literal["wls", "wls_with_zero_constraint", "opt", "irwls", "lp", "af-wls"] = "wls", |
| 68 | + logger: logging.Logger | None = None, |
49 | 69 | recycle: bool = False, |
50 | 70 | ) -> None: ... |
| 71 | + @overload |
51 | 72 | def estimate( |
52 | 73 | self, |
53 | | - v_start: str = "flat", |
54 | | - delta_start: str = "flat", |
55 | | - calculate_voltage_angles: bool = True, |
56 | | - zero_injection: Incomplete | None = None, |
57 | | - fuse_buses_with_bb_switch: str = "all", |
| 74 | + v_start: Collection[float] | str = "flat", |
| 75 | + delta_start: Collection[float] | str = "flat", |
| 76 | + zero_injection: Collection[int] | str | None = None, |
| 77 | + fuse_buses_with_bb_switch: Collection[int] | Literal["all"] = "all", |
| 78 | + algorithm: Literal["wls", "af-wls"] = "wls", |
| 79 | + debug_mode: bool = False, |
| 80 | + **opt_vars, |
| 81 | + ) -> dict[str, Any]: ... |
| 82 | + @overload # algorithm positional |
| 83 | + def estimate( |
| 84 | + self, |
| 85 | + v_start: Collection[float] | str, |
| 86 | + delta_start: Collection[float] | str, |
| 87 | + zero_injection: Collection[int] | str | None, |
| 88 | + fuse_buses_with_bb_switch: Collection[int] | Literal["all"], |
| 89 | + algorithm: Literal["wls_with_zero_constraint", "opt", "irwls", "lp"], |
| 90 | + debug_mode: bool = False, |
| 91 | + **opt_vars, |
| 92 | + ) -> bool: ... |
| 93 | + @overload # algorithm keyword |
| 94 | + def estimate( |
| 95 | + self, |
| 96 | + v_start: Collection[float] | str = "flat", |
| 97 | + delta_start: Collection[float] | str = "flat", |
| 98 | + zero_injection: Collection[int] | str | None = None, |
| 99 | + fuse_buses_with_bb_switch: Collection[int] | Literal["all"] = "all", |
| 100 | + *, |
| 101 | + algorithm: Literal["wls_with_zero_constraint", "opt", "irwls", "lp"], |
| 102 | + debug_mode: bool = False, |
58 | 103 | **opt_vars, |
59 | | - ): ... |
| 104 | + ) -> bool: ... |
60 | 105 | def perform_chi2_test( |
61 | 106 | self, |
62 | | - v_in_out: Incomplete | None = None, |
63 | | - delta_in_out: Incomplete | None = None, |
| 107 | + v_in_out: Collection[float] | str | None = None, |
| 108 | + delta_in_out: Collection[float] | str | None = None, |
64 | 109 | calculate_voltage_angles: bool = True, |
65 | 110 | chi2_prob_false: float = 0.05, |
66 | | - ): ... |
| 111 | + ) -> bool | None: ... |
67 | 112 | def perform_rn_max_test( |
68 | 113 | self, |
69 | | - v_in_out: Incomplete | None = None, |
70 | | - delta_in_out: Incomplete | None = None, |
| 114 | + v_in_out: Collection[float] | str | None = None, |
| 115 | + delta_in_out: Collection[float] | str | None = None, |
71 | 116 | calculate_voltage_angles: bool = True, |
72 | 117 | rn_max_threshold: float = 3.0, |
73 | | - ): ... |
| 118 | + ) -> bool: ... |
0 commit comments