pycba.load_cases.LoadCases#

class LoadCases(beam_model, load_cases=None)[source]#

Bases: object

Collection of named load cases for one PyCBA beam model.

The collection is list-like for simple scripting, but also provides methods to analyse every case, form response matrices, and combine cases with arbitrary linear factors.

Methods

add

Add a named load case to the collection.

add_all_spans_udl

Append a full-span UDL of intensity w to every span of a named case.

add_case

Add and return a named load case.

add_ic

Append an imposed-curvature load to a named load case.

add_load

Append one raw load row to a named load case.

add_ml

Append a concentrated moment load to a named load case.

add_pl

Append a point load to a named load case.

add_pudl

Append a partial UDL to a named load case.

add_segment_udl

Append a UDL covering a global beam segment to a named load case.

add_span_udl

Add one full-span UDL case per span.

add_trap

Append a full-span or partial trapezoidal load to a named load case.

add_udl

Append a full-span UDL to a named load case.

analyse_combination

Analyse one factored load-case combination and return the analysis.

analyze_combination

Analyse one factored load-case combination and return the analysis.

append

Append an existing LoadCase or load-case-like object.

case

Return a named load case, optionally creating it when missing.

combine

Return a linear response combination using arbitrary case factors.

combined_loads

Return one load matrix formed from factored named load cases.

envelope

Analyse every load case independently and return their envelope.

extend

Append several load cases.

factors

Convert sequence or mapping factors to a numeric vector.

linear_combination

Alias for combine().

load_positions

Return integer identifiers for load-position tracking.

response_matrix

Analyse all cases and return the common station vector and matrix.

set

Replace or create a named load case.

target_combination

Select a linear combination by response sign at a target coordinate.

to_LM

Return the load matrices keyed by load-case name.

Attributes

cases

Load cases as an immutable tuple.

names

Load-case names in collection order.

property cases: tuple[LoadCase, ...]#

Load cases as an immutable tuple.

property names: tuple[str, ...]#

Load-case names in collection order.

load_positions()[source]#

Return integer identifiers for load-position tracking.

Cases generated by segmented-load helpers store a load_position in their metadata. Other cases default to one bit per case in collection order.

Return type:

list[int]

to_LM()[source]#

Return the load matrices keyed by load-case name.

The dictionary preserves the collection order and each load matrix is copied so callers can inspect or mutate it without changing the stored load cases.

Return type:

dict[str, List[List[Union[int, float]]]]

case(name, create=True)[source]#

Return a named load case, optionally creating it when missing.

Return type:

LoadCase

add_case(name, loads=None, loaded_spans=(), metadata=None)[source]#

Add and return a named load case.

Return type:

LoadCase

add(name, loads, loaded_spans=(), metadata=None)[source]#

Add a named load case to the collection.

loads is a normal PyCBA load matrix. It is copied on entry so later caller-side mutation does not alter the stored case.

Return type:

LoadCase

set(name, loads, loaded_spans=(), metadata=None)[source]#

Replace or create a named load case.

Return type:

LoadCase

append(load_case)[source]#

Append an existing LoadCase or load-case-like object.

Return type:

LoadCase

extend(load_cases)[source]#

Append several load cases.

Return type:

None

add_span_udl(w)[source]#

Add one full-span UDL case per span.

Return type:

list[LoadCase]

add_load(load_case, load)[source]#

Append one raw load row to a named load case.

Return type:

LoadCase

add_udl(load_case, i_span, w)[source]#

Append a full-span UDL to a named load case.

Return type:

LoadCase

add_pl(load_case, i_span, p, a)[source]#

Append a point load to a named load case.

Return type:

LoadCase

add_pudl(load_case, i_span, w, a, c)[source]#

Append a partial UDL to a named load case.

Return type:

LoadCase

add_segment_udl(load_case, x0, x1, w)[source]#

Append a UDL covering a global beam segment to a named load case.

The segment is split at span boundaries into full-span UDL and partial UDL rows as required.

Return type:

LoadCase

add_all_spans_udl(load_case, w)[source]#

Append a full-span UDL of intensity w to every span of a named case.

The beam is supplied implicitly from this collection (consistent with add_segment_udl()). The named case is created when it does not yet exist.

Parameters:
  • load_case (str) – Name of the load case to add the UDLs to.

  • w (float) – UDL intensity applied to every span.

Returns:

The (created or existing) load case with the UDLs appended.

Return type:

LoadCase

Notes

This adds all spans into the one named case, which is distinct from add_span_udl() (one separate case per span).

add_ml(load_case, i_span, m, a)[source]#

Append a concentrated moment load to a named load case.

Return type:

LoadCase

add_trap(load_case, i_span, w1, w2, a=None, c=None)[source]#

Append a full-span or partial trapezoidal load to a named load case.

Return type:

LoadCase

add_ic(load_case, i_span, kappa)[source]#

Append an imposed-curvature load to a named load case.

Return type:

LoadCase

response_matrix(response='M')[source]#

Analyse all cases and return the common station vector and matrix.

Return type:

tuple[ndarray, ndarray]

envelope(npts=None)[source]#

Analyse every load case independently and return their envelope.

Each case is analysed on its own (no combination) and the per-station pointwise extremes of moment and shear (plus coincident effects and reaction extremes) are enveloped into a first-class pycba.results.Envelopes. This gives a one-call path to a full, plottable envelope from helpers such as make_span_udl_cases() and make_patterned_udl().

Parameters:

npts (Optional[int]) – Number of evaluation points along a member. Defaults to the template beam’s npts when available.

Returns:

The pointwise envelope over the analysed load cases.

Return type:

Envelopes

Notes

This is the pointwise extreme of each case analysed alone, which is a genuinely different result from additive_envelope() (a same-station superposition of the n_combine governing cases).

factors(factors)[source]#

Convert sequence or mapping factors to a numeric vector.

A sequence must have one value per load case. A mapping can use either load-case names or zero-based integer indices as keys; unspecified cases receive a zero factor.

target_combination(name, x, sense='min', response='M', selected_factor=1.0, unselected_factor=0.0)[source]#

Select a linear combination by response sign at a target coordinate.

For sense="min", cases with a negative effect at x receive selected_factor. For sense="max", cases with a positive effect receive selected_factor. Other cases receive unselected_factor.

Return type:

LoadCombination

combine(factors, response='M')[source]#

Return a linear response combination using arbitrary case factors.

A 1D factor vector returns one response vector. A 2D factor matrix returns one response row per factor row.

Return type:

tuple[ndarray, ndarray]

combined_loads(factors)[source]#

Return one load matrix formed from factored named load cases.

factors must define a single combination, either as a 1D sequence with one factor per case, or as a mapping from case names or indices to factors. Cases omitted from a mapping receive a zero factor.

Return type:

List[List[Union[int, float]]]

analyze_combination(factors, npts=None)[source]#

Analyse one factored load-case combination and return the analysis.

This is useful when a combined case should be treated like an ordinary BeamAnalysis, for example to use BeamAnalysis.plot_results().

Return type:

BeamAnalysis

analyse_combination(factors, npts=None)#

Analyse one factored load-case combination and return the analysis.

This is useful when a combined case should be treated like an ordinary BeamAnalysis, for example to use BeamAnalysis.plot_results().

Return type:

BeamAnalysis

linear_combination(factors, response='M')[source]#

Alias for combine().

Return type:

tuple[ndarray, ndarray]