Skip to content

590 formula request add formulas 6.33-35 from eurocode 1993 1 1 #591

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

Merged
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,75 @@
"""Formula 6.33 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 N
from blueprints.validations import raise_if_negative


class Form6Dot33CheckAxialForceY(Formula):
r"""Class representing formula 6.33 for checking axial force about the y-y axis."""

label = "6.33"
source_document = NEN_EN_1993_1_1_C2_A1_2016

def __init__(
self,
n_ed: N,
n_pl_rd: N,
) -> None:
r"""For doubly symmetrical I- and H-sections or other flanges sections,
allowance need not be made for the effect of the axial force on the
plastic resistance moment about the y-y axis when 6.33 and 6.34 are satisfied.

NEN-EN 1993-1-1+C2+A1:2016 art.6.2.9(4) - Formula (6.33)

Parameters
----------
n_ed : N
[$N_{Ed}$] Design axial force [$N$].
n_pl_rd : N
[$N_{pl,Rd}$] Plastic resistance normal force [$N$].
"""
super().__init__()
self.n_ed = n_ed
self.n_pl_rd = n_pl_rd

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

return n_ed <= 0.25 * n_pl_rd

def latex(self) -> LatexFormula:
"""Returns LatexFormula object for formula 6.33."""
_equation: str = r"N_{Ed} \leq 0.25 \cdot N_{pl,Rd}"
_numeric_equation: str = latex_replace_symbols(
_equation,
{
r"N_{Ed}": f"{self.n_ed:.3f}",
r"N_{pl,Rd}": f"{self.n_pl_rd:.3f}",
},
False,
)
_numeric_equation_with_units: str = latex_replace_symbols(
_equation,
{
r"N_{Ed}": rf"{self.n_ed:.3f} \ N",
r"N_{pl,Rd}": rf"{self.n_pl_rd:.3f} \ N",
},
True,
)
return LatexFormula(
return_symbol="CHECK",
result="OK" if self.__bool__() else "\\text{Not OK}",
equation=_equation,
numeric_equation=_numeric_equation,
numeric_equation_with_units=_numeric_equation_with_units,
comparison_operator_label="\\to",
unit="",
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
"""Formula 6.34 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, MM, MPA, N
from blueprints.validations import raise_if_less_or_equal_to_zero, raise_if_negative


class Form6Dot34CheckAxialForceY(Formula):
r"""Class representing formula 6.34 for checking axial force about the y-y axis."""

label = "6.34"
source_document = NEN_EN_1993_1_1_C2_A1_2016

def __init__(
self,
n_ed: N,
h_w: MM,
t_w: MM,
f_y: MPA,
gamma_m0: DIMENSIONLESS,
) -> None:
r"""For doubly symmetrical I- and H-sections or other flanges sections,
allowance need not be made for the effect of the axial force on the
plastic resistance moment about the y-y axis when 6.33 and 6.34 are satisfied.

NEN-EN 1993-1-1+C2+A1:2016 art.6.2.9(4) - Formula (6.34)

Parameters
----------
n_ed : N
[$N_{Ed}$] Design axial force [$N$].
h_w : MM
[$h_w$] Web height [$mm$].
t_w : MM
[$t_{w}$] Web thickness [$mm$].
f_y : MPA
[$f_{y}$] Yield strength [$MPa$].
gamma_m0 : DIMENSIONLESS
[$\gamma_{M0}$] Partial safety factor [-].
"""
super().__init__()
self.n_ed = n_ed
self.h_w = h_w
self.t_w = t_w
self.f_y = f_y
self.gamma_m0 = gamma_m0

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

return n_ed <= (0.5 * h_w * t_w * f_y) / gamma_m0

