Skip to content

497 feature request add formulas 61 68 from nen en 1993 1 1 #498

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

Open
wants to merge 15 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
15 commits
Select commit Hold shift + click to select a range
09ac6e2
Add formula 6.1 implementation and tests for NEN-EN 1993-1-1+C2+A1:2016
GerjanDorgelo Feb 21, 2025
3cb1053
No code changes made. Just formatting
GerjanDorgelo Feb 21, 2025
a275980
Add implementation and tests for formula 6.3 from NEN-EN 1993-1-1+C2+…
GerjanDorgelo Feb 21, 2025
97f3081
Fix string formatting in numeric equation for formula 6.3
GerjanDorgelo Feb 21, 2025
cb772c2
Add implementation and tests for formula 6.4 from NEN-EN 1993-1-1+C2+…
GerjanDorgelo Feb 21, 2025
ec42af9
Add implementation and tests for formula 6.5 from NEN-EN 1993-1-1+C2+…
GerjanDorgelo Feb 21, 2025
3b01032
Add implementation and tests for formula 6.6 from NEN-EN 1993-1-1+C2+…
GerjanDorgelo Feb 21, 2025
6e727c9
Add implementation and tests for formula 6.7 from NEN-EN 1993-1-1+C2+…
GerjanDorgelo Feb 21, 2025
e3f142c
Add implementation and tests for formula 6.8 from NEN-EN 1993-1-1+C2+…
GerjanDorgelo Feb 21, 2025
7e5854a
Merge branch 'main' into 497-feature-request-add-formulas-61-68-from-…
GerjanDorgelo Mar 7, 2025
677fd13
Merge branch 'main' into 497-feature-request-add-formulas-61-68-from-…
GerjanDorgelo Mar 7, 2025
4627dc5
Merge branch 'main' into 497-feature-request-add-formulas-61-68-from-…
GerjanDorgelo Mar 7, 2025
4158555
Merge remote-tracking branch 'origin/main' into 497-feature-request-a…
GerjanDorgelo Apr 28, 2025
e7108e5
Fix LaTeX formatting in test formulas for NEN-EN 1993-1-1+C2+A1:2016
GerjanDorgelo Apr 28, 2025
cd8a7d8
Update implementation status for formulas 6.9 to 6.16 in Eurocode 3 d…
GerjanDorgelo Apr 28, 2025
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,93 @@
"""Formula 6.1 from NEN-EN 1993-1-1+C2+A1:2016: Chapter 6 - Ultimate limit state."""

from blueprints.codes.eurocode.nen_en_1992_1_1_c2_2011 import NEN_EN_1992_1_1_C2_2011
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wrong Eurocode

from blueprints.codes.formula import Formula
from blueprints.codes.latex_formula import LatexFormula, latex_replace_symbols
from blueprints.type_alias import DIMENSIONLESS, MPA
from blueprints.validations import raise_if_negative


class Form6Dot1ElasticVerification(Formula):
r"""Class representing formula 6.1 for the elastic verification with the yield criterion."""

label = "6.1"
source_document = NEN_EN_1992_1_1_C2_2011

def __init__(
self,
sigma_x_ed: MPA,
sigma_z_ed: MPA,
tau_ed: MPA,
f_y: MPA,
gamma_m0: DIMENSIONLESS,
) -> None:
r"""Elastic verification with the yield criterion.

NEN-EN 1993-1-1+C2:2011 art.6.2.1(5) - Formula (6.1)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is also wrong


Parameters
----------
sigma_x_ed : MPA
[$\sigma_{x,\text{Ed}}$] Design value of the longitudinal stress at the point of consideration [$MPa$].
sigma_z_ed : MPA
[$\sigma_{z,\text{Ed}}$] Design value of the transverse stress at the point of consideration [$MPa$].
tau_ed : MPA
[$\tau_{\text{Ed}}$] Design value of the shear stress at the point of consideration [$MPa$].
f_y : MPA
[$f_y$] Yield strength of the material [$MPa$].
gamma_m0 : DIMENSIONLESS
[$\gamma_{M0}$] Partial safety factor for the material [dimensionless].
"""
super().__init__()
self.sigma_x_ed = sigma_x_ed
self.sigma_z_ed = sigma_z_ed
self.tau_ed = tau_ed
self.f_y = f_y
self.gamma_m0 = gamma_m0

