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 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..1210c15b --- /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,37 @@ +""""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 + + +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) + return psi * f_k diff --git a/docs/source/codes/eurocode/nen_9997_1_c2_2017/formulas.md b/docs/source/codes/eurocode/nen_9997_1_c2_2017/formulas.md index 2a4cbb6e..9d631b26 100644 --- a/docs/source/codes/eurocode/nen_9997_1_c2_2017/formulas.md +++ b/docs/source/codes/eurocode/nen_9997_1_c2_2017/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: | | | 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..6e1e5c66 --- /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,30 @@ +""""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)