simplenet.assemble¶
Assemble the reduced :class:PowerCase from a Kron reduction result.
Port of matlab/NetworkReduction2/MakeMPCr.m and
matlab/NetworkReduction2/GenerateBCIRC.m. Produces the reduced
bus / branch / gen arrays plus the per-branch circuit number vector
that MPReduction.m exposes externally.
AssembleResult
dataclass
¶
Output of :func:assemble_reduced.
Attributes:
| Name | Type | Description |
|---|---|---|
reduced_case |
PowerCase
|
The reduced :class: |
bcirc |
ndarray
|
Per-branch circuit numbers for the reduced model. Equivalent
branches use |
eq_bcirc_value |
int
|
Sentinel circuit number applied to every equivalent branch. |
generate_bcirc
¶
Generate per-branch circuit numbers (port of GenerateBCIRC.m).
Branches are not reordered. For each unique (fbus, tbus) pair the
first occurrence gets BCIRC = 1 and any subsequent occurrence
is numbered 2, 3, ... to flag parallel lines.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
branch
|
ndarray
|
MATPOWER-format branch matrix. |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
1-D |
Source code in src/simplenet/assemble.py
assemble_reduced
¶
assemble_reduced(case: PowerCase, external_bus_ids: ndarray, boundary_bus_ids: ndarray, kron_result: KronResult, bcirc: ndarray, *, tol: float = 1e-12) -> AssembleResult
Build the reduced :class:PowerCase from the Kron result.
Steps (matching MakeMPCr.m):
- Drop bus rows for external buses and branches touching them.
- Add equivalent branches between boundary buses where the difference between the reduced and original internal Y blocks is non-trivial.
- Set
Bson every retained bus to(diag(Y_red) - sum_of_branch_susceptances_at_bus) * baseMVA. - Zero out branch shunts (column
b) - all shunts now live on the buses.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
case
|
PowerCase
|
Full input :class: |
required |
external_bus_ids
|
ndarray
|
Original bus IDs to be eliminated. |
required |
boundary_bus_ids
|
ndarray
|
Retained bus IDs that share at least one branch with an
external bus (see :func: |
required |
kron_result
|
KronResult
|
Result of :func: |
required |
bcirc
|
ndarray
|
Per-branch circuit numbers for |
required |
tol
|
float
|
Threshold for treating |
1e-12
|
Returns:
| Type | Description |
|---|---|
AssembleResult
|
Reduced :class: |
Source code in src/simplenet/assemble.py
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 | |