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_1.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_strain.svg../../_images/single_span_girder_cross_section.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#

In VBA editor, there are 5 modules available:

  • Global variables module [global_variable]

  • Iteration or design module [iteration]

  • Read the CDB values [readCDB]

  • List of available records [record_list]

  • sofistik dll functions [sof_dll]

Global variables module [global_variable]

The module contains global variables that can be accessed from anywhere. It means that any code in the application has access to read and modify the variables.

To get the results from the Workbook. First run the .dat file and the single_span_girder.cdb will be created.

Then use VBA to read the data from CDB and calculate the necessary reinforcement via VBA.

  1. Open .dat file and calculate

  2. Open the cdb_workbook_xlsm

  3. Input CDB path into cell (B4)

  4. Get data from CDB

  5. Run calculation

  6. Check the output As1

Iteration or design module [iteration]

This module calculates the necessary reinforcement of a simple rectangular cross-section.

It calculates the necessary reinforcement by reading from CDB the internal forces (My and N), the necessary material properties (fck and fyk) and cross-section properties (b, h, d).

The same project can be modified for other purposes (timber design, steel design, dynamic etc.). Next code defines the variables for the calculation and the type of the variable.

Dim epss, epsc, alpha, mu, xi, ka, zeta, As1, d, fyd, Meds, Mrd, b, fcd, x, Ned, omega, z As Single

Next code gets the values from the tab3 worksheet cells.

'Read the values from excel cells
fcd = tab3.Application.Cells(6, 2).Value
fyd = tab3.Application.Cells(7, 2).Value
b = tab3.Application.Cells(9, 2).Value / 100
d = tab3.Application.Cells(11, 2).Value / 100
Meds = tab3.Application.Cells(25, 2).Value / 1000
Ned = tab3.Application.Cells(26, 2).Value / 1000

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 ‰.

Do While Mrd <= Meds And epsc < 3.5 And CSng(mu) < CSng(0.296)

The ‘’Do While loop’’ loops while the conditions are met. As shown above, the program also checks the μ value, because symmetrical reinforcement isn’t supported and implemented in this module. Maximum possible value of the μ variable is 0.296 (ξmax = x/d = 0.45 ). You can modify the program and implement this feature as well (for ξ>0.45).

The conditions for the the calculation:

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

ΣH = 0 Fc = Fs1

Hint

To understand this module, it is necessary that the user has basic knowledge about concrete design.

Read the CDB module [readCDB]

