IDEA StatiCa Concrete
Supported (tested) IDEA StatiCa versions:
- v24
- v23
- v22
- v21
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 installed using these instructions.
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. OptionallyProjectDataand/orCodeSettingscan 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.
import viktor as vkt
model = vkt.idea_rcs.Model() # Initialize the model.
# Create the desired material(s).
cs_mat = model.create_concrete_material(vkt.idea_rcs.ConcreteMaterial.C12_15)
mat_reinf = model.create_reinforcement_material(vkt.idea_rcs.ReinforcementMaterial.B_400A)
# Create a beam (or other type of member) to be checked.
cross_section = vkt.idea_rcs.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 = vkt.idea_rcs.LoadingSLS(vkt.idea_rcs.ResultOfInternalForces(N=-100000, My=210000))
fund = vkt.idea_rcs.LoadingULS(vkt.idea_rcs.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:
Creating a model using OpenModel
The process consists of the following steps:
-
Create the 'empty'
OpenModel. OptionallyProjectDataand/orCodeSettingscan 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**parametersargument should contain keys and values corresponding to thecross_section_type, else the input file will be invalid. For more information on what**parametersare 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_typeandtwo_way_slab_typeshould correspond to the chosen reinforced cross section -
Generate the input XML file using
OpenModel.generate_xml_input.
import viktor as vkt
model = vkt.idea_rcs.OpenModel() # Initialize the model.
# Create the concrete section.
mat = model.create_matconcrete_ec2(vkt.idea_rcs.ConcreteMaterial.C12_15)
cs = model.create_cross_section_parameter(
name='cs', cross_section_type=vkt.idea_rcs.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(vkt.idea_rcs.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 = vkt.idea_rcs.LoadingSLS(vkt.idea_rcs.ResultOfInternalForces(N=-100000, My=210000))
fund = vkt.idea_rcs.LoadingULS(vkt.idea_rcs.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, vkt.idea_rcs.MemberType.BEAM_SLAB, vkt.idea_rcs.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:
- Project name (>= v14.6.0)
- Project number (>= v14.6.0)
- Project description (>= v14.6.0)
- Author (>= v14.6.0)
- Date (>= v14.6.0)
- National Annex (no annex, Dutch, Belgium)
- Fatigue check
- Design working life (>= v14.6.0)
Currently, CodeSettings supports:
EvaluationInteractionDiagramNoResistanceConcreteTension1dTypeSLSCalculationtheta,theta_min,theta_maxn_cycles_fatigue
Running an analysis
After having generated an input XML file, it can be fed to the
IdeaRcsAnalysis:
import viktor as vkt
# Generate the input XML file from `Model` or `OpenModel`, or generate one yourself.
input_file = ...
# Run the analysis and obtain the output file.
analysis = vkt.idea_rcs.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:
import viktor as vkt
# 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 = vkt.idea_rcs.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):
CapacityShearTorsion(>= v13.4.0)Interaction(>= v13.4.0)Crack widthDetailingStress limitationFatigue
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).