Single span girder

Problem Description

In this example a single span girder will be designed according to EN 1992-2004. The input (geometry, materials, sections…) will be written in Teddy, the design will be done by using the programming interface. We will use other modules and the sof_cdb_get() to create our ‘’own AQB module’’.

Hint

Please note that the algorithm for the cross-section design is just an example, it is simplified as much as possible (we use the simplified stress-strain curve). Do NOT compare AQB with this example, because by using this code sample you will get just approximate results.

The problem consists of a single span girder. The cross-section is designed for an ultimate moment MEd and the required reinforcement is determined.

../../_images/vba_single_span_girder_13.png

In the workbook/project example the value of σsd = fyd for ε ≥ εyd (as shown in figure). AQB uses the second curve.

To show how to get the data and manipulate with it, through the example, next values will be read from the CDB:

  • fck is the characteristic compressive strength of concrete,

  • fyd is the characteristic yield strength of concrete reinforcement,

  • h is the height of the cross-section,

  • b is the width of the cross-section,

  • SU d is the offset of bottom reinforcement,

  • MEd is the design value of applied bending moment,

  • NEd is the design value of applied axial force.

../../_images/stress_strain3.svg../../_images/single_span_girder_cross_section3.svg

To read the mentioned values, next keys are necessary:

  • fck @Rec:(1/NR) m_FCK

  • fyk @Rec:(1/NR) m_FY

  • h @Rec:(9/NR) m_H

  • b @Rec:(9/NR) m_B

  • SU @Rec:(9/NR) m_SU

  • MEd @Rec:(102/LC) m_MY

  • NEd @Rec:(102/LC) m_N

Problem Solution

The Python project example can be found by following:

C:\<sofistik_installation>\2020\SOFiSTiK 2020\interfaces\examples\python\python_3.x\single_span_girder

Hint

Please run the SINGLE_SPAN_GIRDER.DAT to generate the CDB. The file can be found in the interfaces folder.

In the Python project, the main files are:

  • single_span_girder.py The main .py file

  • dlls.py Dynamic Library and Project Configuration

  • structs.py The data structure

This part of code shows how to read the fck value from the CDB.

The main python file - single_span_girder.py

This part of code imports the necessary libraries and the data types:

Import Libraries
# import all types from sofistik_daten.py, original file can be found by following
# --> examples/python/sofistik_daten.py
from sofistik_daten import *

import os             # for the environment variable necessary
import platform       # checks the python platform
from dlls import *
from ctypes import *  # read the functions from the cdb
Read the fck value from the CDB, kwh = 1 and kwl = 1
# Read the fck value from the CDB
if py_sof_cdb_kexist(1, 1) == 2: # the key exists and contains data
   ie = c_int(0)
   RecLen = c_int(sizeof(cmat_conc))
   while ie.value < 2:
      ie.value = py_sof_cdb_get(Index, 1, 1, byref(cmat_conc), byref(RecLen), 1)
      if cmat_conc.m_id == 1.0:
            fck = cmat_conc.m_fck
      RecLen = c_int(sizeof(cmat_conc))

The program calls the py_sof_cdb_get function while the return value is < 2 (if return value = 2 end reached).

The mat_conc data structure is defined in struct.py file. By using ctypes library the return value ie gets value = 0 (ie = c_int(0)) and is defined.

Hint

It is necessary to set RecLen = c_int(sizeof(mat_conc)) always before py_sof_cdb_get is called.

Same principle is used for reading the value fy:

Read the fy value from the CDB
# Read fy value from the CDB
if py_sof_cdb_kexist(1, 2) == 2: # the key exists and contains data
   ie = c_int(0)
   RecLen = c_int(sizeof(cmat_stee))
   while ie.value < 2:
      ie.value = py_sof_cdb_get(Index, 1, 2, byref(cmat_stee), byref(RecLen), 1)
      if cmat_stee.m_id == 1.0:
            fy = cmat_stee.m_fy
      RecLen = c_int(sizeof(cmat_stee))

The kwh value = 1 and the kwl value = 2 (in this case = material number defined in the .DAT file). If the material number is changed in the .DAT file, then it must be also changed in the code.

Next step is to read the cross-section properties (h, b, su and so). The key were the values are stored is kwh = 9 and kwl = 1 (please see CDBASE.CHM for further information.)

