section_study
SectionStudy
SectionStudy(
cable_array: CableArray,
section_array: SectionArray,
span_model_type: Type[ISpan] = CatenarySpan,
deformation_model_type: Type[
IDeformation
] = DeformationRte,
)
User-facing facade that bundles all engines for a power-line section.
SectionStudy creates a
BalanceEngine and a
PositionEngine
eagerly, wiring the observer chain so that every solve automatically
refreshes downstream geometry. A
PlotEngine,
ThermalEngine,
and Guying are created lazily
on first access to avoid unnecessary dependencies (e.g. plotly).
All state-management features (save / restore, rollback on solver error,
intermediate warm-start) live here so that
BalanceEngine
is never modified.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
CableArray
|
Cable specification data. |
required |
|
SectionArray
|
Support / section data. |
required |
|
Type[ISpan]
|
Span model class. Defaults to CatenarySpan. |
CatenarySpan
|
|
Type[IDeformation]
|
Deformation model class. Defaults to DeformationRte. |
DeformationRte
|
Examples:
1 2 3 4 | |
Source code in src/mechaphlowers/api/section_study.py
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 | |
intermediate_memento
property
intermediate_memento: BalanceEngineMemento | None
The memento captured after the intermediate warm-start solve, if any.
manipulation
property
manipulation: Manipulation
The [Manipulation][mechaphlowers.core.manipulation.Manipulation] object storing geometric overlays.
add_loads
Calls preferred method set_loads.
This method is kept for compatibility.
Expected length for load_position_distance and load_mass is the number of pylons. Last array elements should be nan or zero.
Raises:
| Type | Description |
|---|---|
ValueError
|
if at least one load_position_distance is not in [0, span_length] or if the arguments don't have the right lengths. |
Source code in src/mechaphlowers/api/section_study.py
417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 | |
add_rope
Override insulator length and mass for specified supports with rope values.
Delegates to [Manipulation.add_rope][mechaphlowers.core.manipulation.Manipulation.add_rope].
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
dict[int, float]
|
Dictionary mapping support index (0-based) to rope length (meters). |
required |
|
float | None
|
Linear mass of the rope in kg/m. |
None
|
Source code in src/mechaphlowers/api/section_study.py
168 169 170 171 172 173 174 175 176 177 178 179 180 181 | |
add_virtual_support
Insert virtual supports.
Delegates to [Manipulation.add_virtual_support][mechaphlowers.core.manipulation.Manipulation.add_virtual_support].
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
dict[int, dict[str, float]]
|
Dictionary mapping left-support index to virtual support parameters. |
required |
Source code in src/mechaphlowers/api/section_study.py
190 191 192 193 194 195 196 197 198 199 200 201 | |
get_data_spans
Delegate to BalanceEngine.get_data_spans.
Returns:
| Type | Description |
|---|---|
dict[str, list]
|
dict[str, list]: Dictionary with span data (parameter, tensions, etc.). |
Source code in src/mechaphlowers/api/section_study.py
484 485 486 487 488 489 490 | |
get_points_for_plot
Delegate to PositionEngine.get_points_for_plot.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
bool
|
|
False
|
|
Index of the support frame for projection. |
0
|
Returns:
| Type | Description |
|---|---|
tuple[Points, Points, Points]
|
Tuple of |
Source code in src/mechaphlowers/api/section_study.py
513 514 515 516 517 518 519 520 521 522 523 524 525 | |
get_spans_points
get_spans_points(
frame: Literal[
'section', 'localsection', 'cable'
] = 'section',
) -> ndarray
Delegate to PositionEngine.get_spans_points.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
Literal['section', 'localsection', 'cable']
|
Coordinate frame. Defaults to "section". |
'section'
|
Returns:
| Type | Description |
|---|---|
ndarray
|
np.ndarray: Array of span points in the requested frame. |
Source code in src/mechaphlowers/api/section_study.py
492 493 494 495 496 497 498 499 500 501 502 503 | |
get_supports_points
get_supports_points() -> ndarray
Delegate to PositionEngine.get_supports_points.
Returns:
| Type | Description |
|---|---|
ndarray
|
np.ndarray: Array of support points coordinates. |
Source code in src/mechaphlowers/api/section_study.py
505 506 507 508 509 510 511 | |
modify_cable
modify_cable(
shift_support: dict[int, float] | None = None,
shorten_span: dict[int, float] | None = None,
) -> None
Validate and store cable shifting values.
Delegates to [Manipulation.modify_cable][mechaphlowers.core.manipulation.Manipulation.modify_cable].
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
dict[int, float] | None
|
Horizontal shifting per support, in meters. Dictionary mapping support index (0-based) to shift value; first and last supports are forced to 0. |
None
|
|
dict[int, float] | None
|
Span length modification per span, in meters. Dictionary mapping span index (0-based) to shortening value; positive values shorten the span. |
None
|
Source code in src/mechaphlowers/api/section_study.py
210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 | |
modify_support
Apply additive offsets to support geometry.
Delegates to
[Manipulation.modify_support][mechaphlowers.core.manipulation.Manipulation.modify_support].
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
dict[int, dict[str, float]]
|
Dictionary mapping support index (0-based) to
offsets with optional keys |
required |
Source code in src/mechaphlowers/api/section_study.py
147 148 149 150 151 152 153 154 155 156 157 158 159 | |
reset_all
reset_all() -> None
Remove all active manipulations.
Delegates to [Manipulation.reset_all][mechaphlowers.core.manipulation.Manipulation.reset_all].
Source code in src/mechaphlowers/api/section_study.py
236 237 238 239 240 241 | |
reset_cable
reset_cable() -> None
Remove cable shifting.
Delegates to [Manipulation.reset_cable][mechaphlowers.core.manipulation.Manipulation.reset_cable].
Source code in src/mechaphlowers/api/section_study.py
229 230 231 232 233 234 | |
reset_rope
reset_rope() -> None
Remove the rope overlay.
Delegates to [Manipulation.reset_rope][mechaphlowers.core.manipulation.Manipulation.reset_rope].
Source code in src/mechaphlowers/api/section_study.py
183 184 185 186 187 188 | |
reset_support
reset_support() -> None
Remove the support manipulation overlay.
Delegates to [Manipulation.reset_support][mechaphlowers.core.manipulation.Manipulation.reset_support].
Source code in src/mechaphlowers/api/section_study.py
161 162 163 164 165 166 | |
reset_virtual_support
reset_virtual_support() -> None
Remove all virtual supports.
Delegates to [Manipulation.reset_virtual_support][mechaphlowers.core.manipulation.Manipulation.reset_virtual_support].
Source code in src/mechaphlowers/api/section_study.py
203 204 205 206 207 208 | |
restore_state
restore_state(memento: BalanceEngineMemento) -> None
Restore state and notify observers to refresh geometry.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
BalanceEngineMemento
|
Snapshot previously returned by
|
required |
Source code in src/mechaphlowers/api/section_study.py
472 473 474 475 476 477 478 479 480 | |
save_state
save_state() -> BalanceEngineMemento
Create an immutable snapshot of the current engine state.
Returns:
| Name | Type | Description |
|---|---|---|
BalanceEngineMemento |
BalanceEngineMemento
|
Independent copy of every mutable array. |
Source code in src/mechaphlowers/api/section_study.py
464 465 466 467 468 469 470 | |
set_loads
set_loads(
load_position_distance: ndarray | list,
load_mass: ndarray | list,
) -> None
Delegate to BalanceEngine.set_loads.
If either load_position_distance[i] or load_mass[i] is 0 or nan, it means there is no load at span i.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
ndarray | list
|
Position of the loads, in meters. Its size must be the number of spans. |
required |
|
ndarray | list
|
Mass of the loads. Its size must be the number of spans. |
required |
Raises:
| Type | Description |
|---|---|
ValueError
|
if at least one load_position_distance is not in [0, span_length] or if the arguments don't have the right lengths. |
Source code in src/mechaphlowers/api/section_study.py
442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 | |
solve_adjustment
solve_adjustment() -> None
Run adjustment on clean geometry, then apply manipulations if any.
- Build a clean engine from the original section array and solve
adjustment to obtain
initial_L_ref. - If manipulations are registered, call
[
Manipulation.from_section_array][mechaphlowers.core.manipulation.Manipulation.from_section_array] to produce a manipulated copy, then [Manipulation.initialize_engine][mechaphlowers.core.manipulation.Manipulation.initialize_engine] to build the target engine with injectedL_refand blocked adjustment. - Rewire downstream engines (caretaker, position, plot, guying).
On SolverError, the engine
state is restored to the snapshot taken before the solve attempt, and the
error is re-raised.
Raises:
| Type | Description |
|---|---|
SolverError
|
If the solver fails to converge. |
Source code in src/mechaphlowers/api/section_study.py
245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 | |
solve_change_state
solve_change_state(
wind_pressure: ndarray | float | None = None,
ice_thickness: ndarray | float | None = None,
new_temperature: ndarray | float | None = None,
wind_direction: Literal[
'clockwise', 'anticlockwise'
] = 'anticlockwise',
) -> None
Run BalanceEngine.solve_change_state with automatic rollback.
An intermediate solve at default conditions (T=15 °C, wind=0, ice=0) is performed first as a warm-start to improve convergence, unless the requested conditions already match the defaults.
On SolverError, the engine
state is restored to the snapshot taken before the solve attempt, and the
error is re-raised.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
ndarray | float | None
|
Wind pressure in Pa. Defaults to None. |
None
|
|
ndarray | float | None
|
Ice thickness in m. Defaults to None. |
None
|
|
ndarray | float | None
|
New temperature in °C. Defaults to None. |
None
|
|
Literal['clockwise', 'anticlockwise']
|
Direction of the wind. Defaults to "anticlockwise". |
'anticlockwise'
|
Raises:
| Type | Description |
|---|---|
SolverError
|
If the solver fails to converge. |
Source code in src/mechaphlowers/api/section_study.py
310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 | |
supports_number
supports_number() -> int
Return the number of supports in the balance engine.
Source code in src/mechaphlowers/api/section_study.py
536 537 538 | |