Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

429 feature request add formulas from chapter 643 from nen en 1992 1 1 #430

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
"""Formula 6.38 from NEN-EN 1992-1-1+C2:2011: Chapter 6 - Ultimate limit state."""

from blueprints.codes.eurocode.nen_en_1992_1_1_c2_2011 import NEN_EN_1992_1_1_C2_2011
from blueprints.codes.formula import Formula
from blueprints.codes.latex_formula import LatexFormula
from blueprints.type_alias import DIMENSIONLESS, MM, MPA, N
from blueprints.validations import raise_if_less_or_equal_to_zero, raise_if_negative


class Form6Dot38MaxShearStress(Formula):
r"""Class representing formula 6.38 for the calculation of the maximum shear stress, [$$v_{Ed}$$]."""

label = "6.38"
source_document = NEN_EN_1992_1_1_C2_2011

def __init__(
self,
beta: DIMENSIONLESS,
v_ed: N,
u_i: MM,
d: MM,
) -> None:
r"""[$$v_{Ed}$$] Maximum shear stress [$$MPa$$].

NEN-EN 1992-1-1+C2:2011 art.6.4.3(3) - Formula (6.38)

Parameters
----------
beta : DIMENSIONLESS
[$$\beta$$] Factor which depends on the distribution of the support reaction, see equation 6.39.
v_ed : N
[$$V_{Ed}$$] Design value of the shear force [$$N$$].
u_i : MM
[$$u_{i}$$] Length of the control perimeter being considered [$$mm$$].
d : MM
[$$d$$] Mean effective depth of the slab, which may be taken as (dy + dz)/2 [$$mm$$].
"""
super().__init__()
self.beta = beta
self.v_ed = v_ed
self.u_i = u_i
self.d = d

@staticmethod
def _evaluate(
beta: DIMENSIONLESS,
v_ed: N,
u_i: MM,
d: MM,
) -> MPA:
"""Evaluates the formula, for more information see the __init__ method."""
raise_if_negative(
beta=beta,
v_ed=v_ed,
)
raise_if_less_or_equal_to_zero(u_i=u_i, d=d)

return beta * v_ed / (u_i * d)

