コード例 #1
0
ファイル: prt-02-alloc.py プロジェクト: bstriner/sumo-1
    def _init_attributes(self):
        self.add(cm.ObjConf(PrtBerths('berths', self)))

        berths = self.get_berths()
        net = self.get_scenario().net

        self.add_col(am.IdsArrayConf('ids_ptstop', net.ptstops,
                                     name='ID PT stop',
                                     info='ID of public transport stop. ',
                                     ))

        self.add_col(am.ArrayConf('are_depot', default=False,
                                  dtype='bool',
                                  perm='rw',
                                  name='Is depot?',
                                  info='If true stop is a depot.',
                                  ))

        self.add_col(am.IdlistsArrayConf('ids_berth_alight', berths,
                                         #groupnames = ['_private'],
                                         name='Alight berth IDs',
                                         info="Alight berth IDs.",
                                         ))

        self.add_col(am.IdlistsArrayConf('ids_berth_board', berths,
                                         #groupnames = ['_private'],
                                         name='Board berth IDs',
                                         info="Board berth IDs.",
                                         ))
コード例 #2
0
    def __init__(self,
                 ident,
                 parent,
                 persons,
                 edges,
                 datapathkey='tripdatapath',
                 is_add_default=True,
                 name='Person results',
                 info='Table with simulation results for each person.',
                 **kwargs):

        self._init_objman(
            ident=ident,
            parent=parent,  # main results object
            info=info,
            name=name,
            **kwargs)

        self.add(
            cm.AttrConf(
                'datapathkey',
                datapathkey,
                groupnames=['_private'],
                name='data pathkey',
                info="key of data path",
            ))

        self.add_col(
            am.IdsArrayConf(
                'ids_person',
                persons,
                groupnames=['state'],
                is_index=True,
                name='person ID',
                info='ID of person.',
            ))
        attrinfos = OrderedDict([\
                ('times_travel_total', {'name':'Total travel time',     'unit':'s',     'default':0.0, 'info':'Total travel time, including all trips and waiting times, but excluding activities.','groupnames':['tripdata']}),
                ('times_walk', {'name':'Walking time',     'unit':'s',     'default':0.0, 'info':'Time walking, excluding waiting time.','groupnames':['tripdata']}),
                ('times_ride', {'name':'Riding time',     'unit':'s',     'default':0.0, 'info':'Time riding on a vehicle, excluding waiting time.','groupnames':['tripdata']}),
                ('times_wait', {'name':'Waiting time',     'unit':'s',     'default':0.0, 'info':'Time waiting for a vehicle.','groupnames':['tripdata']}),
                ('times_activity', {'name':'Activity time',     'unit':'s',     'default':0.0, 'info':'Time having some activities.','groupnames':['tripdata']}),
                ('times_depart',    {'name':'Dep. time', 'xmltag':'depart',   'unit':'s',     'default':0.0, 'info':'Time beginning firts trip or activity.','groupnames':['tripdata']}),
                ('times_arrival',   {'name':'Arr. time', 'xmltag':'arrival',   'unit':'s',    'default':0.0, 'info':'Time ending last trip or activity.','groupnames':['tripdata']}),
                ])

        for attrname, kwargs in attrinfos.iteritems():
            self.add_resultattr(attrname, **kwargs)

        # this is a special for route info
        self.add_col(
            am.IdlistsArrayConf(
                'ids_edges',
                edges,
                name='Edge IDs',
                groupnames=['routeinfo'],
                info='List of edge IDs constituting the actually taken route.',
                xmltag='edges',
            ))
コード例 #3
0
    def __init__(self, ident, polulation, vtypes, edges, parking, **kwargs):
        print 'IndividualVehicles vtype id_default', vtypes.ids_sumo.get_id_from_index('passenger1')
        self._init_objman(ident=ident,
                          parent=polulation,
                          name='Indiv. Veh.',
                          info='Individual vehicle database. These are privately owned vehicles.',
                          **kwargs)

        self.add_col(am.IdsArrayConf('ids_vtype', vtypes,
                                     id_default=vtypes.ids_sumo.get_id_from_index(
                                         'passenger1'),
                                     groupnames=['state'],
                                     name='Veh. type',
                                     info='Vehicle type.',
                                     #xmltag = 'type',
                                     ))

        self.add_col(am.IdsArrayConf('ids_person', polulation,
                                     groupnames=['state'],
                                     name='ID person',
                                     info='ID of person who ownes the vehicle.',
                                     ))

        self.add_col(am.IdlistsArrayConf('routes', edges,
                                         groupnames=['_private'],
                                         name='Route',
                                         info="The vehicle's route as a sequence of edge ids.",
                                         ))

        self.add_col(am.IdlistsArrayConf('ids_parkings', parking,
                                         groupnames=['state'],
                                         name='Parking',
                                         info='Sequence of parking IDs, this will cause the vehicle to stop successively at these parkings.',
                                         ))

        self.add_col(am.ArrayConf('times_exec', 0.0,
                                  name='Exec time',
                                  info='Total route execution time from simulation run of last plan.',
                                  unit='s',
                                  ))

        parking.link_vehiclefleet(self)
