-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(#89) added formula 8.17 from NEN-EN 1992-1-1+C2:2011 #90
Merged
egarciamendez
merged 7 commits into
main
from
89-feature-request-add-formula-817-from-nen-en-1992-1-1+c22011
Dec 27, 2023
Merged
Changes from 3 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
ae36a3d
(#83) added form 8.17 plus test
PetervWestrienen c3e465b
(#89) added integration test with 8.16
PetervWestrienen cea4621
(#89) added integration test with 8.16
PetervWestrienen 3e6e594
(#89) fixed typo
PetervWestrienen d1806c8
(#89) fixed typo
PetervWestrienen 1e5599d
Merge branch 'main' into 89-feature-request-add-formula-817-from-nen-…
egarciamendez e2f5952
(#83) ruff linting
egarciamendez File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
...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,36 @@ | ||
"""Formula 8.17 from NEN-EN 1992-1-1+C2:2011: Chapter 8: Detailing of reinforcement and prestressing tendons""" | ||
# pylint: disable=arguments-differ | ||
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) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing ' after l_{pt2}