# Single span girder¶

Visual Basic for Applications - Examples

## 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. 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.  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 following example can be found in the SOFiSTiK directory:

```C:\<sofistik_installation>\2020\SOFiSTiK 2020\interfaces\examples\fortran\single_span_girder
```

Note

Please run the single_span_girder.dat file to generate the CDB.

The data structures and the modules can be found by following:

```C:\<sofistik_installation>\2020\SOFiSTiK 2020_dev\interfaces\examples\fortran
```

To configure the project please see: Fortran

In the Fortran project, the main files are:

• `single_span_girder.f90` The main .F90 file

### The main fortran file - `single_span_girder.f90`¶

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

```program single_span_girder
use cdbase
use CDB_TYPES           ! this are our included data types
use CDB_TYPES_CON       ! add the types into project / solution
use CDB_TYPES_GEO
use CDB_TYPES_LFC
use CDB_TYPES_MAT
use CDB_TYPES_LFC
use CDB_TYPES_TEN
use CDB_TYPES_SYS
use CDB_TYPES_SCT
implicit none
```

Declare variables:

```! Define the variable
integer :: nid, l, ie, index
character(len=30)   :: file
character(len=72)   :: text
type(CNODE) :: typ_cnode                ! key 20/00     Nodes
type(CSECT_REC) :: typ_csect_rec        ! key 9/NR:10   SectiontypeRectangular T-Beam
type(CMAT_CONC) :: typ_cmat_conc        ! key 1/NR:1    MaterialConcrete
type(CMAT_STEE) :: typ_cmat_stee        ! key 1/NR:1    MaterialSteel
type(CBEAM_FOC) :: typ_cbeam_foc        ! key 102/LC:0  Maximum of Total
!               Beam forces and deformations
integer :: datalen, pos
integer :: kwh, kwl, ret

! Variables used to store the values from CDB
real :: fy
real :: fck
real :: Med
real :: Ned
real :: b
real :: h
real :: su
real :: so

! Variables used for the iteration
real :: fcd
real :: fyd
real :: epss
real :: epsc
real :: Mrd
real :: mu
real :: alpha
real :: xi
real :: d
real :: ka
real :: z
real :: zeta
real :: omega
real :: As1
real :: Meds
real :: x
```

Connect to the CDB:

```! Define the parameters for cdinti()
! nid = 99,     test if NAME is a valid database and open the base if possible.
!               Return with the assigned index.
!               If the file does not exist, it will be created.

nid=99
file = "simple_span_girder.cdb"   !name of the cdb or the full path

! Connect to the CDB
call cdinit(file,nid)
if (nid > 0) then
write(*,*) "  cdb_init of ", file," successful ", nid
else
write(*,*) "  cdb_init of ", file," not successful ", nid
endif
```

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

```!======================================================
! READ THE FCK VALUE
index = nid
kwh = 1
kwl = 1
datalen = sizeof(typ_cmat_conc)
pos = 1
ie = 0
do while (ie < 2)   ! Read data while ie == 0, Returnvalue:
! (0) no error,
! (1) Item is longer than Data,
! (2) End of file reached
! (3) key does not exist
call cdget(index, kwh, kwl, typ_cmat_conc, datalen, pos, ie)
if (typ_cmat_conc%id == 1.0) then
fck = typ_cmat_conc%fck
end if

datalen = sizeof(typ_cmat_conc)
end do

call cdflush(index)
```

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

The `mat_conc` data structure is defined in `cdbtypemat.for` file.

Hint

It is necessary to set `datalen = sizeof(typ_cmat_conc)` always before cdget is called.

Same principle is used for reading the value fy:

```!======================================================
! READ THE FY VALUE
index = nid
kwh = 1
kwl = 2
datalen = sizeof(typ_cmat_stee)
pos = 1
ie = 0
do while (ie < 2)
call cdget(index, kwh, kwl, typ_cmat_stee, datalen, pos, ie)
if (typ_cmat_stee%id == 1.0) then
fy = typ_cmat_stee%fy
end if

datalen = sizeof(typ_cmat_stee)
end do
```

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

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. 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
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 calculations are:

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

ΣH = 0 Fc = Fs1

```do while (Mrd <= Meds .and. mu < 0.296)
if ((epsc > 0) .and. (epsc <= 2)) then
alpha = epsc/12*(6 - epsc)
elseif (epsc > 2 .and. epsc <= 3.5) then
alpha = (3 * epsc - 2) / (3 * epsc)
end if

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

! Calculate x
x = xi * d

! Calculate ka
if ((epsc > 0) .and. (epsc <= 2)) then
ka = (8 - epsc) / (4 * (6 - epsc))
elseif ((epsc > 2) .and. (epsc <= 3.5)) then
ka = (epsc * (3 * epsc - 4) + 2) / (2 * epsc * (3 * epsc - 2))
end if

! 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 resistance moment
Mrd = alpha * xi * d * b * fcd * zeta * d

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

if (epsc == 3.5) then
epss = 25

do while ((Mrd <= Meds) .and. (epss >= 0.0) .and. (mu < 0.371))
if ((epsc > 0.0) .and. (epsc <= 2.0)) then
alpha = epsc / 12 * (6 - epsc)
elseif (epsc > 2.0 .and. epsc <= 3.5) then
alpha = (3 * epsc - 2) / (3 * epsc)
end if

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

! Calculate x
x = xi * d

! Calculate ka
if (epsc > 0 .and. epsc <= 2.0) then
ka = ((8 - epsc) / (4 * (6 - epsc)))
elseif (epsc > 2 .and. epsc <= 3.5) then
ka = (epsc * (3 * epsc - 4) + 2) / (2 * epsc * (3 * epsc - 2))
end if

! 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 resistance
Mrd = alpha * xi * d * b * fcd * zeta * d

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

if (epss == 0.0) then
print *, "Reinforcement reached 0 [o/oo]"
end if

epss = epss - 0.001
end do
end if

! Change the epsc value
epsc = epsc + 0.001
end do
```

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

```! Close the CDB
call cdclose(0)
```

Print the output:

```print *, "Ned =", Ned
print *, "Med =", Med
print *, "Meds =", Meds
print *, "------------"
print *, "fcd [MPa] =", fcd / 1000
print *, "fyd [MPa] =", fyd / 1000
print *, "epsc [o/oo] =", epsc
print *, "epss [o/oo] =", epss
print *, "alpha [-] =", alpha
print *, "ka [-] =", ka
print *, "z [m] =", z
print *, "zeta [-]", zeta
print *, "omega [-] =", omega
print *, "mu [-] =", mu
print *, "d [cm] =", d * 100
print *, "Xi [-] =", Xi
print *, "x [cm] =", x * 100
print *, "Mrd [kNm] =", Mrd
print *, "------------"
print *, "As1 [cm2] =", As1 * 100**2
```