diff --git a/blueprints/codes/eurocode/nen_en_1992_1_1_c2_2011/chapter_8_detailing_of_reinforcement_and_prestressing_tendons/formula_8_17.py b/blueprints/codes/eurocode/nen_en_1992_1_1_c2_2011/chapter_8_detailing_of_reinforcement_and_prestressing_tendons/formula_8_17.py new file mode 100644 index 00000000..3fa63a64 --- /dev/null +++ b/blueprints/codes/eurocode/nen_en_1992_1_1_c2_2011/chapter_8_detailing_of_reinforcement_and_prestressing_tendons/formula_8_17.py @@ -0,0 +1,35 @@ +"""Formula 8.17 from NEN-EN 1992-1-1+C2:2011: Chapter 8: Detailing of reinforcement and prestressing tendons.""" +from blueprints.codes.eurocode.nen_en_1992_1_1_c2_2011 import NEN_EN_1992_1_1_C2_2011 +from blueprints.codes.formula import Formula +from blueprints.type_alias import MM +from blueprints.validations import raise_if_negative + + +class Form8Dot17DesignValueTransmissionLength1(Formula): + """Class representing formula 8.17 for the calculation of design value 1 of the transmission length :math:`l_{pt1}`. The less favourable of + :math:`l_{pt1}` or :math:`l_{pt2}` has to be chosen depending on the design situation.""" + + label = "8.17" + source_document = NEN_EN_1992_1_1_C2_2011 + + def __init__(self, l_pt: MM) -> None: + """[:math:`l_{pt1}`] design value 1 of the transmission length [:math:`mm`]. + + NEN-EN 1992-1-1+C2:2011 art.8.10.2.2(3) - Formula (8.17) + + Parameters + ---------- + l_pt : MM + [:math:`l_{pt}`] Basic value of the transmission length [:math:`mm`]. + Use your own implementation for this value or use :class:`Form8Dot16BasicTransmissionLength` class. + """ + super().__init__() + self.l_pt = l_pt + + @staticmethod + def _evaluate( + l_pt: MM, + ) -> MM: + """Evaluates the formula, for more information see the __init__ method.""" + raise_if_negative(l_pt=l_pt) + return 0.8 * l_pt diff --git a/tests/codes/eurocode/nen_en_1992_1_1_c2_2011/chapter_8_detailing_of_reinforcement_and_prestressing_tendons/test_formula_8_17.py b/tests/codes/eurocode/nen_en_1992_1_1_c2_2011/chapter_8_detailing_of_reinforcement_and_prestressing_tendons/test_formula_8_17.py new file mode 100644 index 00000000..242b31b7 --- /dev/null +++ b/tests/codes/eurocode/nen_en_1992_1_1_c2_2011/chapter_8_detailing_of_reinforcement_and_prestressing_tendons/test_formula_8_17.py @@ -0,0 +1,50 @@ +"""Testing formula 8.17 of NEN-EN 1992-1-1+C2:2011.""" +import pytest + +from blueprints.codes.eurocode.nen_en_1992_1_1_c2_2011.chapter_8_detailing_of_reinforcement_and_prestressing_tendons.formula_8_16 import ( + Form8Dot16BasicTransmissionLength, +) +from blueprints.codes.eurocode.nen_en_1992_1_1_c2_2011.chapter_8_detailing_of_reinforcement_and_prestressing_tendons.formula_8_17 import ( + Form8Dot17DesignValueTransmissionLength1, +) +from blueprints.validations import NegativeValueError + + +class TestForm8Dot17DesignValueTransmissionLength1: + """Validation for formula 8.17 from NEN-EN 1992-1-1+C2:2011.""" + + def test_evaluation(self) -> None: + """Test the evaluation of the result.""" + # example values + l_pt = 120 # mm + form_8_17 = Form8Dot17DesignValueTransmissionLength1(l_pt=l_pt) + # manually calculated result + manually_calculated_result = 96 # mm + + assert form_8_17 == pytest.approx(expected=manually_calculated_result, rel=1e-4) + + def test_raise_error_if_negative_l_pt(self) -> None: + """Test that a NegativeValueError is raised when a negative value is passed for l_pt.""" + l_pt = -1 + with pytest.raises(NegativeValueError): + Form8Dot17DesignValueTransmissionLength1(l_pt=l_pt) + + def test_integration_with_form_8_dot_16(self) -> None: + """Test integration between formula 8.16 and 8.17.""" + alpha_1 = 1 # [-] + alpha_2 = 0.25 # [-] + diameter = 8 # mm + sigma_pm0 = 350 # MPa + f_bpt = 5 # MPa + l_pt = Form8Dot16BasicTransmissionLength( + alpha_1=alpha_1, + alpha_2=alpha_2, + diameter=diameter, + sigma_pm0=sigma_pm0, + f_bpt=f_bpt, + ) + + form_8_17 = Form8Dot17DesignValueTransmissionLength1(l_pt=l_pt) + manually_calculated_result = 112 # mm + + assert form_8_17 == pytest.approx(expected=manually_calculated_result, rel=1e-4)