Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
eclipse
GitHub Repository: eclipse/sumo
Path: blob/main/tests/complex/tutorial/sumolympics/data/makeSumolympicWalkers.py
169689 views
1
#!/usr/bin/env python
2
# Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3
# Copyright (C) 2009-2025 German Aerospace Center (DLR) and others.
4
# This program and the accompanying materials are made available under the
5
# terms of the Eclipse Public License 2.0 which is available at
6
# https://www.eclipse.org/legal/epl-2.0/
7
# This Source Code may also be made available under the following Secondary
8
# Licenses when the conditions for such availability set forth in the Eclipse
9
# Public License 2.0 are satisfied: GNU General Public License, version 2
10
# or later which is available at
11
# https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12
# SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13
14
# @file makeSumolympicWalkers.py
15
# @author Leonhard Luecken
16
# @date 2016-11-25
17
18
outfile = "sumolympicWalks.rou.xml"
19
startEdge = "beg"
20
endEdge = "end"
21
# Startzeit
22
departTime = 0.
23
# Startposition
24
departPos = -30.
25
# Anzahl Fussgaenger
26
numberTrips = 200
27
# Generiere XML Datei
28
xml_string = "<routes>\n"
29
for i in range(numberTrips):
30
xml_string += ' <person depart="%f" id="p%d" departPos="%f">\n' % (departTime, i, departPos)
31
xml_string += ' <walk edges="%s %s"/>\n' % (startEdge, endEdge)
32
xml_string += ' </person>\n'
33
xml_string += "</routes>\n"
34
with open(outfile, "w") as f:
35
f.write(xml_string)
36
37