-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #90 from Blueprints-org/89-feature-request-add-for…
…mula-817-from-nen-en-1992-1-1+c22011 (#89) added formula 8.17 from NEN-EN 1992-1-1+C2:2011
- Loading branch information
Showing
2 changed files
with
85 additions
and
0 deletions.
There are no files selected for viewing
35 changes: 35 additions & 0 deletions
35
...1_1_c2_2011/chapter_8_detailing_of_reinforcement_and_prestressing_tendons/formula_8_17.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
50 changes: 50 additions & 0 deletions
50
...2_2011/chapter_8_detailing_of_reinforcement_and_prestressing_tendons/test_formula_8_17.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) |