コード例 #4
0
    def _init_attributes(self):
        trips = self.parent.trips

        # TODO: add/update vtypes here
        self.add_col(SumoIdsConf('User', xmltag='id'))

        self.add_col(am.IdlistsArrayConf('ids_trips', trips,
                                         #groupnames = ['_private'],
                                         name='Trip IDs',
                                         info="IDs of trips made by this vehicle. This is a collection of recorded trips associated with this person.",
                                         ))

        self.add_col(am.ArrayConf('ids_genders', default=0,
                                  dtype=np.int,
                                  groupnames=['parameters'],
                                  name='gender',
                                  info='Gender of person.',
                                  ))

        self.add_col(am.ArrayConf('years_birth', default=-1,
                                  dtype=np.int,
                                  groupnames=['parameters'],
                                  name='birth year',
                                  info='Year when person has been born.',
                                  ))

        self.add_col(am.ArrayConf('years_birth', default='',
                                  dtype=np.object,
                                  groupnames=['parameters'],
                                  name='birth year',
                                  info='Year when person has been born.',
                                  ))

        self.add_col(am.ArrayConf('ids_occupation', default=OCCUPATIONS['unknown'],
                                  dtype=np.int32,
                                  choices=OCCUPATIONS,
                                  groupnames=['parameters'],
                                  name='occupation',
                                  info='Tupe of occupation',
                                  ))

        self.add_col(am.ArrayConf('are_frequent_user', False,
                                  dtype=np.int32,
                                  groupnames=['parameters'],
                                  name='frequent user',
                                  info='If true, this person is a frequent user of the recorded transport mode.',
                                  ))

        self.add_col(am.ArrayConf('zips', -1,
                                  dtype=np.int32,
                                  groupnames=['parameters'],
                                  name='ZIP',
                                  info='ZIP code of persons home.',
                                  ))
コード例 #5
0
    def _init_attributes(self):
        self.add_col(SumoIdsConf('Detector', xmltag='id'))

        self.add_col(am.IdlistsArrayConf('ids_lanes', self.get_scenario().net.lanes,
                                         name='IDs Lane',
                                         info="""Lane IDs where detector is located. 
                                    Single or multiple lanes must be from the same egde.
                                    In case of multiple lanes the measured flows are distributed on the lanes using some heuristics.""",
                                         ))

        if hasattr(self, 'ids_lane'):
            self.delete('ids_lane')

        self.add_col(am.ArrayConf('names', "",
                                  dtype=np.object,
                                  perm='rw',
                                  name='Name',
                                  info='Human readable detector name. Can be used to indicate detector location.',
                                  ))

        self.add_col(am.ArrayConf('positions', 0.0,
                                  perm='r',
                                  name='Position',
                                  unit='m',
                                  xmltag='pos',
                                  info='Position on edge where detector is located.',
                                  ))

        self.add_col(am.ArrayConf('directions', 0.0,
                                  perm='rw',
                                  name='direction',
                                  unit='DEG',
                                  info='Direction of detector in degrees. North is zero degree. ',
                                  ))

        self.add_col(am.ArrayConf('coords',  np.zeros(3, dtype=np.float32),
                                  groupnames=['state'],
                                  perm='r',
                                  name='Coords',
                                  unit='m',
                                  info='Dedector coordinate.',
                                  is_plugin=True,
                                  ))

        self.add_col(am.ArrayConf('reliabilities', 1.0,
                                  perm='rw',
                                  name='Reliability',
                                  info='Reliability of detector: 0 = broken, 1 = fully reliable. Some detectors provide this information which can help to eliminate unreliable flow measurements.',
                                  ))