Read the cross-section properties
# Read su, so, h and b values from the CDB
if py_sof_cdb_kexist(9, 1) == 2: # the key exists and contains data
   ie = c_int(0)
   RecLen = c_int(sizeof(csect_rec))
   while ie.value == 0:
      ie.value = py_sof_cdb_get(Index, 9, 1, byref(csect_rec), byref(RecLen), 1)
      if csect_rec.m_id == 10.0:
            b = csect_rec.m_b
            h = csect_rec.m_h
            su = csect_rec.m_su
            so = csect_rec.m_so
      RecLen = c_int(sizeof(csect_rec))

Reading the MEd and NEd internal forces from CDB (for LC 1001 - generated by MAXIMA).

# Read the Med and Ned internal forces from CDB
ie = c_int(0)
Ned = 0.0
Med = 0.0

RecLen = c_int(sizeof(beam_foc))
while ie.value == 0:
   ie.value = py_sof_cdb_get(Index, 102, 1001, byref(beam_foc), byref(RecLen), 1)
   if beam_foc.m_id == 0.0:
      if abs(Ned) < abs(beam_foc.m_n) and abs(beam_foc.m_n < 1e+30):
         Ned = beam_foc.m_n
      if abs(Med) < abs(beam_foc.m_my) and beam_foc.m_my < 1e+30:
         Med = beam_foc.m_my

   RecLen = c_int(sizeof(beam_foc))
myDLL.sof_cdb_flush(Index.value)

The iteration starts from εs1 = 25 ‰ and εc2 = 0 ‰. First the εs1 is modified and iterated. When it reaches the minimum the program iterates εc2 value from 0 to 3.5 ‰.

while Mrd <= Meds and mu < 0.296:

As shown above the μ value must be μ < 0.296 to avoid additional symmetrical reinforcement (x/d ≤ 0.45).

fyd = fyks

γs = 1.15

The formulas for fcd:

fcd = αcc·(fckc)

where: αcc = 0.85 and γc = 1.50

First lets define all variables:

# ITERATION AND DESIGN

fcd = fck / 1.5 * 0.85
fyd = fy / 1.15
epss = 25.0
epsc = 0.0
Mrd = 0.0
mu = 0.0
alpha = 0.0
xi = 0.0
x = 0
d = h - su
ka = 0.0
z = 0.0
zeta = 0.0
omega = 0.0
As1 = 0.0
Meds = Med - Ned * (h / 2 - su)
The d value can not be read from the CDB but can be calculated by reading the su value (representing d1)
d = h - su.

The conditions for the the calculation:

ΣM = 0 Myd = Fc·z = Fs1·z

ΣH = 0 Fc = Fs1

while Mrd <= Meds and mu < 0.296:
   if 0 < epsc <= 2:
      alpha = epsc / 12 * (6 - epsc)
   elif 2 < epsc <= 3.5:
      alpha = (3 * epsc - 2) / (3 * epsc)

   # Calculate the Xi value
   xi = epsc / (epss + epsc)

   # Calculate x
   x = xi * d

   # Calculate ka
   if 0 < epsc <= 2:
      ka = (8 - epsc) / (4 * (6 - epsc))
   elif 2 < epsc <= 3.5:
      ka = (epsc * (3 * epsc - 4) + 2) / (2 * epsc * (3 * epsc - 2))

   # Calculate z
   z = d - ka * x

   # Calculate zeta
   zeta = 1 - ka * xi

   # Calculate omega
   omega = alpha * xi

   # Calculate mu
   mu = alpha * xi * zeta

   # Calculate the Mrd value
   Mrd = alpha * xi * d * b * fcd * zeta * d

   # Required reinforcement
   As1 = (1 / fyd) * (omega * b * d * fcd + Ned)

   if epsc == 3.5:
      epss = 25

      while Mrd <= Meds and epss >= 0.0 and mu < 0.296:
            if 0 < epsc <= 2.0:
               alpha = epsc / 12 * (6 - epsc)
            elif 2.0 < epsc <= 3.5:
               alpha = (3 * epsc - 2) / (3 * epsc)

      # Calculate the Xi value
      xi = epsc / (epss + epsc)

      # Calculate x
      x = xi * d

      # Calculate ka
      if 0 < epsc <= 2:
            ka = ((8 - epsc) / (4 * (6 - epsc)))
      elif 2.0 < epsc <= 3.5:
            ka = (epsc * (3 * epsc - 4) + 2) / (2 * epsc * (3 * epsc - 2))

      # Calculate z
      z = d - ka * x

      # Calculate zeta
      zeta = 1 - ka * xi

      # Calculate omega
      omega = alpha * xi

      # Calculate mu
      mu = alpha * xi * zeta

      # Calculate Mrd value
      Mrd = alpha * xi * d * b * fcd * zeta * d

      # Required reinforcement
      As1 = (1 / fyd) * (omega * b * d * fcd + Ned)

      if epss == 0.0:
            print ("Reinforcement reached 0[o/oo], iteration stopped!")

      epss -= 0.001
   epsc += 0.001

