Skip to content
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
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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`"""
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing ' after l_{pt2}


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
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)
Loading