Code: Select all
# -*- coding: utf-8 -*-
"""
Created on Sat Feb 13 00:58:19 2021
@author: praf_Malla@hotmail.com, Nepal
"""
# Reference M.Scott "Development of Bridge Rating Applications Using OpenSees and Tcl"
# Units in N, mm, sec
inch =1 ; ft =12. *inch
ksi = 1; kip = 1;
L = 40*ft
P = 1*kip
E = 4000*ksi
G = 2400*ksi
b = 18*inch
d = 36*inch
A = b*d
I = b*d**3/12
import numpy as np
import matplotlib.pyplot as plt
import openseespy.opensees as ops
ops.wipe()
ops.model('basic','-ndm',2,'-ndf',3)
# Simply supported bridge model
ops.node(1,0,0); ops.fix(1,1,1,0)
ops.node(2,L,0); ops.fix(2,0,1,0)
ops.geomTransf('Linear',1)
ops.section('Elastic',1,E,A,I,G,5/6)
#ops.beamIntegration('Lobatto',1,1,7)
Criticallocs = [0.1, 0.3, 0.5, 0.7, 0.9]
wts = [0.2, 0.15, 0.3, 0.15, 0.2]
secs = [1, 1, 1, 1, 1]
nIP = len(Criticallocs) # no of integration point or critical locations
ops.beamIntegration(' UserDefined',1,len(secs),*secs,*Criticallocs,*wts)
ops.element('forceBeamColumn',1,1,2,1,1)
ops.analysis('Static')
ops.timeSeries('Constant',1)
Nsteps = 1000
bM=np.zeros( (Nsteps, nIP+1) ) # Initial variable to store data
sF=np.zeros( (Nsteps, nIP+1) ) # Initial variable to store data
# Type of Truck, specify axle spacing and axle weight
AxleSpacing =[0,20,20];
AxleWeight = [10,10,10];
Naxle = len(AxleSpacing); print('No. of Axle',Naxle);
Ltruck = 0;
for j in range(Naxle): # To determine Truck length
Ltruck = Ltruck+AxleSpacing[j]
print('Length of Truck',Ltruck)
# Main Program for moving load
dx = L/Nsteps
for i in range(Nsteps):
x = dx*(i)
ops.pattern('Plain',1,1)
for k in range(Naxle):
x = x-AxleSpacing[k]
if (x <= 0.0 or x >= L):
continue
if (x<=L):
ops.eleLoad('-ele',1,'-type','beamPoint',-AxleWeight[k],x/L)
bM[i,0]=x/ft; # Length of bridge
sF[i,0]=bM[i,0]
break ; #Important
ops.analyze(1)
# storing data for Bending moment and Shear force
for j in range(nIP):
bM[i,j+1]=ops.sectionForce(1, j+1, 2)/ft
sF[i,j+1]=ops.sectionForce(1, j+1, 3)
ops.remove('loadPattern',1)
# Plotting Shear Force and Bending moment for all critical locations
for j in range(nIP):
plt.plot(sF[:,0], sF[:,j+1], linewidth=2.0)
plt.xlabel("Length (ft)")
plt.ylabel("Shear Force (kip)")
plt.title ("Shear Force at Critical locs.")
plt.show()
for j in range(nIP):
plt.plot(bM[:,0], bM[:,j+1], linewidth=2.0)
plt.xlabel("Length (ft)")
plt.ylabel("Bending moment (kipft)")
plt.title ("Bending moment at Critical locs.")
ops.wipe()