sumolib.output.convert.gpsdat
This module includes functions for converting SUMO's fcd-output into csv data files used by dlr-fcd processing chain
1# Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo 2# Copyright (C) 2013-2026 German Aerospace Center (DLR) and others. 3# This program and the accompanying materials are made available under the 4# terms of the Eclipse Public License 2.0 which is available at 5# https://www.eclipse.org/legal/epl-2.0/ 6# This Source Code may also be made available under the following Secondary 7# Licenses when the conditions for such availability set forth in the Eclipse 8# Public License 2.0 are satisfied: GNU General Public License, version 2 9# or later which is available at 10# https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html 11# SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later 12 13# @file gpsdat.py 14# @author Daniel Krajzewicz 15# @author Michael Behrisch 16# @date 2013-01-15 17 18""" 19This module includes functions for converting SUMO's fcd-output into 20csv data files used by dlr-fcd processing chain 21""" 22from __future__ import print_function 23from __future__ import absolute_import 24import datetime 25 26TAXI_STATUS_FREE_FLOW = "70" 27 28 29def fcd2gpsdat(inpFCD, outSTRM, further): 30 date = further["base-date"] 31 for timestep in inpFCD: 32 if timestep.vehicle: 33 # does not work with subseconds 34 mtime = str( 35 date + datetime.timedelta(seconds=int(float(timestep.time)))) 36 for v in timestep.vehicle: 37 print('%s\t%s\t%s\t%s\t%s\t%.3f' % (v.id, mtime, v.x, v.y, 38 TAXI_STATUS_FREE_FLOW, float(v.speed) * 3.6), file=outSTRM)
TAXI_STATUS_FREE_FLOW =
'70'
def
fcd2gpsdat(inpFCD, outSTRM, further):
30def fcd2gpsdat(inpFCD, outSTRM, further): 31 date = further["base-date"] 32 for timestep in inpFCD: 33 if timestep.vehicle: 34 # does not work with subseconds 35 mtime = str( 36 date + datetime.timedelta(seconds=int(float(timestep.time)))) 37 for v in timestep.vehicle: 38 print('%s\t%s\t%s\t%s\t%s\t%.3f' % (v.id, mtime, v.x, v.y, 39 TAXI_STATUS_FREE_FLOW, float(v.speed) * 3.6), file=outSTRM)