Skip to content

Commit 0506933

Browse files
committed
Merge branch 'main' into 401-feature-request-add-formulas-from-chapter-589-from-nen_en_1992_1_1
# Conflicts: # docs/source/codes/eurocode/ec2_1992_1_1_2011/formulas.md
2 parents d531bac + e55791f commit 0506933

40 files changed

+2608
-22
lines changed

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
repos:
1919
- repo: https://github.com/astral-sh/ruff-pre-commit
20-
rev: v0.8.0
20+
rev: v0.8.4
2121
hooks:
2222
# Run the linter.
2323
- id: ruff
@@ -26,7 +26,7 @@ repos:
2626
- id: ruff-format
2727

2828
- repo: https://github.com/pre-commit/mirrors-mypy
29-
rev: v1.13.0
29+
rev: v1.14.0
3030
hooks:
3131
- id: mypy
3232
language_version: python3.12
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
"""Formula 5.21 from NEN-EN 1992-1-1+C2:2011: Chapter 5 - Structural Analysis."""
2+
3+
from blueprints.codes.eurocode.nen_en_1992_1_1_c2_2011 import NEN_EN_1992_1_1_C2_2011
4+
from blueprints.codes.formula import Formula
5+
from blueprints.codes.latex_formula import LatexFormula
6+
from blueprints.type_alias import DIMENSIONLESS, MM4, MPA
7+
from blueprints.validations import raise_if_negative
8+
9+
10+
class Form5Dot21NominalStiffness(Formula):
11+
"""Class representing formula 5.21 for the calculation of the nominal stiffness of slender compression members
12+
with arbitrary cross-section, :math:`EI` [:math:`Nmm^2`].
13+
"""
14+
15+
label = "5.21"
16+
source_document = NEN_EN_1992_1_1_C2_2011
17+
18+
def __init__(self, k_c: DIMENSIONLESS, e_cd: MPA, i_c: MM4, k_s: DIMENSIONLESS, e_s: MPA, i_s: MM4) -> None:
19+
r"""[:math:`EI`] Nominal stiffness of slender compression members with arbitrary cross-section.
20+
21+
NEN-EN 1992-1-1+C2:2011 art.5.8.7.2(2) or (3) - Formula (5.21)
22+
23+
Parameters
24+
----------
25+
k_c : DIMENSIONLESS
26+
[:math:`K_{c}`] is a factor for effects of cracking, creep etc. see 5.8.7.2 (2) or (3).
27+
e_cd : MPA
28+
[:math:`E_{cd}`] is the design value of the modulus of elasticity of concrete, see 5.8.6 (3)
29+
i_c : MPA
30+
[:math:`I_{c}`] is the moment of inertia of concrete cross section.
31+
k_s : DIMENSIONLESS
32+
[:math:`K_{s}`] is a factor for contribution of reinforcement, see 5.8.7.2 (2) or (3).
33+
e_s : MPA
34+
[:math:`E_{s}`] is the design value of the modulus of elasticity of reinforcement, 5.8.6 (3).
35+
i_s : MPA
36+
[:math:`I_{s}`] is the second moment of area of reinforcement, about the centre of area of the concrete.
37+
"""
38+
super().__init__()
39+
self.k_c = k_c
40+
self.e_cd = e_cd
41+
self.i_c = i_c
42+
self.k_s = k_s
43+
self.e_s = e_s
44+
self.i_s = i_s
45+
46+
@staticmethod
47+
def _evaluate(k_c: DIMENSIONLESS, e_cd: MPA, i_c: MPA, k_s: DIMENSIONLESS, e_s: MPA, i_s: MPA) -> MPA:
48+
"""Evaluates the formula, for more information see the __init__ method."""
49+
raise_if_negative(k_c=k_c, e_cd=e_cd, i_c=i_c, k_s=k_s, e_s=e_s, i_s=i_s)
50+
return k_c * e_cd * i_c + k_s * e_s * i_s
51+
52+
def latex(self) -> LatexFormula:
53+
"""Returns LatexFormula object for formula 5.21."""
54+
return LatexFormula(
55+
return_symbol=r"EI",
56+
result=f"{self:.3f}",
57+
equation=r"K_{c} \cdot E_{cd} \cdot I_{c} + K_{s} \cdot E_{s} \cdot I_{s}",
58+
numeric_equation=rf"{self.k_c:.3f} \cdot {self.e_cd:.3f} \cdot {self.i_c:.3f} + {self.k_s:.3f} \cdot {self.e_s:.3f} \cdot {self.i_s:.3f}",
59+
comparison_operator_label="=",
60+
)
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
"""Formula 5.22 from NEN-EN 1992-1-1+C2:2011: Chapter 5 - Structural Analysis."""
2+
3+
from blueprints.codes.eurocode.nen_en_1992_1_1_c2_2011 import NEN_EN_1992_1_1_C2_2011
4+
from blueprints.codes.formula import Formula
5+
from blueprints.codes.latex_formula import LatexFormula
6+
from blueprints.type_alias import DIMENSIONLESS
7+
from blueprints.validations import raise_if_less_or_equal_to_zero, raise_if_negative
8+
9+
10+
class Form5Dot22FactorKs(Formula):
11+
"""Class representing the factor K_s that represents the factor for contribution of reinforcement to the resistance."""
12+
13+
label = "5.22"
14+
source_document = NEN_EN_1992_1_1_C2_2011
15+
16+
def __init__(self, rho: float) -> None:
17+
r"""[:math:`K_s`] Factor K_s = 1.
18+
19+
NEN-EN 1992-1-1+C2:2011 art.5.8.7.2(2) - Formula (5.22)
20+
21+
Parameters
22+
----------
23+
rho : float
24+
[:math:`\rho`] Geometric reinforcement ratio, As/Ac. Must be >= 0.002.
25+
"""
26+
super().__init__()
27+
self.rho = rho
28+
29+
@staticmethod
30+
def _evaluate(rho: float) -> float:
31+
"""Evaluates the formula, for more information see the __init__ method."""
32+
if rho < 0.002:
33+
raise ValueError(f"Invalid rho: {rho}. rho cannot be less than 0.002")
34+
return 1.0
35+
36+
def latex(self) -> LatexFormula:
37+
"""Returns LatexFormula object for formula 5.22 K_s."""
38+
return LatexFormula(
39+
return_symbol=r"K_s",
40+
result=f"{self._evaluate(self.rho):.3f}",
41+
equation=r"1",
42+
numeric_equation="1",
43+
comparison_operator_label="=",
44+
)
45+
46+
47+
class Form5Dot22FactorKc(Formula):
48+
"""Class representing the factor K_c representing the factor for effects of cracking, creep, etc."""
49+
50+
label = "5.22"
51+
source_document = NEN_EN_1992_1_1_C2_2011
52+
53+
def __init__(self, k1: DIMENSIONLESS, k2: DIMENSIONLESS, phi_ef: DIMENSIONLESS, rho: float) -> None:
54+
r"""[:math:`K_c`] Factor K_c = k_1 * k_2 / (1 + \phi_{ef}).
55+
56+
NEN-EN 1992-1-1+C2:2011 art.5.8.7.2(2) - Formula (5.22)
57+
58+
Parameters
59+
----------
60+
k1 : DIMENSIONLESS
61+
[:math:`k_1`] Factor which depends on concrete strength class, Expression (5.23).
62+
k2 : DIMENSIONLESS
63+
[:math:`k_2`] Factor which depends on axial force and slenderness, Expression (5.24).
64+
phi_ef : DIMENSIONLESS
65+
[:math:`\phi_{ef}`] Effective creep ratio, see 5.8.4.
66+
rho : float
67+
[:math:`\rho`] Geometric reinforcement ratio, As/Ac. Must be >= 0.002.
68+
"""
69+
super().__init__()
70+
self.k1 = k1
71+
self.k2 = k2
72+
self.phi_ef = phi_ef
73+
self.rho = rho
74+
75+
@staticmethod
76+
def _evaluate(k1: DIMENSIONLESS, k2: DIMENSIONLESS, phi_ef: DIMENSIONLESS, rho: float) -> DIMENSIONLESS:
77+
"""Evaluates the formula, for more information see the __init__ method."""
78+
if rho < 0.002:
79+
raise ValueError(f"Invalid rho: {rho}. rho cannot be less than 0.002")
80+
raise_if_less_or_equal_to_zero(phi_ef=phi_ef)
81+
raise_if_negative(k1=k1, k2=k2)
82+
return k1 * k2 / (1 + phi_ef)
83+
84+
def latex(self) -> LatexFormula:
85+
"""Returns LatexFormula object for formula 5.22 K_c."""
86+
return LatexFormula(
87+
return_symbol=r"K_c",
88+
result=f"{self:.3f}",
89+
equation=r"\frac{k_1 \cdot k_2}{1 + \phi_{ef}}",
90+
numeric_equation=rf"\frac{{{self.k1:.3f} \cdot {self.k2:.3f}}}{{1 + {self.phi_ef:.3f}}}",
91+
comparison_operator_label="=",
92+
)
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
"""Formula 5.23 from NEN-EN 1992-1-1+C2:2011: Chapter 5 - Structural Analysis."""
2+
3+
from blueprints.codes.eurocode.nen_en_1992_1_1_c2_2011 import NEN_EN_1992_1_1_C2_2011
4+
from blueprints.codes.formula import Formula
5+
from blueprints.codes.latex_formula import LatexFormula
6+
from blueprints.type_alias import DIMENSIONLESS, MPA
7+
from blueprints.validations import raise_if_negative
8+
9+
10+
class Form5Dot23FactorConcreteStrengthClass(Formula):
11+
"""Class representing formula 5.23 for the calculation of the factor for concrete strength class, :math:`k_{1}`."""
12+
13+
label = "5.23"
14+
source_document = NEN_EN_1992_1_1_C2_2011
15+
16+
def __init__(self, f_ck: MPA) -> None:
17+
r"""[:math:`k_{1}`] Factor for concrete strength class.
18+
19+
NEN-EN 1992-1-1+C2:2011 art.5.8.6(3) - Formula (5.23)
20+
21+
Parameters
22+
----------
23+
f_ck : MPA
24+
[:math:`f_{ck}`] is the characteristic compressive strength of concrete.
25+
"""
26+
super().__init__()
27+
self.f_ck = f_ck
28+
29+
@staticmethod
30+
def _evaluate(f_ck: MPA) -> DIMENSIONLESS:
31+
"""Evaluates the formula, for more information see the __init__ method."""
32+
raise_if_negative(f_ck=f_ck)
33+
return (f_ck / 20) ** 0.5
34+
35+
def latex(self) -> LatexFormula:
36+
"""Returns LatexFormula object for formula 5.23."""
37+
return LatexFormula(
38+
return_symbol=r"k_{1}",
39+
result=f"{self:.3f}",
40+
equation=r"\sqrt{\frac{f_{ck}}{20}}",
41+
numeric_equation=rf"\sqrt{{\frac{{{self.f_ck:.3f}}}{{20}}}}",
42+
comparison_operator_label="=",
43+
)
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
"""Formula 5.24 from NEN-EN 1992-1-1+C2:2011: Chapter 5 - Structural Analysis."""
2+
3+
from blueprints.codes.eurocode.nen_en_1992_1_1_c2_2011 import NEN_EN_1992_1_1_C2_2011
4+
from blueprints.codes.formula import Formula
5+
from blueprints.codes.latex_formula import LatexFormula
6+
from blueprints.type_alias import DIMENSIONLESS
7+
from blueprints.validations import raise_if_negative
8+
9+
10+
class Form5Dot24AxialForceCorrectionFactor(Formula):
11+
"""Class representing formula 5.24 for the calculation of the axial force correction factor [:math:`k_{2}`]."""
12+
13+
label = "5.24"
14+
source_document = NEN_EN_1992_1_1_C2_2011
15+
16+
def __init__(
17+
self,
18+
n: DIMENSIONLESS,
19+
lambda_factor: DIMENSIONLESS,
20+
) -> None:
21+
"""[:math:`k_{2}`] Axial force correction factor.
22+
23+
NEN-EN 1992-1-1+C2:2011 art.5.8.3 - Formula (5.24)
24+
25+
Parameters
26+
----------
27+
n : DIMENSIONLESS
28+
[:math:`n`] Relative axial force, :math:`N_{ed} / (A_{c} * f_{cd})` [-].
29+
lambda_factor : DIMENSIONLESS
30+
[:math:`λ`] Slenderness ratio, see 5.8.3 [-].
31+
32+
Notes
33+
-----
34+
The value of :math:`k_{2}` cannot be larger than 0.20.
35+
"""
36+
super().__init__()
37+
self.n = n
38+
self.lambda_factor = lambda_factor
39+
40+
@staticmethod
41+
def _evaluate(n: DIMENSIONLESS, lambda_factor: DIMENSIONLESS) -> DIMENSIONLESS:
42+
"""Evaluates the formula, for more information see the __init__ method."""
43+
raise_if_negative(n=n, lambda_factor=lambda_factor)
44+
k2 = n * lambda_factor / 170
45+
return min(k2, 0.20)
46+
47+
def latex(self) -> LatexFormula:
48+
"""Returns LatexFormula object for formula 5.24."""
49+
return LatexFormula(
50+
return_symbol=r"k_2",
51+
result=f"{self:.3f}",
52+
equation=r"\min(0.20; n \cdot \frac{λ}{170})",
53+
numeric_equation=rf"\min(0.20; {self.n:.3f} \cdot \frac{{{self.lambda_factor:.3f}}}{{170}})",
54+
comparison_operator_label="=",
55+
)
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
"""Formula 5.25 from NEN-EN 1992-1-1+C2:2011: Chapter 5 - Structural Analysis."""
2+
3+
from blueprints.codes.eurocode.nen_en_1992_1_1_c2_2011 import NEN_EN_1992_1_1_C2_2011
4+
from blueprints.codes.formula import Formula
5+
from blueprints.codes.latex_formula import LatexFormula
6+
from blueprints.type_alias import DIMENSIONLESS
7+
from blueprints.validations import raise_if_negative
8+
9+
10+
class Form5Dot25AxialForceCorrectionFactor(Formula):
11+
"""Class representing formula 5.25 for the calculation of the axial force correction factor [:math:`k_{2}`]."""
12+
13+
label = "5.25"
14+
source_document = NEN_EN_1992_1_1_C2_2011
15+
16+
def __init__(self, n: DIMENSIONLESS) -> None:
17+
r"""[:math:`k_{2}`] Axial force correction factor.
18+
19+
NEN-EN 1992-1-1+C2:2011 art.5.8.6(3) - Formula (5.25)
20+
21+
Parameters
22+
----------
23+
n : DIMENSIONLESS
24+
[:math:`n`] Relative axial force, :math:`N_{ed} / (A_{c} * f_{cd})` [-].
25+
"""
26+
super().__init__()
27+
self.n = n
28+
29+
@staticmethod
30+
def _evaluate(n: DIMENSIONLESS) -> DIMENSIONLESS:
31+
"""Evaluates the formula, for more information see the __init__ method."""
32+
raise_if_negative(n=n)
33+
k2 = n * 0.30
34+
return min(k2, 0.20)
35+
36+
def latex(self) -> LatexFormula:
37+
"""Returns LatexFormula object for formula 5.25."""
38+
return LatexFormula(
39+
return_symbol=r"k_{2}",
40+
result=f"{self:.3f}",
41+
equation=r"\min(0.20; n \cdot 0.30)",
42+
numeric_equation=rf"\min(0.20; {self.n:.3f} \cdot 0.30)",
43+
comparison_operator_label="=",
44+
)

0 commit comments

Comments
 (0)