コード例 #6
0
    def __init__(self, ident, trips, net, **kwargs):

        self._init_objman(ident=ident,
                          parent=trips,
                          name='Routes',
                          info='Table with route info.',
                          xmltag=('routes', 'route', None),
                          **kwargs)

        #self.add_col(SumoIdsConf('Route', xmltag = 'id'))

        self.add_col(am.IdsArrayConf('ids_trip', trips,
                                     groupnames=['state'],
                                     name='Trip ID',
                                     info='Route for this trip ID.',
                                     ))

        self.add_col(am.IdlistsArrayConf('ids_edges', net.edges,
                                         name='Edge IDs',
                                         info='List of edge IDs constituting the route.',
                                         xmltag='edges',
                                         ))

        self.add_col(am.ArrayConf('costs', 0.0,
                                  dtype=np.float32,
                                  perm='r',
                                  name='Costs',
                                  info="Route costs.",
                                  xmltag='cost',
                                  ))

        self.add_col(am.ArrayConf('probabilities', 1.0,
                                  dtype=np.float32,
                                  perm='r',
                                  name='Probab.',
                                  info="Route route choice probability.",
                                  xmltag='probability',
                                  ))

        self.add_col(am.ArrayConf('colors', np.ones(4, np.float32),
                                  dtype=np.float32,
                                  metatype='color',
                                  perm='rw',
                                  name='Color',
                                  info="Route color. Color as RGBA tuple with values from 0.0 to 1.0",
                                  xmltag='color',
                                  ))
コード例 #7
0
    def __init__(self, parent, trips, edges, is_add_default=True, **kwargs):

        self._init_objman(ident='tripresults',
                          parent=parent,  # main results object
                          name='Trip results',
                          info='Table with simulation results for each trip made.',
                          **kwargs)

        self.add_col(am.IdsArrayConf('ids_trip', trips,
                                     groupnames=['state'],
                                     is_index=True,
                                     name='ID trip',
                                     info='ID of trip.',
                                     ))
        attrinfos = OrderedDict([
            ('duration', {'name': 'Duration', 'xmltag': 'duration',    'unit': 's',
                          'default': 0, 'info': 'Trip duration', 'groupnames': ['tripdata']}),
            ('depart',   {'name': 'Dep. time', 'xmltag': 'depart',   'unit': 's',
                          'default': 0, 'info': 'Departure time', 'groupnames': ['tripdata']}),
            ('arrival',   {'name': 'Arr. time', 'xmltag': 'arrival',   'unit': 's',
                           'default': 0, 'info': 'Departure time', 'groupnames': ['tripdata']}),
            ('departPos',   {'name': 'depart pos', 'xmltag': 'departPos',   'unit': 'm',
                             'default': 0.0, 'info': 'depart position', 'groupnames': ['tripdata']}),
            ('arrivalPos',   {'name': 'arrival pos', 'xmltag': 'arrivalPos',    'unit': 'm',
                              'default': 0.0, 'info': 'arrival position', 'groupnames': ['tripdata']}),
            ('routeLength',   {'name': 'Length', 'xmltag': 'routeLength',    'unit': 'm',
                               'default': 0.0, 'info': 'Route length', 'groupnames': ['tripdata']}),
            ('waitSteps',   {'name': 'wait steps', 'xmltag': 'waitSteps',   'unit': None,    'default': 0,
                             'info': 'Time steps, the vehicle has been waiting during its trip', 'groupnames': ['tripdata']}),
            ('rerouteNo',   {'name': 'reroute No', 'xmltag': 'rerouteNo',   'unit': None,
                             'default': 0, 'info': 'Number of re-routes', 'groupnames': ['tripdata']}),
        ])

        for attrname, kwargs in attrinfos.iteritems():
            self.add_resultattr(attrname, **kwargs)

        # this is special for route info
        self.add_col(am.IdlistsArrayConf('ids_edges', edges,
                                         name='Edge IDs',
                                         groupnames=['routeinfo'],
                                         info='List of edge IDs constituting the actually taken route.',
                                         xmltag='edges',
                                         ))
