Skip to content

span_loads

SpanLoads

SpanLoads(
    load_position_distance: ndarray | list,
    load_mass: ndarray | list,
    span_length: ndarray | list,
)

NB: The length of load_position_distance and load_mass must be the number of spans. The length of span_length must be the number of pylons (same as SectionArray.data.span_length).

Source code in src/mechaphlowers/core/models/balance/span_loads.py
14
15
16
17
18
19
20
21
22
23
24
25
def __init__(
    self,
    load_position_distance: np.ndarray | list,
    load_mass: np.ndarray | list,
    span_length: np.ndarray | list,
):
    """Create an oject to store discrete loads.

    NB: The length of load_position_distance and load_mass must be the number of spans.
    The length of span_length must be the number of pylons (same as SectionArray.data.span_length).
    """
    self.set_loads(load_position_distance, load_mass, span_length)

set_loads

set_loads(
    load_position_distance: ndarray | list,
    load_mass: ndarray | list,
    span_length: ndarray | list,
) -> None

Set loads.

Input for position is a distance, and will be converted into ratio.

Expected length of load_position_distance and load_mass is the number of spans. Each value refers to a span. Last elements should be nan or zero. Expected length of span_length is the number of pylons (same as SectionArray.data.span_length).

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

load_position_distance

ndarray | list

Position of the loads, in meters

required

load_mass

ndarray | list

Mass of the loads

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/core/models/balance/span_loads.py
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
def set_loads(
    self,
    load_position_distance: np.ndarray | list,
    load_mass: np.ndarray | list,
    span_length: np.ndarray | list,
) -> None:
    """Set loads.

    Input for position is a distance, and will be converted into ratio.

    Expected length of load_position_distance and load_mass is the number of spans. Each value refers to a span.
    Last elements should be nan or zero. Expected length of span_length is the number of pylons (same as
    SectionArray.data.span_length).

    If either load_position_distance[i] or load_mass[i] is 0 or nan, it means there is no load at span i.

    Args:
        load_position_distance (np.ndarray | list): Position of the loads, in meters
        load_mass (np.ndarray | list): Mass of the loads

    Raises:
        ValueError: if at least one load_position_distance is not in [0, span_length],
            or if the arguments don't have the right lengths.
    """
    load_position_distance, load_mass, span_length = (
        self._validate_load_arguments(
            load_position_distance,
            load_mass,
            span_length,
        )
    )
    self.load_position = self._compute_load_position_ratio(
        load_position_distance, span_length
    )
    self.load_mass = load_mass