-
Notifications
You must be signed in to change notification settings - Fork 6
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
base: main
Are you sure you want to change the base?
Changes from all commits
09ac6e2
3cb1053
a275980
97f3081
cb772c2
ec42af9
3b01032
6e727c9
e3f142c
7e5854a
677fd13
4627dc5
4158555
e7108e5
cd8a7d8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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 | ||
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) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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): | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||||||
"""Class representing formula 6.3 for the calculation of the area deduction [$A_{deduction}$].""" | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
||||||
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], | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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$]. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||||||
|
||||||
NEN-EN 1993-1-1+C2+A1:2016 art.6.3 - Formula (6.3) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
||||||
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$]. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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): | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
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) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||||||
|
||||||
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$]. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
""" | ||||||
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 | ||||
---|---|---|---|---|---|---|
@@ -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. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
""" | ||||||
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", | ||||||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wrong Eurocode