コード例 #8
0
    def _init_attributes(self):
        # attrsman = self # = self.get_attrsman()
        demand = self.parent
        net = self.get_net()

        self.add(cm.ObjConf(PtLinks('ptlinks', self)))
        self.add_col(
            am.ArrayConf(
                'linenames',
                default='',
                dtype='object',
                perm='rw',
                name='Line name',
                info=
                'This is the official name or number of the line. Note that the same line may have several line services for different service periods.',
                xmltag='line',
            ))

        self.add_col(
            am.ArrayConf(
                'times_begin',
                0,
                name='Begin time',
                unit='s',
                perm='rw',
                info='Time when service begins.',
                xmltag='begin',
            ))

        self.add_col(
            am.ArrayConf(
                'times_end',
                0,
                name='End time',
                perm='rw',
                unit='s',
                info='Time when service ends.',
                xmltag='end',
            ))

        self.add_col(
            am.ArrayConf(
                'periods',
                0,
                name='Interval',
                perm='rw',
                unit='s',
                info='Time interval between consecutive vehicles.',
                xmltag='period',
            ))

        self.add_col(
            am.ArrayConf(
                'times_dwell',
                20,
                groupnames=['options'],
                perm='rw',
                name='Dwell time',
                untit='s',
                info=
                'Dwell time in a stop while passengers are boarding/alighting.',
                xmltag='duration',
            ))

        self.add_col(
            am.IdlistsArrayConf(
                'ids_stops',
                net.ptstops,
                groupnames=['parameters'],
                name='PT stop IDs',
                info=
                'Sequence of IDs of stops or stations of a public transort line.',
            ))

        self.add_col(
            am.IdlistsArrayConf(
                'ids_edges',
                net.edges,
                name='Edge IDs',
                info=
                'Sequence of edge IDs constituting this public transport line.',
                xmltag='edges',
            ))

        self.add_col(
            am.IdsArrayConf(
                'ids_vtype',
                demand.vtypes,
                id_default=0,
                groupnames=['state'],
                name='Veh. type ID',
                info='Vehicle type used to derve this line.',
                xmltag='type',
            ))

        self.add(
            cm.FuncConf(
                'func_delete_row',
                'on_del_row',
                None,
                groupnames=['rowfunctions', '_private'],
                name='Del line',
                info='Delete line service.',
                is_returnval=False,
            ))

        if self.get_version() < 0.2:
            if hasattr(self, 'period'):
                self.delete('period')
            self.linenames.set_xmltag('line')
            self.ids_vtype.set_xmltag('type')
            self.times_dwell.set_xmltag('duration')
            self.periods.set_xmltag('period')
            self.times_end.set_xmltag('end')
            self.times_begin.set_xmltag('begin')
コード例 #9
0
    def _init_attributes(self):
        LINKTYPES = {
            'none': 0,
            'enter': 1,
            'transit': 2,
            'board': 3,
            'alight': 4,
            'transfer': 5,
            'walk': 6,
            'exit': 7,
        }
        ptlines = self.parent
        net = self.parent.parent.get_net()

        self.add_col(
            am.ArrayConf(
                'types',
                LINKTYPES['none'],
                dtype=np.int32,
                perm='rw',
                choices=LINKTYPES,
                name='Type',
                info=
                'Type of PT link. Walking is needed to tranfer between lines.',
                # xmltag = 'type', # should not be exported?
            ))

        self.add_col(
            am.IdsArrayConf(
                'ids_fromstop',
                net.ptstops,
                groupnames=['state'],
                name='ID stop from',
                info='ID of stop where the link starts.',
                xmltag='from',
            ))

        self.add_col(
            am.IdsArrayConf(
                'ids_tostop',
                net.ptstops,
                groupnames=['state'],
                name='ID stop to',
                info='ID of stop where the link ends.',
                xmltag='to',
            ))

        # Attention, when building Fstar, we need to take
        # into account the travel time, as lines
        # are defined over time intervals
        self.add_col(
            am.IdsArrayConf(
                'ids_line',
                ptlines,
                groupnames=['state'],
                name='Line ID',
                info=
                'ID of public transport line. -1 means no line, in case of walking.',
                xmltag='to',
            ))

        # self.add_col(am.NumArrayConf('speeds_line', 30.0/3.6,
        #                                dtype = np.float32,
        #                                groupnames = ['state'],
        #                                perm = 'rw',
        #                                name = 'line speed',
        #                                unit = 'm/s',
        #                                info = 'Line speed on public transport link.',
        #                                #xmltag = 'speed',
        #                                ))

        self.add_col(
            am.NumArrayConf(
                'lengths',
                0.0,
                dtype=np.float32,
                groupnames=['state'],
                perm='r',
                name='Length',
                unit='m',
                info='Edge length.',
                #xmltag = 'length ',
            ))

        self.add_col(
            am.NumArrayConf(
                'durations',
                0.0,
                dtype=np.float32,
                groupnames=['state'],
                perm='rw',
                name='Duration',
                unit='s',
                info='Time duration of link, including dwell time.',
                #xmltag = 'speed',
            ))

        self.add_col(
            am.IdlistsArrayConf(
                'ids_links_forward',
                self,
                groupnames=['parameters'],
                name='Forward link IDs',
                info='Forward link IDs.',
            ))
        if self.get_version() < 0.1:
            self.types.choices = LINKTYPES
            self.delete('speeds_line')