@staticmethod
def _evaluate(
sigma_x_ed: MPA,
sigma_z_ed: MPA,
tau_ed: MPA,
f_y: MPA,
gamma_m0: DIMENSIONLESS,
) -> bool:
"""Evaluates the formula, for more information see the __init__ method."""
raise_if_negative(sigma_x_ed=sigma_x_ed, sigma_z_ed=sigma_z_ed, tau_ed=tau_ed, f_y=f_y, gamma_m0=gamma_m0)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gamma_m0 and f_y cannot be zero in this formula.


term1 = (sigma_x_ed / (f_y / gamma_m0)) ** 2
term2 = (sigma_z_ed / (f_y / gamma_m0)) ** 2
term3 = (sigma_x_ed / (f_y / gamma_m0)) * (sigma_z_ed / (f_y / gamma_m0))
term4 = 3 * (tau_ed / (f_y / gamma_m0)) ** 2

return term1 + term2 - term3 + term4 <= 1

def latex(self) -> LatexFormula:
"""Returns LatexFormula object for formula 6.1."""
_equation: str = (
r"\left( \frac{\sigma_{x,\text{Ed}}}{f_y / \gamma_{M0}} \right)^2 "
r"+ \left( \frac{\sigma_{z,\text{Ed}}}{f_y / \gamma_{M0}} \right)^2 "
r"- \left( \frac{\sigma_{x,\text{Ed}}}{f_y / \gamma_{M0}} \right) "
r"\left( \frac{\sigma_{z,\text{Ed}}}{f_y / \gamma_{M0}} \right) "
r"+ 3 \left( \frac{\tau_{\text{Ed}}}{f_y / \gamma_{M0}} \right)^2 \leq 1"
)
_numeric_equation: str = latex_replace_symbols(
_equation,
{
r"\sigma_{x,\text{Ed}}": f"{self.sigma_x_ed:.3f}",
r"\sigma_{z,\text{Ed}}": f"{self.sigma_z_ed:.3f}",
r"\tau_{\text{Ed}}": f"{self.tau_ed:.3f}",
r"f_y": f"{self.f_y:.3f}",
r"\gamma_{M0}": f"{self.gamma_m0:.3f}",
},
False,
)
return LatexFormula(
return_symbol=r"CHECK",
result="OK" if self.__bool__() else "\\text{Not OK}",
equation=_equation,
numeric_equation=_numeric_equation,
comparison_operator_label="\\to",
unit="",
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
"""Formula 6.3 from NEN-EN 1993-1-1+C2+A1:2016: Chapter 6 - Ultimate limit state."""

# pylint: disable=arguments-differ
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

legacy code. can be removed

from blueprints.codes.eurocode.nen_en_1993_1_1_c2_a1_2016 import NEN_EN_1993_1_1_C2_A1_2016
from blueprints.codes.formula import Formula
from blueprints.codes.latex_formula import LatexFormula
from blueprints.type_alias import MM
from blueprints.validations import raise_if_less_or_equal_to_zero, raise_if_lists_differ_in_length, raise_if_negative


class Form6Dot3ADeductionAreaStaggeredFastenerHoles(Formula):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is kind of a minimum?
Deduction should be the max of a and b.
image

Suggested change
class Form6Dot3ADeductionAreaStaggeredFastenerHoles(Formula):
class Form6Dot3MinDeductionAreaStaggeredFastenerHoles(Formula):

"""Class representing formula 6.3 for the calculation of the area deduction [$A_{deduction}$]."""
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"""Class representing formula 6.3 for the calculation of the area deduction [$A_{deduction}$]."""
"""Class representing formula 6.3 for the calculation of the minimum area deduction for staggered fastener holes [$A_{deduction}$]."""


label = "6.3"
source_document = NEN_EN_1993_1_1_C2_A1_2016

def __init__(
self,
t: MM,
n: MM,
d_0: MM,
s: list[MM],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be better to use Sequence from typing or typing_extention.

p: list[MM],
) -> None:
"""[$A_{deduction}$] Calculation of the area deduction [$mm^2$].
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"""[$A_{deduction}$] Calculation of the area deduction [$mm^2$].
"""[$A_{deduction}$] Calculation of the area deduction for staggered fastener holes [$mm^2$].

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

perhaps also good to let the user know that the deduction should be the max of two things and we are calculating only one of them here.
image


NEN-EN 1993-1-1+C2+A1:2016 art.6.3 - Formula (6.3)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
NEN-EN 1993-1-1+C2+A1:2016 art.6.3 - Formula (6.3)
NEN-EN 1993-1-1+C2+A1:2016 art.6.2.2.2 (4) - Formula (6.3)


Parameters
----------
t : MM
[$t$] Thickness [$mm$].
n : MM
[$n$] Number of holes extending in any diagonal or zig-zag line progressively across the member [$mm$].
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can refer to Figure 6.1 (like in the Eurocode)

d_0 : MM
[$d_0$] Diameter of hole [$mm$].
s : list[MM]
[$s$] Staggered pitch, the spacing of the centres of two consecutive holes in the
chain measured parallel to the member axis [$mm$].
p : list[MM]
[$p$] Spacing of the centres of the same two holes measured perpendicular to the member axis [$mm$].
"""
super().__init__()
self.t = t
self.n = n
self.d_0 = d_0
self.s = s
self.p = p

@staticmethod
def _evaluate(
t: MM,
n: MM,
d_0: MM,
s: list[MM],
p: list[MM],
) -> MM:
"""Evaluates the formula, for more information see the __init__ method."""
raise_if_negative(t=t, n=n, d_0=d_0)
raise_if_less_or_equal_to_zero(t=t, n=n, d_0=d_0)
raise_if_lists_differ_in_length(s=s, p=p)
for s_i, p_i in zip(s, p):
raise_if_negative(s=s_i, p=p_i)
raise_if_less_or_equal_to_zero(s=s_i, p=p_i)

return t * (n * d_0 - sum((s_i**2) / (4 * p_i) for s_i, p_i in zip(s, p)))

def latex(self) -> LatexFormula:
"""Returns LatexFormula object for formula 6.3."""
_equation: str = r"t \left( n \cdot d_0 - \sum \frac{s^2}{4 \cdot p} \right)"
_numeric_equation: str = (
rf"{self.t:.3f} \left( {self.n:.3f} \cdot {self.d_0:.3f} - \left( \frac{{{self.s[0]:.3f}^2}}"
rf"{{4 \cdot {self.p[0]:.3f}}}"
)
for s_i, p_i in zip(self.s[1:], self.p[1:]):
_numeric_equation += rf" + \frac{{{s_i:.3f}^2}}{{4 \cdot {p_i:.3f}}}"
_numeric_equation += r" \right) \right)"
return LatexFormula(
return_symbol=r"A_{deduction}",
result=f"{self:.3f}",
equation=_equation,
numeric_equation=_numeric_equation,
comparison_operator_label="=",
unit="mm^2",
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
"""Formula 6.4 from NEN-EN 1993-1-1+C2+A1:2016: Chapter 6 - Ultimate Limit State."""

from blueprints.codes.eurocode.nen_en_1993_1_1_c2_a1_2016 import NEN_EN_1993_1_1_C2_A1_2016
from blueprints.codes.formula import Formula
from blueprints.codes.latex_formula import LatexFormula, latex_replace_symbols
from blueprints.type_alias import MM, NMM, N
from blueprints.validations import raise_if_negative


class Form6Dot4AxialCompression(Formula):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
class Form6Dot4AxialCompression(Formula):
class Form6Dot4AdditionalMoment(Formula):

r"""Class representing formula 6.4 for the calculation of additional moment [$\Delta M_{Ed}$]."""

label = "6.4"
source_document = NEN_EN_1993_1_1_C2_A1_2016

def __init__(
self,
n_ed: N,
e_n: MM,
) -> None:
r"""[$\Delta M_{Ed}$] Calculation of the additional moment [$Nmm$].

NEN-EN 1993-1-1+C2+A1:2016 art.6.2.2.5(4) - Formula (6.4)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All this info should be covered in this doc-string, especially the note:

image

image


Parameters
----------
n_ed : N
[$N_{Ed}$] Axial compression force [$N$].
e_n : MM
[$e_{N}$] Shift of the centroid of the effective area relative to the centre of gravity of the gross cross section [$mm$].
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
[$e_{N}$] Shift of the centroid of the effective area relative to the centre of gravity of the gross cross section [$mm$].
[$e_{N}$] Shift of the centroid of the effective area relative to the centre of gravity of the gross cross section [$mm$]. the method given in EN 1993-1-5 should be used to determine the possible shift [$e_{N}$] of the centroid of the effective area [$A_{eff$] relative to the centre of gravity of the gross cross section

"""
super().__init__()
self.n_ed = n_ed
self.e_n = e_n

@staticmethod
def _evaluate(
n_ed: N,
e_n: MM,
) -> NMM:
"""Evaluates the formula, for more information see the __init__ method."""
raise_if_negative(n_ed=n_ed, e_n=e_n)

return n_ed * e_n

def latex(self) -> LatexFormula:
"""Returns LatexFormula object for formula 6.4."""
_equation: str = r"N_{Ed} \cdot e_{N}"
_numeric_equation: str = latex_replace_symbols(
_equation,
{
r"N_{Ed}": f"{self.n_ed:.3f}",
r"e_{N}": f"{self.e_n:.3f}",
},
False,
)
return LatexFormula(
return_symbol=r"\Delta M_{Ed}",
result=f"{self:.3f}",
equation=_equation,
numeric_equation=_numeric_equation,
comparison_operator_label="=",
unit="Nmm",
)
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
"""Formula 6.5 from NEN-EN 1993-1-1+C2+A1:2016: Chapter 6 - Ultimate limit state."""

# pylint: disable=arguments-differ
from blueprints.codes.eurocode.nen_en_1993_1_1_c2_a1_2016 import NEN_EN_1993_1_1_C2_A1_2016
from blueprints.codes.formula import Formula
from blueprints.codes.latex_formula import LatexFormula
from blueprints.type_alias import KN, RATIO
from blueprints.codes.latex_formula import LatexFormula, latex_replace_symbols
from blueprints.type_alias import N
from blueprints.validations import raise_if_less_or_equal_to_zero, raise_if_negative


Expand All @@ -16,40 +15,50 @@ class Form6Dot5UnityCheckTensileStrength(Formula):

def __init__(
self,
n_ed: KN,
n_t_rd: KN,
n_ed: N,
n_t_rd: N,
) -> None:
r"""[$N_{Ed}/N_{t,Rd}$] Unity check for tensile strength of an element in tension.
r"""[$N_{Ed}/N_{t,Rd} \leq 1$] Unity check for tensile strength of an element in tension.

NEN-EN 1993-1-1+C2+A1:2016 art.6.2.3(1) - Formula (6.5)

Parameters
----------
n_ed : KN
[$N_{Ed}$] Design value of the normal tensile force [kN].
n_t_rd : KN
[$N_{t,Rd}$] Design value of the resistance against tensile force [kN].
n_ed : N
[$N_{Ed}$] Design value of the normal tensile force [$N$].
n_t_rd : N
[$N_{t,Rd}$] Design value of the resistance against tensile force [$N$].
"""
super().__init__()
self.n_ed = n_ed
self.n_t_rd = n_t_rd

@staticmethod
def _evaluate(
n_ed: KN,
n_t_rd: KN,
) -> RATIO:
n_ed: N,
n_t_rd: N,
) -> bool:
"""Evaluates the formula, for more information see the __init__ method."""
raise_if_less_or_equal_to_zero(n_t_rd=n_t_rd)
raise_if_negative(n_ed=n_ed)
return n_ed / n_t_rd
return (n_ed / n_t_rd) <= 1

def latex(self) -> LatexFormula:
"""Returns LatexFormula object for formula 6.5."""
_equation: str = r"\left( \frac{N_{Ed}}{N_{t,Rd}} \leq 1 \right)"
_numeric_equation: str = latex_replace_symbols(
_equation,
{
"N_{Ed}": f"{self.n_ed:.3f}",
"N_{t,Rd}": f"{self.n_t_rd:.3f}",
},
False,
)
return LatexFormula(
return_symbol=r"N_{Ed}/N_{t,Rd}",
result=f"{self:.2f}",
equation=r"N_{Ed} / N_{t,Rd}",
numeric_equation=rf"{self.n_ed:.2f} / {self.n_t_rd:.2f}",
comparison_operator_label="=",
return_symbol=r"CHECK",
result="OK" if self.__bool__() else "\\text{Not OK}",
equation=_equation,
numeric_equation=_numeric_equation,
comparison_operator_label="\\to",
unit="",
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
"""Formula 6.6 from NEN-EN 1993-1-1+C2+A1:2016: Chapter 6 - Ultimate Limit State."""

from blueprints.codes.eurocode.nen_en_1993_1_1_c2_a1_2016 import NEN_EN_1993_1_1_C2_A1_2016
from blueprints.codes.formula import Formula
from blueprints.codes.latex_formula import LatexFormula, latex_replace_symbols
from blueprints.type_alias import DIMENSIONLESS, MM2, MPA, N
from blueprints.validations import raise_if_less_or_equal_to_zero, raise_if_negative


class Form6Dot6DesignPlasticRestistanceGrossCrossSection(Formula):
r"""Class representing formula 6.6 for the calculation of [$N_{pl,Rd}$]."""

label = "6.6"
source_document = NEN_EN_1993_1_1_C2_A1_2016

def __init__(
self,
a: MM2,
f_y: MPA,
gamma_m0: DIMENSIONLESS,
) -> None:
r"""[$N_{pl,Rd}$] Calculation of the design plastic resistance of the gross cross-section [$N$].

NEN-EN 1993-1-1+C2+A1:2016 art.6.2.3(2) - Formula (6.6)

Parameters
----------
a : MM2
[$A$] Gross cross-sectional area [$mm^2$].
f_y : MPA
[$f_y$] Yield strength of the material [$MPa$].
gamma_m0 : DIMENSIONLESS
[$\gamma_{M0}$] Partial safety factor for resistance of cross-sections whatever the class is.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
[$\gamma_{M0}$] Partial safety factor for resistance of cross-sections whatever the class is.
[$\gamma_{M0}$] Partial safety factor for resistance of cross-sections, irrespective of the class.

"""
super().__init__()
self.a = a
self.f_y = f_y
self.gamma_m0 = gamma_m0

@staticmethod
def _evaluate(
a: MM2,
f_y: MPA,
gamma_m0: DIMENSIONLESS,
) -> N:
"""Evaluates the formula, for more information see the __init__ method."""
raise_if_negative(a=a, f_y=f_y)
raise_if_less_or_equal_to_zero(gamma_m0=gamma_m0)

return (a * f_y) / gamma_m0

def latex(self) -> LatexFormula:
"""Returns LatexFormula object for formula 6.6."""
_equation: str = r"\frac{A \cdot f_y}{\gamma_{M0}}"
_numeric_equation: str = latex_replace_symbols(
_equation,
{
r"A": f"{self.a:.3f}",
r"f_y": f"{self.f_y:.3f}",
r"\gamma_{M0}": f"{self.gamma_m0:.3f}",
},
False,
)
return LatexFormula(
return_symbol=r"N_{pl,Rd}",
result=f"{self:.3f}",
equation=_equation,
numeric_equation=_numeric_equation,
comparison_operator_label="=",
unit="N",
)
Loading