Member Reinforcement#
|
This example demonstrates how to model provided longitudinal and shear reinforcement for a single-span member with cantilever and review the results of bending design check according to EN 1992:
|
from dlubal.api import rfem, common
from math import inf
import pandas
from enum import Enum
import re
# -------------------------------------------------------
# This example demonstrates the ultimate limit state design check of a concrete
# single-span member with cantilever in accordance with DIN EN 1992-1-1:NA 2015-12.
# It includes the definition of shear and longitudal reinforacement and the extraction
# of detailed results related to Section resistance for bending with or without axial force.
# -------------------------------------------------------
# Editable parameters (SI units)
LENGTH_TOTAL = 8.0
LENGHT_CANTILEVER = 2.0
CONCRETE_GRADE = "C30/37"
STEEL_REINF_GRADE = "B500S(A)"
CROSS_SECTION = "R_M1 0.3/0.45" # rectangle 300/450
def define_structure() -> list:
# Reinforced concrete design of single-span continuous beam with tapered cantilever.
# Because the model is defined in a 2D (XZ plane) stress plane, it is supported against translational motion.
return [
# Materials
rfem.structure_core.Material(
no=1,
name="C25/30",
),
rfem.structure_core.Material(
no=2,
name="B500S(A)",
),
# Cross-Sections
rfem.structure_core.CrossSection(
no=1,
name="R_M1 0.3/0.45", # rectangle 300/450
material=1,
),
# Nodes
rfem.structure_core.Node(
no=1,
coordinate_1=0
),
rfem.structure_core.Node(
no=2,
type=rfem.structure_core.Node.TYPE_ON_MEMBER,
on_member_reference_member=1,
distance_from_start_is_defined_as_relative=False,
distance_from_start_absolute=LENGTH_TOTAL-LENGHT_CANTILEVER,
),
rfem.structure_core.Node(
no=3,
coordinate_1=LENGTH_TOTAL,
),
# Line
rfem.structure_core.Line(
no=1,
definition_nodes=[1, 3],
),
# Member
rfem.structure_core.Member(
no=1,
line=1,
cross_section_start=1,
concrete_cover_different_at_cross_section_sides_enabled=True,
concrete_durability_top=1,
concrete_durability_left=2,
concrete_durability_right=2,
concrete_durability_bottom=2,
concrete_shear_reinforcement_spans = rfem.structure_core.Member.ConcreteShearReinforcementSpansTable(
rows = [
rfem.structure_core.Member.ConcreteShearReinforcementSpansRow(
stirrup_type = rfem.structure_core.Member.ConcreteShearReinforcementSpansRow.STIRRUP_TYPE_TWO_LEGGED_CLOSED_HOOK_135,
stirrup_diameter = 0.008,
stirrup_distances = 0.3,
span_position_definition_format=rfem.structure_core.Member.ConcreteShearReinforcementSpansRow.SPAN_POSITION_DEFINITION_FORMAT_ABSOLUTE,
span_start_absolute = 0,
span_end_absolute = (LENGTH_TOTAL-LENGHT_CANTILEVER)*0.75,
stirrup_layout_rule = rfem.structure_core.Member.ConcreteShearReinforcementSpansRow.STIRRUP_LAYOUT_RULE_START_EQUALS_END,
),
rfem.structure_core.Member.ConcreteShearReinforcementSpansRow(
stirrup_type = rfem.structure_core.Member.ConcreteShearReinforcementSpansRow.STIRRUP_TYPE_TWO_LEGGED_CLOSED_HOOK_135,
stirrup_diameter = 0.008,
stirrup_distances = 0.2,
span_position_definition_format=rfem.structure_core.Member.ConcreteShearReinforcementSpansRow.SPAN_POSITION_DEFINITION_FORMAT_ABSOLUTE,
span_start_absolute = (LENGTH_TOTAL-LENGHT_CANTILEVER)*0.75,
span_end_absolute = LENGTH_TOTAL,
stirrup_layout_rule = rfem.structure_core.Member.ConcreteShearReinforcementSpansRow.STIRRUP_LAYOUT_RULE_START_EQUALS_END,
),
],
),
concrete_longitudinal_reinforcement_items = rfem.structure_core.Member.ConcreteLongitudinalReinforcementItemsTable(
rows = [
rfem.structure_core.Member.ConcreteLongitudinalReinforcementItemsRow(
# name = "2Ø12 | 1Ø12 | 3Ø16",
rebar_type = rfem.structure_core.Member.ConcreteLongitudinalReinforcementItemsRow.REBAR_TYPE_UNSYMMETRICAL,
material=2,
bar_count_unsymmetrical_top_side=2,
bar_diameter_unsymmetrical_top_side=0.012,
bar_count_unsymmetrical_at_side=1,
bar_diameter_unsymmetrical_at_side=0.010,
bar_count_unsymmetrical_bottom_side=3,
bar_diameter_unsymmetrical_bottom_side=0.016,
span_position_definition_format=rfem.structure_core.Member.ConcreteLongitudinalReinforcementItemsRow.SPAN_POSITION_DEFINITION_FORMAT_ABSOLUTE,
span_start_absolute = 0,
span_end_absolute = LENGTH_TOTAL,
),
rfem.structure_core.Member.ConcreteLongitudinalReinforcementItemsRow(
# name = " -- | -- | 2Ø16",
rebar_type = rfem.structure_core.Member.ConcreteLongitudinalReinforcementItemsRow.REBAR_TYPE_UNSYMMETRICAL,
material=2,
bar_count_unsymmetrical_top_side=0,
bar_count_unsymmetrical_at_side=0,
bar_count_unsymmetrical_bottom_side=2,
bar_diameter_unsymmetrical_bottom_side=0.016,
span_position_definition_format=rfem.structure_core.Member.ConcreteLongitudinalReinforcementItemsRow.SPAN_POSITION_DEFINITION_FORMAT_ABSOLUTE,
span_start_absolute = 0,
span_end_absolute = LENGTH_TOTAL-LENGHT_CANTILEVER,
additional_offset_type=rfem.structure_core.Member.ConcreteLongitudinalReinforcementItemsRow.ADDITIONAL_OFFSET_TYPE_FROM_STIRRUP,
additional_offset_left_side=0.04,
additional_offset_right_side=0.04,
),
rfem.structure_core.Member.ConcreteLongitudinalReinforcementItemsRow(
# name = "2Ø12 | -- | -- ",
rebar_type = rfem.structure_core.Member.ConcreteLongitudinalReinforcementItemsRow.REBAR_TYPE_LINE,
material=2,
bar_count_line=2,
bar_diameter_line=0.012,
additional_offset_type=rfem.structure_core.Member.ConcreteLongitudinalReinforcementItemsRow.ADDITIONAL_OFFSET_TYPE_FROM_STIRRUP,
additional_offset_reference_type_at_start=rfem.structure_core.Member.ConcreteLongitudinalReinforcementItemsRow.ADDITIONAL_OFFSET_REFERENCE_TYPE_AT_START_LEFT_TOP,
additional_horizontal_offset_at_start=0.04,
additional_vertical_offset_at_start=0.0,
additional_offset_reference_type_at_end=rfem.structure_core.Member.ConcreteLongitudinalReinforcementItemsRow.ADDITIONAL_OFFSET_REFERENCE_TYPE_AT_START_RIGHT_TOP,
additional_horizontal_offset_at_end=0.04,
additional_vertical_offset_at_end=0.0,
span_position_definition_format=rfem.structure_core.Member.ConcreteLongitudinalReinforcementItemsRow.SPAN_POSITION_DEFINITION_FORMAT_ABSOLUTE,
span_start_absolute = LENGTH_TOTAL-LENGHT_CANTILEVER*1.6,
span_end_absolute = LENGTH_TOTAL-LENGHT_CANTILEVER*0.4,
),
]
),
),
# Concrete durability
rfem.reinforcement.ConcreteDurability( # XC1/XF2
no=1,
corrosion_induced_by_carbonation_enabled = True,
corrosion_induced_by_carbonation = rfem.reinforcement.ConcreteDurability.CORROSION_INDUCED_BY_CARBONATION_DRY_OR_PERMANENTLY_WET,
freeze_thaw_attack_enabled = True,
freeze_thaw_attack = rfem.reinforcement.ConcreteDurability.FREEZE_THAW_ATTACK_MODERATE_WATER_SATURATION_DEICING,
allowance_of_deviation_type = rfem.reinforcement.ConcreteDurability.ALLOWANCE_OF_DEVIATION_TYPE_STANDARD,
),
rfem.reinforcement.ConcreteDurability( # XC3/XF2
no=2,
corrosion_induced_by_carbonation_enabled = True,
corrosion_induced_by_carbonation = rfem.reinforcement.ConcreteDurability.CORROSION_INDUCED_BY_CARBONATION_MODERATE_HUMIDITY,
freeze_thaw_attack_enabled = True,
freeze_thaw_attack = rfem.reinforcement.ConcreteDurability.FREEZE_THAW_ATTACK_MODERATE_WATER_SATURATION_DEICING,
allowance_of_deviation_type = rfem.reinforcement.ConcreteDurability.ALLOWANCE_OF_DEVIATION_TYPE_STANDARD,
),
# Nodal Supports
rfem.types_for_nodes.NodalSupport(
no=1,
user_defined_name_enabled=True,
name="Hinged",
nodes=[1],
spring=common.Vector3d(x=inf, y=inf, z=inf),
rotational_restraint=common.Vector3d(x=inf, y=0, z=inf),
),
rfem.types_for_nodes.NodalSupport(
no=2,
user_defined_name_enabled=True,
name="Moveable in X",
nodes=[2],
spring=common.Vector3d(x=0, y=inf, z=inf),
rotational_restraint=common.Vector3d(x=0, y=0, z=inf),
),
]
def define_loading() -> list:
# The column is subjected to an axial compressive force and and three lateral loads.
# The beam is
return [
# Load Cases
rfem.loading.LoadCase(
no=1,
name="Self-weight",
static_analysis_settings=1,
self_weight_active=True,
),
rfem.loading.LoadCase(
no=2,
name="Variable Load",
static_analysis_settings=1,
action_category=rfem.loading.Action.IMPOSED_LOAD_CATEGORY_IMPOSED_LOADS_CATEGORY_A,
),
# Loads
rfem.loads.MemberLoad(
no=1,
load_case=1,
members=[1],
load_distribution=rfem.loads.MemberLoad.LOAD_DISTRIBUTION_UNIFORM,
magnitude=10000,
),
rfem.loads.MemberLoad(
no=2,
load_case=2,
members=[1],
load_distribution=rfem.loads.MemberLoad.LOAD_DISTRIBUTION_UNIFORM,
magnitude=15000,
),
# Design Situations
rfem.loading.DesignSituation(
no=1,
name="ULS (STR/GEO) - Permanent and transient - Eq. 6.10",
design_situation_type=rfem.loading.DesignSituation.DESIGN_SITUATION_TYPE_STR_PERMANENT_AND_TRANSIENT_6_10,
combination_wizard=1
),
# Static Analysis Settings
rfem.loading.StaticAnalysisSettings(
no=1,
),
rfem.loading.CombinationWizard(
no=1,
static_analysis_settings=1,
),
]
def define_concrete_design() -> list:
return [
# Concrete Design Configurations
rfem.concrete_design_objects.ConcreteDesignUlsConfiguration(
no=1,
assigned_to_all_members=True,
assigned_to_all_nodes=True,
),
# Design Supports
rfem.types_for_members.DesignSupport(
no=1,
type=rfem.types_for_members.DesignSupport.TYPE_CONCRETE,
assigned_to_members=[1],
assigned_to_nodes=[1],
direct_support_z_enabled=True,
inner_support_z_enabled=False,
support_width_z=0.4,
consider_in_deflection_design_z=True,
consider_in_deflection_design_y=False,
),
rfem.types_for_members.DesignSupport(
no=2,
type=rfem.types_for_members.DesignSupport.TYPE_CONCRETE,
assigned_to_members=[1],
assigned_to_nodes=[2],
direct_support_z_enabled=True,
inner_support_z_enabled=True,
concrete_ratio_of_moment_redistribution_z=0.850,
support_width_z=0.4,
consider_in_deflection_design_z=True,
consider_in_deflection_design_y=False,
),
]
class ReinforcementLayer(Enum):
TOP = 0
BOTTOM = 1
def get_max_req_reinf_location(required_reinf_df: pandas.DataFrame, reinforcement_layer: "ReinforcementLayer") -> float:
"""
Returns the design_check_details_id for the row with the maximum longitudinal reinforcement area
at the specified reinforcement layer (ReinforcementLayer.TOP or ReinforcementLayer.BOTTOM).
Args:
required_reinf_df (pandas.DataFrame): DataFrame with required reinforcement data.
reinforcement_layer (ReinforcementLayer): Enum value ReinforcementLayer.TOP or ReinforcementLayer.BOTTOM.
Returns:
float: location for the row with the maximum reinforcement area.
"""
if not isinstance(reinforcement_layer, ReinforcementLayer):
raise ValueError("reinforcement_layer must be an instance of ReinforcementLayer Enum")
layer_map = {ReinforcementLayer.TOP: "top", ReinforcementLayer.BOTTOM: "bottom"}
col = f"longitudinal_reinforcement_area_a_s_{layer_map[reinforcement_layer]}"
if col not in required_reinf_df.columns:
raise ValueError(f"Column '{col}' not found in DataFrame.")
max_row = required_reinf_df.loc[required_reinf_df[col].idxmax()]
return max_row["location"]
def get_design_check_details_id_for_location(design_checks_df: pandas.DataFrame, location: float):
"""
Returns the design_check_details_id for the row at the specified location
with the maximum top longitudinal reinforcement area in design_checks_df.
Args:
design_checks_df (pandas.DataFrame): DataFrame with design check results.
location: Value to filter the 'location_x' column (float or int).
Returns:
int: design_check_details_id for the row with the maximum top reinforcement area at the given location.
"""
filtered = design_checks_df[design_checks_df["location_x"] == location]
if filtered.empty:
raise ValueError(f"No rows found for location_x == {location}")
max_row = filtered.loc[filtered["design_ratio"].idxmax()]
return max_row["design_check_details_id"]
def get_design_check_value_by_key(design_check_details, key) -> str:
"""
This function extracts the 'value', 'unit', and 'caption' from the design check details
based on the specified 'key'. The unit string is cleaned to remove any HTML tags.
"""
row = design_check_details.loc[design_check_details['key'] == key]
if row.empty:
raise ValueError(f"Key '{key}' not found in design check details.")
caption = row['caption'].values[0]
key = row['key'].values[0]
value = row['value'].values[0]
unit = row['unit'].values[0]
# Remove HTML tags from unit string
unit_clean = re.sub(r"<[^>]+>", "", str(unit))
return f"{key} = {value} [{unit_clean}]\t| {caption}"
# -------------------------------------------------------
# MAIN SCRIPT
# -------------------------------------------------------
with rfem.Application() as rfem_app:
# Initialize model
# rfem_app.close_all_models(save_changes=False)
rfem_app.create_model(name="concrete_design_member_reinf.rf6")
# Edit base data
base_data = rfem_app.get_base_data()
base_data.combinations_settings.combination_wizard_active = True
base_data.addons.concrete_design_active = True
base_data.addons.load_wizards_active = True
base_data.addons.combination_wizard_and_classification_active = True
base_data.standards.concrete_design_standard = rfem.BaseData.Standards.CONCRETE_DESIGN_NATIONAL_ANNEX_AND_EDITION_EN_1992_DIN_2015_12_STANDARD
base_data.standards.load_wizard_standard = rfem.BaseData.Standards.LOAD_WIZARD_NATIONAL_ANNEX_AND_EDITION_EN_1991_DIN_2019_04_STANDARD
base_data.standards.combination_wizard_standard = rfem.BaseData.Standards.COMBINATION_WIZARD_NATIONAL_ANNEX_AND_EDITION_EN_1990_DIN_2012_08_STANDARD
base_data.main.model_type = rfem.BaseData.Main.MODEL_TYPE_2D_XZ_PLANE_STRESS
rfem_app.set_base_data(base_data=base_data)
# Create model
rfem_app.delete_all_objects()
rfem_app.create_object_list(
objs=
define_structure()+
define_loading()+
define_concrete_design()
)
# Calculate model
rfem_app.calculate_all(skip_warnings=False)
# Retrieve required reinforcement by location
required_reinf_df = rfem_app.get_result_table(
table=rfem.results.CONCRETE_DESIGN_REQUIRED_REINFORCEMENT_AREA_ON_MEMBERS_BY_LOCATION_TABLE,
loading=None
).data
# Retrieve design check ratios for section resistance
design_ratios_df = rfem_app.get_results(
results_type=rfem.results.CONCRETE_DESIGN_MEMBERS_DESIGN_RATIOS,
).data
design_check_type = "UL0100.00"
design_check_ul0100 = design_ratios_df.loc[design_ratios_df['design_check_type'] == design_check_type]
design_check_desc = design_ratios_df.loc[design_ratios_df['design_check_type'] == design_check_type, 'design_check_description'].values[0]
print(f"\nDesign Check Ratios | {design_check_type} | {design_check_desc}:\n {design_check_ul0100}")
# Get bottom reiforcement design check details
bottom_reinf_location_max = get_max_req_reinf_location(required_reinf_df, ReinforcementLayer.BOTTOM)
bottom_reinf_details_id = get_design_check_details_id_for_location(design_check_ul0100, bottom_reinf_location_max)
bottom_reinf_details = rfem_app.get_results(
results_type=rfem.results.CONCRETE_DESIGN_DESIGN_CHECK_DETAILS,
filters=[
rfem.results.ResultsFilter(
column_id="design_check_details_id",
filter_expression=str(bottom_reinf_details_id)
)
],
).data
print(f"\nBottom Reinforcement | Location = {bottom_reinf_location_max} [m]:")
print(get_design_check_value_by_key(bottom_reinf_details, key='a_s_z_bottom'))
print(get_design_check_value_by_key(bottom_reinf_details, key='m_y_ed'))
print(get_design_check_value_by_key(bottom_reinf_details, key='m_y_rd'))
print(get_design_check_value_by_key(bottom_reinf_details, key='x_rd'))
print(get_design_check_value_by_key(bottom_reinf_details, key='eta'))
# Get top reiforcement design check details
top_reinf_location_max = get_max_req_reinf_location(required_reinf_df, ReinforcementLayer.TOP)
top_reinf_details_id = get_design_check_details_id_for_location(design_check_ul0100, top_reinf_location_max)
top_reinf_details = rfem_app.get_results(
results_type=rfem.results.CONCRETE_DESIGN_DESIGN_CHECK_DETAILS,
filters=[
rfem.results.ResultsFilter(
column_id="design_check_details_id",
filter_expression=str(top_reinf_details_id)
)
],
).data
print(f"\nTop Reinforcement | Location = {top_reinf_location_max} [m]:")
print(get_design_check_value_by_key(top_reinf_details, key='a_s_z_top'))
print(get_design_check_value_by_key(top_reinf_details, key='m_y_ed'))
print(get_design_check_value_by_key(top_reinf_details, key='m_y_rd'))
print(get_design_check_value_by_key(top_reinf_details, key='x_rd'))
print(get_design_check_value_by_key(top_reinf_details, key='eta'))
using System.Text.RegularExpressions;
using Dlubal.Api.Common;
using Google.Protobuf;
using Microsoft.Data.Analysis;
using Common = Dlubal.Api.Common;
using Rfem = Dlubal.Api.Rfem;
// -------------------------------------------------------
// This example demonstrates the ultimate limit state design check of a concrete
// single-span member with cantilever in accordance with DIN EN 1992-1-1:NA 2015-12.
// It includes the definition of shear and longitudinal reinforcement and extraction
// of detailed section resistance results for bending with or without axial force.
// -------------------------------------------------------
const double LENGTH_TOTAL = 8.0;
const double LENGTH_CANTILEVER = 2.0;
const string CONCRETE_GRADE = "C25/30";
const string STEEL_REINF_GRADE = "B500S(A)";
const string CROSS_SECTION = "R_M1 0.3/0.45";
static List<IMessage> DefineStructure()
{
return new List<IMessage>
{
// Materials
new Rfem.StructureCore.Material
{
No = 1,
Name = CONCRETE_GRADE,
},
new Rfem.StructureCore.Material
{
No = 2,
Name = STEEL_REINF_GRADE,
},
// Cross-section
new Rfem.StructureCore.CrossSection
{
No = 1,
Name = CROSS_SECTION,
Material = 1,
},
// Nodes
new Rfem.StructureCore.Node
{
No = 1,
Coordinate1 = 0,
},
new Rfem.StructureCore.Node
{
No = 2,
Type = Rfem.StructureCore.Node.Types.Type.OnMember,
OnMemberReferenceMember = 1,
DistanceFromStartIsDefinedAsRelative = false,
DistanceFromStartAbsolute = LENGTH_TOTAL - LENGTH_CANTILEVER,
},
new Rfem.StructureCore.Node
{
No = 3,
Coordinate1 = LENGTH_TOTAL,
},
// Line
new Rfem.StructureCore.Line
{
No = 1,
Type = Rfem.StructureCore.Line.Types.Type.Polyline,
DefinitionNodes = { 1, 3 },
},
// Member
new Rfem.StructureCore.Member
{
No = 1,
Type = Rfem.StructureCore.Member.Types.Type.Beam,
Line = 1,
CrossSectionStart = 1,
ConcreteCoverDifferentAtCrossSectionSidesEnabled = true,
ConcreteDurabilityTop = 1,
ConcreteDurabilityLeft = 2,
ConcreteDurabilityRight = 2,
ConcreteDurabilityBottom = 2,
ConcreteShearReinforcementSpans = new Rfem.StructureCore.Member.Types.ConcreteShearReinforcementSpansTable
{
Rows =
{
new Rfem.StructureCore.Member.Types.ConcreteShearReinforcementSpansRow
{
StirrupType = Rfem.StructureCore.Member.Types.ConcreteShearReinforcementSpansRow.Types.StirrupType.TwoLeggedClosedHook135,
StirrupDiameter = 0.008,
StirrupDistances = 0.3,
SpanPositionDefinitionFormat = Rfem.StructureCore.Member.Types.ConcreteShearReinforcementSpansRow.Types.SpanPositionDefinitionFormat.Absolute,
SpanStartAbsolute = 0,
SpanEndAbsolute = (LENGTH_TOTAL - LENGTH_CANTILEVER) * 0.75,
StirrupLayoutRule = Rfem.StructureCore.Member.Types.ConcreteShearReinforcementSpansRow.Types.StirrupLayoutRule.StartEqualsEnd,
},
new Rfem.StructureCore.Member.Types.ConcreteShearReinforcementSpansRow
{
StirrupType = Rfem.StructureCore.Member.Types.ConcreteShearReinforcementSpansRow.Types.StirrupType.TwoLeggedClosedHook135,
StirrupDiameter = 0.008,
StirrupDistances = 0.2,
SpanPositionDefinitionFormat = Rfem.StructureCore.Member.Types.ConcreteShearReinforcementSpansRow.Types.SpanPositionDefinitionFormat.Absolute,
SpanStartAbsolute = (LENGTH_TOTAL - LENGTH_CANTILEVER) * 0.75,
SpanEndAbsolute = LENGTH_TOTAL,
StirrupLayoutRule = Rfem.StructureCore.Member.Types.ConcreteShearReinforcementSpansRow.Types.StirrupLayoutRule.StartEqualsEnd,
},
},
},
ConcreteLongitudinalReinforcementItems = new Rfem.StructureCore.Member.Types.ConcreteLongitudinalReinforcementItemsTable
{
Rows =
{
new Rfem.StructureCore.Member.Types.ConcreteLongitudinalReinforcementItemsRow
{
RebarType = Rfem.StructureCore.Member.Types.ConcreteLongitudinalReinforcementItemsRow.Types.RebarType.Unsymmetrical,
Material = 2,
BarCountUnsymmetricalTopSide = 2,
BarDiameterUnsymmetricalTopSide = 0.012,
BarCountUnsymmetricalAtSide = 1,
BarDiameterUnsymmetricalAtSide = 0.010,
BarCountUnsymmetricalBottomSide = 3,
BarDiameterUnsymmetricalBottomSide = 0.016,
SpanPositionDefinitionFormat = Rfem.StructureCore.Member.Types.ConcreteLongitudinalReinforcementItemsRow.Types.SpanPositionDefinitionFormat.Absolute,
SpanStartAbsolute = 0,
SpanEndAbsolute = LENGTH_TOTAL,
},
new Rfem.StructureCore.Member.Types.ConcreteLongitudinalReinforcementItemsRow
{
RebarType = Rfem.StructureCore.Member.Types.ConcreteLongitudinalReinforcementItemsRow.Types.RebarType.Unsymmetrical,
Material = 2,
BarCountUnsymmetricalTopSide = 0,
BarCountUnsymmetricalAtSide = 0,
BarCountUnsymmetricalBottomSide = 2,
BarDiameterUnsymmetricalBottomSide = 0.016,
SpanPositionDefinitionFormat = Rfem.StructureCore.Member.Types.ConcreteLongitudinalReinforcementItemsRow.Types.SpanPositionDefinitionFormat.Absolute,
SpanStartAbsolute = 0,
SpanEndAbsolute = LENGTH_TOTAL - LENGTH_CANTILEVER,
AdditionalOffsetType = Rfem.StructureCore.Member.Types.ConcreteLongitudinalReinforcementItemsRow.Types.AdditionalOffsetType.FromStirrup,
AdditionalOffsetLeftSide = 0.04,
AdditionalOffsetRightSide = 0.04,
},
new Rfem.StructureCore.Member.Types.ConcreteLongitudinalReinforcementItemsRow
{
RebarType = Rfem.StructureCore.Member.Types.ConcreteLongitudinalReinforcementItemsRow.Types.RebarType.Line,
Material = 2,
BarCountLine = 2,
BarDiameterLine = 0.012,
AdditionalOffsetType = Rfem.StructureCore.Member.Types.ConcreteLongitudinalReinforcementItemsRow.Types.AdditionalOffsetType.FromStirrup,
AdditionalOffsetReferenceTypeAtStart = Rfem.StructureCore.Member.Types.ConcreteLongitudinalReinforcementItemsRow.Types.AdditionalOffsetReferenceTypeAtStart.LeftTop,
AdditionalHorizontalOffsetAtStart = 0.04,
AdditionalVerticalOffsetAtStart = 0.0,
AdditionalOffsetReferenceTypeAtEnd = Rfem.StructureCore.Member.Types.ConcreteLongitudinalReinforcementItemsRow.Types.AdditionalOffsetReferenceTypeAtEnd.RightTop,
AdditionalHorizontalOffsetAtEnd = 0.04,
AdditionalVerticalOffsetAtEnd = 0.0,
SpanPositionDefinitionFormat = Rfem.StructureCore.Member.Types.ConcreteLongitudinalReinforcementItemsRow.Types.SpanPositionDefinitionFormat.Absolute,
SpanStartAbsolute = LENGTH_TOTAL - LENGTH_CANTILEVER * 1.6,
SpanEndAbsolute = LENGTH_TOTAL - LENGTH_CANTILEVER * 0.4,
},
},
},
},
// Concrete durability
new Rfem.Reinforcement.ConcreteDurability
{
No = 1,
CorrosionInducedByCarbonationEnabled = true,
CorrosionInducedByCarbonation = Rfem.Reinforcement.ConcreteDurability.Types.CorrosionInducedByCarbonation.DryOrPermanentlyWet,
FreezeThawAttackEnabled = true,
FreezeThawAttack = Rfem.Reinforcement.ConcreteDurability.Types.FreezeThawAttack.ModerateWaterSaturationDeicing,
AllowanceOfDeviationType = Rfem.Reinforcement.ConcreteDurability.Types.AllowanceOfDeviationType.Standard,
},
new Rfem.Reinforcement.ConcreteDurability
{
No = 2,
CorrosionInducedByCarbonationEnabled = true,
CorrosionInducedByCarbonation = Rfem.Reinforcement.ConcreteDurability.Types.CorrosionInducedByCarbonation.ModerateHumidity,
FreezeThawAttackEnabled = true,
FreezeThawAttack = Rfem.Reinforcement.ConcreteDurability.Types.FreezeThawAttack.ModerateWaterSaturationDeicing,
AllowanceOfDeviationType = Rfem.Reinforcement.ConcreteDurability.Types.AllowanceOfDeviationType.Standard,
},
// Supports
new Rfem.TypesForNodes.NodalSupport
{
No = 1,
UserDefinedNameEnabled = true,
Name = "Hinged",
Nodes = { 1 },
Spring = new Common.Vector3d { X = double.PositiveInfinity, Y = double.PositiveInfinity, Z = double.PositiveInfinity },
RotationalRestraint = new Common.Vector3d { X = double.PositiveInfinity, Y = 0, Z = double.PositiveInfinity },
},
new Rfem.TypesForNodes.NodalSupport
{
No = 2,
UserDefinedNameEnabled = true,
Name = "Moveable in X",
Nodes = { 2 },
Spring = new Common.Vector3d { X = 0, Y = double.PositiveInfinity, Z = double.PositiveInfinity },
RotationalRestraint = new Common.Vector3d { X = 0, Y = 0, Z = double.PositiveInfinity },
},
};
}
static List<IMessage> DefineLoading()
{
return new List<IMessage>
{
new Rfem.Loading.LoadCase
{
No = 1,
Name = "Self-weight",
StaticAnalysisSettings = 1,
SelfWeightActive = true,
},
new Rfem.Loading.LoadCase
{
No = 2,
Name = "Variable Load",
StaticAnalysisSettings = 1,
ActionCategory = Rfem.Loading.LoadCase.Types.ActionCategory.ImposedLoadsCategoryADomesticResidentialAreasQiA,
},
new Rfem.Loads.MemberLoad
{
No = 1,
LoadCase = 1,
Members = { 1 },
LoadDistribution = Rfem.Loads.MemberLoad.Types.LoadDistribution.Uniform,
Magnitude = 10000,
},
new Rfem.Loads.MemberLoad
{
No = 2,
LoadCase = 2,
Members = { 1 },
LoadDistribution = Rfem.Loads.MemberLoad.Types.LoadDistribution.Uniform,
Magnitude = 15000,
},
new Rfem.Loading.DesignSituation
{
No = 1,
Name = "ULS (STR/GEO) - Permanent and transient - Eq. 6.10",
DesignSituationType = Rfem.Loading.DesignSituation.Types.DesignSituationType.StrPermanentAndTransient610,
CombinationWizard = 1,
},
new Rfem.Loading.StaticAnalysisSettings
{
No = 1,
},
new Rfem.Loading.CombinationWizard
{
No = 1,
StaticAnalysisSettings = 1,
},
};
}
static List<IMessage> DefineConcreteDesign()
{
return new List<IMessage>
{
new Rfem.ConcreteDesignObjects.ConcreteDesignUlsConfiguration
{
No = 1,
AssignedToAllMembers = true,
AssignedToAllNodes = true,
},
new Rfem.TypesForMembers.DesignSupport
{
No = 1,
Type = Rfem.TypesForMembers.DesignSupport.Types.Type.Concrete,
AssignedToMembers = { 1 },
AssignedToNodes = { 1 },
DirectSupportZEnabled = true,
InnerSupportZEnabled = false,
SupportWidthZ = 0.4,
ConsiderInDeflectionDesignZ = true,
ConsiderInDeflectionDesignY = false,
},
new Rfem.TypesForMembers.DesignSupport
{
No = 2,
Type = Rfem.TypesForMembers.DesignSupport.Types.Type.Concrete,
AssignedToMembers = { 1 },
AssignedToNodes = { 2 },
DirectSupportZEnabled = true,
InnerSupportZEnabled = true,
ConcreteRatioOfMomentRedistributionZ = 0.850,
SupportWidthZ = 0.4,
ConsiderInDeflectionDesignZ = true,
ConsiderInDeflectionDesignY = false,
},
};
}
static double ParseDoubleCell(object? value)
{
if (value == null)
{
return double.NaN;
}
if (double.TryParse(value.ToString(), out double parsed))
{
return parsed;
}
return double.NaN;
}
static string ParseStringCell(object? value)
{
return value?.ToString() ?? string.Empty;
}
static int GetColumnIndex(DataFrame df, string columnName)
{
for (int i = 0; i < df.Columns.Count; i++)
{
if (df.Columns[i].Name == columnName)
{
return i;
}
}
return -1;
}
static Dictionary<string, int> BuildColumnIndexMap(DataFrame df, params string[] columns)
{
var map = new Dictionary<string, int>();
foreach (var column in columns)
{
int index = GetColumnIndex(df, column);
if (index < 0)
{
throw new InvalidOperationException($"Required column '{column}' was not found.");
}
map[column] = index;
}
return map;
}
static double GetMaxReqReinfLocation(Common.Table requiredReinf, string layer)
{
if (layer != "top" && layer != "bottom")
{
throw new ArgumentException("layer must be 'top' or 'bottom'.");
}
string columnName = layer == "top"
? "longitudinal_reinforcement_area_a_s_top"
: "longitudinal_reinforcement_area_a_s_bottom";
var col = BuildColumnIndexMap(requiredReinf.Data, columnName, "location");
int reqCol = col[columnName];
int locationCol = col["location"];
double maxValue = double.NegativeInfinity;
double maxLocation = double.NaN;
for (int row = 0; row < requiredReinf.Data.Rows.Count; row++)
{
double value = ParseDoubleCell(requiredReinf.Data[row, reqCol]);
if (double.IsNaN(value))
{
continue;
}
if (value > maxValue)
{
maxValue = value;
maxLocation = ParseDoubleCell(requiredReinf.Data[row, locationCol]);
}
}
if (double.IsNaN(maxLocation))
{
throw new InvalidOperationException("No valid reinforcement row found.");
}
return maxLocation;
}
static long GetDesignCheckDetailsIdForLocation(Common.Table designChecks, string designCheckType, double location)
{
var col = BuildColumnIndexMap(
designChecks.Data,
"design_check_type",
"location_x",
"design_ratio",
"design_check_details_id"
);
double maxRatio = double.NegativeInfinity;
long bestId = -1;
bool foundLocation = false;
for (int row = 0; row < designChecks.Data.Rows.Count; row++)
{
string rowType = ParseStringCell(designChecks.Data[row, col["design_check_type"]]);
if (rowType != designCheckType)
{
continue;
}
double rowLoc = ParseDoubleCell(designChecks.Data[row, col["location_x"]]);
if (Math.Abs(rowLoc - location) > 1e-9)
{
continue;
}
foundLocation = true;
double ratio = ParseDoubleCell(designChecks.Data[row, col["design_ratio"]]);
if (double.IsNaN(ratio))
{
continue;
}
if (ratio > maxRatio)
{
maxRatio = ratio;
bestId = (long)ParseDoubleCell(designChecks.Data[row, col["design_check_details_id"]]);
}
}
if (!foundLocation || bestId < 0)
{
throw new InvalidOperationException($"No design check details found for location_x == {location}");
}
return bestId;
}
static Dictionary<string, string> BuildDesignCheckValueMap(Common.Table designCheckDetails)
{
var col = BuildColumnIndexMap(designCheckDetails.Data, "key", "caption", "value", "unit");
var valueByKey = new Dictionary<string, string>();
for (int row = 0; row < designCheckDetails.Data.Rows.Count; row++)
{
string rowKey = ParseStringCell(designCheckDetails.Data[row, col["key"]]);
if (string.IsNullOrWhiteSpace(rowKey))
{
continue;
}
string caption = ParseStringCell(designCheckDetails.Data[row, col["caption"]]);
string value = ParseStringCell(designCheckDetails.Data[row, col["value"]]);
string unit = ParseStringCell(designCheckDetails.Data[row, col["unit"]]);
string unitClean = Regex.Replace(unit, "<[^>]+>", "");
valueByKey[rowKey] = $"{rowKey} = {value} [{unitClean}]\t| {caption}";
}
return valueByKey;
}
static void PrintDesignCheckValues(Dictionary<string, string> valuesByKey, params string[] keys)
{
foreach (string key in keys)
{
if (!valuesByKey.TryGetValue(key, out string? value))
{
throw new InvalidOperationException($"Key '{key}' not found in design check details.");
}
Console.WriteLine(value);
}
}
static string GetDesignCheckDescription(Common.Table designRatios, string designCheckType)
{
int typeCol = GetColumnIndex(designRatios.Data, "design_check_type");
int descCol = GetColumnIndex(designRatios.Data, "design_check_description");
if (typeCol < 0 || descCol < 0)
{
return string.Empty;
}
for (int row = 0; row < designRatios.Data.Rows.Count; row++)
{
if (ParseStringCell(designRatios.Data[row, typeCol]) == designCheckType)
{
return ParseStringCell(designRatios.Data[row, descCol]);
}
}
return string.Empty;
}
// -------------------------------------------------------
// MAIN SCRIPT
// -------------------------------------------------------
ApplicationRfem? rfemApp = null;
try
{
rfemApp = new ApplicationRfem();
// Initialize model
rfemApp.create_model(name: "concrete_design_member_reinf.rf6");
// Edit base data
Rfem.BaseData baseData = rfemApp.get_base_data();
baseData.CombinationsSettings.CombinationWizardActive = true;
baseData.Addons.ConcreteDesignActive = true;
baseData.Addons.LoadWizardsActive = true;
baseData.Addons.CombinationWizardAndClassificationActive = true;
baseData.Standards.ConcreteDesignStandard = Rfem.BaseData.Types.Standards.Types.ConcreteDesignStandard.ConcreteDesignNationalAnnexAndEditionEn1992Din201512Standard;
baseData.Standards.LoadWizardStandard = Rfem.BaseData.Types.Standards.Types.LoadWizardStandard.LoadWizardNationalAnnexAndEditionEn1991Din201904Standard;
baseData.Standards.CombinationWizardStandard = Rfem.BaseData.Types.Standards.Types.CombinationWizardStandard.CombinationWizardNationalAnnexAndEditionEn1990Din201208Standard;
baseData.Main.ModelType = Rfem.BaseData.Types.Main.Types.ModelType._2DXzPlaneStress;
rfemApp.set_base_data(baseData: baseData);
rfemApp.delete_all_objects();
rfemApp.create_object_list(DefineStructure());
rfemApp.create_object_list(DefineLoading());
rfemApp.create_object_list(DefineConcreteDesign());
// Calculate model
rfemApp.calculate_all(skipWarnings: false);
// Required reinforcement by location
Common.Table requiredReinf = rfemApp.get_result_table(
table: Rfem.Results.ResultTable.ConcreteDesignRequiredReinforcementAreaOnMembersByLocationTable
);
// Design ratios for section resistance
Common.Table designRatios = rfemApp.get_results(
resultsType: Rfem.Results.ResultsType.ConcreteDesignMembersDesignRatios
);
string designCheckType = "UL0100.00";
string designCheckDesc = GetDesignCheckDescription(designRatios, designCheckType);
Console.WriteLine($"\nDesign Check Ratios | {designCheckType} | {designCheckDesc}:\n{designRatios.Data}");
// Bottom reinforcement details
double bottomLocationMax = GetMaxReqReinfLocation(requiredReinf, "bottom");
long bottomDetailsId = GetDesignCheckDetailsIdForLocation(designRatios, designCheckType, bottomLocationMax);
Common.Table bottomDetails = rfemApp.get_results(
resultsType: Rfem.Results.ResultsType.ConcreteDesignDesignCheckDetails,
filters: new List<Rfem.Results.ResultsFilter>
{
new Rfem.Results.ResultsFilter
{
ColumnId = "design_check_details_id",
FilterExpression = bottomDetailsId.ToString(),
},
}
);
Console.WriteLine($"\nBottom Reinforcement | Location = {bottomLocationMax} [m]:");
var bottomValuesByKey = BuildDesignCheckValueMap(bottomDetails);
PrintDesignCheckValues(bottomValuesByKey, "a_s_z_bottom", "m_y_ed", "m_y_rd", "x_rd", "eta");
// Top reinforcement details
double topLocationMax = GetMaxReqReinfLocation(requiredReinf, "top");
long topDetailsId = GetDesignCheckDetailsIdForLocation(designRatios, designCheckType, topLocationMax);
Common.Table topDetails = rfemApp.get_results(
resultsType: Rfem.Results.ResultsType.ConcreteDesignDesignCheckDetails,
filters: new List<Rfem.Results.ResultsFilter>
{
new Rfem.Results.ResultsFilter
{
ColumnId = "design_check_details_id",
FilterExpression = topDetailsId.ToString(),
},
}
);
Console.WriteLine($"\nTop Reinforcement | Location = {topLocationMax} [m]:");
var topValuesByKey = BuildDesignCheckValueMap(topDetails);
PrintDesignCheckValues(topValuesByKey, "a_s_z_top", "m_y_ed", "m_y_rd", "x_rd", "eta");
}
catch (Exception ex)
{
Console.WriteLine($"Error: {ex.Message}");
}
finally
{
if (rfemApp != null) rfemApp.close_connection();
}