-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add reinforcement material (#83)
* Add draft base class for reinforcement material * Add draft implementation of code specific reinforcement * Add Youngs modulus to reinforcement base class * Add factory function for reinforcement * Add fyd function for ec2_2004 and mc2010 * Add default gamma_s for ec2_2023 * Add fyd property for all reinforcement classes * Add youngs modulus in reinforcement factory * Correct internal attr in base reinforcement * Add tests for reinforcement materials * Add functions for getting reinf duct props * Add ftk and epsuk to reinforcement classes
- Loading branch information
1 parent
90dd941
commit cd6bb81
Showing
17 changed files
with
762 additions
and
2 deletions.
There are no files selected for viewing
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
72 changes: 72 additions & 0 deletions
72
structuralcodes/codes/ec2_2004/_reinforcement_material_properties.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,72 @@ | ||
"""Material properties for reinforcement steel.""" | ||
|
||
import typing as t | ||
|
||
DUCTILITY_CLASSES = { | ||
'A': { | ||
'epsuk': 2.5e-2, | ||
'k': 1.05, | ||
}, | ||
'B': { | ||
'epsuk': 5.0e-2, | ||
'k': 1.08, | ||
}, | ||
'C': { | ||
'epsuk': 7.5e-2, | ||
'k': 1.15, | ||
}, | ||
} | ||
|
||
|
||
def fyd(fyk: float, gamma_s: float = 1.15) -> float: | ||
"""Calculate the design value of the reinforcement yield strength. | ||
EUROCODE 2 1992-1-1:2004, Fig. 3.8 | ||
Args: | ||
fyk (float): The characteristic yield strength in MPa. | ||
gamma_s (float): The partial factor. | ||
Returns: | ||
float: The design yield strength in MPa. | ||
Raises: | ||
ValueError: if fyk is less than 0 | ||
ValueError: if gamma_s is less than or equal to 0 | ||
""" | ||
if fyk < 0: | ||
raise ValueError(f'fyk={fyk} cannot be less than 0') | ||
if gamma_s <= 0: | ||
raise ValueError(f'gamma_s={gamma_s} must be larger than 0') | ||
return fyk / gamma_s | ||
|
||
|
||
def reinforcement_duct_props( | ||
fyk: float, | ||
ductility_class: t.Literal['A', 'B', 'C'], | ||
) -> t.Dict[str, float]: | ||
"""Return a dict with the minimum characteristic ductility properties for | ||
reinforcement ductility class. | ||
EUROCODE 2 1992-1-1:2004, Tab. C.1 | ||
Args: | ||
fyk (float): The characteristic yield strength. | ||
ductility_class (Literal['A', 'B', 'C']): The reinforcement ductility | ||
class designation. | ||
Returns: | ||
Dict[str, float]: A dict with the characteristik strain value at the | ||
ultimate stress level (epsuk), and the characteristic ultimate stress | ||
(ftk). | ||
""" | ||
duct_props = DUCTILITY_CLASSES.get(ductility_class.upper(), None) | ||
if duct_props is None: | ||
raise ValueError( | ||
'The no properties was found for the provided ductility class ' | ||
f'({ductility_class}).' | ||
) | ||
return { | ||
'epsuk': duct_props['epsuk'], | ||
'ftk': duct_props['k'] * fyk, | ||
} |
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
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
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
76 changes: 76 additions & 0 deletions
76
structuralcodes/codes/mc2010/_reinforcement_material_properties.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,76 @@ | ||
"""Material properties for reinforcement steel.""" | ||
|
||
import typing as t | ||
|
||
DUCTILITY_CLASSES = { | ||
'A': { | ||
'epsuk': 2.5e-2, | ||
'k': 1.05, | ||
}, | ||
'B': { | ||
'epsuk': 5.0e-2, | ||
'k': 1.08, | ||
}, | ||
'C': { | ||
'epsuk': 7.5e-2, | ||
'k': 1.15, | ||
}, | ||
'D': { | ||
'epsuk': 8.0e-2, | ||
'k': 1.25, | ||
}, | ||
} | ||
|
||
|
||
def fyd(fyk: float, gamma_s: float = 1.15) -> float: | ||
"""Calculate the design value of the reinforcement yield strength. | ||
fib Model Code 2010, Sec. 4.5.2.2.3 | ||
Args: | ||
fyk (float): The characteristic yield strength in MPa. | ||
gamma_s (float): The partial factor. | ||
Returns: | ||
float: The design yield strength in MPa. | ||
Raises: | ||
ValueError: if fyk is less than 0 | ||
ValueError: if gamma_s is less than or equal to 0 | ||
""" | ||
if fyk < 0: | ||
raise ValueError(f'fyk={fyk} cannot be less than 0') | ||
if gamma_s <= 0: | ||
raise ValueError(f'gamma_s={gamma_s} must be larger than 0') | ||
return fyk / gamma_s | ||
|
||
|
||
def reinforcement_duct_props( | ||
fyk: float, | ||
ductility_class: t.Literal['A', 'B', 'C', 'D'], | ||
) -> t.Dict[str, float]: | ||
"""Return a dict with the minimum characteristic ductility properties for | ||
reinforcement ductility class. | ||
fib Model Code 2010, Sec. 5.2.5.4 | ||
Args: | ||
fyk (float): The characteristic yield strength. | ||
ductility_class (Literal['A', 'B', 'C', 'D']): The reinforcement | ||
ductility class designation. | ||
Returns: | ||
Dict[str, float]: A dict with the characteristik strain value at the | ||
ultimate stress level (epsuk), and the characteristic ultimate stress | ||
(ftk). | ||
""" | ||
duct_props = DUCTILITY_CLASSES.get(ductility_class.upper(), None) | ||
if duct_props is None: | ||
raise ValueError( | ||
'The no properties was found for the provided ductility class ' | ||
f'({ductility_class}).' | ||
) | ||
return { | ||
'epsuk': duct_props['epsuk'], | ||
'ftk': duct_props['k'] * fyk, | ||
} |
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 |
---|---|---|
@@ -1,7 +1,8 @@ | ||
"""Main entry point for materials.""" | ||
|
||
from . import concrete | ||
from . import concrete, reinforcement | ||
|
||
__all__ = [ | ||
'concrete', | ||
'reinforcement', | ||
] |
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,81 @@ | ||
"""Reinforcement material.""" | ||
|
||
import typing as t | ||
|
||
from structuralcodes.codes import _use_design_code | ||
|
||
from ._reinforcement import Reinforcement | ||
from ._reinforcementEC2_2004 import ReinforcementEC2_2004 | ||
from ._reinforcementEC2_2023 import ReinforcementEC2_2023 | ||
from ._reinforcementMC2010 import ReinforcementMC2010 | ||
|
||
__all__ = [ | ||
'create_reinforcement', | ||
'Reinforcement', | ||
'ReinforcementMC2010', | ||
'ReinforcementEC2_2004', | ||
'ReinforcementEC2_2023', | ||
] | ||
|
||
REINFORCEMENTS: t.Dict[str, Reinforcement] = { | ||
'fib Model Code 2010': ReinforcementMC2010, | ||
'EUROCODE 2 1992-1-1:2004': ReinforcementEC2_2004, | ||
'EUROCODE 2 1992-1-1:2023': ReinforcementEC2_2023, | ||
} | ||
|
||
|
||
def create_reinforcement( | ||
fyk: float, | ||
Es: float, | ||
ftk: float, | ||
epsuk: float, | ||
name: t.Optional[str] = None, | ||
density: float = 7850, | ||
design_code: t.Optional[str] = None, | ||
) -> t.Optional[Reinforcement]: | ||
"""A factory function to create the correct type of reinforcement based on | ||
the desired design code. | ||
Args: | ||
fyk (float): Characteristic yield strength in MPa. | ||
Es (float): The Young's modulus in MPa. | ||
ftk (float): Characteristic ultimate strength in MPa. | ||
epsuk (float): The characteristik strain at the ultimate stress level. | ||
Keyword Args: | ||
density (float): Density of the material in kg/m3 (default: 7850) | ||
design_code (str): Optional string (default: None) indicating the | ||
desired standard. If None (default) the globally used design | ||
standard will be adopted. Otherwise the design standard specified | ||
will be used for the instance of the material. | ||
Raises: | ||
ValueError: if the design code is not valid or does not cover | ||
reinforcement as a material. | ||
""" | ||
# Get the code from the global variable | ||
_code = _use_design_code(design_code) | ||
|
||
# Check if the code is a proper code for reinforcement | ||
code = None | ||
if _code is not None and 'reinforcement' in _code.__materials__: | ||
code = _code | ||
if code is None: | ||
raise ValueError( | ||
'The design code is not set, either use ' | ||
'structuralcodes.code.set_designcode, or provide a valid ' | ||
'string in the function.' | ||
) | ||
|
||
# Create the proper reinforcement object | ||
current_reinforcement = REINFORCEMENTS.get(code.__title__, None) | ||
if current_reinforcement is not None: | ||
return current_reinforcement( | ||
fyk=fyk, | ||
Es=Es, | ||
name=name, | ||
density=density, | ||
ftk=ftk, | ||
epsuk=epsuk, | ||
) | ||
return None |
Oops, something went wrong.