Skip to content

Commit

Permalink
name changed
Browse files Browse the repository at this point in the history
  • Loading branch information
egarciamendez committed Nov 23, 2024
1 parent 3f90370 commit 6377d13
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
from blueprints.validations import raise_if_less_or_equal_to_zero


class Form5Dot10aRedistributionOfMoments:
"""Class representing formula 5.10a for the redistribution of moments in continuous beams or slabs."""
class Form5Dot10aRedistributionOfMomentsLowerFck:
r"""Class representing formula 5.10a for the redistribution of moments in continuous beams or slabs when :math:`f_{ck} \leq 50 MPa`."""

label = "5.10a"
source_document = NEN_EN_1992_1_1_C2_2011

def __init__(self, delta: DIMENSIONLESS, k1: DIMENSIONLESS, k2: DIMENSIONLESS, xu: M, d: M) -> None:
"""[:math:`δ`] Redistribution of moments.
r"""[:math:`δ`] Redistribution of moments in continuous beams or slabs when :math:`f_{ck} \leq 50 MPa`.
NEN-EN 1992-1-1+C2:2011 art.5.5(4) - Formula (5.10a)
Expand Down Expand Up @@ -81,6 +81,6 @@ def latex(self) -> LatexFormula:
return_symbol=r"CHECK",
result="OK" if self.__bool__() else "\\text{Not OK}",
equation=r"\delta \geq k_1 + k_2 \frac{x_u}{d}",
numeric_equation=(rf"{self.left_hand_side:.3f} \geq {self.k1} + {self.k2} \frac{{{self.xu}}}{{{self.d}}}"),
numeric_equation=rf"{self.left_hand_side:.3f} \geq {self.k1} + {self.k2} \frac{{{self.xu}}}{{{self.d}}}",
comparison_operator_label=r"\rightarrow",
)
2 changes: 1 addition & 1 deletion docs/source/codes/eurocode/ec2_1992_1_1_2011/formulas.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ Total of 304 formulas present.
| 5.7b | :heavy_check_mark: | | Form5Dot7bFlangeEffectiveFlangeWidth |
| 5.8 | :heavy_check_mark: | | Form5Dot8EffectiveSpan |
| 5.9 | :heavy_check_mark: | | Form5Dot9DesignSupportMomentReduction |
| 5.10a | :heavy_check_mark: | | Form5Dot10aRedistributionOfMoments |
| 5.10a | :heavy_check_mark: | | Form5Dot10aRedistributionOfMomentsLowerFck |
| 5.10b | :x: | | |
| 5.11N | :heavy_check_mark: | | Form5Dot11nShearSlendernessCorrectionFactor |
| 5.12N | :heavy_check_mark: | | Form5Dot12nRatioDistancePointZeroAndMaxMoment |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

import pytest

from blueprints.codes.eurocode.nen_en_1992_1_1_c2_2011.chapter_5_structural_analysis.formula_5_10a import Form5Dot10aRedistributionOfMoments
from blueprints.codes.eurocode.nen_en_1992_1_1_c2_2011.chapter_5_structural_analysis.formula_5_10a import Form5Dot10aRedistributionOfMomentsLowerFck
from blueprints.validations import LessOrEqualToZeroError


class TestForm5Dot10aRedistributionOfMoments:
class TestForm5Dot10aRedistributionOfMomentsLowerFck:
"""Validation for formula 5.10a from NEN-EN 1992-1-1+C2:2011."""

@pytest.mark.parametrize(
Expand All @@ -18,7 +18,7 @@ class TestForm5Dot10aRedistributionOfMoments:
)
def test_comparison(self, delta: float, k1: float, k2: float, xu: float, d: float, result_manual: bool) -> None:
"""Test the evaluation of the comparison."""
form_5_10a = bool(Form5Dot10aRedistributionOfMoments(delta=delta, k1=k1, k2=k2, xu=xu, d=d))
form_5_10a = bool(Form5Dot10aRedistributionOfMomentsLowerFck(delta=delta, k1=k1, k2=k2, xu=xu, d=d))
assert form_5_10a == pytest.approx(expected=result_manual)