def latex(self) -> LatexFormula:
"""Returns LatexFormula object for formula 6.34."""
_equation: str = r"N_{Ed} \leq \frac{0.5 \cdot h_{w} \cdot t_{w} \cdot f_{y}}{\gamma_{M0}}"
_numeric_equation: str = latex_replace_symbols(
_equation,
{
r"N_{Ed}": f"{self.n_ed:.3f}",
r"h_{w}": f"{self.h_w:.3f}",
r"t_{w}": f"{self.t_w:.3f}",
r"f_{y}": f"{self.f_y:.3f}",
r"\gamma_{M0}": f"{self.gamma_m0:.3f}",
},
False,
)
_numeric_equation_with_units: str = latex_replace_symbols(
_equation,
{
r"N_{Ed}": rf"{self.n_ed:.3f} \ N",
r"h_{w}": rf"{self.h_w:.3f} \ mm",
r"t_{w}": rf"{self.t_w:.3f} \ mm",
r"f_{y}": rf"{self.f_y:.3f} \ MPa",
r"\gamma_{M0}": rf"{self.gamma_m0:.3f}",
},
True,
)
return LatexFormula(
return_symbol="CHECK",
result="OK" if self.__bool__() else "\\text{Not OK}",
equation=_equation,
numeric_equation=_numeric_equation,
numeric_equation_with_units=_numeric_equation_with_units,
comparison_operator_label="\\to",
unit="",
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
"""Formula 6.35 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, MM, MPA, N
from blueprints.validations import raise_if_less_or_equal_to_zero, raise_if_negative


class Form6Dot35CheckAxialForceZ(Formula):
r"""Class representing formula 6.35 for checking axial force about the z-z axis."""

label = "6.35"
source_document = NEN_EN_1993_1_1_C2_A1_2016

def __init__(
self,
n_ed: N,
h_w: MM,
t_w: MM,
f_y: MPA,
gamma_m0: DIMENSIONLESS,
) -> None:
r"""For doubly symmetrical I- and H-sections, allowance need not be made for the
effect of the axial force on the plastic resistance moment about the z-z axis when
6.35 is satisfied.

NEN-EN 1993-1-1+C2+A1:2016 art.6.2.9(4) - Formula (6.35)

Parameters
----------
n_ed : N
[$N_{Ed}$] Design axial force [$N$].
h_w : MM
[$h_w$] Web height [$mm$].
t_w : MM
[$t_{w}$] Web thickness [$mm$].
f_y : MPA
[$f_{y}$] Yield strength [$MPa$].
gamma_m0 : DIMENSIONLESS
[$\gamma_{M0}$] Partial safety factor [-].
"""
super().__init__()
self.n_ed = n_ed
self.h_w = h_w
self.t_w = t_w
self.f_y = f_y
self.gamma_m0 = gamma_m0

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

return n_ed <= (h_w * t_w * f_y) / gamma_m0

def latex(self) -> LatexFormula:
"""Returns LatexFormula object for formula 6.35."""
_equation: str = r"N_{Ed} \leq \frac{h_{w} \cdot t_{w} \cdot f_{y}}{\gamma_{M0}}"
_numeric_equation: str = latex_replace_symbols(
_equation,
{
r"N_{Ed}": f"{self.n_ed:.3f}",
r"h_{w}": f"{self.h_w:.3f}",
r"t_{w}": f"{self.t_w:.3f}",
r"f_{y}": f"{self.f_y:.3f}",
r"\gamma_{M0}": f"{self.gamma_m0:.3f}",
},
False,
)
_numeric_equation_with_units: str = latex_replace_symbols(
_equation,
{
r"N_{Ed}": rf"{self.n_ed:.3f} \ N",
r"h_{w}": rf"{self.h_w:.3f} \ mm",
r"t_{w}": rf"{self.t_w:.3f} \ mm",
r"f_{y}": rf"{self.f_y:.3f} \ MPa",
r"\gamma_{M0}": rf"{self.gamma_m0:.3f}",
},
True,
)
return LatexFormula(
return_symbol="CHECK",
result="OK" if self.__bool__() else "\\text{Not OK}",
equation=_equation,
numeric_equation=_numeric_equation,
numeric_equation_with_units=_numeric_equation_with_units,
comparison_operator_label="\\to",
unit="",
)
6 changes: 3 additions & 3 deletions docs/objects_overview/eurocode/ec3_1993_1_1_2016/formulas.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ Total of 108 formulas present.
| 6.30 | :x: | | |
| 6.31 | :heavy_check_mark: | | Form6Dot31CheckBendingAndAxialForce |
| 6.32 | :x: | | |
| 6.33 | :x: | | |
| 6.34 | :x: | | |
| 6.35 | :x: | | |
| 6.33 | :heavy_check_mark: | | Form6Dot33CheckAxialForceY |
| 6.34 | :heavy_check_mark: | | Form6Dot34CheckAxialForceY |
| 6.35 | :heavy_check_mark: | | Form6Dot35CheckAxialForceZ |
| 6.36 | :x: | | |
| 6.37 | :x: | | |
| 6.38 | :x: | | |
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
"""Testing formula 6.33 of NEN-EN 1993-1-1+C2+A1:2016."""

import pytest

from blueprints.codes.eurocode.nen_en_1993_1_1_c2_a1_2016.chapter_6_ultimate_limit_state.formula_6_33 import Form6Dot33CheckAxialForceY
from blueprints.validations import NegativeValueError


class TestForm6Dot33CheckAxialForceY:
"""Validation for formula 6.33 from NEN-EN 1993-1-1+C2+A1:2016."""

def test_evaluation(self) -> None:
"""Tests the evaluation of the result."""
n_ed = 50.0
n_pl_rd = 300.0

formula = Form6Dot33CheckAxialForceY(n_ed=n_ed, n_pl_rd=n_pl_rd)

expected_result = True

assert formula == expected_result

@pytest.mark.parametrize(
"n_pl_rd",
[-300.0], # n_pl_rd is negative
)
def test_raise_error_when_invalid_values_are_given(self, n_pl_rd: float) -> None:
"""Test invalid values."""
with pytest.raises(NegativeValueError):
Form6Dot33CheckAxialForceY(n_ed=50.0, n_pl_rd=n_pl_rd)

@pytest.mark.parametrize(
("representation", "expected"),
[
(
"complete",
r"CHECK \to N_{Ed} \leq 0.25 \cdot N_{pl,Rd} \to 50.000 \leq 0.25 \cdot 300.000 \to OK",
),
(
"complete_with_units",
r"CHECK \to N_{Ed} \leq 0.25 \cdot N_{pl,Rd} \to 50.000 \ N \leq 0.25 \cdot 300.000 \ N \to OK",
),
("short", r"CHECK \to OK"),
],
)
def test_latex(self, representation: str, expected: str) -> None:
"""Test the latex representation of the formula."""
n_ed = 50.0
n_pl_rd = 300.0

latex = Form6Dot33CheckAxialForceY(n_ed=n_ed, n_pl_rd=n_pl_rd).latex()

actual = {
"complete": latex.complete,
"complete_with_units": latex.complete_with_units,
"short": latex.short,
}

assert expected == actual[representation], f"{representation} representation failed."
Loading