IDEA StatiCa Concrete
General cross-sections can be created, defined by a set of coordinates.
Fatigue calculations can be performed.
Supported (tested) IDEA StatiCa versions:
- v22
- v21
- v20
An IDEA StatiCa Concrete binding has been developed by VIKTOR to simplify the process of creating a model, running an analysis (worker required) and parsing the results. VIKTOR's IDEA-RCS integration requires a specific IDEA worker which can be downloaded here.
Creating a model
A model can be created using the binding in two different ways:
Model
: create a model with the least effort. Limited set of features.OpenModel
: resembles the API of IDEA StatiCa Concrete. Less intuitive thanModel
, but can be used if the latter lacks desired features.
Creating a model using Model
The process consists of the following steps:
- Create the 'empty'
Model
. OptionallyProjectData
and/orCodeSettings
can be specified (see this section) - Create one or more materials for the cross section(s) using
Model.create_concrete_material
. - Create one or more materials for the reinforcement(s) using
Model.create_reinforcement_material
. - Create members to be checked using
Model.create_beam
(or similar methods, see below). - Create reinforcement(s) using
Beam.create_bar
. - Create extreme(s) with corresponding internal forces using
Beam.create_extreme
(or similar). - Generate the input XML file using
Model.generate_xml_input
.
from viktor.external.idea_rcs import Model, ConcreteMaterial, ReinforcementMaterial, \
ResultOfInternalForces, LoadingSLS, LoadingULS, RectSection
model = Model() # Initialize the model.
# Create the desired material(s).
cs_mat = model.create_concrete_material(ConcreteMaterial.C12_15)
mat_reinf = model.create_reinforcement_material(ReinforcementMaterial.B_400A)
# Create a beam (or other type of member) to be checked.
cross_section = RectSection(0.5, 1.0)
beam = model.create_beam(cross_section, cs_mat)
# Create bars (and stirrups) as desired
bar_locations = [(-0.101, -0.175), (0.101, -0.175), (0.101, 0.175), (-0.101, 0.175)]
bar_diameters = [0.016, 0.016, 0.016, 0.016]
for coords, diameter in zip(bar_locations, bar_diameters):
beam.create_bar(coords, diameter, mat_reinf)
# Add extreme(s)
freq = LoadingSLS(ResultOfInternalForces(N=-100000, My=210000))
fund = LoadingULS(ResultOfInternalForces(N=-99999, My=200000))
beam.create_extreme(frequent=freq, fundamental=fund)
# Generate the input XML file.
input_file = model.generate_xml_input()
Model.generate_xml_input
needs to be mocked
within the context of (automated) testing.
Currently, Model
supports the following member types:
Currently, Model
supports the following section types:
- General (>= v12.7.0)
- Rectangular
Creating a model using OpenModel
The process consists of the following steps:
Create the 'empty'
OpenModel
. OptionallyProjectData
and/orCodeSettings
can be specified (see this section)Create one or more materials for the cross section(s) using
OpenModel.create_matconcrete_ec2
.Create a concrete cross-section using one of:
noteIn case of a
CrossSectionParameter
, the**parameters
argument should contain keys and values corresponding to thecross_section_type
, else the input file will be invalid. For more information on what**parameters
are required for a certaincross_section_type
, please seecreate_cross_section_parameter
Create one or more materials for the reinforcement(s) using
OpenModel.create_matreinforcement_ec2
.Create the reinforced cross section(s) using
OpenModel.create_reinforced_cross_section
.Create reinforcement(s) using
ReinforcedCrossSection.create_bar
.Create check member(s) using
OpenModel.create_check_member1d
.Couple the check member and reinforced cross section using
OpenModel.add_check_section
.Create extreme(s) with corresponding internal forces using
CheckSection.create_extreme
.Add additional data to the check member using
OpenModel.add_member_data_ec2
.noteThe
member_type
andtwo_way_slab_type
should correspond to the chosen reinforced cross sectionGenerate the input XML file using
OpenModel.generate_xml_input
.
from viktor.external.idea_rcs import OpenModel, ConcreteMaterial, ReinforcementMaterial, CrossSectionType, \
ResultOfInternalForces, LoadingSLS, LoadingULS, MemberType, TwoWaySlabType
model = OpenModel() # Initialize the model.
# Create the concrete section.
mat = model.create_matconcrete_ec2(ConcreteMaterial.C12_15)
cs = model.create_cross_section_parameter(name='cs', cross_section_type=CrossSectionType.RECT, material=mat,
Width=2.0, Height=2.0)
# Create the reinforced cross section.
rcs = model.create_reinforced_cross_section(name='rcs', cross_section=cs)
# Create bars (and stirrups) as desired
mat_reinf = model.create_matreinforcement_ec2(ReinforcementMaterial.B_400A)
bar_locations = [(-0.101, -0.175), (0.101, -0.175), (0.101, 0.175), (-0.101, 0.175)]
bar_diameters = [0.016, 0.016, 0.016, 0.016]
for coords, diameter in zip(bar_locations, bar_diameters):
rcs.create_bar(coords, diameter, mat_reinf)
# Create a CheckMember.
member = model.create_check_member1d()
# 'Assign' the CheckMember to a CheckSection with the previously defined reinforced section and add extremes.
check_section = model.add_check_section(description='S 1', check_member=member, reinf_section=rcs)
freq = LoadingSLS(ResultOfInternalForces(N=-100000, My=210000))
fund = LoadingULS(ResultOfInternalForces(N=-99999, My=200000))
check_section.create_extreme(frequent=freq, fundamental=fund)
# 'Assign' the necessary additional data to the CheckMember.
model.add_member_data_ec2(member, MemberType.BEAM_SLAB, TwoWaySlabType.SHELL_AS_PLATE)
# Generate the input XML file.
input_file = model.generate_xml_input()
OpenModel.generate_xml_input
needs to be mocked
within the context of (automated) testing.
ProjectData and CodeSettings
When a Model
or OpenModel
is initialized, optionally project data and/or code settings can be specified.
Currently, ProjectData
supports:
- National Annex (no annex, Dutch, Belgium)
- Fatigue check
Currently, CodeSettings
supports:
EvaluationInteractionDiagram
NoResistanceConcreteTension1d
TypeSLSCalculation
theta
,theta_min
,theta_max
(>= v12.7.0)n_cycles_fatigue
(>= v12.7.0)
Running an analysis
After having generated an input XML file, it can be fed to the
IdeaRcsAnalysis
:
from viktor.external.idea_rcs import IdeaRcsAnalysis
# Generate the input XML file from `Model` or `OpenModel`, or generate one yourself.
input_file = ...
# Run the analysis and obtain the output file.
analysis = IdeaRcsAnalysis(input_file)
analysis.execute(60)
output_file = analysis.get_output_file()
Extracting results using RcsOutputFileParser
After running an analysis, the obtained output file can be fed to the RcsOutputFileParser
for convenient extraction
of the results:
from viktor.external.idea_rcs import RcsOutputFileParser
# Obtain the XML output file from `IdeaRcsAnalysis`, or obtain one yourself.
xml_file = idea_rcs_analysis.get_output_file(as_file=True)
# Obtain the results for specific or all section(s).
with xml_file.open_binary() as f:
parser = RcsOutputFileParser(f)
# loop through all sections
for section in parser.section_results():
capacity_results = section.capacity()
shear_results = section.shear()
# or get results for a single section
section_4 = parser.section_result(4)
...
Currently, RcsOutputFileParser
supports the following results (partially):
Capacity
Shear
Torsion
(>= v13.4.0)Interaction
(>= v13.4.0)Crack width
Detailing
Stress limitation
Fatigue
In case you require results which are not supported, you can retrieve the raw results using the
OutputFileParser
. We do not advice to use this when
handling very large result files:
# Obtain the raw results as a dictionary
xml_file = idea_rcs_analysis.get_output_file(as_file=True)
parser = OutputFileParser(xml_file)
raw_results = parser.raw_results()
Testing
mock_IdeaRcsAnalysis
decorator for easier testing of IdeaRcsAnalysis
IdeaRcsAnalysis.execute
needs to be mocked within
the context of (automated) testing.
The viktor.testing
module provides the mock_IdeaRcsAnalysis
decorator that facilitate mocking of workers:
import unittest
from viktor import File
from viktor.testing import mock_IdeaRcsAnalysis
from app.my_entity_type.controller import MyEntityTypeController
class TestMyEntityTypeController(unittest.TestCase):
@mock_IdeaRcsAnalysis(
get_output_file=File.from_path('test_file.xml'),
get_idea_rcs_file=File.from_path('test_file.ideaRcs'),
)
def test_idea_analysis(self):
MyEntityTypeController().idea_analysis()
For the decorator's input parameters the following holds:
- If a Sequence type is provided, the next entry is returned for each corresponding method call. When a call is performed on a depleted iterable, an Exception is raised.
- If a single object is provided, the object is returned each time the corresponding method is called (endlessly).
- If None is provided (default), a default File/BytesIO object (with empty content) is returned each time the corresponding method is called (endlessly).