When the iteration is finished, the CDB must be closed:

# Close the CDB, 0 - will close all the files
myDLL.sof_cdb_close(0)

Print the output:

###########################################################
# OUTPUT

print ("Ned = {0} kN".format(str(Ned)))
print ("Med = {0} kNm".format(str(Med)))
print ("Meds = {0} kNm".format(str(Meds)))

print ("----------------------------")

print ("fcd = {0} MPa".format(str(fcd / 1000)))
print ("fyd = {0} MPa".format(str(fyd / 1000)))
print ("epsc = {0} o/oo".format(str(Meds)))
print ("epsc = {0} o/oo".format(str(Meds)))
print ("alpha = {0}".format(str(alpha)))
print ("ka = {0}".format(str(ka)))
print ("z = {0} cm".format(str(z * 100)))
print ("zeta = {0}".format(str(zeta)))
print ("omega = {0}".format(str(omega)))
print ("mu = {0}".format(str(mu)))
print ("d = {0} cm".format(str(d * 100)))
print ("Xi = {0}".format(str(xi)))
print ("x = {0} cm".format(str(x * 100)))
print ("Mrd = {0} kNm".format(str(Mrd)))

print ("----------------------------")

print ("As1 = {0} cm2".format(str(As1 * 100**2)))

# Print CDB Status
cdbStat.value = myDLL.sof_cdb_status(Index.value)
print ("CDB Status after closing:", cdbStat.value)

Dynamic Library and Project Configuration - dlls.py

Import libraries:

import os             # for the environment variable necessary
import platform       # checks the python platform
from ctypes import *  # read the functions from the cdb

It is necessary to define the Environment PATH variable. Set the PATH variable to the path of the necessary DLLs.

Define the DLL Environment PATH variable
# Set environment variable for the DLL files
print ("Hint: 64bit DLLs are used")
path = os.environ["Path"]

# 64bit DLLs
dllPath = r"C:\sofistik_installation\trunk\SOFiSTiK trunk\interfaces\64bit"
dllPath += ";"

# Other necessary DLLs
dllPath += r"C:\sofistik_installation\trunk\SOFiSTiK trunk"
os.environ["Path"] = dllPath + ";" + path

To use the right DLL (32bit or 64bit, in this example Python 64-bit platform is used), please check the python platform by using:

Python platform
# Check the python platform (32bit or 64bit)
print "The path variable=", os.environ["Path"]
print "Python architecture=", platform.architecture()

Lets load the py_sof_cdb_get and the py_sof_cdb_kenq functions:

Load DLL functions
# Get the DLL functions
myDLL = cdll.LoadLibrary("sof_cdb_w-70.dll")
py_sof_cdb_get = cdll.LoadLibrary("sof_cdb_w-70.dll").sof_cdb_get
py_sof_cdb_get.restype = c_int

py_sof_cdb_kenq = cdll.LoadLibrary("sof_cdb_w-70.dll").sof_cdb_kenq_ex
py_sof_cdb_kexist = cdll.LoadLibrary("sof_cdb_w-70.dll").sof_cdb_kexist

Next step is to connect to the CDB:

Connect to CDB
# Connect to CDB
Index = c_int()
cdbIndex = 99

# Set the CDB Path
fileName = r"S:\test\single_span_girder.cdb"

# important: Unicode call!
Index.value = myDLL.sof_cdb_init(fileName.encode('utf-8'), cdbIndex)

cdbStat = c_int()  # get the CDB status
cdbStat.value = myDLL.sof_cdb_status(Index.value)

# Print the Status of the CDB
cdbStat.value = myDLL.sof_cdb_status(Index.value)
if cdbStat.value == 0:
   print ("CDB closed successfully, status = 0")

The data structure - sofistik_daten.py

The data structs are defined in the sofistik_daten.py file. All data-types are available in the CDBASE.CHM description.

