Skip to content

Commit f7b2969

Browse files
Merge pull request #636 from Blueprints-org/606-feature-request-formula-517-518-and-519-from-nen-en-1993-52008-1
add formula 5.17, 5.18 and 5.19 EN-1993-5:2007
2 parents e7c2f5f + 12b3dc3 commit f7b2969

File tree

8 files changed

+467
-4
lines changed

8 files changed

+467
-4
lines changed
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
"""Formula 5.17 from EN 1993-5:2007: Chapter 5 - Ultimate limit state."""
2+
3+
from blueprints.codes.eurocode.en_1993_5_2007 import EN_1993_5_2007
4+
from blueprints.codes.formula import ComparisonFormula
5+
from blueprints.codes.latex_formula import LatexFormula, latex_replace_symbols
6+
from blueprints.type_alias import KN
7+
from blueprints.validations import raise_if_less_or_equal_to_zero
8+
9+
10+
class Form5Dot17CompressionCheckZProfilesClass1And2(ComparisonFormula):
11+
r"""Class representing formula 5.17 for Z-profiles of class 1 and 2: [$\frac{N_{Ed}}{N_{pl,Rd}} \leq 0.1$]."""
12+
13+
label = "5.17"
14+
source_document = EN_1993_5_2007
15+
16+
def __init__(
17+
self,
18+
n_ed: KN,
19+
n_pl_rd: KN,
20+
) -> None:
21+
r"""Compression check for Z-profiles of class 1 and 2.
22+
Design axial force [$N_{Ed}$] should not exceed 10% of plastic resistance [$N_{pl,Rd}$].
23+
24+
EN 1993-5:2007 art. 5.2.3 (10) - Formula (5.17)
25+
26+
Parameters
27+
----------
28+
n_ed : KN
29+
[$N_{Ed}$] Design value of the compression force [$kN$].
30+
n_pl_rd : KN
31+
[$N_{pl,Rd}$] Plastic design resistance of the cross-section [$kN$].
32+
"""
33+
super().__init__()
34+
self.n_ed = n_ed
35+
self.n_pl_rd = n_pl_rd
36+
37+
@staticmethod
38+
def _evaluate_lhs(
39+
n_ed: KN,
40+
n_pl_rd: KN,
41+
) -> float:
42+
"""Evaluates the left-hand side of the comparison. see __init__ for details."""
43+
raise_if_less_or_equal_to_zero(n_pl_rd=n_pl_rd)
44+
return n_ed / n_pl_rd
45+
46+
@staticmethod
47+
def _evaluate_rhs(*_, **_kwargs) -> float:
48+
"""Evaluates the right-hand side of the comparison. see __init__ for details."""
49+
return 0.1
50+
51+
@property
52+
def unity_check(self) -> float:
53+
"""Returns the unity check value."""
54+
return self.lhs
55+
56+
@staticmethod
57+
def _evaluate(
58+
n_ed: KN,
59+
n_pl_rd: KN,
60+
) -> bool:
61+
"""Evaluates the comparison; see __init__ for details."""
62+
return (
63+
Form5Dot17CompressionCheckZProfilesClass1And2._evaluate_lhs(n_ed=n_ed, n_pl_rd=n_pl_rd)
64+
<= Form5Dot17CompressionCheckZProfilesClass1And2._evaluate_rhs()
65+
)
66+
67+
def __bool__(self) -> bool:
68+
"""Allow truth-checking of the check object itself."""
69+
return self._evaluate(self.n_ed, self.n_pl_rd)
70+
71+
def latex(self) -> LatexFormula:
72+
"""Returns LatexFormula object for formula 5.17."""
73+
_equation: str = r"\frac{N_{Ed}}{N_{pl,Rd}} \leq 0.1"
74+
_numeric_equation: str = latex_replace_symbols(
75+
_equation,
76+
{
77+
r"N_{Ed}": f"{self.n_ed:.3f}",
78+
r"N_{pl,Rd}": f"{self.n_pl_rd:.3f}",
79+
},
80+
False,
81+
)
82+
return LatexFormula(
83+
return_symbol=r"CHECK",
84+
result="OK" if bool(self) else r"\text{Not OK}",
85+
equation=_equation,
86+
numeric_equation=_numeric_equation,
87+
comparison_operator_label=r"\to",
88+
unit="",
89+
)
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
"""Formula 5.18 from EN 1993-5:2007: Chapter 5 - Ultimate limit state."""
2+
3+
from blueprints.codes.eurocode.en_1993_5_2007 import EN_1993_5_2007
4+
from blueprints.codes.formula import ComparisonFormula
5+
from blueprints.codes.latex_formula import LatexFormula, latex_replace_symbols
6+
from blueprints.type_alias import KN
7+
from blueprints.validations import raise_if_less_or_equal_to_zero
8+
9+
10+
class Form5Dot18CompressionCheckUProfilesClass1And2(ComparisonFormula):
11+
r"""Class representing formula 5.18 for U-profiles of class 1 and 2: [$\frac{N_{Ed}}{N_{pl,Rd}} \leq 0.25$]."""
12+
13+
label = "5.18"
14+
source_document = EN_1993_5_2007
15+
16+
def __init__(
17+
self,
18+
n_ed: KN,
19+
n_pl_rd: KN,
20+
) -> None:
21+
r"""Compression check for U-profiles of class 1 and 2.
22+
Design axial force [$N_{Ed}$] should not exceed 25% of plastic resistance [$N_{pl,Rd}$].
23+
24+
EN 1993-5:2007 art. 5.2.3 (10) - Formula (5.18)
25+
26+
Parameters
27+
----------
28+
n_ed : KN
29+
[$N_{Ed}$] Design value of the compression force [$kN$].
30+
n_pl_rd : KN
31+
[$N_{pl,Rd}$] Plastic design resistance of the cross-section [$kN$].
32+
"""
33+
super().__init__()
34+
self.n_ed = n_ed
35+
self.n_pl_rd = n_pl_rd
36+
37+
@staticmethod
38+
def _evaluate_lhs(
39+
n_ed: KN,
40+
n_pl_rd: KN,
41+
) -> float:
42+
"""Evaluates the left-hand side of the comparison; see __init__ for details."""
43+
raise_if_less_or_equal_to_zero(n_pl_rd=n_pl_rd)
44+
return n_ed / n_pl_rd
45+
46+
@staticmethod
47+
def _evaluate_rhs(*_, **_kwargs) -> float:
48+
"""Evaluates the right-hand side of the comparison; see __init__ for details."""
49+
return 0.25
50+
51+
@staticmethod
52+
def _evaluate(
53+
n_ed: KN,
54+
n_pl_rd: KN,
55+
) -> bool:
56+
"""Evaluates the comparison; see __init__ for details."""
57+
return (
58+
Form5Dot18CompressionCheckUProfilesClass1And2._evaluate_lhs(n_ed=n_ed, n_pl_rd=n_pl_rd)
59+
<= Form5Dot18CompressionCheckUProfilesClass1And2._evaluate_rhs()
60+
)
61+
62+
@property
63+
def unity_check(self) -> float:
64+
"""Returns the unity check value."""
65+
return self.lhs
66+
67+
def __bool__(self) -> bool:
68+
"""Allow truth-checking of the check object itself."""
69+
return self._evaluate(self.n_ed, self.n_pl_rd)
70+
71+
def latex(self) -> LatexFormula:
72+
"""Returns LatexFormula object for formula 5.18."""
73+
_equation: str = r"\frac{N_{Ed}}{N_{pl,Rd}} \leq 0.25"
74+
_numeric_equation: str = latex_replace_symbols(
75+
_equation,
76+
{
77+
r"N_{Ed}": f"{self.n_ed:.3f}",
78+
r"N_{pl,Rd}": f"{self.n_pl_rd:.3f}",
79+
},
80+
False,
81+
)
82+
return LatexFormula(
83+
return_symbol=r"CHECK",
84+
result="OK" if bool(self) else r"\text{Not OK}",
85+
equation=_equation,
86+
numeric_equation=_numeric_equation,
87+
comparison_operator_label=r"\to",
88+
unit="",
89+
)
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
"""Formula 5.19 from EN 1993-5:2007: Chapter 5 - Ultimate limit state."""
2+
3+
from blueprints.codes.eurocode.en_1993_5_2007 import EN_1993_5_2007
4+
from blueprints.codes.formula import ComparisonFormula
5+
from blueprints.codes.latex_formula import LatexFormula, latex_replace_symbols
6+
from blueprints.type_alias import KN
7+
from blueprints.validations import raise_if_less_or_equal_to_zero
8+
9+
10+
class Form5Dot19CompressionCheckClass3Profiles(ComparisonFormula):
11+
r"""Class representing formula 5.19 for class 3 profiles: [$\frac{N_{Ed}}{N_{pl,Rd}} \leq 0.1$]."""
12+
13+
label = "5.19"
14+
source_document = EN_1993_5_2007
15+
16+
def __init__(
17+
self,
18+
n_ed: KN,
19+
n_pl_rd: KN,
20+
) -> None:
21+
r"""Compression check for class 3 profiles: design axial force [$N_{Ed}$] should not exceed 10% of plastic resistance [$N_{pl,Rd}$].
22+
23+
EN 1993-5:2007 art. 5.2.3 (10) - Formula (5.19)
24+
25+
Parameters
26+
----------
27+
n_ed : KN
28+
[$N_{Ed}$] Design value of the compression force [$kN$].
29+
n_pl_rd : KN
30+
[$N_{pl,Rd}$] Plastic design resistance of the cross-section [$kN$].
31+
"""
32+
super().__init__()
33+
self.n_ed = n_ed
34+
self.n_pl_rd = n_pl_rd
35+
36+
@staticmethod
37+
def _evaluate_lhs(
38+
n_ed: KN,
39+
n_pl_rd: KN,
40+
) -> float:
41+
"""Evaluates the left-hand side of the comparison; see __init__ for details."""
42+
raise_if_less_or_equal_to_zero(n_pl_rd=n_pl_rd)
43+
return n_ed / n_pl_rd
44+
45+
@staticmethod
46+
def _evaluate_rhs(*_, **_kwargs) -> float:
47+
"""Evaluates the right-hand side of the comparison; see __init__ for details."""
48+
return 0.1
49+
50+
@staticmethod
51+
def _evaluate(
52+
n_ed: KN,
53+
n_pl_rd: KN,
54+
) -> bool:
55+
"""Evaluates the comparison; see __init__ for details."""
56+
return (
57+
Form5Dot19CompressionCheckClass3Profiles._evaluate_lhs(n_ed=n_ed, n_pl_rd=n_pl_rd)
58+
<= Form5Dot19CompressionCheckClass3Profiles._evaluate_rhs()
59+
)
60+
61+
@property
62+
def unity_check(self) -> float:
63+
"""Returns the unity check value."""
64+
return self.lhs
65+
66+
def __bool__(self) -> bool:
67+
"""Allow truth-checking of the check object itself."""
68+
return self._evaluate(self.n_ed, self.n_pl_rd)
69+
70+
def latex(self) -> LatexFormula:
71+
"""Returns LatexFormula object for formula 5.19."""
72+
_equation: str = r"\frac{N_{Ed}}{N_{pl,Rd}} \leq 0.1"
73+
_numeric_equation: str = latex_replace_symbols(
74+
_equation,
75+
{
76+
r"N_{Ed}": f"{self.n_ed:.3f}",
77+
r"N_{pl,Rd}": f"{self.n_pl_rd:.3f}",
78+
},
79+
False,
80+
)
81+
return LatexFormula(
82+
return_symbol=r"CHECK",
83+
result="OK" if bool(self) else r"\text{Not OK}",
84+
equation=_equation,
85+
numeric_equation=_numeric_equation,
86+
comparison_operator_label=r"\to",
87+
unit="",
88+
)