This is one most important module of the ‘’single span girder’’ tutorial. It explains how to get the necessary data from the CDB. In the readCDB module there are 5 subs:

  • Get the fy value [Public Sub S_CMAT_STEE()]

    First lets define the variables:

    Dim row As Long
    Dim i As Long
    Dim j As Long
    Dim kwlMax, kwlMin, kwl As Long
    Dim datalen As Long
    Dim GetFunc As Long
    Dim cdbPath As String
    Dim fyd As Single
    

    Next step is to connect to the CDB:

    'Get the path from the cell
    cdbPath = tab3.Application.Cells(4, 2).Value
    
    'Connect to the CDB
    Index = sof_cdb_init(cdbPath, 99)
    

    Declare the data type of the variables. Check the sof_dll module in VBA editor. There you can find all available data types.

    'Declare variables (data types) for steel
    Dim data As CMAT_STEE
    

    Set the data length (datalen), this is also important to know if the data-type is suitable for the current reading position. It is necessary to get the datalen always before reading the CDB (also in loops).

    datalen = Len(data)
    

    Lets read the CDB now. The fy value for second material is saved in the @REC:1/2. Number 1 defines the kwh for materials properties, and 2 is used to define the material number.

    Do While sof_cdb_get(Index, 1, 2, data, datalen, 1) < 2
        If data.m_ID = 1 Then
            fy = data.m_FY
        End If
    
        'Datalen is important, get the length of the data-type
        datalen = Len(data)
    Loop
    

    Because of this, in the .DAT (Teddy) or in the .SOFISTIK (SSD) file the steel material must always be set as the number 2.

    The value fy is now available. Lets calculate the fyd value.

    fyd = fyks

    γs = 1.15

    Code:

    'Recalculate the fcd
    fyd = (fy / 1.15) / 1000
    

    The value is divided with 1000 because in the CDB the value is stored in kN/m2 units, the macro converted the units to N/mm2.

    Next step is to output the fyd value to the (7,2) cell and close the CDB.

    'Output the value
    tab3.Application.Cells(7, 2).Value = fyd
    
    'Close the CDB
    Call sof_cdb_close(0)
    
  • Get the fck value [Public Sub S_CMAT_CONC()]

    First lets define the variables:

    Dim row As Long
    Dim i As Long
    Dim j As Long
    Dim kwlMax, kwlMin, kwl As Long
    Dim datalen As Long
    Dim GetFunc As Long
    Dim cdbPath As String
    Dim fcd As Single
    

    Connect to the CDB:

    'Get the path from the cell
    cdbPath = tab3.Application.Cells(4, 2).Value
    
    'Connect to the CDB
    Index = sof_cdb_init(cdbPath, 99)
    

    Declare data-type of the concrete material, the name of the data type is CMAT_CONC:

    'Declare variables (data types) for concrete
    Dim data As CMAT_CONC
    
    datalen = Len(data)
    

    Get the fck value from the CDB by looping through. The fck value is stored in the @Rec: (1/1) key. Where 1 is the KWH for the material properties and the second value 1 is the material number. The concrete material number in .DAT or .SOFISTIK file must be set to 1.

    Do While sof_cdb_get(Index, 1, 1, data, datalen, 1) < 2
        If data.m_ID = 1 Then
            fck = data.m_FCK
        End If
    
       'Datalen is important, get the length of the data-type
        datalen = Len(data)
    Loop
    

    The code:

    Do While sof_cdb_get(Index, 1, 1, data, datalen , 1) < 2
    

    means ‘’do loop until the end of file is reached’’. It can be written in other way:

    Do Until sof_cdb_get(Index, 1, 1, data, datalen , 1) = 2
    

    For further information about the return value please read the CDBASE.CHM file. Next step is to calculate the fcd value:

    'Recalculate the fcd
    fcd =  ((fck * 0.85) / 1.5) / 1000
    
    'Output the value
    tab3.Application.Cells(6, 2).Value = fcd
    
    'Close the CDB
    Call sof_cdb_close(0)
    

    The formulas for fcd:

    fcd = αcc·(fckc)

    where: αcc = 0.85 and γc = 1.50

  • Get the maximum of total beam force [Public Sub S_CBEAM_FOC()]

    First lets define the variables:

    Dim row As Long
    Dim i As Long
    Dim j As Long
    Dim kwlMax, kwlMin, kwl As Long
    Dim datalen As Long
    Dim GetFunc As Long
    Dim cdbPath As String
    Dim Med, Ned As Single
    

    Connect to CDB, define the data type and set the data length.

    'Get the path from the cell
    cdbPath = tab3.Application.Cells(4, 2).Value
    
    'Connect to the CDB
    Index = sof_cdb_init(cdbPath, 99)
    
    Call sof_cdb_kenq(Index, 102, kwlMax, 2)
    Call sof_cdb_kenq(Index, 102, kwlMin, -2)
    kwl = kwlMin
    
    'Declare variables (data types) for internal forces
    Dim data As CBEAM_FOC
    datalen = Len(data)
    

    Get the maximum values for the load-case 1001 generated in MAXIMA, the @Rec is 102/1001:

    'Loop and get the values
    Call sof_cdb_get(Index, 102, 1001, data, datalen , 1)
    
    If data.m_ID = 0 Then
       If Abs(Ned) < Abs(data.m_N) Then
          Ned = data.m_N
       End If
    
       If Abs(Med) < Abs(data.m_MY) Then
          Med = data.m_MY
       End If
    
    End If
    

    This part of code is fixed to get only the maximum values from the load-case 1001. Do not hesitate to modify it and to see how it works. Making loops through the load-cases is also possible.

    Output the values to the cells and close the CDB:

    'Output the value
    tab3.Application.Cells(25, 2).Value = Med
    tab3.Application.Cells(26, 2).Value = Ned
    
    'Reload the keys
    Call sof_cdb_close(0)
    
  • Get the cross-section properties [Public Sub S_CSECT_REC()]

    First lets define the variables:

    Dim row As Long
    Dim i As Long
    Dim j As Long
    Dim kwlMax, kwlMin, kwl As Long
    Dim datalen As Long
    Dim GetFunc As Long
    Dim cdbPath As String
    Dim b, h, so, su, d As Single
    

    Connect to the CDB and define the data type. The data-type name for the

    'Get the path from the cell
    cdbPath = tab3.Application.Cells(4, 2).Value
    
    'Connect to the CDB
    Index = sof_cdb_init(cdbPath, 99)
    
    Call sof_cdb_kenq(Index, 102, kwlMax, 2)
    Call sof_cdb_kenq(Index, 102, kwlMin, -2)
    kwl = kwlMin
    
    'Declare variables (data types) for rect cross-section
    Dim data As CSECT_REC
    datalen = Len(data)
    

    Loop through CDB and get the values:

    Do While sof_cdb_get(Index, 9, 1, data, datalen , 1) < 2
       If data.m_ID = 10 Then 'ID=10 -> rectangular
          b = data.m_B
          h = data.m_H
          so = data.m_SO
          su = data.m_SU
       End If
    Loop
    

    The d value can not be read from the CDB but can be internal calculated by reading the m_SU what represents the d1 value.

    d = h - d1

    In VBA editor we have

    'Calculate d
    d = h - su
    
    'Output the value
    tab3.Application.Cells(9, 2).Value = b * 100   '[cm]
    tab3.Application.Cells(10, 2).Value = h * 100  '[cm]
    tab3.Application.Cells(11, 2).Value = d * 100  '[cm]
    
    'Close the CDB
    Call sof_cdb_close(0)
    
  • Call the subs by button click [ButtonGetData()]

    This sub calls all previous subs by clicking on the button in the workbook. The macro is assigned to the Get data from CDB button.

    Public Sub ButtonGetData()
       'Call the subroutines
       Call S_CBEAM_FOC  'Beam forces
       Call S_CMAT_STEE  'Material - steel
       Call S_CMAT_CONC  'Material - concrete
       Call S_CSECT_REC  'Cross-section
    End Sub
    
  • Record list [record_list] and dll functions [sof_dll] module

The modules can be just copied. The record list contains all data types and the sof_dll all available function for the SOFiSTiK dlls. Please see the code in the example.