From f38162f7ddbf81dbce809faba3067609fc301eff Mon Sep 17 00:00:00 2001 From: PetervWestrienen Date: Thu, 28 Dec 2023 10:04:54 +0100 Subject: [PATCH 1/5] (#100) updated docs according to new EC --- README.md | 10 +++++----- .../codes/eurocode/ec7_1997_1_2016/formulas.md | 17 ++--------------- 2 files changed, 7 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index 87508a1c..a1c4a0f5 100644 --- a/README.md +++ b/README.md @@ -47,11 +47,11 @@ 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 equations, 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 | [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 | [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-EN 1997-1+C1+A1:2016 | Eurocode 7: Geotechnical design - Part 1: General rules | [102](docs/source/codes/eurocode/ec7_1997_1_2016/formulas.md) | [11](docs/source/codes/eurocode/ec7_1997_1_2016/tables.md) | [25](docs/source/codes/eurocode/ec7_1997_1_2016/figures.md) | +| 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 | [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 | [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-EN 9997-1+C2:2017 | Eurocode 7: Geotechnical design - Part 1: General rules | [88](docs/source/codes/eurocode/ec7_1997_1_2016/formulas.md) | [11](docs/source/codes/eurocode/ec7_1997_1_2016/tables.md) | [25](docs/source/codes/eurocode/ec7_1997_1_2016/figures.md) | ## Contributing diff --git a/docs/source/codes/eurocode/ec7_1997_1_2016/formulas.md b/docs/source/codes/eurocode/ec7_1997_1_2016/formulas.md index 2a4cbb6e..9d631b26 100644 --- a/docs/source/codes/eurocode/ec7_1997_1_2016/formulas.md +++ b/docs/source/codes/eurocode/ec7_1997_1_2016/formulas.md @@ -1,11 +1,11 @@ -**NEN-EN 1997- 1+C1+A1 - June 2016 +**NEN-EN 9997-1+C2 - November 2017 Eurocode 7: Geotechnical design Part 1: General rules** The table presents a list of equations from the Eurocode 7 standards for geotechnical design, 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 102 equations present. +Total of 88 equations present. | Equation number | Done | Remarks | Object name | |:----------------|:----:|:--------|:------------| @@ -67,19 +67,6 @@ Total of 102 equations present. | 8.14 | :x: | | | | 9.1 | :x: | | | | 9.2 | :x: | | | -| A.9 | :x: | | | -| A.10 | :x: | | | -| A.11 | :x: | | | -| A.12 | :x: | | | -| A.13 | :x: | | | -| A.14 | :x: | | | -| A.15 | :x: | | | -| A.16 | :x: | | | -| A.17 | :x: | | | -| A.18 | :x: | | | -| A.19 | :x: | | | -| A.20 | :x: | | | -| A.21 | :x: | | | | B.1 | :x: | | | | B.2 | :x: | | | | B.3.1 | :x: | | | From f85216476b3097d9a334e4418b885b9d131ea13f Mon Sep 17 00:00:00 2001 From: PetervWestrienen Date: Thu, 28 Dec 2023 10:06:37 +0100 Subject: [PATCH 2/5] (#100) updated docs according to new EC --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index fc701671..4cd6ddfe 100644 --- a/README.md +++ b/README.md @@ -47,11 +47,11 @@ 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 equations, tables, and figures for streamlined access and reference. -| Document | Description | Formulas | Tables | Figures | -|:---------------------------|:--------------------------------------------------------------------------------------------|:----------------------------------------------------------------:|:------------------------------------------------------------:|:--------------------------------------------------------------:| +| 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 | [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 | [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 | [102](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 9997-1+C2:2017 | Eurocode 7: Geotechnical design of structures - Part 1: General rules | [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) | ## Contributing From 3db50e5c98910ebb9ed04de37b5318447d6b8729 Mon Sep 17 00:00:00 2001 From: PetervWestrienen Date: Thu, 28 Dec 2023 10:26:04 +0100 Subject: [PATCH 3/5] (#100) added 2.1b --- .../__init__.py | 1 + .../formula_2_1_b.py | 36 ++++++++++++++++++ .../eurocode/nen_9997_1_c2_2017/__init__.py | 1 + .../__init__.py | 1 + .../test_formula_2_1_b.py | 38 +++++++++++++++++++ 5 files changed, 77 insertions(+) create mode 100644 blueprints/codes/eurocode/nen_9997_1_c2_2017/chapter_2_basic_of_geotechnical_design/__init__.py create mode 100644 blueprints/codes/eurocode/nen_9997_1_c2_2017/chapter_2_basic_of_geotechnical_design/formula_2_1_b.py create mode 100644 tests/codes/eurocode/nen_9997_1_c2_2017/__init__.py create mode 100644 tests/codes/eurocode/nen_9997_1_c2_2017/chapter_2_basic_of_geotechnical_design/__init__.py create mode 100644 tests/codes/eurocode/nen_9997_1_c2_2017/chapter_2_basic_of_geotechnical_design/test_formula_2_1_b.py diff --git a/blueprints/codes/eurocode/nen_9997_1_c2_2017/chapter_2_basic_of_geotechnical_design/__init__.py b/blueprints/codes/eurocode/nen_9997_1_c2_2017/chapter_2_basic_of_geotechnical_design/__init__.py new file mode 100644 index 00000000..b66254a0 --- /dev/null +++ b/blueprints/codes/eurocode/nen_9997_1_c2_2017/chapter_2_basic_of_geotechnical_design/__init__.py @@ -0,0 +1 @@ +"""Package contains the formulas from chapter 2: Basic of geotechnical design of NEN 9997-1+C2:2017.""" diff --git a/blueprints/codes/eurocode/nen_9997_1_c2_2017/chapter_2_basic_of_geotechnical_design/formula_2_1_b.py b/blueprints/codes/eurocode/nen_9997_1_c2_2017/chapter_2_basic_of_geotechnical_design/formula_2_1_b.py new file mode 100644 index 00000000..1fe38c5f --- /dev/null +++ b/blueprints/codes/eurocode/nen_9997_1_c2_2017/chapter_2_basic_of_geotechnical_design/formula_2_1_b.py @@ -0,0 +1,36 @@ +""""Formula 2.1b from NEN 9997-1+C2:2017: Chapter 2: Basis of geotechnical design.""" +from blueprints.codes.formula import Formula +from blueprints.type_alias import DIMENSIONLESS +from blueprints.validations import raise_if_negative + + +class Form2Dot1BRepresentativeValue(Formula): + """Class representing formula 2.1b for the calculation of the representative value :math:`F_{rep}` of actions.""" + + label = "2.1b" + source_document = "NEN 9997-1+C2:2017" + + def __init__(self, psi: DIMENSIONLESS, f_k: float) -> None: + """[:math:`F_{rep}`] Representative value of actions. + + NEN 9997-1+C2:2017 art.2.4.6.1(2) - Formula (2.1b) + + Parameters + ---------- + psi : DIMENSIONLESS + [:math:`Ψ`] factor for converting the characteristic value to the representative value [-]. + f_k : float + [:math:`F_{k}`] Characteristic value of actions. + """ + super().__init__() + self.psi = psi + self.f_k = f_k + + @staticmethod + def _evaluate( + psi: DIMENSIONLESS, + f_k: float, + ) -> float: + """Evaluates the formula, for more information see the __init__ method.""" + raise_if_negative(psi=psi, f_k=f_k) + return psi * f_k diff --git a/tests/codes/eurocode/nen_9997_1_c2_2017/__init__.py b/tests/codes/eurocode/nen_9997_1_c2_2017/__init__.py new file mode 100644 index 00000000..62635da0 --- /dev/null +++ b/tests/codes/eurocode/nen_9997_1_c2_2017/__init__.py @@ -0,0 +1 @@ +"""Package contains tests for the formulas of NEN 9997-1-C2:2017.""" diff --git a/tests/codes/eurocode/nen_9997_1_c2_2017/chapter_2_basic_of_geotechnical_design/__init__.py b/tests/codes/eurocode/nen_9997_1_c2_2017/chapter_2_basic_of_geotechnical_design/__init__.py new file mode 100644 index 00000000..557a8757 --- /dev/null +++ b/tests/codes/eurocode/nen_9997_1_c2_2017/chapter_2_basic_of_geotechnical_design/__init__.py @@ -0,0 +1 @@ +"""Package contains the tests for the formulas from chapter 2: Basic of geotechnical design of NEN 9997-1+C2:2017.""" diff --git a/tests/codes/eurocode/nen_9997_1_c2_2017/chapter_2_basic_of_geotechnical_design/test_formula_2_1_b.py b/tests/codes/eurocode/nen_9997_1_c2_2017/chapter_2_basic_of_geotechnical_design/test_formula_2_1_b.py new file mode 100644 index 00000000..f53caf90 --- /dev/null +++ b/tests/codes/eurocode/nen_9997_1_c2_2017/chapter_2_basic_of_geotechnical_design/test_formula_2_1_b.py @@ -0,0 +1,38 @@ +""""Testing Formula 2.1b from NEN 9997-1+C2:2017: Chapter 2: Basis of geotechnical design.""" +import pytest + +from blueprints.codes.eurocode.nen_9997_1_c2_2017.chapter_2_basic_of_geotechnical_design.formula_2_1_b import Form2Dot1BRepresentativeValue +from blueprints.validations import NegativeValueError + + +class TestForm2Dot1BRepresentativeValue: + """Validation for formula 2.1b from NEN 9997-1+C2:2017.""" + + def test_evaluation(self) -> None: + """Test the evaluation of the result.""" + # example values + psi = 1.2 # [-] + f_k = 100 # kN + + form_2_1_b = Form2Dot1BRepresentativeValue(psi=psi, f_k=f_k) + + # manually calculated result + manually_calculated_result = 120 + + assert form_2_1_b == pytest.approx(expected=manually_calculated_result, rel=1e-9) + + def test_raise_error_if_negative_psi(self) -> None: + """Test that a NegativeValueError is raised when a negative value is passed for psi.""" + psi = -1 + f_k = 100 + + with pytest.raises(NegativeValueError): + Form2Dot1BRepresentativeValue(psi=psi, f_k=f_k) + + def test_raise_error_if_negative_f_k(self) -> None: + """Test that a NegativeValueError is raised when a negative value is passed for f_k.""" + psi = 1.2 + f_k = -100 + + with pytest.raises(NegativeValueError): + Form2Dot1BRepresentativeValue(psi=psi, f_k=f_k) From a6923954de329a73e44eaac7dbf4389d3c2c8adb Mon Sep 17 00:00:00 2001 From: PetervWestrienen Date: Thu, 28 Dec 2023 10:48:59 +0100 Subject: [PATCH 4/5] (#100) changed source document --- .../chapter_2_basic_of_geotechnical_design/formula_2_1_b.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/blueprints/codes/eurocode/nen_9997_1_c2_2017/chapter_2_basic_of_geotechnical_design/formula_2_1_b.py b/blueprints/codes/eurocode/nen_9997_1_c2_2017/chapter_2_basic_of_geotechnical_design/formula_2_1_b.py index 1fe38c5f..1e8bf532 100644 --- a/blueprints/codes/eurocode/nen_9997_1_c2_2017/chapter_2_basic_of_geotechnical_design/formula_2_1_b.py +++ b/blueprints/codes/eurocode/nen_9997_1_c2_2017/chapter_2_basic_of_geotechnical_design/formula_2_1_b.py @@ -1,4 +1,5 @@ """"Formula 2.1b from NEN 9997-1+C2:2017: Chapter 2: Basis of geotechnical design.""" +from blueprints.codes.eurocode.nen_9997_1_c2_2017 import NEN_9997_1_C2_2017 from blueprints.codes.formula import Formula from blueprints.type_alias import DIMENSIONLESS from blueprints.validations import raise_if_negative @@ -8,7 +9,7 @@ class Form2Dot1BRepresentativeValue(Formula): """Class representing formula 2.1b for the calculation of the representative value :math:`F_{rep}` of actions.""" label = "2.1b" - source_document = "NEN 9997-1+C2:2017" + source_document = NEN_9997_1_C2_2017 def __init__(self, psi: DIMENSIONLESS, f_k: float) -> None: """[:math:`F_{rep}`] Representative value of actions. From fd63943cf6f3f08cfdf70cb2842ed0bcb6cf39d0 Mon Sep 17 00:00:00 2001 From: PetervWestrienen Date: Thu, 28 Dec 2023 10:51:48 +0100 Subject: [PATCH 5/5] (#100) f_k can be negative --- .../formula_2_1_b.py | 2 +- .../test_formula_2_1_b.py | 8 -------- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/blueprints/codes/eurocode/nen_9997_1_c2_2017/chapter_2_basic_of_geotechnical_design/formula_2_1_b.py b/blueprints/codes/eurocode/nen_9997_1_c2_2017/chapter_2_basic_of_geotechnical_design/formula_2_1_b.py index 1e8bf532..1210c15b 100644 --- a/blueprints/codes/eurocode/nen_9997_1_c2_2017/chapter_2_basic_of_geotechnical_design/formula_2_1_b.py +++ b/blueprints/codes/eurocode/nen_9997_1_c2_2017/chapter_2_basic_of_geotechnical_design/formula_2_1_b.py @@ -33,5 +33,5 @@ def _evaluate( f_k: float, ) -> float: """Evaluates the formula, for more information see the __init__ method.""" - raise_if_negative(psi=psi, f_k=f_k) + raise_if_negative(psi=psi) return psi * f_k diff --git a/tests/codes/eurocode/nen_9997_1_c2_2017/chapter_2_basic_of_geotechnical_design/test_formula_2_1_b.py b/tests/codes/eurocode/nen_9997_1_c2_2017/chapter_2_basic_of_geotechnical_design/test_formula_2_1_b.py index f53caf90..6e1e5c66 100644 --- a/tests/codes/eurocode/nen_9997_1_c2_2017/chapter_2_basic_of_geotechnical_design/test_formula_2_1_b.py +++ b/tests/codes/eurocode/nen_9997_1_c2_2017/chapter_2_basic_of_geotechnical_design/test_formula_2_1_b.py @@ -28,11 +28,3 @@ def test_raise_error_if_negative_psi(self) -> None: with pytest.raises(NegativeValueError): Form2Dot1BRepresentativeValue(psi=psi, f_k=f_k) - - def test_raise_error_if_negative_f_k(self) -> None: - """Test that a NegativeValueError is raised when a negative value is passed for f_k.""" - psi = 1.2 - f_k = -100 - - with pytest.raises(NegativeValueError): - Form2Dot1BRepresentativeValue(psi=psi, f_k=f_k)