From 29e0f8048445f331c50cd494751ab0500529ab02 Mon Sep 17 00:00:00 2001 From: "Rick Goeij, de" Date: Tue, 26 Nov 2024 11:42:08 +0100 Subject: [PATCH 1/9] added 11_1 --- Pipfile | 26 +++++++ .../eurocode/pren_1995_1_1_2023/__init__.py | 3 + .../chapter_11_connections/__init__.py | 1 + .../chapter_11_connections/formula_11_1.py | 78 +++++++++++++++++++ .../eurocode/pren_1995_1_1_2023/__init__.py | 1 + .../chapter_11_connections/__init__.py | 0 .../test_formula_11_1.py | 78 +++++++++++++++++++ 7 files changed, 187 insertions(+) create mode 100644 Pipfile create mode 100644 blueprints/codes/eurocode/pren_1995_1_1_2023/__init__.py create mode 100644 blueprints/codes/eurocode/pren_1995_1_1_2023/chapter_11_connections/__init__.py create mode 100644 blueprints/codes/eurocode/pren_1995_1_1_2023/chapter_11_connections/formula_11_1.py create mode 100644 tests/codes/eurocode/pren_1995_1_1_2023/__init__.py create mode 100644 tests/codes/eurocode/pren_1995_1_1_2023/chapter_11_connections/__init__.py create mode 100644 tests/codes/eurocode/pren_1995_1_1_2023/chapter_11_connections/test_formula_11_1.py diff --git a/Pipfile b/Pipfile new file mode 100644 index 000000000..6323cbf56 --- /dev/null +++ b/Pipfile @@ -0,0 +1,26 @@ +[[source]] +url = "https://pypi.org/simple" +verify_ssl = true +name = "pypi" + +[packages] +matplotlib = ">=3.7.2" +plotly = ">=5.15.0" +pandas = ">=2.1.0" +shapely = ">=2.0.1" +numpy = ">=1.25.2" +mypy = "==1.13.0" +ruff = "==0.8.0" +pre-commit = "==4.0.1" +pytest = "==8.3.3" +pytest-cov = "==6.0.0" +pytest-describe = "==2.2.0" +pytest-pspec = "==0.0.4" +pytest-raises = "==0.11" +types-shapely = "==2.0.0.20241112" +pandas-stubs = "==2.2.3.241009" + +[dev-packages] + +[requires] +python_version = "3.10" diff --git a/blueprints/codes/eurocode/pren_1995_1_1_2023/__init__.py b/blueprints/codes/eurocode/pren_1995_1_1_2023/__init__.py new file mode 100644 index 000000000..0b0f33959 --- /dev/null +++ b/blueprints/codes/eurocode/pren_1995_1_1_2023/__init__.py @@ -0,0 +1,3 @@ +"""prEN 1995-1-1:2023.""" + +PREN_1995_1_1_2023 = "prEN 1995-1-1:2023" diff --git a/blueprints/codes/eurocode/pren_1995_1_1_2023/chapter_11_connections/__init__.py b/blueprints/codes/eurocode/pren_1995_1_1_2023/chapter_11_connections/__init__.py new file mode 100644 index 000000000..bf4f3193b --- /dev/null +++ b/blueprints/codes/eurocode/pren_1995_1_1_2023/chapter_11_connections/__init__.py @@ -0,0 +1 @@ +"""Module containing all formulas from prEN 1995-1-1-2023 Chapter 11 - Ultimate limit state.""" diff --git a/blueprints/codes/eurocode/pren_1995_1_1_2023/chapter_11_connections/formula_11_1.py b/blueprints/codes/eurocode/pren_1995_1_1_2023/chapter_11_connections/formula_11_1.py new file mode 100644 index 000000000..ee9c27863 --- /dev/null +++ b/blueprints/codes/eurocode/pren_1995_1_1_2023/chapter_11_connections/formula_11_1.py @@ -0,0 +1,78 @@ +"""Formula 11.1 from prEN 1995-1-1: Chapter 11 - Connections.""" + +from blueprints.codes.eurocode.pren_1995_1_1_2023 import PREN_1995_1_1_2023 +from blueprints.codes.formula import Formula +from blueprints.codes.latex_formula import LatexFormula, latex_replace_symbols +from blueprints.type_alias import DIMENSIONLESS, KN +from blueprints.validations import raise_if_less_or_equal_to_zero + + +class Form11Dot1AxialTensileResistance(Formula): + """Class representing formula 11.1 for axial tensile resistance of a fastener.""" + + label = "11.1" + source_document = PREN_1995_1_1_2023 + + def __init__( + self, + k_mod: DIMENSIONLESS, + gamma_r: DIMENSIONLESS, + f_pull_k: KN, + f_w_k: KN, + ) -> None: + r"""[:math:`F_{ax,t,d}`] Calculate the design axial tensile resistance of an axially-loaded fastener. + + Parameters + ---------- + k_mod : DIMENSIONLESS + [:math:`k_{mod}`] Modification factor for duration of load and moisture. + gamma_r : DIMENSIONLESS + [:math:`\\gamma_R`] Partial factor for resistance. + f_pull_k : KN + [:math:`F_{pull,k}`] Characteristic head pull-through resistance in [:math:`kN`]. + f_w_k : KN + [:math:`F_{w,k}`] Characteristic withdrawal resistance in [:math:`kN`]. + """ + super().__init__() + self.k_mod: float = k_mod + self.gamma_r: float = gamma_r + self.f_pull_k: float = f_pull_k + self.f_w_k: float = f_w_k + + @staticmethod + def _evaluate( + k_mod: DIMENSIONLESS, + gamma_r: DIMENSIONLESS, + f_pull_k: KN, + f_w_k: KN, + ) -> KN: + """Evaluates the formula for the design axial tensile resistance.""" + raise_if_less_or_equal_to_zero( + k_mod=k_mod, + gamma_r=gamma_r, + f_pull_k=f_pull_k, + f_w_k=f_w_k + ) + return k_mod / gamma_r * max(f_pull_k, f_w_k) + + def latex(self) -> LatexFormula: + """Returns LatexFormula object for formula 11.1.""" + _equation: str = r"\frac{k_{mod}}{\gamma_R} \cdot \max \left \{ \begin{array}{c}F_{pull,k} \\ F_{w,k} \end{array}}" + _numeric_equation: str = latex_replace_symbols( + _equation, + { + r"k_{mod}": f"{self.k_mod:.2f}", + r"gamma_R": f"{self.gamma_r:.2f}", + r"F_{pull,k}": f"{self.f_pull_k:.2f}", + r"F_{w,k}": f"{self.f_w_k:.2f}", + }, + True + ) + + return LatexFormula( + return_symbol=r"F_{ax,t,d}", + result=str(self), + equation=_equation, + numeric_equation=_numeric_equation, + comparison_operator_label="=", + ) diff --git a/tests/codes/eurocode/pren_1995_1_1_2023/__init__.py b/tests/codes/eurocode/pren_1995_1_1_2023/__init__.py new file mode 100644 index 000000000..8d2e8aaf3 --- /dev/null +++ b/tests/codes/eurocode/pren_1995_1_1_2023/__init__.py @@ -0,0 +1 @@ +"""Module containing all tests for prEN 1995-1-1-2023 Chapter 11 - Ultimate limit state.""" diff --git a/tests/codes/eurocode/pren_1995_1_1_2023/chapter_11_connections/__init__.py b/tests/codes/eurocode/pren_1995_1_1_2023/chapter_11_connections/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/tests/codes/eurocode/pren_1995_1_1_2023/chapter_11_connections/test_formula_11_1.py b/tests/codes/eurocode/pren_1995_1_1_2023/chapter_11_connections/test_formula_11_1.py new file mode 100644 index 000000000..850bd0c17 --- /dev/null +++ b/tests/codes/eurocode/pren_1995_1_1_2023/chapter_11_connections/test_formula_11_1.py @@ -0,0 +1,78 @@ +"""Tests for formula 11.1 from prEN 1995-1-1: Chapter 11 - Connections.""" + +import pytest +from pytest import approx + +from blueprints.codes.eurocode.pren_1995_1_1_2023.chapter_11_connections.formula_11_1 import Form11Dot1AxialTensileResistance +from blueprints.validations import LessOrEqualToZeroError, NegativeValueError + + +class TestForm11Dot1AxialTensileResistance: + """Validation for formula 11.1 from prEN 1995-1-1.""" + + @pytest.mark.parametrize( + ("k_mod", "gamma_r", "f_pull_k", "f_w_k", "expected"), + [ + (0.55, 1.3, 15, 1, 6.388), + (1.10, 1.3, 15, 1, 6.388), + (0.55, 1.3, 1, 15, 6.388), + (1.10, 1.3, 1, 15, 12.777), + ], + ) + def test_evaluation( + self, k_mod: float, gamma_r: float, f_pull_k: float, f_w_k: float, expected: float + ) -> None: + """Test the evaluation of the result.""" + form = Form11Dot1AxialTensileResistance( + k_mod=k_mod, gamma_r=gamma_r, f_pull_k=f_pull_k, f_w_k=f_w_k + ) + assert form.result == approx(expected, rel=1e-3) + + @pytest.mark.parametrize( + ("k_mod", "gamma_r", "f_pull_k", "f_w_k"), + [ + (-1.0, 1.2, 10.0, 10.0), + (1.0, -1.2, 10.0, 10.0), + (1.0, 1.2, -10.0, 10.0), + (1.0, 1.2, 10.0, -10.0), + ], + ) + def test_raise_error_when_less_or_equal_to_zero( + self, k_mod: float, gamma_r: float, f_pull_k: float, f_w_k: float + ) -> None: + """Test values that are less than or equal to zero for critical parameters.""" + with pytest.raises(LessOrEqualToZeroError): + Form11Dot1AxialTensileResistance( + k_mod=k_mod, gamma_r=gamma_r, f_pull_k=f_pull_k, f_w_k=f_w_k + ) + + @pytest.mark.parametrize( + ("representation", "expected"), + [ + ( + "complete", + r"F_{ax,t,d} = \frac{k_{mod}}{\gamma_R} \cdot \max \left \{ \begin{array}{c}F_{pull,k} \\ F_{w,k} \end{array} \right \} " + r"= \frac{0.90}{1.20} \cdot \max(15.00, 12.00) = 11.25", + ), + ("short", r"F_{ax,t,d} = 11.25"), + ], + ) + def test_latex(self, representation: str, expected: str) -> None: + """Test the LaTeX representation of the formula.""" + # Example values + k_mod = 0.9 + gamma_r = 1.2 + f_pull_k = 15.0 + f_w_k = 12.0 + + # Object to test + form_latex = Form11Dot1AxialTensileResistance( + k_mod=k_mod, gamma_r=gamma_r, f_pull_k=f_pull_k, f_w_k=f_w_k + ).latex() + + actual = { + "complete": form_latex.complete, + "short": form_latex.short, + } + + assert actual[representation] == expected, f"{representation} representation failed." From 7389297b6379baa198717b5647f6f23b8e3a4455 Mon Sep 17 00:00:00 2001 From: "Rick Goeij, de" Date: Tue, 26 Nov 2024 13:40:21 +0100 Subject: [PATCH 2/9] change readme table to HTML table --- README.md | 61 +++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 55 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 769d12460..fc8e3281d 100644 --- a/README.md +++ b/README.md @@ -120,12 +120,61 @@ Documentation is available at [blueprints.readthedocs.io](https://blueprints.rea This table serves as a quick navigator to the key elements of the code within Blueprints, offering immediate links to its formulas, tables, and figures for streamlined access and reference. -| Document | Description | Formulas | Tables | Figures | -|:---------------------------|:--------------------------------------------------------------------------------------------|:---------------------------------------------------------------:|:-------------------------------------------------------------:|:--------------------------------------------------------------:| -| NEN-EN 1992-1-1+C2:2011 | Eurocode 2: Design of concrete structures – Part 1-1: General rules and rules for buildings ([code](blueprints/codes/eurocode/nen_en_1992_1_1_c2_2011)) | [304](docs/source/codes/eurocode/ec2_1992_1_1_2011/formulas.md) | [38](docs/source/codes/eurocode/ec2_1992_1_1_2011/tables.md) | [104](docs/source/codes/eurocode/ec2_1992_1_1_2011/figures.md) | -| NEN-EN 1993-1-1+C2+A1:2016 | Eurocode 3: Design of steel structures – Part 1-1: General rules and rules for buildings ([code](blueprints/codes/eurocode/nen_en_1993_1_1_c2_a1_2016)) | [108](docs/source/codes/eurocode/ec3_1993_1_1_2016/formulas.md) | [20](docs/source/codes/eurocode/ec3_1993_1_1_2016/tables.md) | [28](docs/source/codes/eurocode/ec3_1993_1_1_2016/figures.md) | -| NEN 9997-1+C2:2017 | Eurocode 7: Geotechnical design of structures - Part 1: General rules ([code](blueprints/codes/eurocode/nen_9997_1_c2_2017)) | [88](docs/source/codes/eurocode/nen_9997_1_c2_2017/formulas.md) | [11](docs/source/codes/eurocode/nen_9997_1_c2_2017/tables.md) | [25](docs/source/codes/eurocode/nen_9997_1_c2_2017/figures.md) | -| NEN-EN 1993-5:2008 | Eurocode 3: Design of steel structures – Part 5: Piling ([code](blueprints/codes/eurocode/nen_en_1993_5_2008)) | [63](docs/source/codes/eurocode/nen_en_1993_5_2008/formulas.md) | [0](docs/source/codes/eurocode/nen_en_1993_5_2008/tables.md) | [0](docs/source/codes/eurocode/nen_en_1993_5_2008/figures.md) | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
DocumentDescriptionFormulasTablesFigures
NEN-EN 1992-1-1+C2:2011 + Eurocode 2: Design of concrete structures – Part 1-1: General rules and rules for buildings + (code) + 30438104
NEN-EN 1993-1-1+C2+A1:2016 + NEN-EN 1993-1-1+C2+A1:2016 | Eurocode 3: Design of steel structures – Part 1-1: General rules and rules for buildings + (code) + 1082028
NEN-EN 1993-5:2008 + Eurocode 3: Design of steel structures – Part 5: Piling + (code) + 6300
NEN 9997-1+C2:2017 + Eurocode 7: Geotechnical design of structures - Part 1: General rules + (code) + 881125
+ ## Contributing From 4969306d26263b9568d9b4000fb4b882c34a9b7f Mon Sep 17 00:00:00 2001 From: "Rick Goeij, de" Date: Tue, 26 Nov 2024 13:45:33 +0100 Subject: [PATCH 3/9] added to documentation upcoming features --- docs/source/index.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/source/index.rst b/docs/source/index.rst index 33d933335..45ebc3368 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -46,6 +46,7 @@ Our mission is to reduce the cost and time associated with civil engineering cal * NEN-EN 1993-1-1+C2+A1:2016 🚧 * NEN-EN 1993-1-9+C2:2012 🚧 * NEN-EN 1993-5:2008 🚧 + * prEN-EN 1995-1-1:2023 🚧 * NEN 9997-1+C2:2017 🚧 * Reinforced Concrete Section 🚧 From 0fde7c41eb39af1b96306e98d4d76166d7e12010 Mon Sep 17 00:00:00 2001 From: "Rick Goeij, de" Date: Tue, 26 Nov 2024 13:51:48 +0100 Subject: [PATCH 4/9] added documentation prEN 1995-1-1 --- .../codes/eurocode/pren_1995_1_1_2023/figures.md | 10 ++++++++++ .../codes/eurocode/pren_1995_1_1_2023/formulas.md | 11 +++++++++++ .../codes/eurocode/pren_1995_1_1_2023/tables.md | 11 +++++++++++ 3 files changed, 32 insertions(+) create mode 100644 docs/source/codes/eurocode/pren_1995_1_1_2023/figures.md create mode 100644 docs/source/codes/eurocode/pren_1995_1_1_2023/formulas.md create mode 100644 docs/source/codes/eurocode/pren_1995_1_1_2023/tables.md diff --git a/docs/source/codes/eurocode/pren_1995_1_1_2023/figures.md b/docs/source/codes/eurocode/pren_1995_1_1_2023/figures.md new file mode 100644 index 000000000..257ab7ce2 --- /dev/null +++ b/docs/source/codes/eurocode/pren_1995_1_1_2023/figures.md @@ -0,0 +1,10 @@ +**prEN 1995-1-1 - September 2023 +Eurocode 5: Design of Timber structures +Part 1-1: General rules and rules for building** + +The table presents a list of figures from the Eurocode 5 standards for timber structures, tracking their implementation status (:x: or :heavy_check_mark:) and any pertinent remarks. The 'Object Name' column references the corresponding Python entities inside of Blueprints. + +Total of 0 figures present. + +| Figure number | Done | Remarks | Object name | +|:--------------|:----:|:--------|:------------| diff --git a/docs/source/codes/eurocode/pren_1995_1_1_2023/formulas.md b/docs/source/codes/eurocode/pren_1995_1_1_2023/formulas.md new file mode 100644 index 000000000..798c25ab6 --- /dev/null +++ b/docs/source/codes/eurocode/pren_1995_1_1_2023/formulas.md @@ -0,0 +1,11 @@ +**prEN 1995-1-1 - September 2023 +Eurocode 5: Design of Timber structures +Part 1-1: General rules and rules for building** + +The table presents a list of formulas from the Eurocode 5 standards for timber structures, tracking their implementation status (:x: or :heavy_check_mark:) and any pertinent remarks. The 'Object Name' column references the corresponding Python entities inside of Blueprints. + +Total of 1 formulas present. + +| Formula number | Done | Remarks | Object name | +|:---------------|:----:|:--------|:------------| +| 11.1 | :heavy_check_mark: | | Form11Dot1AxialTensileResistance | diff --git a/docs/source/codes/eurocode/pren_1995_1_1_2023/tables.md b/docs/source/codes/eurocode/pren_1995_1_1_2023/tables.md new file mode 100644 index 000000000..c4cfddd0e --- /dev/null +++ b/docs/source/codes/eurocode/pren_1995_1_1_2023/tables.md @@ -0,0 +1,11 @@ +**prEN 1995-1-1 - September 2023 +Eurocode 5: Design of Timber structures +Part 1-1: General rules and rules for building** + +The table presents a list of tables from the Eurocode 5 standards for timber structures, tracking their implementation status (:x: or :heavy_check_mark:) and any pertinent remarks. The 'Object Name' column references the corresponding Python entities inside of Blueprints. + +Total of 0 tables present. + +| Table number | Done | Remarks | Object name | +|:-------------|:----:|:--------|:------------| +| 11.1 | :heavy_check_mark: | | Form11Dot1AxialTensileResistance | From be6196604c0aaf8ddc6411fe12ee44c87a119cc5 Mon Sep 17 00:00:00 2001 From: "Rick Goeij, de" Date: Tue, 26 Nov 2024 14:03:08 +0100 Subject: [PATCH 5/9] tweak docstring and fix unittest --- .../chapter_11_connections/formula_11_1.py | 7 ++-- .../test_formula_11_1.py | 36 ++++++++----------- 2 files changed, 19 insertions(+), 24 deletions(-) diff --git a/blueprints/codes/eurocode/pren_1995_1_1_2023/chapter_11_connections/formula_11_1.py b/blueprints/codes/eurocode/pren_1995_1_1_2023/chapter_11_connections/formula_11_1.py index ee9c27863..864621765 100644 --- a/blueprints/codes/eurocode/pren_1995_1_1_2023/chapter_11_connections/formula_11_1.py +++ b/blueprints/codes/eurocode/pren_1995_1_1_2023/chapter_11_connections/formula_11_1.py @@ -24,8 +24,8 @@ def __init__( Parameters ---------- - k_mod : DIMENSIONLESS - [:math:`k_{mod}`] Modification factor for duration of load and moisture. + k_mod : DIMENSIONLESS. + [:math:`k_{mod}`] Modification factor accounting for the effect of the duration of load and moisture gamma_r : DIMENSIONLESS [:math:`\\gamma_R`] Partial factor for resistance. f_pull_k : KN @@ -62,7 +62,7 @@ def latex(self) -> LatexFormula: _equation, { r"k_{mod}": f"{self.k_mod:.2f}", - r"gamma_R": f"{self.gamma_r:.2f}", + r"\gamma_R": f"{self.gamma_r:.2f}", r"F_{pull,k}": f"{self.f_pull_k:.2f}", r"F_{w,k}": f"{self.f_w_k:.2f}", }, @@ -75,4 +75,5 @@ def latex(self) -> LatexFormula: equation=_equation, numeric_equation=_numeric_equation, comparison_operator_label="=", + unit="kN" ) diff --git a/tests/codes/eurocode/pren_1995_1_1_2023/chapter_11_connections/test_formula_11_1.py b/tests/codes/eurocode/pren_1995_1_1_2023/chapter_11_connections/test_formula_11_1.py index 850bd0c17..1d2b2f510 100644 --- a/tests/codes/eurocode/pren_1995_1_1_2023/chapter_11_connections/test_formula_11_1.py +++ b/tests/codes/eurocode/pren_1995_1_1_2023/chapter_11_connections/test_formula_11_1.py @@ -1,10 +1,9 @@ """Tests for formula 11.1 from prEN 1995-1-1: Chapter 11 - Connections.""" import pytest -from pytest import approx from blueprints.codes.eurocode.pren_1995_1_1_2023.chapter_11_connections.formula_11_1 import Form11Dot1AxialTensileResistance -from blueprints.validations import LessOrEqualToZeroError, NegativeValueError +from blueprints.validations import LessOrEqualToZeroError class TestForm11Dot1AxialTensileResistance: @@ -13,10 +12,10 @@ class TestForm11Dot1AxialTensileResistance: @pytest.mark.parametrize( ("k_mod", "gamma_r", "f_pull_k", "f_w_k", "expected"), [ - (0.55, 1.3, 15, 1, 6.388), - (1.10, 1.3, 15, 1, 6.388), - (0.55, 1.3, 1, 15, 6.388), - (1.10, 1.3, 1, 15, 12.777), + (0.55, 1.3, 15, 1, 6.35), + (1.10, 1.3, 15, 1, 12.69), + (0.55, 1.3, 1, 15, 6.35), + (1.10, 1.3, 1, 15, 12.69), ], ) def test_evaluation( @@ -26,7 +25,7 @@ def test_evaluation( form = Form11Dot1AxialTensileResistance( k_mod=k_mod, gamma_r=gamma_r, f_pull_k=f_pull_k, f_w_k=f_w_k ) - assert form.result == approx(expected, rel=1e-3) + assert form == pytest.approx(expected, rel=1e-3) @pytest.mark.parametrize( ("k_mod", "gamma_r", "f_pull_k", "f_w_k"), @@ -40,32 +39,27 @@ def test_evaluation( def test_raise_error_when_less_or_equal_to_zero( self, k_mod: float, gamma_r: float, f_pull_k: float, f_w_k: float ) -> None: - """Test values that are less than or equal to zero for critical parameters.""" + """Test values that are less than or equal to zero raise error.""" with pytest.raises(LessOrEqualToZeroError): Form11Dot1AxialTensileResistance( k_mod=k_mod, gamma_r=gamma_r, f_pull_k=f_pull_k, f_w_k=f_w_k ) @pytest.mark.parametrize( - ("representation", "expected"), + ("k_mod", "gamma_r", "f_pull_k", "f_w_k", "representation", "expected"), [ ( - "complete", - r"F_{ax,t,d} = \frac{k_{mod}}{\gamma_R} \cdot \max \left \{ \begin{array}{c}F_{pull,k} \\ F_{w,k} \end{array} \right \} " - r"= \frac{0.90}{1.20} \cdot \max(15.00, 12.00) = 11.25", + 0.9, 1.2, 15, 12, "complete", + r"F_{ax,t,d} = \frac{k_{mod}}{\gamma_R} \cdot \max \left \{ \begin{array}{c}F_{pull,k} \\ F_{w,k} \end{array}}" + r" = \frac{0.90}{1.20} \cdot \max \left \{ \begin{array}{c}15.00 \\ 12.00 \end{array}} = 11.25 kN" ), - ("short", r"F_{ax,t,d} = 11.25"), + (0.9, 1.2, 15, 12, "short", r"F_{ax,t,d} = 11.25 kN"), ], ) - def test_latex(self, representation: str, expected: str) -> None: + def test_latex( + self, k_mod: float, gamma_r: float, f_pull_k: float, f_w_k: float ,representation: str, expected: str + ) -> None: """Test the LaTeX representation of the formula.""" - # Example values - k_mod = 0.9 - gamma_r = 1.2 - f_pull_k = 15.0 - f_w_k = 12.0 - - # Object to test form_latex = Form11Dot1AxialTensileResistance( k_mod=k_mod, gamma_r=gamma_r, f_pull_k=f_pull_k, f_w_k=f_w_k ).latex() From 3ac0027344827df34c17a6e8e8f652b230d9912b Mon Sep 17 00:00:00 2001 From: "Rick Goeij, de" Date: Tue, 26 Nov 2024 14:36:29 +0100 Subject: [PATCH 6/9] removed from tables --- docs/source/codes/eurocode/pren_1995_1_1_2023/tables.md | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/source/codes/eurocode/pren_1995_1_1_2023/tables.md b/docs/source/codes/eurocode/pren_1995_1_1_2023/tables.md index c4cfddd0e..6c2e794d8 100644 --- a/docs/source/codes/eurocode/pren_1995_1_1_2023/tables.md +++ b/docs/source/codes/eurocode/pren_1995_1_1_2023/tables.md @@ -8,4 +8,3 @@ Total of 0 tables present. | Table number | Done | Remarks | Object name | |:-------------|:----:|:--------|:------------| -| 11.1 | :heavy_check_mark: | | Form11Dot1AxialTensileResistance | From faa89c37bc7aa56c0db25498912707b48b23df90 Mon Sep 17 00:00:00 2001 From: "Rick Goeij, de" Date: Tue, 26 Nov 2024 14:38:39 +0100 Subject: [PATCH 7/9] fix documentation --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ac6b5a295..c68c43cf3 100644 --- a/README.md +++ b/README.md @@ -167,7 +167,7 @@ figures for streamlined access and reference. Eurocode 5: Design of timber structures – Part 1-1: General rules and rules for buildings (code) - 63 + 1 0 0 From 10a844d3f76c8b20e2f922e0e29d4e9c919fcca3 Mon Sep 17 00:00:00 2001 From: "Rick Goeij, de" Date: Tue, 26 Nov 2024 14:43:01 +0100 Subject: [PATCH 8/9] added docstrings init files --- .../pren_1995_1_1_2023/chapter_11_connections/__init__.py | 2 +- tests/codes/eurocode/pren_1995_1_1_2023/__init__.py | 2 +- .../pren_1995_1_1_2023/chapter_11_connections/__init__.py | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/blueprints/codes/eurocode/pren_1995_1_1_2023/chapter_11_connections/__init__.py b/blueprints/codes/eurocode/pren_1995_1_1_2023/chapter_11_connections/__init__.py index bf4f3193b..694a86135 100644 --- a/blueprints/codes/eurocode/pren_1995_1_1_2023/chapter_11_connections/__init__.py +++ b/blueprints/codes/eurocode/pren_1995_1_1_2023/chapter_11_connections/__init__.py @@ -1 +1 @@ -"""Module containing all formulas from prEN 1995-1-1-2023 Chapter 11 - Ultimate limit state.""" +"""Module containing all formulas from prEN 1995-1-1-2023 Chapter 11 - Connections.""" diff --git a/tests/codes/eurocode/pren_1995_1_1_2023/__init__.py b/tests/codes/eurocode/pren_1995_1_1_2023/__init__.py index 8d2e8aaf3..7a3e0b3e5 100644 --- a/tests/codes/eurocode/pren_1995_1_1_2023/__init__.py +++ b/tests/codes/eurocode/pren_1995_1_1_2023/__init__.py @@ -1 +1 @@ -"""Module containing all tests for prEN 1995-1-1-2023 Chapter 11 - Ultimate limit state.""" +"""Module containing all tests for prEN 1995-1-1-2023.""" diff --git a/tests/codes/eurocode/pren_1995_1_1_2023/chapter_11_connections/__init__.py b/tests/codes/eurocode/pren_1995_1_1_2023/chapter_11_connections/__init__.py index e69de29bb..083488646 100644 --- a/tests/codes/eurocode/pren_1995_1_1_2023/chapter_11_connections/__init__.py +++ b/tests/codes/eurocode/pren_1995_1_1_2023/chapter_11_connections/__init__.py @@ -0,0 +1 @@ +"""Module containing all tests from prEN 1995-1-1-2023 Chapter 11 - Connections.""" From 67c10cc45e3689852383c0924471f66204b2b33a Mon Sep 17 00:00:00 2001 From: "Rick Goeij, de" Date: Wed, 27 Nov 2024 11:41:10 +0100 Subject: [PATCH 9/9] fix formatting --- .../chapter_11_connections/formula_11_1.py | 11 ++----- .../test_formula_11_1.py | 32 +++++++------------ 2 files changed, 15 insertions(+), 28 deletions(-) diff --git a/blueprints/codes/eurocode/pren_1995_1_1_2023/chapter_11_connections/formula_11_1.py b/blueprints/codes/eurocode/pren_1995_1_1_2023/chapter_11_connections/formula_11_1.py index 864621765..b79440ca2 100644 --- a/blueprints/codes/eurocode/pren_1995_1_1_2023/chapter_11_connections/formula_11_1.py +++ b/blueprints/codes/eurocode/pren_1995_1_1_2023/chapter_11_connections/formula_11_1.py @@ -47,12 +47,7 @@ def _evaluate( f_w_k: KN, ) -> KN: """Evaluates the formula for the design axial tensile resistance.""" - raise_if_less_or_equal_to_zero( - k_mod=k_mod, - gamma_r=gamma_r, - f_pull_k=f_pull_k, - f_w_k=f_w_k - ) + raise_if_less_or_equal_to_zero(k_mod=k_mod, gamma_r=gamma_r, f_pull_k=f_pull_k, f_w_k=f_w_k) return k_mod / gamma_r * max(f_pull_k, f_w_k) def latex(self) -> LatexFormula: @@ -66,7 +61,7 @@ def latex(self) -> LatexFormula: r"F_{pull,k}": f"{self.f_pull_k:.2f}", r"F_{w,k}": f"{self.f_w_k:.2f}", }, - True + True, ) return LatexFormula( @@ -75,5 +70,5 @@ def latex(self) -> LatexFormula: equation=_equation, numeric_equation=_numeric_equation, comparison_operator_label="=", - unit="kN" + unit="kN", ) diff --git a/tests/codes/eurocode/pren_1995_1_1_2023/chapter_11_connections/test_formula_11_1.py b/tests/codes/eurocode/pren_1995_1_1_2023/chapter_11_connections/test_formula_11_1.py index 1d2b2f510..ae7241c08 100644 --- a/tests/codes/eurocode/pren_1995_1_1_2023/chapter_11_connections/test_formula_11_1.py +++ b/tests/codes/eurocode/pren_1995_1_1_2023/chapter_11_connections/test_formula_11_1.py @@ -18,13 +18,9 @@ class TestForm11Dot1AxialTensileResistance: (1.10, 1.3, 1, 15, 12.69), ], ) - def test_evaluation( - self, k_mod: float, gamma_r: float, f_pull_k: float, f_w_k: float, expected: float - ) -> None: + def test_evaluation(self, k_mod: float, gamma_r: float, f_pull_k: float, f_w_k: float, expected: float) -> None: """Test the evaluation of the result.""" - form = Form11Dot1AxialTensileResistance( - k_mod=k_mod, gamma_r=gamma_r, f_pull_k=f_pull_k, f_w_k=f_w_k - ) + form = Form11Dot1AxialTensileResistance(k_mod=k_mod, gamma_r=gamma_r, f_pull_k=f_pull_k, f_w_k=f_w_k) assert form == pytest.approx(expected, rel=1e-3) @pytest.mark.parametrize( @@ -36,33 +32,29 @@ def test_evaluation( (1.0, 1.2, 10.0, -10.0), ], ) - def test_raise_error_when_less_or_equal_to_zero( - self, k_mod: float, gamma_r: float, f_pull_k: float, f_w_k: float - ) -> None: + def test_raise_error_when_less_or_equal_to_zero(self, k_mod: float, gamma_r: float, f_pull_k: float, f_w_k: float) -> None: """Test values that are less than or equal to zero raise error.""" with pytest.raises(LessOrEqualToZeroError): - Form11Dot1AxialTensileResistance( - k_mod=k_mod, gamma_r=gamma_r, f_pull_k=f_pull_k, f_w_k=f_w_k - ) + Form11Dot1AxialTensileResistance(k_mod=k_mod, gamma_r=gamma_r, f_pull_k=f_pull_k, f_w_k=f_w_k) @pytest.mark.parametrize( ("k_mod", "gamma_r", "f_pull_k", "f_w_k", "representation", "expected"), [ ( - 0.9, 1.2, 15, 12, "complete", + 0.9, + 1.2, + 15, + 12, + "complete", r"F_{ax,t,d} = \frac{k_{mod}}{\gamma_R} \cdot \max \left \{ \begin{array}{c}F_{pull,k} \\ F_{w,k} \end{array}}" - r" = \frac{0.90}{1.20} \cdot \max \left \{ \begin{array}{c}15.00 \\ 12.00 \end{array}} = 11.25 kN" + r" = \frac{0.90}{1.20} \cdot \max \left \{ \begin{array}{c}15.00 \\ 12.00 \end{array}} = 11.25 kN", ), (0.9, 1.2, 15, 12, "short", r"F_{ax,t,d} = 11.25 kN"), ], ) - def test_latex( - self, k_mod: float, gamma_r: float, f_pull_k: float, f_w_k: float ,representation: str, expected: str - ) -> None: + def test_latex(self, k_mod: float, gamma_r: float, f_pull_k: float, f_w_k: float, representation: str, expected: str) -> None: """Test the LaTeX representation of the formula.""" - form_latex = Form11Dot1AxialTensileResistance( - k_mod=k_mod, gamma_r=gamma_r, f_pull_k=f_pull_k, f_w_k=f_w_k - ).latex() + form_latex = Form11Dot1AxialTensileResistance(k_mod=k_mod, gamma_r=gamma_r, f_pull_k=f_pull_k, f_w_k=f_w_k).latex() actual = { "complete": form_latex.complete,