MAT_CONC @Rec: 001/NR:1:1???
class CMAT_CONC(Structure):     # 1/NR:1  MaterialConcrete
_fields_ = [
      ('m_id', c_int),          #        Identification
      ('m_type', c_int),        #        Material type
      ('m_class', c_int),       #        Classification
      ('m_emod', c_float),      # [1090] Elasticity Modulus
      ('m_mue', c_float),       #        Poissons ratio
      ('m_gmod', c_float),      # [1090] Shear modulus
      ('m_kmod', c_float),      # [1090] Compression modulus
      ('m_gam', c_float),       # [1091] nominal weight
      ('m_rho', c_float),       # [1189] Density
      ('m_alfa', c_float),      # [ 107] Temperature Elongation coefficient
      ('m_e90', c_float),       # [1090] Elasticity modulus perpendicular
      ('m_mue90', c_float),     #        Poissons ratio perpendicular
      ('m_alf', c_float),       # [   5] Euler Angle I
      ('m_bet', c_float),       # [   5] Euler Angle II
      ('m_scm', c_float),       #        Material safety
      ('m_fc', c_float),        # [1092] effective strength
      ('m_fck', c_float),       # [1092] nominal strength
      ('m_ftm', c_float),       # [1092] mean value of tensional strength
      ('m_ftl', c_float),       # [1092] lower fractile of tensional strength
      ('m_ftk', c_float),       # [1092] upper fractile of tensional strength
      ('m_ec', c_float),        #        compr. failure Energy (deprecated)
      ('m_et', c_float),        # [ 112] tensile failure energy
      ('m_muer', c_float),      #        friction in the crack
      ('m_fcm', c_float),       # [1092] mean value of strength
      ('m_rdcl', c_float),      #        weight class
      ('m_fcr', c_float),       # [1092] calculatoric mean value of strength
      ('m_ecr', c_float),       # [1090] Elasticity modul for worklaw CE
      ('m_fbd', c_float),       # [1092] bond strength (EC2 Table. 5.1.3)
      ('m_ftd', c_float),       # [1092] Initial tensile strength Bemessungszugfestigkeit
      ('m_feqr', c_float),      # [1092] Tensile strength after cracking Zugfestigkeit nach Rissbildung
      ('m_feqt', c_float),      # [1092] Residual tensile strength  Restzugfestigkeit im Bruch
      ('m_fcfat', c_float),     # [1092] Fatigue Strength
      ('m_scms', c_float),      #        Material safety for the serviceability law
      ('m_scmu', c_float),      #        Material safety for ultimate stress strain law
      ('m_scmc', c_float)       #        Material safety for the calculatoric law
   ]
cmat_conc = CMAT_CONC()
MAT_STEE @Rec: 001/NR:1:2???
class CMAT_STEE(Structure):     # 1/NR:1  MaterialSteel
_fields_ = [
      ('m_id', c_int),          #        Identification
      ('m_type', c_int),        #        Material type
      ('m_class', c_int),       #        Classification
      ('m_emod', c_float),      # [1090] Elasticity Modulus
      ('m_mue', c_float),       #        Poissons ratio
      ('m_gmod', c_float),      # [1090] Shear modulus
      ('m_kmod', c_float),      # [1090] Compression modulus
      ('m_gam', c_float),       # [1091] nominal weight
      ('m_rho', c_float),       # [1189] Density
      ('m_alfa', c_float),      # [ 107] Temperature Elongation coefficient
      ('m_e90', c_float),       # [1090] Elasticity modulus perpendicular
      ('m_mue90', c_float),     #        Poissons ratio perpendicular
      ('m_alf', c_float),       # [   5] Euler Angle I
      ('m_bet', c_float),       # [   5] Euler Angle II
      ('m_scm', c_float),       #        Material safety
      ('m_fy', c_float),        # [1092] yield stress
      ('m_ft', c_float),        # [1092] tensile strength
      ('m_eps', c_float),       # [   9] limit strain
      ('m_rel1', c_float),      #        Relaxation 0.55fpk
      ('m_rel2', c_float),      #        Relaxation 0.70fpk or 0.70fp=rho-1000 for ENC?
      ('m_r', c_float),         #        bond coefficient
      ('m_k1', c_float),        #        bondfactor EC2
      ('m_eh', c_float),        # [1090] Hardening module
      ('m_fe', c_float),        # [1092] Proportional stress
      ('m_epse', c_float),      # [   9] Plastic strain
      ('m_fdyn', c_float),      # [1092] Dynamic strength
      ('m_fyc', c_float),       # [1092] compr. yield stress
      ('m_ftc', c_float),       # [1092] compress. strength
      ('m_tmax', c_float),      # [1023] max.plate thickness
      ('m_bc', c_float),        #        (eg. Aluminium 1.0/2.0 = "A","B" )
      ('m_dummy', c_float * 2),
      ('m_scms', c_float),      #        Material safety for the serviceability law
      ('m_scmu', c_float),      #        Material safety for ultimate stress strain law
      ('m_scmc', c_float)       #        Material safety for the calculatoric law
   ]
