span
CatenarySpan
CatenarySpan(
span_length: ndarray,
elevation_difference: ndarray,
parameter: ndarray,
load_coefficient: ndarray | None = None,
linear_weight: float64 | None = None,
span_index: ndarray | None = None,
span_type: ndarray | None = None,
**_,
)
Bases: ISpan
Implementation of a span cable model according to the catenary equation.
The coordinates are expressed in the cable frame.
Source code in src/mechaphlowers/core/models/cable/span.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 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 | |
T_mean
T_mean() -> ndarray
Return the mean tension along the whole cable. Used in deformation model to compute mechanical deformation. Warning: this method uses stored values of x_m, x_n and L. If any attribute has been updated, compute_values() should be called before calling this method.
Source code in src/mechaphlowers/core/models/cable/span.py
625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 | |
compute_L
compute_L() -> ndarray
Total length of the cable.
Source code in src/mechaphlowers/core/models/cable/span.py
579 580 581 582 583 584 | |
compute_partial_L
compute_partial_L(new_a: ndarray) -> ndarray
Cable length from left hanging point to point corresponding to span length new_a.
Source code in src/mechaphlowers/core/models/cable/span.py
586 587 588 589 590 | |
compute_values
compute_values()
Compute and store values for x_m, x_n and L based on current attributes. T_mean depends on these values, so this method should be called before calling T_mean(), especially if an attribute has been updated.
The goal of this implementation is to reduce the number of times compute_x_m, compute_x_n and compute_L are called during solver iterations.
Source code in src/mechaphlowers/core/models/cable/span.py
144 145 146 147 148 149 150 151 152 153 154 155 156 157 | |
compute_x_n
compute_x_n() -> ndarray
Distance between the lowest point of the cable and the right hanging point, projected on the horizontal axis.
In other words: abscissa of the right hanging point.
Source code in src/mechaphlowers/core/models/cable/span.py
280 281 282 283 284 285 286 | |
get_coords
get_coords(resolution: int) -> tuple[ndarray, ndarray]
Get x and z coordinates for catenary generation in cable frame.
This method handles different span types in case of virtual nodes and produces an output of the same size than the real number of spans.
Updates the loads_indices attribute to store the positions of the loads.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
int
|
Number of points to generate between supports. |
required |
Returns:
| Type | Description |
|---|---|
tuple[ndarray, ndarray]
|
tuple[np.ndarray, np.ndarray]: x and z coordinates of the cable |
Source code in src/mechaphlowers/core/models/cable/span.py
487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 | |
mirror
mirror(span_model: Self) -> None
Copy attributes from an other ISpan object. This method is useful for copying values and keeping the reference of the current object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
Self
|
other ISpan object to copy attribute from |
required |
Examples:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | |
Source code in src/mechaphlowers/core/models/cable/span.py
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 | |
sag
sag() -> ndarray
Sag of the cable span (s1 formula).
The sag is the maximum perpendicular distance between the cable and the chord connecting both attachment points.
Returns:
| Type | Description |
|---|---|
ndarray
|
np.ndarray: sag value for each span. |
Source code in src/mechaphlowers/core/models/cable/span.py
663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 | |
sag_s2
sag_s2() -> ndarray
Sag of the cable span, computed with the s2 formula.
The sag s2 is the maximum perpendicular distance between the lowest point of the cable and the lowest hanging point.
Returns:
| Type | Description |
|---|---|
ndarray
|
np.ndarray: sag s2 value for each span. |
Source code in src/mechaphlowers/core/models/cable/span.py
681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 | |
set_lengths
set_lengths(
span_length: ndarray, elevation_difference: ndarray
)
Set value of span_length and elevation_difference and compute x_m, x_n and L.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
ndarray
|
new value for span_length parameter. |
required |
|
ndarray
|
new value for elevation_difference parameter. |
required |
Source code in src/mechaphlowers/core/models/cable/span.py
122 123 124 125 126 127 128 129 130 131 132 133 | |
set_parameter
set_parameter(parameter: ndarray)
Set value of sagging parameter and compute x_m, x_n and L.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
ndarray
|
new value for sagging parameter. |
required |
Source code in src/mechaphlowers/core/models/cable/span.py
135 136 137 138 139 140 141 142 | |
slope
Slope angle at the supports in radians.
Note that the left side corresponds to the slope for support_index 0 to N-1 and the right side corresponds to the slope for support_index 1 to N.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
Literal['left', 'right']
|
side regarding the span, in order to select the correct support to compute the slope. |
required |
Returns: np.ndarray: slope angle at each support in radians.
Source code in src/mechaphlowers/core/models/cable/span.py
649 650 651 652 653 654 655 656 657 658 659 660 661 | |
tensions_sup_inf
tensions_sup_inf() -> tuple[ndarray, ndarray]
Cable tensions at attachment points, x_m and x_n.
The two attachments have different values, the highest value is the one with the higher altitude.
Returns (T_high, T_low), T_high being the higher tension of the two values.
Source code in src/mechaphlowers/core/models/cable/span.py
385 386 387 388 389 390 391 392 393 394 | |
update_from_dict
Update the span model with new data.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
dict
|
Dictionary containing the new data. |
required |
Source code in src/mechaphlowers/core/models/cable/span.py
218 219 220 221 222 223 224 225 226 | |
x
x(resolution: int = 10) -> ndarray
x_coordinate for catenary generation in cable frame
Args: resolution (int, optional): Number of point to generation between supports. Defaults to 10.
Returns: np.ndarray: points generated x number of rows in SectionArray. Last column is nan due to the non-definition of last span.
Source code in src/mechaphlowers/core/models/cable/span.py
454 455 456 457 458 459 460 461 462 463 464 465 466 467 | |
z_many_points
z_many_points(x: ndarray) -> ndarray
Altitude of cable points depending on the abscissa. Many points per spans, used for graphs.
Source code in src/mechaphlowers/core/models/cable/span.py
439 440 441 | |
z_many_points_local
z_many_points_local(x: ndarray, p: ndarray) -> ndarray
Altitude of cable points depending on the abscissa. Many points per spans, used for graphs.
Source code in src/mechaphlowers/core/models/cable/span.py
424 425 426 427 428 429 430 431 432 433 434 435 436 437 | |
ISpan
ISpan(
span_length: ndarray,
elevation_difference: ndarray,
parameter: ndarray,
load_coefficient: ndarray | None = None,
linear_weight: float64 | None = None,
span_index: ndarray | None = None,
span_type: ndarray | None = None,
**_,
)
Bases: ABC
Abstract base class for cable span models in the cable frame.
Because the coordinates are in the cable frame, there is no need to factor in wind or angle, so we work under the following simplifying assumptions:
- a = a' = span_length
- b = b' = elevation_difference
The class handles both simple regular spans and spans with point loads. When factoring in point loads, virtual nodes are created, and the span is divided into semi-spans, thus modifiying the number of spans.
Attributes:
| Name | Type | Description |
|---|---|---|
span_length |
ndarray
|
Horizontal length of each span. |
elevation_difference |
ndarray
|
Vertical difference between support points for each span. |
parameter |
ndarray
|
Parameter controlling the cable sag (model-dependent). |
linear_weight |
float64
|
Linear weight of the cable per unit length. |
load_coefficient |
ndarray
|
Coefficient applied to loads for each span (defaults to ones). |
span_index |
ndarray
|
Index identifying each span, with duplicates for spans with loads. |
span_type |
ndarray
|
Type indicator for each span:
|
loads_indices |
tuple[ndarray, ndarray]
|
tuple containing:
|
Notes
- The class uses caching for computed values (x_m, x_n, L) to optimize performance during iterative solving.
- Therefore, if parameter, span_length, or elevation_difference are updated, it should be done by calling set_parameter or set_lengths methods to ensure consistency.
- Arrays are vectorized to handle multiple spans simultaneously.
Examples:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | |
Source code in src/mechaphlowers/core/models/cable/span.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 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 | |
L_m
abstractmethod
L_m() -> ndarray
Length of the left portion of the cable. The left portion refers to the portion from the left point to lowest point of the cables
Source code in src/mechaphlowers/core/models/cable/span.py
299 300 301 302 | |
L_n
abstractmethod
L_n() -> ndarray
Length of the right portion of the cable. The right portion refers to the portion from the right point to lowest point of the cables
Source code in src/mechaphlowers/core/models/cable/span.py
304 305 306 307 | |
T
abstractmethod
T(x_one_per_span: ndarray) -> ndarray
Norm of the tension on the cable. Same as T_v, x_one_per_span must of same length as the number of spans.
Args: x_one_per_span: array of abscissa, one abscissa per span
Source code in src/mechaphlowers/core/models/cable/span.py
356 357 358 359 360 361 362 363 | |
T_h
abstractmethod
T_h() -> ndarray
Horizontal tension on the cable. Right now, this tension is constant all along the cable, but that might not be true for elastic catenary model.
Raises:
| Type | Description |
|---|---|
AttributeError
|
linear_weight is required |
Source code in src/mechaphlowers/core/models/cable/span.py
326 327 328 329 330 331 332 333 | |
T_mean
abstractmethod
T_mean() -> ndarray
Mean tension along the whole cable.
Source code in src/mechaphlowers/core/models/cable/span.py
373 374 375 | |
T_mean_m
abstractmethod
T_mean_m() -> ndarray
Mean tension of the left portion of the cable.
Source code in src/mechaphlowers/core/models/cable/span.py
365 366 367 | |
T_mean_n
abstractmethod
T_mean_n() -> ndarray
Mean tension of the right portion of the cable.
Source code in src/mechaphlowers/core/models/cable/span.py
369 370 371 | |
T_v
abstractmethod
T_v(x_one_per_span: ndarray) -> ndarray
Vertical tension on the cable, depending on the abscissa.
Args: x_one_per_span: array of abscissa, one abscissa per span: should be at the same length as span_length/elevation_difference/p
Example with 3 spans, named a, b, c:
span_length = [500, 600, 700]
p = [2_000, 1_500, 1_000]
Then, x_one_per_span must be of size 3. Each element refers to one span:
x_one_per_span = [x_a, x_b, x_c]
Then, the output is:
T_v = [T_v(x_a), T_v(x_b), T_v(x_c)]
Source code in src/mechaphlowers/core/models/cable/span.py
335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 | |
compute_L
abstractmethod
compute_L() -> ndarray
Total length of the cable. Should be called after calling compute_x_m and compute_x_n if x_n or x_m have changed
Source code in src/mechaphlowers/core/models/cable/span.py
309 310 311 312 | |
compute_partial_L
abstractmethod
compute_partial_L(new_a: ndarray) -> ndarray
Cable length from left hanging point to point corresponding to span length new_a.
Source code in src/mechaphlowers/core/models/cable/span.py
314 315 316 | |
compute_values
compute_values()
Compute and store values for x_m, x_n and L based on current attributes. T_mean depends on these values, so this method should be called before calling T_mean(), especially if an attribute has been updated.
The goal of this implementation is to reduce the number of times compute_x_m, compute_x_n and compute_L are called during solver iterations.
Source code in src/mechaphlowers/core/models/cable/span.py
144 145 146 147 148 149 150 151 152 153 154 155 156 157 | |
compute_x_m
abstractmethod
compute_x_m() -> ndarray
Distance between the lowest point of the cable and the left hanging point, projected on the horizontal axis.
In other words: opposite of the abscissa of the left hanging point.
Source code in src/mechaphlowers/core/models/cable/span.py
273 274 275 276 277 278 | |
compute_x_n
compute_x_n() -> ndarray
Distance between the lowest point of the cable and the right hanging point, projected on the horizontal axis.
In other words: abscissa of the right hanging point.
Source code in src/mechaphlowers/core/models/cable/span.py
280 281 282 283 284 285 286 | |
get_coords
abstractmethod
Get x and z coordinates for catenary generation in cable frame
Returns:
| Type | Description |
|---|---|
tuple[ndarray, ndarray]
|
tuple[np.ndarray, np.ndarray]: x and z coordinates of the cable |
Source code in src/mechaphlowers/core/models/cable/span.py
318 319 320 321 322 323 324 | |
mirror
mirror(span_model: Self) -> None
Copy attributes from an other ISpan object. This method is useful for copying values and keeping the reference of the current object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
Self
|
other ISpan object to copy attribute from |
required |
Examples:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | |
Source code in src/mechaphlowers/core/models/cable/span.py
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 | |
sag
abstractmethod
sag() -> ndarray
Sag of the cable span (s1 formula).
The sag is the maximum perpendicular distance between the cable and the chord connecting both attachment points.
Returns:
| Type | Description |
|---|---|
ndarray
|
np.ndarray: sag value for each span. |
Source code in src/mechaphlowers/core/models/cable/span.py
396 397 398 399 400 401 402 403 404 405 | |
sag_s2
abstractmethod
sag_s2() -> ndarray
Sag of the cable span, computed with the s2 formula.
The sag s2 is the maximum perpendicular distance between the lowest point of the cable and the lowest hanging point.
Returns:
| Type | Description |
|---|---|
ndarray
|
np.ndarray: sag s2 value for each span. |
Source code in src/mechaphlowers/core/models/cable/span.py
407 408 409 410 411 412 413 414 415 | |
set_lengths
set_lengths(
span_length: ndarray, elevation_difference: ndarray
)
Set value of span_length and elevation_difference and compute x_m, x_n and L.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
ndarray
|
new value for span_length parameter. |
required |
|
ndarray
|
new value for elevation_difference parameter. |
required |
Source code in src/mechaphlowers/core/models/cable/span.py
122 123 124 125 126 127 128 129 130 131 132 133 | |
set_parameter
set_parameter(parameter: ndarray)
Set value of sagging parameter and compute x_m, x_n and L.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
ndarray
|
new value for sagging parameter. |
required |
Source code in src/mechaphlowers/core/models/cable/span.py
135 136 137 138 139 140 141 142 | |
slope
abstractmethod
slope(side: Literal['left', 'right']) -> ndarray
Slope angle at the supports in radians.
Returns:
| Type | Description |
|---|---|
ndarray
|
np.ndarray: slope angle at each support in radians. |
Source code in src/mechaphlowers/core/models/cable/span.py
377 378 379 380 381 382 383 | |
tensions_sup_inf
tensions_sup_inf() -> tuple[ndarray, ndarray]
Cable tensions at attachment points, x_m and x_n.
The two attachments have different values, the highest value is the one with the higher altitude.
Returns (T_high, T_low), T_high being the higher tension of the two values.
Source code in src/mechaphlowers/core/models/cable/span.py
385 386 387 388 389 390 391 392 393 394 | |
update_from_dict
Update the span model with new data.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
dict
|
Dictionary containing the new data. |
required |
Source code in src/mechaphlowers/core/models/cable/span.py
218 219 220 221 222 223 224 225 226 | |
x
abstractmethod
x(resolution: int) -> ndarray
x_coordinate for catenary generation in cable frame: abscissa of the different points of the cable
Args: resolution (int, optional): Number of point to generation between supports.
Returns: np.ndarray: points generated x number of rows in SectionArray. Last column is nan due to the non-definition of last span.
Source code in src/mechaphlowers/core/models/cable/span.py
288 289 290 291 292 293 294 295 296 297 | |
z_many_points
abstractmethod
z_many_points(x: ndarray) -> ndarray
Altitude of cable points depending on the abscissa.
Args: x: abscissa
Returns: altitudes based on the sag tension parameter "p" stored in the model.
x is an array of any length.
Example with 3 spans, named a, b, c:
span_length = [500, 600, 700]
p = [2_000, 1_500, 1_000]
x = [x0, x1, x2, x3]
Then, the output is:
1 2 3 4 5 6 | |
Source code in src/mechaphlowers/core/models/cable/span.py
228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 | |
z_one_point
abstractmethod
z_one_point(x: ndarray) -> ndarray
Altitude of cable point depending on the abscissa. One cable point per span If there is 2 spans/ 3 supports:
span_length = [500, 600, 700]
p = [2_000, 1_500, 1_000]
x = [x0, x1, x2]
Then the output is: z = [z0, z1, z2]
Source code in src/mechaphlowers/core/models/cable/span.py
260 261 262 263 264 265 266 267 268 269 270 271 | |
span_model_builder
span_model_builder(
section_array: SectionArray,
cable_array: CableArray,
span_model_type: Type[ISpan],
) -> ISpan
Builds a Span object, using data from SectionArray and CableArray
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
SectionArray
|
input data (span_length, elevation_difference, parameter) |
required |
|
CableArray
|
input data from cable (only linar weight used here) |
required |
|
Type[Span]
|
choose the type of span model to use |
required |
Returns:
| Name | Type | Description |
|---|---|---|
Span |
ISpan
|
span model to return |
Source code in src/mechaphlowers/core/models/cable/span.py
701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 | |