"""This module provides the column class implementation for the ``CP03`` model
in the BNSM layer.
"""
# Imports from installed packages
import openseespy.opensees as ops
from typing import Literal, List, Tuple
# Imports from bnsm cp01 library
from ..cp01.column import Column as ColumnCP01, HYSTERETIC_PARAMETERS
from ..cp01.column import STIFF_INTERIOR_FACTOR
# Imports from bnsm base library
from ..baselib.node import Node
from ..baselib.constants import PDELTA_TRANSF_Z
# Imports from utils library
from ....utils.misc import round_list
from ....utils.tags import element_end_node_tag
[docs]
class Column(ColumnCP01):
"""Column implementation for the ``CP03`` model.
The column is modeled based on a concentrated plasticity approach.
An elastic interior member (``elasticBeamColumn``) is connected to
nonlinear rotational hinges at both ends. Each hinge is implemented
as a ``zeroLengthSection`` element between the original column-end node
and an auxiliary element node.
The hinge response is defined by a uniaxial ``Hysteretic`` material
assigned to the rotational degree of freedom about the local z-axis.
All other translational and rotational degrees of freedom across the
hinge are constrained to behave rigidly using rigid materials, so the
hinge represents concentrated flexural nonlinearity.
The hinge backbone rotations are chord rotations of the whole member
(the yield rotation includes the elastic deformations), so the elastic
member is nearly rigid in flexure (``STIFF_INTERIOR_FACTOR``) and the
hinges carry the whole flexural flexibility.
Attributes
----------
hinge_node_i : Node
Extra node considered for hinge definition at the start of column.
hinge_node_j : Node
Extra node considered for hinge definition at the end of column.
See Also
--------
:class:`~simdesign.rcmrf.bnsm.cp01.column.Column`
Base column definition extended by this class.
"""
hinge_node_i: Node
hinge_node_j: Node
@property
def hinge_i_tag(self) -> int:
"""
Returns
-------
int
Tag of hinge element at the start of the column.
"""
return self.ele_node_i.tag
@property
def hinge_j_tag(self) -> int:
"""
Returns
-------
int
Tag of hinge element at the end of the column.
"""
return self.ele_node_j.tag
[docs]
def set_ele_node_i(self) -> None:
"""Initialize and set ele_node_i based on hinge_node_i.
"""
coords = self.hinge_node_i.coordinates.copy()
tag = element_end_node_tag(self.hinge_node_i.tag)
self.ele_node_i = Node(tag, coords)
[docs]
def set_ele_node_j(self) -> None:
"""Initialize and set ele_node_j based on hinge_node_j.
"""
coords = self.hinge_node_j.coordinates.copy()
tag = element_end_node_tag(self.hinge_node_j.tag)
self.ele_node_j = Node(tag, coords)
[docs]
def add_to_ops(self) -> None:
"""Adds column components to the OpenSees domain
(i.e, plastic hinges, elastic column element and nodes).
Notes
-----
Same hinge materials are used at both ends.
"""
# Create column element nodes
self.ele_node_i.add_to_ops()
self.ele_node_j.add_to_ops()
# Create elastic column element
ops.element(*self._get_elastic_ele_inputs())
# Create plastic hinge materials
ops.uniaxialMaterial(*self._get_rot_hinge_mat_inputs('x'))
ops.uniaxialMaterial(*self._get_rot_hinge_mat_inputs('y'))
if not self.capacity_design:
vy_mat, vy_curve = self._get_shear_hinge_mat_inputs('y')
vz_mat, vz_curve = self._get_shear_hinge_mat_inputs('x')
ops.limitCurve(*vy_curve)
ops.uniaxialMaterial(*vy_mat)
ops.limitCurve(*vz_curve)
ops.uniaxialMaterial(*vz_mat)
# Create plastic hinge section
ops.section(*self._get_inelastic_sec_inputs())
# Create plastic hinge elements at both ends
hinge_i_ele_inputs, hinge_j_ele_inputs = self._get_hinge_ele_inputs()
ops.element(*hinge_i_ele_inputs)
ops.element(*hinge_j_ele_inputs)
[docs]
def to_py(self) -> List[str]:
"""Gets the Python commands to construct beam components in OpenSees
domain (i.e, plastic hinges, elastic beam element and nodes).
Returns
-------
List[str]
List of Python commands for constructing the components of beam
object in OpenSees.
"""
# Create beam element nodes
content = ['# Create elastic beam element nodes']
content.append(self.ele_node_i.to_py())
content.append(self.ele_node_j.to_py())
# Create elastic beam element
content.append('# Create elastic beam element')
elastic_ele_inputs = ', '.join(
repr(item) if isinstance(item, str) else str(item)
for item in self._get_elastic_ele_inputs()
)
content.append(f"ops.element({elastic_ele_inputs})")
# Create plastic hinge materials
content.append('# Create plastic hinge materials')
mz_mat_inputs = ', '.join(
repr(item) if isinstance(item, str) else str(item)
for item in self._get_rot_hinge_mat_inputs('x')
)
my_mat_inputs = ', '.join(
repr(item) if isinstance(item, str) else str(item)
for item in self._get_rot_hinge_mat_inputs('y')
)
content.append(f"ops.uniaxialMaterial({mz_mat_inputs})")
content.append(f"ops.uniaxialMaterial({my_mat_inputs})")
if not self.capacity_design: # New shear materials
vy_mat, vy_curve = self._get_shear_hinge_mat_inputs('y')
vz_mat, vz_curve = self._get_shear_hinge_mat_inputs('x')
vy_mat_inputs = ', '.join(
repr(item) if isinstance(item, str) else str(item)
for item in vy_mat
)
vz_mat_inputs = ', '.join(
repr(item) if isinstance(item, str) else str(item)
for item in vz_mat
)
vy_curve_inputs = ', '.join(
repr(item) if isinstance(item, str) else str(item)
for item in vy_curve
)
vz_curve_inputs = ', '.join(
repr(item) if isinstance(item, str) else str(item)
for item in vz_curve
)
content.append(f"ops.limitCurve({vy_curve_inputs})")
content.append(f"ops.uniaxialMaterial({vy_mat_inputs})")
content.append(f"ops.limitCurve({vz_curve_inputs})")
content.append(f"ops.uniaxialMaterial({vz_mat_inputs})")
# Create plastic hinge section
content.append('# Create plastic hinge section')
inelastic_sec_inputs = ', '.join(
repr(item) if isinstance(item, str) else str(item)
for item in self._get_inelastic_sec_inputs()
)
content.append(f"ops.section({inelastic_sec_inputs})")
# Create plastic hinge elements
content.append('# Create plastic hinge elements')
hinge_i_ele_inputs, hinge_j_ele_inputs = self._get_hinge_ele_inputs()
hinge_i_ele_inputs = ', '.join(
repr(item) if isinstance(item, str) else str(item)
for item in hinge_i_ele_inputs
)
hinge_j_ele_inputs = ', '.join(
repr(item) if isinstance(item, str) else str(item)
for item in hinge_j_ele_inputs
)
content.append(f"ops.element({hinge_i_ele_inputs})")
content.append(f"ops.element({hinge_j_ele_inputs})")
return content
[docs]
def to_tcl(self) -> List[str]:
"""Gets the Tcl commands to construct beam components in OpenSees
domain (i.e, plastic hinges, elastic beam element and nodes).
Returns
-------
List[str]
List of Tcl commands for constructing the components of beam
object in OpenSees.
"""
# Create beam element nodes
content = ['# Create elastic beam element nodes']
content.append(self.ele_node_i.to_tcl())
content.append(self.ele_node_j.to_tcl())
# Create elastic beam element
content.append('# Create elastic beam element')
elastic_ele_inputs = ' '.join(
f'{item}' for item in self._get_elastic_ele_inputs()
)
content.append(f"element {elastic_ele_inputs}")
# Create plastic hinge materials
content.append('# Create plastic hinge materials')
mz_mat_inputs = ' '.join(
f"{item}" for item in self._get_rot_hinge_mat_inputs('x'))
my_mat_inputs = ' '.join(
f"{item}" for item in self._get_rot_hinge_mat_inputs('y'))
content.append(f"uniaxialMaterial {mz_mat_inputs}")
content.append(f"uniaxialMaterial {my_mat_inputs}")
if not self.capacity_design: # New shear materials
vy_mat, vy_curve = self._get_shear_hinge_mat_inputs('y')
vz_mat, vz_curve = self._get_shear_hinge_mat_inputs('x')
vy_mat_inputs = ' '.join(f"{item}" for item in vy_mat)
vz_mat_inputs = ' '.join(f"{item}" for item in vz_mat)
vy_curve_inputs = ' '.join(f"{item}" for item in vy_curve)
vz_curve_inputs = ' '.join(f"{item}" for item in vz_curve)
content.append(f"limitCurve {vy_curve_inputs}")
content.append(f"uniaxialMaterial {vy_mat_inputs}")
content.append(f"limitCurve {vz_curve_inputs}")
content.append(f"uniaxialMaterial {vz_mat_inputs}")
# Create plastic hinge section
content.append('# Create plastic hinge section')
inelastic_sec_inputs = ' '.join(
f"{item}" for item in self._get_inelastic_sec_inputs())
content.append(f"section {inelastic_sec_inputs}")
# Create plastic hinge elements at both ends
content.append('# Create plastic hinge elements')
hinge_i_ele_inputs, hinge_j_ele_inputs = self._get_hinge_ele_inputs()
hinge_i_ele_inputs = ' '.join(f"{item}" for item in hinge_i_ele_inputs)
hinge_j_ele_inputs = ' '.join(f"{item}" for item in hinge_j_ele_inputs)
content.append(f"element {hinge_i_ele_inputs}")
content.append(f"element {hinge_j_ele_inputs}")
return content
def _get_hinge_ele_inputs(self) -> Tuple[List[str | float | int],
List[str | float | int]]:
"""Retrieves plastic hinge element inputs (zero-length spring).
Returns
-------
hinge_i_ele_inputs : List[str | float | int]
Element inputs for the hinge at the start section.
hinge_j_ele_inputs : List[str | float | int]
Element inputs for the hinge at the end section.
"""
# Nodes
hinge_i_nodes = [self.hinge_node_i.tag, self.ele_node_i.tag]
hinge_j_nodes = [self.ele_node_j.tag, self.hinge_node_j.tag]
# Section orientation
vecx = [0.0, 0.0, 1.0]
vecyp = [0.0, 1.0, 0.0]
orientation = [*vecx, *vecyp] # cross product is vecz = [-1, 0, 0]
# Element inputs
hinge_i_inputs = [
'zeroLengthSection', self.hinge_i_tag, *hinge_i_nodes,
self.inelastic_sec_tag, '-orient', *orientation
]
hinge_j_inputs = [
'zeroLengthSection', self.hinge_j_tag, *hinge_j_nodes,
self.inelastic_sec_tag, '-orient', *orientation
]
return hinge_i_inputs, hinge_j_inputs
def _get_elastic_ele_inputs(self) -> List[float]:
"""Retrieves elastic column element inputs.
Returns
-------
List[float]
List of elastic column element inputs.
Notes
-----
The moments of inertia are multiplied by ``STIFF_INTERIOR_FACTOR``,
since the hinges carry the whole flexural flexibility.
"""
# Cracked section properties
if self.cracked:
Iz = self._Ix_eff
Iy = self._Iy_eff
else:
Iz = self.design.Ix
Iy = self.design.Iy
# Nearly rigid in flexure
Iz, Iy = Iz * STIFF_INTERIOR_FACTOR, Iy * STIFF_INTERIOR_FACTOR
# List of elasticBeamColumn element inputs
ele_inputs = round_list([
'elasticBeamColumn', self.design.line.tag,
self.ele_node_i.tag, self.ele_node_j.tag,
self.design.Ag, self.Ecm_q, self.Gcm_q,
self.design.J, Iy, Iz, PDELTA_TRANSF_Z
])
return ele_inputs
def _get_rot_hinge_mat_inputs(self, axis: Literal['x', 'y']
) -> List[int | float | str]:
"""Gets the plastic hinge material inputs for given axis.
Parameters
----------
axis : Literal['x', 'y']
The local axis considered for the calculations.
Returns
-------
rot_mat_inputs : List[int | float | str]
Hysteretic material model inputs for the plastic hinge describing
behaviour in flexure around `axis`.
"""
if axis == 'x':
# The integer tag for the material describing flexure behaviour
# around local -x (corresponds to z in ops)
flex_mat_tag = self.mz_mat_tag
elif axis == 'y':
# The integer tag for the material describing flexure behaviour
# around local -y axis (corresponds to y in ops)
flex_mat_tag = self.my_mat_tag
# Backbone of the plastic hinges
(
_, My, Mc, Mr, theta_y, theta_cap_pl, theta_pc
) = self._get_rot_hinge_props(axis)
# Rotation values
theta_1 = theta_y
theta_2 = theta_1 + theta_cap_pl
theta_3 = theta_2 + theta_pc
# Material inputs
rot_mat_inputs = [
'Hysteretic', flex_mat_tag,
My, theta_1, Mc, theta_2, Mr, theta_3,
-My, -theta_1, -Mc, -theta_2, -Mr, -theta_3,
*HYSTERETIC_PARAMETERS
]
# Rounding to precision
rot_mat_inputs = round_list(rot_mat_inputs)
return rot_mat_inputs