docs/objects_overview/eurocode/nen_en_1993_5_2008/formulas.md renamed to docs/objects_overview/eurocode/ec3_1993_5_2007/formulas.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
**NEN-EN 1993-5 - februari 2008
1+
**EN 1993-5 - februari 2007
22
Eurocode 3: Design of steel structures
33
Part 5: Piling**
44

@@ -7,6 +7,8 @@ The table presents a list of formulas from the Eurocode 3 standards for steel st
77

88
Total of 63 formulas present.
99

10+
Total of 63 formulas present.
11+
1012
| Formula number | Done | Remarks | Object name |
1113
|:---------------|:------------------:|:--------|:-------------------------------------------------|
1214
| 5.1 | :x: | | |
@@ -25,9 +27,9 @@ Total of 63 formulas present.
2527
| 5.14 | :x: | | |
2628
| 5.15 | :x: | | |
2729
| 5.16 | :heavy_check_mark: | | Form5Dot16PlasticDesignResistance |
28-
| 5.17 | :x: | | |
29-
| 5.18 | :x: | | |
30-
| 5.19 | :x: | | |
30+
| 5.17 | :heavy_check_mark: | | Form5Dot17CompressionCheckZProfilesClass1And2 |
31+
| 5.18 | :heavy_check_mark: | | Form5Dot18CompressionCheckUProfilesClass1And2 |
32+
| 5.19 | :heavy_check_mark: | | Form5Dot19CompressionCheckClass3Profiles |
3133
| 5.20 | :heavy_check_mark: | | Form5Dot20ReducedMomentResistanceClass2ZProfiles |
3234
| 5.21 | :heavy_check_mark: | | Form5Dot21ReducedMomentResistanceClass2UProfiles |
3335
| 5.22 | :heavy_check_mark: | | Form5Dot22ReducedMomentResistanceClass3 |
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
"""Testing formula 5.17 of EN 1993-5:2007."""
2+
3+
import pytest
4+
5+
from blueprints.codes.eurocode.en_1993_5_2007.chapter_5_ultimate_limit_states.formula_5_17 import Form5Dot17CompressionCheckZProfilesClass1And2
6+
from blueprints.validations import LessOrEqualToZeroError, NegativeValueError
7+
8+
9+
class TestForm5Dot17CompressionCheckZProfilesClass1And2:
10+
"""Validation for formula 5.17 from EN 1993-5:2007."""
11+
12+
def test_evaluation(self) -> None:
13+
"""Tests the evaluation of the result."""
14+
# Example values
15+
n_ed = 12.0 # kN
16+
n_pl_rd = 200.0 # kN
17+
18+
# Object to test
19+
formula = Form5Dot17CompressionCheckZProfilesClass1And2(n_ed=n_ed, n_pl_rd=n_pl_rd)
20+
21+
# Expected result, manually calculated
22+
expected_result = True
23+
24+
assert formula == expected_result
25+
assert formula.unity_check == n_ed / n_pl_rd
26+
27+
@pytest.mark.parametrize(
28+
("n_ed", "n_pl_rd"),
29+
[
30+
(50.0, 0.0), # n_pl_rd is zero
31+
(50.0, -100.0), # n_pl_rd is negative
32+
],
33+
)
34+
def test_raise_error_when_invalid_values_are_given(self, n_ed: float, n_pl_rd: float) -> None:
35+
"""Test invalid values."""
36+
with pytest.raises((NegativeValueError, LessOrEqualToZeroError)):
37+
Form5Dot17CompressionCheckZProfilesClass1And2(n_ed=n_ed, n_pl_rd=n_pl_rd)
38+
39+
@pytest.mark.parametrize(
40+
("representation", "expected"),
41+
[
42+
(
43+
"complete",
44+
r"CHECK \to \frac{N_{Ed}}{N_{pl,Rd}} \leq 0.1 \to \frac{12.000}{200.000} \leq 0.1 \to OK",
45+
),
46+
("short", r"CHECK \to OK"),
47+
],
48+
)
49+
def test_latex(self, representation: str, expected: str) -> None:
50+
"""Test the latex representation of the formula."""
51+
# Example values
52+
n_ed = 12.0 # kN
53+
n_pl_rd = 200.0 # kN
54+
55+
# Object to test
56+
latex = Form5Dot17CompressionCheckZProfilesClass1And2(n_ed=n_ed, n_pl_rd=n_pl_rd).latex()
57+
58+
actual = {
59+
"complete": latex.complete,
60+
"short": latex.short,
61+
}
62+
63+
assert expected == actual[representation], f"{representation} representation failed."

0 commit comments

Comments
 (0)