### ===================================================================================================================
### L5-N strengthening measure
### ===================================================================================================================
# Copyright ©VIIA 2024
### ===================================================================================================================
### 1. Import modules
### ===================================================================================================================
# General imports
from __future__ import annotations
from typing import TYPE_CHECKING, Union
from copy import deepcopy
# References for functions and classes in the rhdhv_fem package
from rhdhv_fem.fem_math import fem_unit_vector
from rhdhv_fem.shapes import Wall
# References for functions and classes in the viiaPackage
if TYPE_CHECKING:
from viiapackage.viiaStatus import ViiaProject
from viiapackage.strengthening.helper_functions import viia_check_shape_argument, viia_add_strengthening_shape, \
viia_check_measure_in_gmc
### ===================================================================================================================
### 2. Function to create L5-N strengthening measures
### ===================================================================================================================
[docs]def viia_l5n(project: ViiaProject, wall: Union[Wall, str], application: str = 'Center', variant: int = 1):
"""
This function creates an L5N-measure (Reinforced concrete wall addition) for a selected wall. It adds a concrete
wall of 150mm, C20/25 and applies a grid reinforcement of 2x2R12-150. Optional is the inclusion of eccentricity.
It will model the strengthening measure around openings and can be applied on walls in all directions.
.. warning:: Function is currently not available, it requires updates, please send request to the VIIA automating
team.
Input:
- project (obj): VIIA project object containing collections of fem objects and project variables.
- wall (obj): The object reference of the wall that has to be strengthened.
Alternative (str): Name of the wall to be strengthened.
- application (str): Default value is 'Center'. In that case no eccentricity is applied. If 'Positive' or
'Negative' the measure will be applied with corresponding eccentricity. Positive is in the direction of the
local z-axis of the strengthened wall. Input 'Center', 'Positive' or 'Negative'.
- variant (int): The variant number of the measure that is in the GMC.
Output:
- The strengthening measure is added to the wall and modelled in DIANA or SCIA.
For example:
.. code-block:: python
project.viia_l5n(wall=wall)
This example will apply the L5-N measure with a concrete wall and grid reinforcement. No eccentricities applied.
.. code-block:: python
project.viia_l5n(wall=wall, application='Positive')
The example has the same result as the previous, but an eccentricity has been applied in the direction of the local
z-axis of the wall.
"""
raise NotImplementedError(
"ERROR: Function to apply L5-N measure is currently not available, script needs updates. Please contact the "
"VIIA automation team.")
# Check if measure is in GMC
measure_type = 'L5-N'
measure_sub_type = f"{measure_type}-{int(variant)}"
viia_check_measure_in_gmc(project=project, measure_sub_type=measure_sub_type)
# Argument handling
wall = viia_check_shape_argument(project, wall, 'viia_l5n')
if application_type.lower() not in ['center', 'positive', 'negative']:
raise ValueError(f"ERROR: Input for viia_l5n function for 'application_type' has to be 'Center' or 'Positive' "
f"or 'Negative'. Check your input ({application_type}).")
application_type = application_type.lower()
# Find geometry properties of wall
for geometry_object in project.collections.geometriesObjects:
if wall.geometry == geometry_object.name:
break
# Compute normal vector of wall, which can point either inward or outward
normal_vector = wall.normal_vector()
# Compute normal vector that points outward, both are used to compute the eccentricities
normal_vector_outward = wall.outward_vector()
# Material and geometry to be used for strengthening measure
# The eccentricity is set in direction of normalvector of wall. It may be necessary to adjust this to the negative direction
# depending on the location where the measure will be fitted.
# Eccentricity is half the thickness of the wall and half of the new concrete (150mm)
NewWallName = wall.name.split('-')[0] + "-WANDEN-L5N-BETON-C20/25-150-" + wall.name[-1]
MaterialName = "BETON-C20/25"
if application == 'Positive':
# If normalVector points outward, Eccentricity must have a positive Z-component
if normal_vector_outward == normal_vector:
Eccentricity = "-(0,0," + str(round(geometry_object.thickness / 2 + + 0.075, 3)) + ")"
# Else, Eccentricity must have a negative Z-component
elif normal_vector_outward == fem_unit_vector([-normal_vector[0], -normal_vector[1], -normal_vector[2]]):
Eccentricity = "-(0,0,-" + str(round(geometry_object.thickness / 2 + + 0.075, 3)) + ")"
elif application == 'Negative':
# If normalVector points outward, Eccentricity must have a negative Z-component
if normal_vector_outward == normal_vector:
Eccentricity = "-(0,0,-" + str(round(geometry_object.thickness / 2 + + 0.075, 3)) + ")"
# Else, Eccentricity must have a positive Z-component
elif normal_vector_outward == fem_unit_vector([-normal_vector[0], -normal_vector[1], -normal_vector[2]]):
Eccentricity = "-(0,0," + str(round(geometry_object.thickness / 2 + + 0.075, 3)) + ")"
else:
Eccentricity = ""
GeometryName = "WAND-150-(" + str(geometry_object.localAxis[0]) + ',' + str(geometry_object.localAxis[1]) + ',' \
+ str(geometry_object.localAxis[2]) + ')-' + Eccentricity
NewPoints = wall.points
if application == 'Center':
ReinforcementName = wall.name.split('-')[0] + "-WANDEN-L5N-WAP-B500-" + wall.name[-1]
MaterialNameReinforcement = "WAP-B500"
GeometryNameReinforcement = "L5N-WAP-2x2R12-150-" + '(' + str(geometry_object.localAxis[0]) + ',' + \
str(geometry_object.localAxis[1]) + ',' + str(geometry_object.localAxis[2]) + ')'
else:
ReinforcementNameIn = wall.name.split('-')[0] + "-WANDEN-L5N-WAP-IN-B500-" + wall.name[-1]
ReinforcementNameOut = wall.name.split('-')[0] + "-WANDEN-L5N-WAP-OUT-B500-" + wall.name[-1]
MaterialNameReinforcement = "WAP-B500"
if application == 'Positive':
EccentricityIn = round(geometry_object.thickness / 2 + 0.025, 3)
EccentricityOut = round(geometry_object.thickness / 2 + 0.15-0.025, 3)
elif application == 'Negative':
EccentricityIn = -round(geometry_object.thickness / 2 + 0.025, 3)
EccentricityOut = -round(geometry_object.thickness / 2 + 0.15-0.025, 3)
GeometryNameReinforcementIn = "L5N-WAP-1x2R12-150-In-" + '(' + str(geometry_object.localAxis[0]) + ',' + \
str(geometry_object.localAxis[1]) + ',' + str(geometry_object.localAxis[2]) + ')'
GeometryNameReinforcementOut = "L5N-WAP-1x2R12-150-Out-" + '(' + str(geometry_object.localAxis[0]) + ',' + \
str(geometry_object.localAxis[1]) + ',' + str(geometry_object.localAxis[2]) + ')'
# Reinforcement eccentricity
if application == 'Positive' or application == 'Negative':
normal_direction = wall.outward_vector()
NewPointsIn = deepcopy(NewPoints)
for i in range(len(NewPointsIn)):
for j in range(len(NewPointsIn[i])):
NewPointsIn[i][j][0] = NewPointsIn[i][j][0] + normal_direction[0] * EccentricityIn
NewPointsIn[i][j][1] = NewPointsIn[i][j][1] + normal_direction[1] * EccentricityIn
NewPointsIn[i][j][2] = NewPointsIn[i][j][2] + normal_direction[2] * EccentricityIn
NewPointsOut = deepcopy(NewPoints)
for i in range(len(NewPointsOut)):
for j in range(len(NewPointsOut[i])):
NewPointsOut[i][j][0] = NewPointsOut[i][j][0] + normal_direction[0] * EccentricityOut
NewPointsOut[i][j][1] = NewPointsOut[i][j][1] + normal_direction[1] * EccentricityOut
NewPointsOut[i][j][2] = NewPointsOut[i][j][2] + normal_direction[2] * EccentricityOut
# Create the new shapes in PY-memory and in model if created
new_wall = Wall(NewWallName, MaterialName, GeometryName, NewPoints)
viia_add_strengthening_shape(shape=wall, strengthening_shape=new_wall)
if application == 'Center':
reinf = project.create_surface_reinforcement(
ReinforcementName, NewPoints, MaterialNameReinforcement, GeometryNameReinforcement)
viia_add_strengthening_shape(shape=wall, strengthening_shape=reinf)
else:
reinf = project.create_surface_reinforcement(
ReinforcementNameIn, NewPointsIn, MaterialNameReinforcement, GeometryNameReinforcementIn)
viia_add_strengthening_shape(shape=wall, strengthening_shape=reinf)
reinf = project.create_surface_reinforcement(
ReinforcementNameOut, NewPointsOut, MaterialNameReinforcement, GeometryNameReinforcementOut)
viia_add_strengthening_shape(shape=wall, strengthening_shape=reinf)
# Set the data for strengthening in attribute of wall
wall.add_meta_data({'strengthening': measure_sub_type})
# Notifications for user
project.write_log(f"L5-N measure applied on wall {wall_name}.")
### ===================================================================================================================
### 3. End of script
### ===================================================================================================================