cmat_stee = CMAT_STEE()
SECT_REC @Rec: 009/NR:10
class CSECT_REC(Structure):        # 9/NR:10  SectiontypeRectangular T-Beam (SREC)
   _fields_ = [
         ('m_id', c_int),          #        Identification = 10
         ('m_iq', c_int),          #        Identification of section
         ('m_ir', c_int),          #        Identification of reinforcement and origin
         ('m_h', c_float),         # [1011] total height
         ('m_b', c_float),         # [1011] width (of web)
         ('m_so', c_float),        # [1024] Boundary distance of upper reinforcement
         ('m_su', c_float),        # [1024] Boundary distance of lower reinforcement
         ('m_aso', c_float),       # [1020] reinforcement up
         ('m_asu', c_float),       # [1020] reinforcement down
         ('m_ho', c_float),        # [1011] height of plate
         ('m_bo', c_float),        # [1011] width  of plate
         ('m_daso', c_float),      # [1023] reinf. Diameter up
         ('m_dasu', c_float),      # [1023] reinf. Diameter dn
         ('m_fkit', c_float),      #        <0 = factor for torsional inertia >0 = absolut value of torsion
         ('m_fkay', c_float),      #        <0 = factor for shear deformation area >0 = absolut value of sh
         ('m_fkaz', c_float),      #        <0 = factor for shear deformation area >0 = absolut value of sh
         ('m_ysmp', c_float),      # [1011] explicit location of shear center
         ('m_zssmp', c_float),     # [1011] explicit location of shear center
         ('m_ys', c_float),        # [1011] explicit location of reference point
         ('m_zs', c_float),        # [1011] explicit location of reference point
         ('m_phib', c_float),      # [   5] inclination of transverse reinforcements
         ('m_beff', c_float),      # [1011] width of equivalent hollow section
         ('m_asbm', c_float),      #        Minimum shear reinf.
         ('m_a', c_float),         # [1011] spacing of reinforcements
         ('m_amin', c_float),      # [1011] minimum distance of single reinforcements
         ('m_amax', c_float),      # [1011] maximum distance of single reinforcements
         ('m_ss', c_float),        # [1024] Boundary distance of lateral reinforcement
         ('m_dass', c_float),      # [1023] reinf. Diameter side
         ('m_hmax', c_float),      # [1011] maximum mesh size for FE/fibre analysis
         ('m_betc', c_float),      #        friction coefficient
         ('m_mue', c_float)        #        friction in joint
      ]
csect_rec = CSECT_REC()
SECT_REC @Rec: 009/NR:10
class CBEAM_FOC(Structure):     # 102/LC:0  Maximum of Total Beam forces and deformations
_fields_ = [
      ('m_id', c_int),          #        identifier 0
      ('m_x', c_float),         # [1001] max. beam length
      ('m_n', c_float),         # [1101] normal force
      ('m_vy', c_float),        # [1102] y-shear force
      ('m_vz', c_float),        # [1102] z-shear force
      ('m_mt', c_float),        # [1103] torsional moment
      ('m_my', c_float),        # [1104] bending moment My
      ('m_mz', c_float),        # [1104] bending moment Mz
      ('m_mb', c_float),        # [1105] warping moment Mb
      ('m_mt2', c_float),       # [1103] 2nd torsionalmom.
      ('m_ux', c_float),        # [1003] diplacem. local x
      ('m_uy', c_float),        # [1003] diplacem. local y
      ('m_uz', c_float),        # [1003] diplacem. local z
      ('m_phix', c_float),      # [1004] rotation local x
      ('m_phiy', c_float),      # [1004] rotation local y
      ('m_phiz', c_float),      # [1004] rotation local z
      ('m_phiw', c_float),      # [1005] twisting
      ('m_mt3', c_float),       # [1103] 3rd torsionalmom
      ('m_pa', c_float),        # [1095] axial bedding
      ('m_pt', c_float),        # [1095] transverse bedding
      ('m_pty', c_float),       # [1095] local y component of transverse bedding
      ('m_ptz', c_float)        # [1095] local z component of transverse bedding
   ]
cbeam_foc = CBEAM_FOC()