コード例 #10
0
ファイル: demandbase.py プロジェクト: qichaow/sumo
    def _init_attributes(self, landuse=None):
        # self.add_col(SumoIdsConf('Activitytypes'))

        self.add_col(
            am.ArrayConf(
                'names',
                '',
                dtype=np.object,
                is_index=True,
                groupnames=['parameters'],
                perm='rw',
                name='Type name',
                info='Human readable name of activity type.',
            ))

        self.add_col(
            am.ArrayConf(
                'symbols',
                '',
                dtype=np.object,
                perm='rw',
                is_index=True,
                name='Type symbol',
                info=
                'Symbol of activity type name. Used to represent activity sequences.',
            ))

        self.add_col(
            am.ArrayConf(
                'descriptions',
                '',
                dtype=np.object,
                perm='rw',
                name='Description',
                info='Description of activity.',
            ))

        # this works only for first init
        # if landuse is not None:
        self.add_col(
            am.IdlistsArrayConf(
                'ids_landusetypes',
                self.parent.get_scenario().landuse.landusetypes,
                name='Landuse types',
                info=
                "Landuse type IDs, eher this activity type can take place.",
            ))

        self.add_col(
            am.ArrayConf(
                'hours_begin_earliest',
                0.0,
                dtype=np.float32,
                groupnames=['parameters'],
                perm='rw',
                name='Earliest hour begin',
                unit='h',
                info=
                'Default value for earliest hour when this activity can begin.',
            ))

        self.add_col(
            am.ArrayConf(
                'hours_begin_latest',
                1.0,
                dtype=np.float32,
                groupnames=['parameters'],
                perm='rw',
                name='Latest begin hour',
                unit='h',
                info=
                'Default value for latest hour when this activity can begin.',
            ))

        self.add_col(
            am.ArrayConf(
                'durations_min',
                6.0,
                dtype=np.float32,
                groupnames=['parameters'],
                perm='rw',
                name='Min. Duration',
                unit='h',
                info=
                'Default value for minimum activity duration for a person within a day.',
            ))

        self.add_col(
            am.ArrayConf(
                'durations_max',
                8.0,
                dtype=np.float32,
                groupnames=['parameters'],
                perm='rw',
                name='Max. Duration',
                unit='h',
                info=
                'Default value for maximum activity duration for a person within a day.',
            ))