def latex(self) -> LatexFormula:
"""Returns LatexFormula object for formula 6.38."""
return LatexFormula(
return_symbol=r"v_{Ed}",
result=f"{self:.3f}",
equation=r"\beta \cdot \frac{V_{Ed}}{u_{i} \cdot d}",
numeric_equation=rf"{self.beta:.3f} \cdot \frac{{{self.v_ed:.3f}}}{{{self.u_i:.3f} \cdot {self.d:.3f}}}",
comparison_operator_label="=",
unit="MPa",
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
"""Formula 6.39 from NEN-EN 1992-1-1+C2:2011: Chapter 6 - Ultimate Limit State."""

from blueprints.codes.eurocode.nen_en_1992_1_1_c2_2011 import NEN_EN_1992_1_1_C2_2011
from blueprints.codes.formula import Formula
from blueprints.codes.latex_formula import LatexFormula
from blueprints.type_alias import DIMENSIONLESS, MM, MM2, NMM, N
from blueprints.validations import raise_if_less_or_equal_to_zero, raise_if_negative


class Form6Dot39BetaCoefficient(Formula):
r"""Class representing formula 6.39 for the calculation of the beta coefficient, [$$\beta$$]."""

label = "6.39"
source_document = NEN_EN_1992_1_1_C2_2011

def __init__(
self,
k: DIMENSIONLESS,
m_ed: NMM,
v_ed: N,
u_1: MM,
w_1: MM2,
) -> None:
r"""[$$\beta$$] Beta coefficient [$$-$$].

NEN-EN 1992-1-1+C2:2011 art.6.4.3(3) - Formula (6.39)

Parameters
----------
k : DIMENSIONLESS
[$$k$$] Coefficient dependent on the ratio between the column dimensions c1 and c2 [$$-$$].
m_ed : NMM
[$$M_{Ed}$$] Design value of the applied moment [$$Nmm$$].
v_ed : N
[$$V_{Ed}$$] Design value of the applied shear force [$$N$$].
u_1 : MM
[$$u_1$$] Length of the basic control perimeter [$$mm$$].
w_1 : MM2
[$$W_1$$] Distribution of shear as illustrated in Figure 6.19 [$$mm^2$$].
"""
super().__init__()
self.k = k
self.m_ed = m_ed
self.v_ed = v_ed
self.u_1 = u_1
self.w_1 = w_1

@staticmethod
def _evaluate(
k: DIMENSIONLESS,
m_ed: NMM,
v_ed: N,
u_1: MM,
w_1: MM,
) -> DIMENSIONLESS:
"""Evaluates the formula, for more information see the __init__ method."""
raise_if_negative(
k=k,
m_ed=m_ed,
u_1=u_1,
)
raise_if_less_or_equal_to_zero(v_ed=v_ed, w_1=w_1)

return 1 + k * m_ed / v_ed * u_1 / w_1

def latex(self) -> LatexFormula:
"""Returns LatexFormula object for formula 6.39."""
return LatexFormula(
return_symbol=r"\beta",
result=f"{self:.3f}",
equation=r"1 + k \cdot \frac{M_{Ed}}{V_{Ed}} \cdot \frac{u_1}{W_1}",
numeric_equation=rf"1 + {self.k:.3f} \cdot \frac{{{self.m_ed:.3f}}}{{{self.v_ed:.3f}}} \cdot \frac{{{self.u_1:.3f}}}{{{self.w_1:.3f}}}",
comparison_operator_label="=",
unit="-",
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
"""Formula 6.41 from NEN-EN 1992-1-1+C2:2011: Chapter 6 - Ultimate Limit State."""

import numpy as np

from blueprints.codes.eurocode.nen_en_1992_1_1_c2_2011 import NEN_EN_1992_1_1_C2_2011
from blueprints.codes.formula import Formula
from blueprints.codes.latex_formula import LatexFormula
from blueprints.type_alias import MM, MM2
from blueprints.validations import raise_if_negative


class Form6Dot41W1Rectangular(Formula):
r"""Class representing formula 6.41 for the calculation of [$$W_1$$]."""

label = "6.41"
source_document = NEN_EN_1992_1_1_C2_2011

def __init__(
self,
c_1: MM,
c_2: MM,
d: MM,
) -> None:
r"""[$$W_1$$] Calculation of [$$W_1$$].

NEN-EN 1992-1-1+C2:2011 art.6.4.3(3) - Formula (6.41)

Parameters
----------
c_1 : MM
[$$c_1$$] Column dimension parallel to the eccentricity of the load [$$mm$$].
c_2 : MM
[$$c_2$$] Column dimension perpendicular to the eccentricity of the load [$$mm$$].
d : MM
[$$d$$] Mean effective depth of the slab [$$mm$$].
"""
super().__init__()
self.c_1 = c_1
self.c_2 = c_2
self.d = d

@staticmethod
def _evaluate(
c_1: MM,
c_2: MM,
d: MM,
) -> MM2:
"""Evaluates the formula, for more information see the __init__ method."""
raise_if_negative(c_1=c_1, c_2=c_2, d=d)

return (c_1**2) / 2 + c_1 * c_2 + 4 * c_2 * d + 16 * d**2 + 2 * np.pi * d * c_1

def latex(self) -> LatexFormula:
"""Returns LatexFormula object for formula 6.41."""
return LatexFormula(
return_symbol=r"W_1",
result=f"{self:.3f}",
equation=r"\frac{c_1^2}{2} + c_1 \cdot c_2 + 4 \cdot c_2 \cdot d + 16 \cdot d^2 + 2 \cdot \pi \cdot d \cdot c_1",
numeric_equation=rf"\frac{{{self.c_1:.3f}^2}}{{2}} + {self.c_1:.3f} \cdot "
rf"{self.c_2:.3f} + 4 \cdot {self.c_2:.3f} \cdot {self.d:.3f} + 16 \cdot {self.d:.3f}^2 + "
rf"2 \cdot \pi \cdot {self.d:.3f} \cdot {self.c_1:.3f}",
comparison_operator_label="=",
unit="mm^2",
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
"""Formula 6.42 from NEN-EN 1992-1-1+C2:2011: Chapter 6 - Ultimate Limit State."""

import numpy as np

from blueprints.codes.eurocode.nen_en_1992_1_1_c2_2011 import NEN_EN_1992_1_1_C2_2011
from blueprints.codes.formula import Formula
from blueprints.codes.latex_formula import LatexFormula, latex_replace_symbols
from blueprints.type_alias import DIMENSIONLESS, MM
from blueprints.validations import raise_if_negative


class Form6Dot42BetaCircular(Formula):
r"""Class representing formula 6.42 for the calculation of [$$\beta$$]."""

label = "6.42"
source_document = NEN_EN_1992_1_1_C2_2011

def __init__(
self,
d: MM,
diameter: MM,
e: MM,
) -> None:
r"""[$$\beta$$] Calculation of [$$\beta$$].

NEN-EN 1992-1-1+C2:2011 art.6.4.3(3) - Formula (6.42)

Parameters
----------
d : MM
[$$d$$] Effective depth of the slab [$$mm$$].
diameter : MM
[$$D$$] Diameter of the circular column [$$mm$$].
e : MM
[$$e$$] Distance from the axis about which the moment [$$M_{Ed}$$] acts [$$mm$$].
"""
super().__init__()
self.d = d
self.diameter = diameter
self.e = e

@staticmethod
def _evaluate(
d: MM,
diameter: MM,
e: MM,
) -> DIMENSIONLESS:
"""Evaluates the formula, for more information see the __init__ method."""
raise_if_negative(d=d, diameter=diameter, e=e)

return 1 + 0.6 * np.pi * e / (diameter + 4 * d)

def latex(self) -> LatexFormula:
"""Returns LatexFormula object for formula 6.42."""
_equation: str = r"1 + 0.6 \cdot \pi \cdot \frac{e}{D + 4 \cdot d}"
_numeric_equation: str = latex_replace_symbols(
_equation,
{
r" d": f" {self.d:.3f}",
r"D": f"{self.diameter:.3f}",
r"e": f"{self.e:.3f}",
},
True,
)
return LatexFormula(
return_symbol=r"\beta",
result=f"{self:.3f}",
equation=_equation,
numeric_equation=_numeric_equation,
comparison_operator_label="=",
unit="-",
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
"""Formula 6.43 from NEN-EN 1992-1-1+C2:2011: Chapter 6 - Ultimate Limit State."""

import numpy as np

from blueprints.codes.eurocode.nen_en_1992_1_1_c2_2011 import NEN_EN_1992_1_1_C2_2011
from blueprints.codes.formula import Formula
from blueprints.codes.latex_formula import LatexFormula, latex_replace_symbols
from blueprints.type_alias import DIMENSIONLESS, MM
from blueprints.validations import raise_if_negative


class Form6Dot43BetaRectangular(Formula):
r"""Class representing formula 6.43 for the calculation of [$$\beta$$] for rectangular columns."""

label = "6.43"
source_document = NEN_EN_1992_1_1_C2_2011

def __init__(
self,
ey: MM,
ez: MM,
by: MM,
bz: MM,
) -> None:
r"""[$$\beta$$] Calculation of [$$\beta$$].

NEN-EN 1992-1-1+C2:2011 art.6.4.3(3) - Formula (6.43)

Parameters
----------
ey : MM
[$$e_y$$] Eccentricity along y-axis [$$mm$$].
ez : MM
[$$e_z$$] Eccentricity along z-axis [$$mm$$].
by : MM
[$$b_y$$] Dimension of the control perimeter along y-axis [$$mm$$].
bz : MM
[$$b_z$$] Dimension of the control perimeter along z-axis [$$mm$$].
"""
super().__init__()
self.ey = ey
self.ez = ez
self.by = by
self.bz = bz

@staticmethod
def _evaluate(
ey: MM,
ez: MM,
by: MM,
bz: MM,
) -> DIMENSIONLESS:
"""Evaluates the formula, for more information see the __init__ method."""
raise_if_negative(ey=ey, ez=ez, by=by, bz=bz)

return 1 + 1.8 * np.sqrt((ey / bz) ** 2 + (ez / by) ** 2)

def latex(self) -> LatexFormula:
"""Returns LatexFormula object for formula 6.43."""
_equation: str = r"1 + 1.8 \cdot \sqrt{\left(\frac{e_y}{b_z}\right)^2 + \left(\frac{e_z}{b_y}\right)^2}"
_numeric_equation: str = latex_replace_symbols(
_equation,
{
r"e_y": f"{self.ey:.3f}",
r"e_z": f"{self.ez:.3f}",
r"b_y": f"{self.by:.3f}",
r"b_z": f"{self.bz:.3f}",
},
True,
)
return LatexFormula(
return_symbol=r"\beta",
result=f"{self:.3f}",
equation=_equation,
numeric_equation=_numeric_equation,
comparison_operator_label="=",
unit="",
)
Loading