Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[sumo-user] Pedestrian flow Probability

Hello sumo users,

I want the pedestrians to trip in certain walking ereas, and I'm using this
code to write the trip file.

 with open("pedestrians.trip.xml", "w") as routes: print('<routes
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xsi:noNamespaceSchemaLocation="http://sumo.dlr.de/xsd/routes_file.xsd";>',
file=routes)
        lastVeh = 0
        perNr = 0
        p2a10 = 1. / 35
        p2a11 = 1. / 35
        p2a12 = 1. / 35
        p2a13 = 1. / 35
        for i in range(N):
            if random.uniform(0, 1) < p2a10:
                print('  <person id="ped%i" depart="%i">' % (perNr, i),
file=routes)
                print('    <walk from= "1b" to= "1e" departPos="0"
arrivalPos="50"/>', file=routes)
                print('  </person>', file=routes)
                perNr += 1
                lastVeh = i
            if random.uniform(0, 1) < p2a11:
                print('  <person id="ped%i" depart="%i">' % (perNr, i),
file=routes)
                print('    <walk from= "1e" to= "1b" departPos="50"
arrivalPos="0"/>', file=routes)
                print('  </person>', file=routes)
                perNr += 1
                lastVeh = i
            if random.uniform(0, 1) < p2a12:
                print('  <person id="ped%i" depart="%i">' % (perNr, i),
file=routes)
                print('    <walk from= "4o" to= "3i" departPos="50"
arrivalPos="0"/>', file=routes)
                print('  </person>', file=routes)
                perNr += 1
                lastVeh = i
            if random.uniform(0, 1) < p2a13:
                print('  <person id="ped%i" depart="%i">' % (perNr, i),
file=routes)
                print('    <walk from= "3i" to= "4o" departPos="0"
arrivalPos="50"/>', file=routes)
                print('  </person>', file=routes)
                perNr += 1
                lastVeh = i

        print("</routes>", file=routes)

I need to make sure that giving the rate 1. / 35 to each walking erea (4
times) is equivalent to giving the period    '--period', '35' (like in the
following code) to the whole walking ereas. Will I get the same pedestrian
flow frequency?

# randomTrips.main(randomTrips.get_options([
    #         '--net-file', net,
    #         '--output-trip-file', 'pedestrians.trip.xml',
    #         '--seed', '42',  # make runs reproducible
    #         '--pedestrians',
    #         '--prefix', 'ped',
    #         # prevent trips that start and end on the same edge
    #         '--min-distance', '1',
    #         '--trip-attributes', 'departLane="1a10_0" departPos="random"
arrivalPos="random"',
    #         '--binomial', '4',
    #         '--period', '35']))

-- 
*Best regards*


*Sara EL HAMDANI*
*Phd student -Umi University.*
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
sumo-user mailing list
sumo-user@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/sumo-user


Back to the top