コード例 #11
0
    def __init__(self,
                 ident,
                 parent,
                 trips,
                 edges,
                 datapathkey='tripdatapath',
                 is_add_default=True,
                 name='Trip results',
                 info='Table with simulation results for each trip made.',
                 **kwargs):

        self._init_objman(
            ident=ident,
            parent=parent,  # main results object
            info=info,
            name=name,
            **kwargs)

        self.add(
            cm.AttrConf(
                'datapathkey',
                datapathkey,
                groupnames=['_private'],
                name='data pathkey',
                info="key of data path",
            ))

        self.add_col(
            am.IdsArrayConf(
                'ids_trip',
                trips,
                groupnames=['state'],
                is_index=True,
                name='ID trip',
                info='ID of trip.',
            ))
        attrinfos = OrderedDict([
            ('duration', {
                'name': 'Duration',
                'xmltag': 'duration',
                'unit': 's',
                'default': 0,
                'info': 'Trip duration',
                'groupnames': ['tripdata']
            }),
            ('depart', {
                'name': 'Dep. time',
                'xmltag': 'depart',
                'unit': 's',
                'default': 0,
                'info': 'Departure time',
                'groupnames': ['tripdata'],
                'is_average': True
            }),
            ('arrival', {
                'name': 'Arr. time',
                'xmltag': 'arrival',
                'unit': 's',
                'default': 0,
                'info': 'Arrival time',
                'groupnames': ['tripdata'],
                'is_average': True
            }),
            ('routeLength', {
                'name': 'Length',
                'xmltag': 'routeLength',
                'unit': 'm',
                'default': 0.0,
                'info': 'Route length',
                'groupnames': ['tripdata']
            }),
            ('departdelays', {
                'name': 'Dep. delay',
                'xmltag': 'departDelay',
                'unit': 's',
                'default': 0,
                'info':
                'The time the vehicle had to wait before it could start his journey',
                'groupnames': ['tripdata'],
                'is_average': True
            }),
            ('waittimes', {
                'name': 'Wait time',
                'xmltag': 'waitingTime',
                'unit': 's',
                'default': 0,
                'info':
                'The time in which the vehicle speed was below 0.1m/s (scheduled stops do not count) ',
                'groupnames': ['tripdata'],
                'is_average': True
            }),
            ('stoptimes', {
                'name': 'Stop time',
                'xmltag': 'stopTime',
                'unit': 's',
                'default': 0,
                'info':
                'The time in which the vehicle was taking a planned stop',
                'groupnames': ['tripdata'],
                'is_average': True
            }),
            ('timelosses', {
                'name': 'Timeloss',
                'xmltag': 'timeLoss',
                'unit': 's',
                'default': 0,
                'info':
                'The time lost due to driving below the ideal speed. (ideal speed includes the individual speedFactor; slowdowns due to intersections etc. will incur timeLoss, scheduled stops do not count)',
                'groupnames': ['tripdata'],
                'is_average': True
            }),
            ('departPos', {
                'name': 'depart pos',
                'xmltag': 'departPos',
                'unit': 'm',
                'default': 0.0,
                'info': 'depart position',
                'groupnames': ['tripdata'],
                'is_average': True
            }),
            ('arrivalPos', {
                'name': 'arrival pos',
                'xmltag': 'arrivalPos',
                'unit': 'm',
                'default': 0.0,
                'info': 'arrival position',
                'groupnames': ['tripdata'],
                'is_average': True
            }),
            ('speedfactors', {
                'name': 'Speedfactor',
                'xmltag': 'speedFactor',
                'default': 0.0,
                'info':
                'The individual speed factor of the vehicle (possibly drawn from a speed distribution at the start of the simulation)',
                'groupnames': ['tripdata'],
            }),
            ('are_vaporized', {
                'name': 'vaporized',
                'xmltag': 'vaporized',
                'default': False,
                'info':
                'Whether the vehicle was removed from the simulation before reaching its destination',
                'groupnames': ['tripdata'],
            }),
            ('waitSteps', {
                'name': 'wait steps',
                'xmltag': 'waitingCount',
                'unit': None,
                'default': 0,
                'info':
                'Count of time steps, the vehicle has been waiting during its trip',
                'groupnames': ['tripdata']
            }),
            ('rerouteNo', {
                'name': 'reroute No',
                'xmltag': 'rerouteNo',
                'unit': None,
                'default': 0,
                'info': 'Number of re-routes',
                'groupnames': ['tripdata']
            }),
            ('waitSteps', {
                'name': 'wait steps',
                'xmltag': 'waitSteps',
                'unit': None,
                'default': 0,
                'info':
                'Time steps, the vehicle has been waiting during its trip',
                'groupnames': ['tripdata']
            }),
        ])

        for attrname, kwargs in attrinfos.iteritems():
            self.add_resultattr(attrname, **kwargs)

        # this is special for route info
        self.add_col(
            am.IdlistsArrayConf(
                'ids_edges',
                edges,
                name='Edge IDs',
                groupnames=['routeinfo'],
                info='List of edge IDs constituting the actually taken route.',
                xmltag='edges',
            ))