@pytest.mark.parametrize(
Expand All @@ -30,16 +30,16 @@ def test_comparison(self, delta: float, k1: float, k2: float, xu: float, d: floa
)
def test_evaluation(self, delta: float, k1: float, k2: float, xu: float, d: float) -> None:
"""Test the right-hand side evaluation of the result."""
form_5_10a = Form5Dot10aRedistributionOfMoments(delta=delta, k1=k1, k2=k2, xu=xu, d=d)
form_5_10a = Form5Dot10aRedistributionOfMomentsLowerFck(delta=delta, k1=k1, k2=k2, xu=xu, d=d)
expected_rhs = k1 + k2 * (xu / d)
assert form_5_10a.right_hand_side == pytest.approx(expected_rhs, abs=1e-3)

def test_raise_error_if_negative_values(self) -> None:
"""Test that a LessOrEqualToZeroError is raised when a negative or zero value is passed."""
with pytest.raises(LessOrEqualToZeroError):
Form5Dot10aRedistributionOfMoments(delta=-0.5, k1=0.44, k2=1.25, xu=0.2, d=0.5)
Form5Dot10aRedistributionOfMomentsLowerFck(delta=-0.5, k1=0.44, k2=1.25, xu=0.2, d=0.5)
with pytest.raises(LessOrEqualToZeroError):
Form5Dot10aRedistributionOfMoments(delta=0.5, k1=0, k2=1.25, xu=0.2, d=0.5)
Form5Dot10aRedistributionOfMomentsLowerFck(delta=0.5, k1=0, k2=1.25, xu=0.2, d=0.5)

@pytest.mark.parametrize(
("delta", "k1", "k2", "xu", "d", "expected_lhs_rhs"),
Expand All @@ -50,14 +50,14 @@ def test_raise_error_if_negative_values(self) -> None:
)
def test_properties(self, delta: float, k1: float, k2: float, xu: float, d: float, expected_lhs_rhs: float) -> None:
"""Test the properties of the comparison."""
form_5_10a = Form5Dot10aRedistributionOfMoments(delta=delta, k1=k1, k2=k2, xu=xu, d=d)
form_5_10a = Form5Dot10aRedistributionOfMomentsLowerFck(delta=delta, k1=k1, k2=k2, xu=xu, d=d)
assert form_5_10a.left_hand_side == pytest.approx(expected_lhs_rhs, abs=1e-3)
assert form_5_10a.right_hand_side == pytest.approx(expected_lhs_rhs, abs=1e-3)
assert form_5_10a.ratio == pytest.approx(1, abs=1e-3)

def test_str_representation(self) -> None:
"""Test the string representation of the comparison."""
form_5_10a = Form5Dot10aRedistributionOfMoments(delta=0.5, k1=0.44, k2=1.25, xu=0.2, d=0.5)
form_5_10a = Form5Dot10aRedistributionOfMomentsLowerFck(delta=0.5, k1=0.44, k2=1.25, xu=0.2, d=0.5)
expected_str = (
r"CHECK \rightarrow \delta \geq k_1 + k_2 \frac{x_u}{d} \rightarrow 0.500 \geq 0.44 + 1.25 \frac{0.2}{" r"0.5} \rightarrow \text{Not OK}"
)
Expand All @@ -84,7 +84,7 @@ def test_latex_ok(self, representation: str, expected: str) -> None:
d = 0.5

# Object to test
form_5_10a_latex = Form5Dot10aRedistributionOfMoments(delta=delta, k1=k1, k2=k2, xu=xu, d=d).latex()
form_5_10a_latex = Form5Dot10aRedistributionOfMomentsLowerFck(delta=delta, k1=k1, k2=k2, xu=xu, d=d).latex()

actual = {
"complete": form_5_10a_latex.complete,
Expand Down Expand Up @@ -113,7 +113,7 @@ def test_latex_not_ok(self, representation: str, expected: str) -> None:
d = 50

# Object to test
form_5_10a_latex = Form5Dot10aRedistributionOfMoments(delta=delta, k1=k1, k2=k2, xu=xu, d=d).latex()
form_5_10a_latex = Form5Dot10aRedistributionOfMomentsLowerFck(delta=delta, k1=k1, k2=k2, xu=xu, d=d).latex()

actual = {
"complete": form_5_10a_latex.complete,
Expand Down

0 comments on commit 6377d13

Please sign in to comment.