I am attempting to use the following function to simulate loads on a beam:
def simulateBeamRun(personList, beam, times):
I have come up with the following code so far:
def createPersonList(fileName):
"""Function will go through each line of file and
create a person object using the data provided in
the line and add it to a list
"""
theFile = open(fileName)
next(theFile)
#array = []
for line in theFile:
aList = line.split(',')
bList = map(lambda s: s.strip('\n'), aList)
cList = [float(i) for i in bList]
print cList
def simulateBeamRun(personList, beam, times):
"""Takes a list of times covering the duration of
the simulation (0-35 s), the list of person
objects and a beam object to simulate a beam run
"""
dList = []
for time in times:
eList = []
for person in personList:
loadTuples = personModel.person.loadDisplacement(time)
if beamModel.beam.L > loadTuples[1] > 0:
eList.append(loadTuples)
else:
return None
beamModel.beam.setLoads(eList)
dList.append(beamModel.beam.getMaxDeflection())
However, I am getting the following error when trying to run the function (before I give it any inputs:
for person in personList:
TypeError: 'NoneType' object is not iterable
personListisNone. Relevant parts of your code are missing.cListnot printing it