コード例 #12
0
ファイル: virtualpop.py プロジェクト: wsgan001/plexe-sumo
    def __init__(self, demand, **kwargs):
        self._init_objman(
            ident='virtualpop',
            parent=demand,
            name='Virtual polulation',
            info=
            'Contains information of each individual of the virtual population.',
            #xmltag = ('plans','plan',None),
            **kwargs)

        scenario = demand.get_scenario()
        #--------------------------------------------------------------------
        # plans table
        self.add(cm.ObjConf(Plans(self)))
        #--------------------------------------------------------------------
        # individual vehicles table
        self.add(
            cm.ObjConf(
                IndividualVehicles('individualvehicles', self, demand.vtypes,
                                   scenario.net.edges,
                                   scenario.landuse.parking)))

        #--------------------------------------------------------------------
        # walks table
        #self.walks = self.add_tableman(Walks(self))
        self.add(cm.ObjConf(Walks('walks', self, scenario.net.edges)))

        #--------------------------------------------------------------------
        # rides table
        self.add(cm.ObjConf(Rides('rides', self, scenario.landuse.parking)))

        #--------------------------------------------------------------------
        # pt rides table
        # self.add(cm.ObjConf(Transits(self, publictransport))   )

        #--------------------------------------------------------------------
        # Activities table
        self.add(cm.ObjConf(Activities('activities', self,
                                       scenario.net.lanes)))

        #--------------------------------------------------------------------
        # misc params
        # this is option for intermodal routing process
        # self.add(AttrConf(  'dist_max_wait', kwargs.get('dist_max_wait',20.0),
        #                                groupnames = ['options'],
        #                                perm='wr',
        #                                unit = 'm',
        #                                name = 'Max dist. Wait',
        #                                info = 'The maximum distance between two stops or platforms, when a person during transfer is not walking, but just waiting for the next bus/train to come.' ,
        #                                #xmltag = 'pos',
        #                                ))
        #--------------------------------------------------------------------
        # columns

        self.add_col(
            am.ArrayConf(
                'identification ',
                '',
                dtype=np.object,
                name='Name',
                info='Identification or name of person.',
            ))

        self.add_col(
            am.IdsArrayConf(
                'ids_fac_home',
                scenario.landuse.facilities,
                groupnames=['state'],
                name='ID home fac.',
                info='Facility ID of home.',
            ))

        self.add_col(
            am.IdsArrayConf(
                'ids_fac_activity',
                scenario.landuse.facilities,
                groupnames=['state'],
                name='ID activity fac.',
                info='Facility ID of location of main activity (work, study).',
            ))

        self.add_col(
            am.IdsArrayConf(
                'ids_mode_preferred',
                scenario.net.modes,
                name='ID preferred mode',
                info='ID of preferred transport mode of person.',
            ))

        self.add_col(
            am.ArrayConf(
                'times_start',
                0,
                name='Start time',
                unit='s',
                info=
                'Time when person leaves home facility for doing some activity.',
            ))

        # this could be extended to a list with more plans
        self.add_col(
            am.IdsArrayConf(
                'ids_plan',
                self.get_plans(),
                name='ID Plan',
                info='Currently best mobility plan ID of person.',
            ))

        self.add_col(
            am.IdlistsArrayConf(
                'lists_ids_plan',
                self.get_plans(),
                name='IDs Plans',
                info='List with the IDs of feasible mobility plans.',
            ))
コード例 #13
0
    def __init__(self, demand, net, **kwargs):
        # print 'Trips.__init__'
        self._init_objman(ident='trips',
                          parent=demand,
                          name='Trips',
                          info='Table with trip and route info.',
                          xmltag=('trips', 'trip', 'ids_sumo'),
                          **kwargs)

        self.add_col(SumoIdsConf('Trip', xmltag='id'))

        self.add_col(am.IdsArrayConf('ids_vtype', demand.vtypes,
                                     groupnames=['state'],
                                     name='Type',
                                     info='Vehicle type.',
                                     xmltag='type',
                                     ))

        self.add_col(am.ArrayConf('times_depart', 0,
                                  dtype=np.int32,
                                  perm='rw',
                                  name='Depart time',
                                  info="Departure time of vehicle in seconds. Must be an integer!",
                                  xmltag='depart',
                                  ))

        self.add_col(am.IdsArrayConf('ids_edge_depart', net.edges,
                                     groupnames=['state'],
                                     name='ID from-edge',
                                     info='ID of network edge where trip starts.',
                                     xmltag='from',
                                     ))

        self.add_col(am.IdsArrayConf('ids_edge_arrival', net.edges,
                                     groupnames=['state'],
                                     name='ID to-edge',
                                     info='ID of network edge where trip ends.',
                                     xmltag='to',
                                     ))

        self.add_col(am.ArrayConf('inds_lane_depart', OPTIONMAP_LANE_DEPART["free"],
                                  dtype=np.int32,
                                  #choices = OPTIONMAP_LANE_DEPART,
                                  perm='r',
                                  name='Depart lane',
                                  info="Departure lane index. 0 is rightmost lane or sidewalk, if existant.",
                                  xmltag='departLane',
                                  xmlmap=get_inversemap(OPTIONMAP_LANE_DEPART),
                                  ))

        self.add_col(am.ArrayConf('positions_depart', OPTIONMAP_POS_DEPARTURE["random_free"],
                                  dtype=np.float32,
                                  #choices = OPTIONMAP_POS_DEPARTURE,
                                  perm='r',
                                  name='Depart pos',
                                  unit='m',
                                  info="Position on edge at the moment of departure.",
                                  xmltag='departPos',
                                  xmlmap=get_inversemap(
                                      OPTIONMAP_POS_DEPARTURE),
                                  ))

        self.add_col(am.ArrayConf('speeds_depart', 0.0,
                                  dtype=np.float32,
                                  #choices = OPTIONMAP_SPEED_DEPARTURE,
                                  perm='r',
                                  name='Depart speed',
                                  unit='m/s',
                                  info="Speed at the moment of departure.",
                                  xmltag='departSpeed',
                                  xmlmap=get_inversemap(
                                      OPTIONMAP_SPEED_DEPARTURE),
                                  ))
        self.add_col(am.ArrayConf('inds_lane_arrival', OPTIONMAP_LANE_ARRIVAL["current"],
                                  dtype=np.int32,
                                  #choices = OPTIONMAP_LANE_ARRIVAL,
                                  perm='r',
                                  name='Arrival lane',
                                  info="Arrival lane index. 0 is rightmost lane or sidewalk, if existant.",
                                  xmltag='arrivalLane',
                                  xmlmap=get_inversemap(
                                      OPTIONMAP_LANE_ARRIVAL),
                                  ))

        self.add_col(am.ArrayConf('positions_arrival', OPTIONMAP_POS_ARRIVAL["random"],
                                  dtype=np.float32,
                                  #choices = OPTIONMAP_POS_ARRIVAL,
                                  perm='r',
                                  name='Arrival pos',
                                  unit='m',
                                  info="Position on edge at the moment of arrival.",
                                  xmltag='arrivalPos',
                                  xmlmap=get_inversemap(OPTIONMAP_POS_ARRIVAL),
                                  ))

        self.add_col(am.ArrayConf('speeds_arrival', 0.0,
                                  dtype=np.float32,
                                  #choices = OPTIONMAP_SPEED_ARRIVAL,
                                  perm='r',
                                  name='Arrival speed',
                                  unit='m/s',
                                  info="Arrival at the moment of departure.",
                                  xmltag='arrivalSpeed',
                                  xmlmap=get_inversemap(
                                      OPTIONMAP_SPEED_ARRIVAL),
                                  ))

        self.add(cm.ObjConf(Routes('routes', self, net)))

        # print '  self.routes.get_value()',self.routes.get_value()
        self.add_col(am.IdlistsArrayConf('ids_routes', self.routes.get_value(),
                                         name='Route IDs',
                                         info='List of edge IDs constituting the route.',
                                         ))
