pycba.bridge.BridgeAnalysis#
- class BridgeAnalysis(ba=None, veh=None)[source]#
Bases:
objectPerforms a bridge crossing analysis for a defined vehicle. The vehicle is moved from the zero global x-coordinate of the beam until it has left the beam at the far end.
Any loads already defined on the BeamAnalysis object are retained and superimposed in each vehicle position analysis.
Can instantiate with nothing and later add or define the objects, or with instantiate with pre-defined bridge and vehicle objects.
Any loads already defined on the BeamAnalysis object are retained in each vehicle position analysis.
- Parameters:
ba (
Optional[BeamAnalysis]) – Apycba.analysis.BeamAnalysisobject. The default is None.veh (
Optional[Vehicle]) – Apycba.bridge.Vehicleobject. The default is None.
- Return type:
None.
Methods
Create and add a beam to a bridge analysis
Create and add the vehicle to the analysis
Animate the vehicle crossing the bridge.
From the envelopes output, returns the extreme values, their locations, and the position of the vehicle for each in a dictionary of dictionaries.
Returns the ratios of two sets of envelopes considering zero values and reactions.
Plots the envelopes of load effects from a vehicle traverse analysis
Plots the output of
pycba.bridge.BridgeAnalysis.envelopes_ratios().Draw the bridge with the vehicle at a given position, above the instantaneous bending-moment and shear-force diagrams.
Run a moving load model: the vehicle together with an accompanying lane UDL, enveloped over the traverse.
Runs the vehicle over the bridge performing a static analysis at each point
Set the bridge for the bridge analysis.
Set the vehicle for the bridge analysis.
Performs a single analysis for the vehicle, static at a given position
- add_bridge(L, EI, R, eletype=None, GAv=None)[source]#
Create and add a beam to a bridge analysis
- Parameters:
L (
ndarray) – A vector of span lengths.EI (
Union[float,ndarray]) – A vector of member flexural rigidities.R (
ndarray) – A vector describing the support conditions at each member end.eletype (
Optional[ndarray]) – A vector of the member types. Defaults to a fixed-fixed element.GAv (
Union[float,ndarray,None]) – Transverse shear rigidityG·A_vof each span. When given, the bridge is analysed with shear-deformable Timoshenko elements; the default (None) uses Euler–Bernoulli elements.
- Returns:
ba – A
pycba.analysis.BeamAnalysisobject.- Return type:
- set_bridge(ba)[source]#
Set the bridge for the bridge analysis.
Any loads already defined on the BeamAnalysis object are retained in each vehicle position analysis.
- Parameters:
ba (
BeamAnalysis) – Apycba.analysis.BeamAnalysisobject.- Return type:
None.
- add_vehicle(axle_spacings, axle_weights)[source]#
Create and add the vehicle to the analysis
- Parameters:
axle_spacings (
ndarray) – A vector of axle spacings of length one fewer than the length of the vector of axle weightsaxle_weights (
ndarray) – A vector of axle weights, length one greater than the length of the axle spacings vector.
- Returns:
veh – A
pycba.bridge.Vehicleobject.- Return type:
- set_vehicle(veh)[source]#
Set the vehicle for the bridge analysis.
- Parameters:
veh (
Vehicle) – Apycba.bridge.Vehicleobject.- Return type:
None.
- static_vehicle(pos, plotflag=False, shear_points=None, dv=None)[source]#
Performs a single analysis for the vehicle, static at a given position
- Parameters:
pos (
float) – The location of the front axle of the vehicle in global beam coordinates.plotflag (
bool) – Whether or not to plot the results. The default is False.shear_points (
Union[float,List[float],ndarray,Dict,None]) – Section(s) at which the shear is recovered exactly on both sides. Either global coordinate(s) (resolved viaresolve_shear_points()) or a pre-resolved{member_index: local_coords}mapping.dv (
Optional[float]) – Critical-shear distance: add a shear point this distance from every vertical support, on each valid side (seeresolve_shear_points()).
- Raises:
ValueError – If a static beam analysis does not succeed, usually due to a beam configuration error.
- Returns:
ba – The pycba.Beamresults object containing the analysis results.
- Return type:
- run_vehicle(step, plot_env=False, plot_all=False, pos_start=None, pos_end=None, shear_points=None, dv=None)[source]#
Runs the vehicle over the bridge performing a static analysis at each point
- Parameters:
step (
float) – The distance increment to move the vehicle.plot_env (
bool) – Whether or not to plot the results envelope. The default is False.plot_all (
bool) – Whether or not to plot the results for each position as an animation. The default is False.pos_start (
Optional[float]) – The starting position of the front axle. Defaults to 0 (front axle at the left end of the beam).pos_end (
Optional[float]) – The ending position of the front axle. Defaults to beam length plus vehicle length (front axle past the right end of the beam).shear_points (
Union[float,List[float],ndarray,Dict,None]) – Section(s) at which the shear is recovered exactly on both sides for every vehicle position - e.g. support faces or a distanced_vfrom a support, for bridge shear assessment. Either global coordinate(s) (resolved viaresolve_shear_points()) or a pre-resolved{member_index: local_coords}mapping. The resulting sections are reported bycritical_values().dv (
Optional[float]) – Critical-shear distance: add a shear point this distance from every vertical support, on each valid side (seeresolve_shear_points()).
- Raises:
ValueError – If a static beam analysis does not succeed, usually due to a beam configuration error.
- Returns:
The load effect envelopes for the traverse; a pycba.Envelopes object.
- Return type:
- run_load_model(step, w_lane, clearances=None, plot_env=False, pos_start=None, pos_end=None, shear_points=None, dv=None)[source]#
Run a moving load model: the vehicle together with an accompanying lane UDL, enveloped over the traverse.
At each vehicle position the axles are placed as point loads (as in
run_vehicle()) and a uniform lane UDL of intensityw_laneis applied along the deck while the vehicle sweeps across it. By default the UDL is continuous, running directly beneath the vehicle - as for the AS5100 M1600, where the 6 kN/m lane UDL accompanies the truck with no break. Load models that interrupt the lane UDL around the vehicle specify a clear zone viaclearances(see below).The lane UDL is applied over the full deck (outside any clear zone). For a continuous beam, loading only the same-sign influence-line regions can be more adverse for a given effect; influence-line patterning of the lane UDL is a planned refinement. To pattern manually, combine separate envelopes with
Envelopes.sum()/Envelopes.augment().- Parameters:
step (
float) – The distance increment to move the vehicle.w_lane (
float) – The lane UDL intensity (same sign convention as a beam UDL).clearances (
Optional[tuple]) –The clear zone over which the lane UDL is removed around the vehicle, given as
(back, front)distances in metres:backis measured rearward from the rear axle andfrontforward from the front axle, and the wheelbase between the axles is always part of the cleared zone. Both values must be finite and non-negative.Beware:
Noneand(0.0, 0.0)are not the same.None(the default) means no clear zone - the lane UDL is continuous and runs directly beneath the vehicle (the AS5100 M1600 case).(0.0, 0.0)clears exactly the wheelbase (the UDL is removed from under the vehicle) with no headway either side. For a single-point vehicle (vehicle.L == 0) the wheelbase has zero length, so(0.0, 0.0)then coincides withNone.plot_env (
bool) – Whether to plot the resulting envelope. The default is False.pos_start (
Optional[float]) – The traverse range of the front axle (seerun_vehicle()).pos_end (
Optional[float]) – The traverse range of the front axle (seerun_vehicle()).shear_points (
Union[float,List[float],ndarray,Dict,None]) – Sections for exact both-sided shear recovery (seerun_vehicle()).dv (
Optional[float]) – Critical-shear distance shear points at every vehicle position (seerun_vehicle()).
- Raises:
ValueError – If
clearancesis not a finite, non-negative(back, front)pair, or if a static beam analysis does not succeed.- Returns:
The load-effect envelopes for the traverse.
- Return type:
- critical_values(env)[source]#
From the envelopes output, returns the extreme values, their locations, and the position of the vehicle for each in a dictionary of dictionaries.
Each moment entry (
Mmax,Mmin) also contains a"Vco"key with the coincident shear at the critical location. Each shear entry (Vmax,Vmin) contains a"Mco"key with the coincident moment.- Parameters:
env (
Envelopes) – An pycba.Envelopes object containing the results of a moving load analysis.- Raises:
ValueError – If the supplied envelope is inconsistent with the current pycba.bridge.BridgeAnalysis object.
- Returns:
crit_values – A dictionary of dictionaries containing the critical values (i.e. extremes) of each of the load effects, both maximum and minimum, along with coincident values of the other effect.
- Return type:
Dict[str,Dict[str,Union[float,ndarray]]]
- envelopes_ratios(trial_env, ref_env)[source]#
Returns the ratios of two sets of envelopes considering zero values and reactions. Note that ratios are only meaningful for any one location on the beam, and so reaction envelopes ratios reduce to a scalar value. Ratios are absolute, and zeroed if within 1e-3 absolute tolerance of zero.
- Parameters:
trial_env (
Envelopes) – The numerator pycba.Envelopes object, usually from the vehicle seeking access to the bridge.ref_env (
Envelopes) – The denominator pycba.Envelopes object, usually from the reference or benchamrk of acceptable load effects on the bridge. Can be from a single notional vehicle, or a suite of such vehicles.
- Raises:
ValueError – The envelopes need to be from the same bridge analysis object.
- Returns:
A dictionary of ratios between the two envelopes, considering the maximum and minimum of each load effect.
- Return type:
Dict[str,ndarray]
- plot_static(pos, axs=None, units=None)[source]#
Draw the bridge with the vehicle at a given position, above the instantaneous bending-moment and shear-force diagrams.
The top panel shows the structural schematic - the deck with its real support symbols and any permanent loads - with the vehicle drawn as a small truck on the deck at
pos(a wheel at each axle and a downward load arrow, labelled with its weight, for every axle that is currently on the bridge). The two panels below show the bending moment and shear force for that single (“stationary”) position; faint vertical lines mark the axle positions so the load effects can be related to the loads that cause them.- Parameters:
pos (
float) – The position of the front axle of the vehicle in global bridge coordinates.axs (
Optional[Axes]) – Axes to draw into. IfNone(default) a new three-panel figure is created and the analysis forposis run first. When axes are supplied the current results are used as-is: pass three axes (schematic + moment + shear) or two (moment + shear only).units (str or pycba.units.UnitSystem, optional) – Display unit system for the labels (see
pycba.set_units()).
- Returns:
The figure and its axes when a new figure is created, otherwise
None.- Return type:
tuple(matplotlib.figure.Figure, numpy.ndarray) or None
- animate(step, save=None, fps=12, pos_start=None, pos_end=None, dpi=110, units=None)[source]#
Animate the vehicle crossing the bridge.
Steps the vehicle across the bridge and animates three stacked, x-aligned panels: the deck with the moving truck on top, then the instantaneous bending-moment and shear-force diagrams. As the vehicle advances, the running envelope of each load effect is shaded behind the instantaneous diagram and grows to the full traverse envelope - so the envelope can be seen being built up position by position.
All positions are analysed up front (this is the slow part); playback and saving then just redraw the stored results.
- Parameters:
step (
float) – Distance increment to move the vehicle between frames.save (
Optional[str]) – If given, write the animation to this path. A.gifis written with Pillow; any other extension (e.g..mp4) uses ffmpeg.fps (
int) – Frames per second for playback / the saved file.pos_start (
Optional[float]) – First and last front-axle positions (defaults:0tobeam length + vehicle length, i.e. a full on-and-off crossing).pos_end (
Optional[float]) – First and last front-axle positions (defaults:0tobeam length + vehicle length, i.e. a full on-and-off crossing).dpi (
int) – Resolution used whensaveis given.units (str or pycba.units.UnitSystem, optional) – Display unit system for the labels (see
pycba.set_units()).
- Returns:
The animation. In a notebook, display it with
HTML(anim.to_jshtml())(oranim.to_html5_video()); theFuncAnimationmust be kept referenced while it plays.- Return type:
matplotlib.animation.FuncAnimation
- plot_envelopes(env, units=None)[source]#
Plots the envelopes of load effects from a vehicle traverse analysis
- Parameters:
env (
Envelopes) – An pycba.Envelopes object containing the results of a moving load analysis.units (str or pycba.units.UnitSystem, optional) – Display unit system for the labels (see
pycba.set_units()).
- Return type:
None
- plot_ratios(env_ratios, units=None)[source]#
Plots the output of
pycba.bridge.BridgeAnalysis.envelopes_ratios().- Parameters:
env_ratios (
Dict[str,ndarray]) – The dictionary of envelopes ratios.units (str or pycba.units.UnitSystem, optional) – Display unit system for the distance axis (the ratios themselves are dimensionless). See
pycba.set_units().
- Raises:
ValueError – Inconsistency in the dictionary entries.
- Return type:
None.