IndeterminateBeam Reference
Main module that contains the main class for Beam and auxillary class for Support.
Example
>>> beam = Beam(6)
>>> a = Support()
>>> c = Support(6,(0,1,0))
>>> beam.add_supports(a,c)
>>> beam.add_loads(PointLoadV(-1500,3))
>>> beam.analyse()
>>> beam.plot_beam_external()
>>> beam.plot_beam_internal()
Support
- class indeterminatebeam.Support(coord=0, fixed=(1, 1, 1), kx=None, ky=None)
A class to represent a support.
Attributes:
- _position: float
x coordinate of support on a beam (default 0)
- _stiffness: tuple of 3 floats or infinity
stiffness K (default units N/m) for movement in x, y and bending. oo represents infinity in sympy and means a completely fixed conventional support, and 0 means free to move.
- _DOFtuple of 3 booleans
Degrees of freedom that are restraint on a beam for movement in x, y and bending. 1 represents that a reaction force exists and 0 represents free (default (1,1,1))
- _fixed: tuple of 3 booleans
Degrees of freedom that are completely fixed on a beam for movement in x, y and bending. 1 represents fixed and 0 represents free or spring (default (1,1,1))
Examples
>>> # Creates a fixed suppot at location 0 >>> Support(0, (1,1,1)) >>> # Creates a pinned support at location 5 m >>> Support(5, (1,1,0)) >>> # Creates a roller support at location 5.54 m >>> Support(5.54, (0,1,0)) >>> # Creates a y direction spring support at location 7.5 m >>> Support(7.5, (0,1,0), ky = 5)
- indeterminatebeam.Support.__init__(self, coord=0, fixed=(1, 1, 1), kx=None, ky=None)
Constructs all the necessary attributes for the Support object.
Parameters:
- coord: float
x coordinate of support on a beam (default unit m) (default 0)
- fixed: tuple of 3 booleans
Degrees of freedom that are fixed on a beam for movement in x, y and bending. 1 represents fixed and 0 represents free (default (1,1,1))
- kx :
stiffness of x support (default unit N/m), if set will overide the value placed in the fixed tuple. (default = None)
- ky(positive number)
stiffness of y support (default unit N/m), if set will overide the value placed in the fixed tuple. (default = None)
Beam
- class indeterminatebeam.Beam(span: float = 5, E=200000000000, I=9.05e-06, A=0.23)
Represents a one-dimensional beam that can take axial and tangential loads.
- _x0
Left end coordinate of beam (always defined as 0).
- Type:
float
- _x1
Right end coordinate of beam (default unit m).
- Type:
float
- _E
Young’s Modulus of the beam (default unit N/m2 or Pa)
- Type:
float
- _I
Second Moment of Area of the beam (default unit m4)
- Type:
float
- _A
Cross-sectional area of the beam (default unit m2)
- Type:
float
- _loads
list of load objects associated with the beam
- Type:
list
- _supports
A list of support objects associated with the beam.
- Type:
list
- _query
A list containing x coordinates that are to have values explicitly written on graphs.
- Type:
list
- _normal_forces
A sympy function representing the internal axial force (default unit N) as a function of x (m).
- Type:
sympy piecewise function
- _shear_forces
A sympy function representing the internal shear force (default unit N) as a function of x (m).
- Type:
sympy piecewise function
- _bending_moments
A sympy function representing the internal bending moments (default unit N.m) as a function of x (m).
- Type:
sympy piecewise function
- _deflection_equation
A sympy function representing the tangential deflection (default unit m) as a function of x (default unit m).
- Type:
sympy piecewise function
- _reactions
A dictionary with keys for support positions. Each key is associated with a list of forces of the form [‘x’,’y’,’m’]
- Type:
dictionary of lists
- _DATA_POINTS
Number of data points generated for plotting (default 200).
- Type:
integer,
Notes
Default units are SI units all using N and m, this can however be changed using the update_units() method
The default units for length, force and bending moment (torque) are in N and m (m, N, N·m)
The default units for beam properties (E, I, A) are in N and m (N/m2, m4, m2)
The default unit for spring support stiffness is N/m
- indeterminatebeam.Beam.__init__(self, span: float = 5, E=200000000000, I=9.05e-06, A=0.23)
Initializes a Beam object of a given length.
- Parameters:
span (float) – Length of the beam span (default unit m). Must be positive, and the pinned and rolling supports can only be placed within this span. The default value is 5 m.
E (float) – Youngs modulus for the beam (default unit Pa). The default value is 200 GPa, which is the youngs modulus for steel.
I (float) – Second moment of area for the beam about the z axis (default unit m4). The default value is 9.05*10**-6 m4.
A (float) – Cross-sectional area for the beam about the z axis (default unit m2). The default value is 0.23 m4.
Notes
Default properties are for a 150UB18.0 steel beam.
- indeterminatebeam.Beam.update_units(self, key='length', unit='m', reset=False)
Change units used for inputs and outputs.
- Parameters:
key (string, default 'length') – Identifying property with unit to be changed. One of the following: ‘length’, ‘force’, ‘moment’, ‘distributed’, ‘stiffness’, ‘A’, ‘E’, ‘I’, ‘deflection’
unit (string, default 'm') – unit to assign should contain a unit balanced representation consisting of the following units: ‘mm’, ‘cm’, ‘m’, ‘N’, ‘kN’, ‘Pa’, ‘kPa’, ‘MPa’, ‘in’, ‘ft’, ‘lbf’, ‘kip’. Unit combinations are written in the following formats: ‘mm2’, ‘mm4’, ‘N/m’, ‘N.m’, ‘kip/ft2’.
reset (boolean, default False) – If True then all units reset to default SI units.
- indeterminatebeam.Beam.add_loads(self, *loads)
Associate load objects with the beam object.
- Parameters:
*loads (iterable) – An iterable containing load objects to be applied to the Beam object. Note that the load application point (or segment) must be within the Beam span.
- indeterminatebeam.Beam.remove_loads(self, *loads, remove_all=False)
Unassociate load objects with the beam object.
- Parameters:
*loads (iterable) – An iterable containing load objects to be removed from the Beam object. If load not on beam then does nothing.
remove_all (boolean) – If true all loads associated with beam will be removed, by default False.
- indeterminatebeam.Beam.add_supports(self, *supports)
Associate support objects with the beam object.
- Parameters:
*supports (iterable) – An iterable containing Support objects to be applied to the Beam object. Note that the load application point (or segment) must be within the Beam span.
- indeterminatebeam.Beam.remove_supports(self, *supports, remove_all=False)
Unassociate support objects with the beam object.
- Parameters:
*supports (iterable) – An iterable containing Support objects to be removed from the Beam object. If support not on beam then does nothing.
remove_all (boolean) – If true all supports associated with beam will be removed, by default False.
- indeterminatebeam.Beam.analyse(self)
Solve the beam structure for reaction and internal forces
- indeterminatebeam.Beam.get_reaction(self, x_coord, direction=None)
Find the reactions of a support at position x.
- Parameters:
x_coord (float) – The x_coordinates on the beam to be substituted into the equation. List returned (if bools all false)
direction (str ('x','y' or 'm')) – The direction of the reaction force to be returned. If not specified all are returned in a list.
- Returns:
int – If direction is ‘x’, ‘y’, or ‘m’ will return an integer representing the reaction force of the support in that direction at location x_coord.
list of ints – If direction = None, will return a list of 3 integers, representing the reaction forces of the support [‘x’,’y’,’m’] at location x_coord.
None – If there is no support at the x coordinate specified.
- indeterminatebeam.Beam.get_bending_moment(self, *x_coord, return_max=False, return_min=False, return_absmax=False)
Find the bending moment(s) on the beam object.
- Parameters:
x_coord (list) – The x_coordinates on the beam to be substituted into the equation. List returned (if bools all false)
return_max (bool) – return max value of function if true
return_min (bool) – return minx value of function if true
return_absmax (bool) – return absolute max value of function if true
- Returns:
int – Max, min or absmax value of the bending moment depending on which parameters are set. If single x-coordinate set then also returns int.
list of ints – If x-coordinates are specfied value at x-coordinates for func.
Notes
Priority of query parameters is return_max, return_min, return_absmax, x_coord (if more than 1 of the parameters are specified).
- indeterminatebeam.Beam.get_shear_force(self, *x_coord, return_max=False, return_min=False, return_absmax=False)
Find the shear force(s) on the beam object.
- Parameters:
x_coord (list) – The x_coordinates on the beam to be substituted into the equation. List returned (if bools all false)
return_max (bool) – return max value of function if true
return_min (bool) – return minx value of function if true
return_absmax (bool) – return absolute max value of function if true
- Returns:
int – Max, min or absmax value of the shear force depending on which parameters are set. If single x-coordinate set then also returns int.
list of ints – If x-coordinates are specfied value at x-coordinates for func.
Notes
Priority of query parameters is return_max, return_min, return_absmax, x_coord (if more than 1 of the parameters are specified).
- indeterminatebeam.Beam.get_normal_force(self, *x_coord, return_max=False, return_min=False, return_absmax=False)
Find the normal force(s) on the beam object.
- Parameters:
x_coord (list) – The x_coordinates on the beam to be substituted into the equation. List returned (if bools all false)
return_max (bool) – return max value of function if true
return_min (bool) – return minx value of function if true
return_absmax (bool) – return absolute max value of function if true
- Returns:
int – Max, min or absmax value of the normal force depending on which parameters are set. If single x-coordinate set then also returns int.
list of ints – If x-coordinates are specfied value at x-coordinates for func.
Notes
Priority of query parameters is return_max, return_min, return_absmax, x_coord (if more than 1 of the parameters are specified).
- indeterminatebeam.Beam.get_deflection(self, *x_coord, return_max=False, return_min=False, return_absmax=False)
Find the deflection(s) on the beam object.
- Parameters:
x_coord (list) – The x_coordinates on the beam to be substituted into the equation. List returned (if bools all false)
return_max (bool) – return max value of function if true
return_min (bool) – return minx value of function if true
return_absmax (bool) – return absolute max value of function if true
- Returns:
int – Max, min or absmax value of the deflection depending on which parameters are set. If single x-coordinate set then also returns int.
list of ints – If x-coordinates are specfied value at x-coordinates for func.
Notes
Priority of query parameters is return_max, return_min, return_absmax, x_coord (if more than 1 of the parameters are specified).
- indeterminatebeam.Beam.add_query_points(self, *x_coords)
Document the forces on a beam at position x_coord when plotting.
- Parameters:
x_coord (list) – The x_coordinates on the beam to be queried on plot.
- indeterminatebeam.Beam.remove_query_points(self, *x_coords, remove_all=False)
Remove a query point added by add_query_points function.
- Parameters:
x_coord (list) – The x_coordinates on the beam to be removed from query on plot.
remove_all (boolean) – If true all query points will be removed.
- indeterminatebeam.Beam.plot_beam_external(self)
Generates a single figure with 2 plots corresponding respectively to:
a schematic of the loaded beam
reaction force diagram
- Returns:
figure – Returns a handle to a figure with the 2 subplots.
- Return type:
plotly.graph_objs._figure.Figure
- indeterminatebeam.Beam.plot_beam_internal(self, reverse_x=False, reverse_y=False)
Generates a single figure with 4 plots corresponding respectively to:
normal force diagram,
shear force diagram,
bending moment diagram, and
deflection diagram
- Parameters:
reverse_x (bool, optional) – reverse the x axes, by default False
reverse_y (bool, optional) – reverse the y axes, by default False
- Returns:
figure – Returns a handle to a figure with the 4 subplots.
- Return type:
plotly.graph_objs._figure.Figure
- indeterminatebeam.Beam.plot_beam_diagram(self, fig=None, row=None, col=None)
Returns a schematic of the beam and all the loads applied on it
- Parameters:
fig (bool, optional) – Figure to append subplot diagram too. If creating standalone figure then None, by default None
row (int, optional) – row number if subplot, by default None
col (int, optional) – column number if subplot, by default None
- Returns:
figure – Returns a handle to a figure with the beam schematic.
- Return type:
plotly.graph_objs._figure.Figure
- indeterminatebeam.Beam.plot_reaction_force(self, fig=None, row=None, col=None)
Returns a plot of the beam with reaction forces.
- Parameters:
fig (bool, optional) – Figure to append subplot diagram too. If creating standalone figure then None, by default None
row (int, optional) – row number if subplot, by default None
col (int, optional) – column number if subplot, by default None
- Returns:
figure – Returns a handle to a figure with reaction forces.
- Return type:
plotly.graph_objs._figure.Figure
- indeterminatebeam.Beam.plot_normal_force(self, reverse_x=False, reverse_y=False, switch_axes=False, fig=None, row=None, col=None)
Returns a plot of the normal force as a function of the x-coordinate.
- Parameters:
reverse_x (bool, optional) – reverse the x axes, by default False
reverse_y (bool, optional) – reverse the y axes, by default False
switch_axes (bool, optional) – switch the x and y axis, by default False
fig (bool, optional) – Figure to append subplot diagram too. If creating standalone figure then None, by default None
row (int, optional) – row number if subplot, by default None
col (int, optional) – column number if subplot, by default None
- Returns:
figure – Returns a handle to a figure with the normal force diagram.
- Return type:
plotly.graph_objs._figure.Figure
- indeterminatebeam.Beam.plot_shear_force(self, reverse_x=False, reverse_y=False, switch_axes=False, fig=None, row=None, col=None)
Returns a plot of the shear force as a function of the x-coordinate.
- Parameters:
reverse_x (bool, optional) – reverse the x axes, by default False
reverse_y (bool, optional) – reverse the y axes, by default False
switch_axes (bool, optional) – switch the x and y axis, by default False
fig (bool, optional) – Figure to append subplot diagram too. If creating standalone figure then None, by default None
row (int, optional) – row number if subplot, by default None
col (int, optional) – column number if subplot, by default None
- Returns:
figure – Returns a handle to a figure with the shear force diagram.
- Return type:
plotly.graph_objs._figure.Figure
- indeterminatebeam.Beam.plot_bending_moment(self, reverse_x=False, reverse_y=False, switch_axes=False, fig=None, row=None, col=None)
Returns a plot of the bending moment as a function of the x-coordinate.
- Parameters:
reverse_x (bool, optional) – reverse the x axes, by default False
reverse_y (bool, optional) – reverse the y axes, by default False
switch_axes (bool, optional) – switch the x and y axis, by default False
fig (bool, optional) – Figure to append subplot diagram too. If creating standalone figure then None, by default None
row (int, optional) – row number if subplot, by default None
col (int, optional) – column number if subplot, by default None
- Returns:
figure – Returns a handle to a figure with the bending moment diagram.
- Return type:
plotly.graph_objs._figure.Figure
- indeterminatebeam.Beam.plot_deflection(self, reverse_x=False, reverse_y=False, switch_axes=False, fig=None, row=None, col=None)
Returns a plot of the beam deflection as a function of the x-coordinate.
- Parameters:
reverse_x (bool, optional) – reverse the x axes, by default False
reverse_y (bool, optional) – reverse the y axes, by default False
switch_axes (bool, optional) – switch the x and y axis, by default False
fig (bool, optional) – Figure to append subplot diagram too. If creating standalone figure then None, by default None
row (int, optional) – row number if subplot, by default None
col (int, optional) – column number if subplot, by default None
- Returns:
figure – Returns a handle to a figure with the deflection diagram.
- Return type:
plotly.graph_objs._figure.Figure
PointLoads
- class indeterminatebeam.PointTorque(force=0, coord=0)
Point clockwise torque.
Parameters:
- force: float
Torque load (default units N.m), (named force for consistency with other load types)
- coord: float
x coordinate of torque on beam (default units m)
Examples
>>> # 30 N·m (anti-clockwise) torque at x = 4 m >>> motor_torque = PointTorque(30, 4)
Note: Anti-clockwise is positive
- class indeterminatebeam.PointLoad(force=0, coord=0, angle=0)
Point load.
Parameters:
- Force: float
Force load (default units m)
- coord: float
x coordinate of load on beam (default units m)
- angle: float
angle of point load where: - 0 degrees is purely horizontal +ve - 90 degrees is purely vertical +ve - 180 degrees is purely horizontal -ve of force sign specified.
Examples
>>> # 100 N towards the right at x = 9 m >>> external_force = PointLoad(100, 9, 90) >>> # 300 N downwards at x = 3 m >>> external_force = PointLoad(-300, 3, 0) >>> external_force PointLoad(force=-300, coord=3, angle=0)
- class indeterminatebeam.PointLoadV(force=0, coord=0)
Vertical Point Load.
Parameters:
- Force: float
Force load (default units N)
- coord: float
x coordinate of load on beam (default units m)
Examples
>>> # 100 N towards the right at x = 9 m >>> external_force = PointLoad(100, 9)
Note: Positive force acts up.
DistributedLoads
- class indeterminatebeam.UDL(force=0, span=(0, 0), angle=0)
Uniformly Distributed Load (UDL).
- Parameters:
force (int, optional) – UDL load (default units N/m), by default 0
span (tuple of floats) – A tuple containing the starting and ending coordinate that the UDL is applied to (default units m).
angle (float) – angle of point load where: - 0 degrees is purely horizontal +ve - 90 degrees is purely vertical +ve - 180 degrees is purely horizontal -ve of force sign specified.
Examples
>>> # load of 1000 N/m from 1 m <= x <= 4 m (vertical) >>> self_weight = UDL(1000, (1, 4), 90)
- class indeterminatebeam.UDLV(force=0, span=(0, 0))
Vertical Uniformly Distributed Load.
- Parameters:
Force (float) – Force load (default units N/m)
span (tuple of floats) – A tuple containing the starting and ending coordinate that the UDL is applied to (default units m).
Examples
>>> # load of 1000 N/m (acting down) from 1 <= x <= 4 m >>> self_weight = UDL(-1000, (1, 4))
Note: Positive force acts up.
- class indeterminatebeam.UDLH(force=0, span=(0, 0))
Horizontal Uniformly Distributed Load.
- Parameters:
Force (float) – Force load (default units N/m)
span (tuple of floats) – A tuple containing the starting and ending coordinate that the UDL is applied to (default units m).
Examples
>>> # load of 1000 N/m (acting right) from 1 <= x <= 4 m >>> self_weight = UDL(-1000, (1, 4))
Note: Positive force acts right.
- class indeterminatebeam.TrapezoidalLoad(force=(0, 0), span=(0, 0), angle=0)
Trapezoidal Distributed Load.
- Parameters:
force (tuple of floats) – A tuple containing the starting and ending loads of the trapezoidal load (default units N/m).
span (tuple of floats) – A tuple containing the starting and ending coordinate that the trapezoidal load is applied to (default units m).
angle (float) – angle of point load where: - 0 degrees is purely horizontal +ve - 90 degrees is purely vertical +ve - 180 degrees is purely horizontal -ve of force sign specified.
Examples
>>> # trapezoidal load starting at 2000 N/m at 1 m and ending at 3000 N/m >>> # at 4 m (vertical) >>> self_weight = UDL((2000, 3000), (1, 4), 90)
- class indeterminatebeam.TrapezoidalLoadV(force=(0, 0), span=(0, 0))
Vertical Trapezoidal Distributed Load.
- Parameters:
force (tuple of floats) – A tuple containing the starting and ending loads of the trapezoidal load (default units N/m).
span (tuple of floats) – A tuple containing the starting and ending coordinate that the trapezoidal load is applied to (default units m).
Examples
>>> # trapezoidal load starting at 2000 N/m at 1 m and ending at 3000 N/m >>> # at 4 m (acting down) >>> self_weight = UDL((-2000,-3000), (1, 4))
Note: Positive force acts up.
- class indeterminatebeam.TrapezoidalLoadH(force=(0, 0), span=(0, 0))
Horizontal Trapezoidal Distributed Load.
- Parameters:
force (tuple of floats) – A tuple containing the starting and ending loads of the trapezoidal load (default units N/m).
span (tuple of floats) – A tuple containing the starting and ending coordinate that the trapezoidal load is applied to (default units m).
Examples
>>> # trapezoidal load starting at 2000 N/m at 1 m and ending at 3 N/m >>> # at 4 m (acting right) >>> self_weight = UDL((2000, 3000), (1, 4))
Note: Positive force acts right.
- class indeterminatebeam.DistributedLoad(expr, span=(0, 0), angle=0)
Distributed load, described by its functional form, application interval and the angle of the load relative to the beam.
Parameters:
- expr: sympy expression
Sympy expression of the distributed load function expressed using variable x which represents the beam x-coordinate. Requires quotation marks around expression (default units in N/m).
- span: tuple of floats
- A tuple containing the starting and ending coordinate that
the function is applied to (default units m).
- angle: float
angle of point load where: - 0 degrees is purely horizontal +ve - 90 degrees is purely vertical +ve - 180 degrees is purely horizontal -ve of force sign specified.
Examples
>>> # Linearly growing load for 0 < x < 2 m >>> snow_load = DistributedLoad("10 * x + 5", (0, 2), 90)
- class indeterminatebeam.DistributedLoadV(expr=0, span=(0, 0))
Vertical distributed load, described by its functional form, application interval and the angle of the load relative to the beam.
Parameters:
- expr: sympy expression
Sympy expression of the distributed load function expressed using variable x which represents the beam x-coordinate (default units N/m).Requires quotation marks around expression.
- span: tuple of floats
- A tuple containing the starting and ending coordinate that
the function is applied to (default units m).
Examples
>>> # Linearly growing load (acting down) for 0 < x < 2 m >>> snow_load = DistributedLoad("-10*x-5", (0, 2))
Note: Positive force acts up.
- class indeterminatebeam.DistributedLoadH(expr=0, span=(0, 0))
Horizontal distributed load, described by its functional form, application interval and the angle of the load relative to the beam.
Parameters:
- expr: sympy expression
Sympy expression of the distributed load function expressed using variable x which represents the beam x-coordinate (default units N/m). Requires quotation marks around expression.
- span: tuple of floats
- A tuple containing the starting and ending coordinate that
the function is applied to (default units m).
Examples
>>> # Linearly growing load (acting right) for 0 < x < 2 m >>> snow_load = DistributedLoad("10*x+5", (0, 2))
Note: Positive force acts right.