コード例 #14
0
    def _init_attributes(self):

        self.add_col(SumoIdsConf('GPS Trip', xmltag='id', info='GPS trip data.'))

        self.add_col(am.ArrayConf('timestamps', default=0,
                                  dtype=np.int,
                                  groupnames=['parameters', 'gps'],
                                  name='timestamp',
                                  unit='s',
                                  info='Timestamp when trip started in seconds after 01 January 1970.',
                                  ))

        self.add_col(am.ArrayConf('durations_gps', default=0.0,
                                  dtype=np.int,
                                  groupnames=['parameters', 'gps'],
                                  name='GPS duration',
                                  unit='s',
                                  info='Time duration measure with GPS points.',
                                  ))

        self.add_col(am.ArrayConf('distances_gps', default=0.0,
                                  dtype=np.int,
                                  groupnames=['parameters', 'gps'],
                                  name='GPS distance',
                                  unit='m',
                                  info='Distance measure with GPS points.',
                                  ))

        self.add_col(am.ArrayConf('speeds_average', default=0.0,
                                  dtype=np.float32,
                                  groupnames=['parameters', 'gps'],
                                  name='Av. speed',
                                  unit='m/s',
                                  info='Average speed based on GPS info.',
                                  ))
        self.add_col(am.ArrayConf('speeds_max', default=0.0,
                                  dtype=np.float32,
                                  groupnames=['parameters', 'gps'],
                                  name='Max. speed',
                                  unit='m/s',
                                  info='Maximum speed based on GPS info.',
                                  ))

        Trips._init_attributes(self)
        self.add_col(am.IdsArrayConf('ids_route_mapped', self.routes.get_value(),
                                     name='ID mapped route',
                                     info='Route ID of mapped route.',
                                     ))

        self.add_col(am.IdsArrayConf('ids_route_shortest', self.routes.get_value(),
                                     name='ID shortest route',
                                     info='Route ID of shortest route.',
                                     ))

        self.add_col(am.ArrayConf('ids_purpose', default=TRIPPUROPSES['unknown'],
                                  dtype=np.int32,
                                  groupnames=['parameters', 'gps'],
                                  choices=TRIPPUROPSES,
                                  name='Purpose',
                                  info='Trip purpose ID',
                                  ))

        self.add_col(am.ArrayConf('ids_device', default=DEVICES['unknown'],
                                  dtype=np.int32,
                                  groupnames=['parameters', 'gps'],
                                  choices=DEVICES,
                                  name='Devices',
                                  info='Device ID',
                                  ))

        self.add_col(am.IdlistsArrayConf('ids_points', self.parent.points,
                                         #groupnames = ['_private'],
                                         name='Point IDs',
                                         info="GPS point IDs.",
                                         ))