Exemple #1
0
    def _init_attributes(self):
        vtypes = self.get_scenario().demand.vtypes
        net = self.get_scenario().net

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

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

        self.add_col(
            am.ArrayConf(
                'states',
                default=VEHICLESTATES['init'],
                dtype=np.int32,
                choices=VEHICLESTATES,
                name='state',
                info='State of vehicle.',
            ))

        self.add_col(
            am.IdsArrayConf(
                'ids_targetprtstop',
                self.parent.prtstops,
                groupnames=['parameters'],
                name='Target stop ID',
                info='ID of current target PRT stop.',
            ))

        self.add_col(
            am.IdsArrayConf(
                'ids_currentedge',
                net.edges,
                groupnames=['state'],
                name='Current edge ID',
                info='Edge ID of most recent reported position.',
            ))

        self.add_col(
            am.IdsArrayConf(
                'ids_targetedge',
                net.edges,
                groupnames=['state'],
                name='Target edge ID',
                info=
                'Target edge ID to be reached. This can be either intermediate target edges (), such as a compressor station.',
            ))
    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.',
                                  ))
Exemple #3
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.',
                                  ))
Exemple #4
0
    def _init_attributes(self):
        net = self.parent.get_net()

        # lanechange model is now centralized: all vehicle types have the same
        # lanechange model.
        if self.get_version() < 0.1:
            self.delete('lanechangemodels')
            self.delete('alignments_lat')
            self.delete('speeds_max_lat')
            self.delete('gaps_min_lat')

        self.add(
            cm.AttrConf(
                'lanechangemodel',
                LANECHANGEMODELS[0],
                groupnames=['parameters'],
                choices=LANECHANGEMODELS,
                name='Lanechange model',
                info=
                "Lanechange model. The choice of the lanechange model will also determine the choice of lanechange parameters. With model SL2015, sublanes will be simulated.",
                #xmltag = 'laneChangeModel',
            ))

        self.add_col(SumoIdsConf('vtype', name='Type name', perm='rw'))

        self.add_col(
            am.ArrayConf(
                'lengths',
                5.0,
                groupnames=['parameters'],
                name='Length',
                unit='m',
                info="The vehicle's netto-length",
                xmltag='length',
            ))

        self.add_col(
            am.ArrayConf(
                'widths',
                2.0,
                groupnames=['parameters'],
                name='Width',
                unit='m',
                info="The vehicle's  width.",
                xmltag='width',
            ))

        self.add_col(
            am.ArrayConf(
                'heights',
                1.5,
                groupnames=['parameters'],
                name='Height',
                unit='m',
                info="The vehicle's  height.",
                xmltag='height',
            ))

        self.add_col(
            am.ArrayConf(
                'numbers_persons_initial',
                1,
                groupnames=['parameters'],
                name='Passengers',
                info="Initial number of persons in the vehicle.",
                xmltag='personNumber',
            ))

        self.add_col(
            am.ArrayConf(
                'capacities_persons',
                1,
                groupnames=['parameters'],
                name='Capacity',
                info="Maximum number of persons that fit in a vehicle.",
                xmltag='personCapacity',
            ))

        self.add_col(
            am.ArrayConf(
                'numbers_container',
                0,
                groupnames=['parameters'],
                name='Containers',
                info="Initial number of containers on the vehicle.",
                xmltag='containerNumber',
            ))

        self.add_col(
            am.ArrayConf(
                'speeds_max',
                70.0,
                groupnames=['parameters'],
                name='Max. speed',
                unit='m/s',
                info="The vehicle's maximum velocity",
                xmltag='maxSpeed',
            ))

        self.add_col(
            am.ArrayConf(
                'accels',
                0.8,
                groupnames=['parameters'],
                name='Max. accel.',
                unit='m/s^2',
                info='The acceleration ability of vehicles of this type',
                xmltag='accel',
            ))

        self.add_col(
            am.ArrayConf(
                'decels',
                4.5,
                groupnames=['parameters'],
                name='Max. decel.',
                unit='m/s^2',
                info='The acceleration ability of vehicles of this type',
                xmltag='decel',
            ))

        self.add_col(
            am.ArrayConf(
                'taus',
                1.0,
                groupnames=['parameters'],
                name='Reaction',
                unit='s',
                info=
                "The driver's reaction time in s (actually the minimum time gap)",
                xmltag='tau',
            ))

        self.add_col(
            am.ArrayConf(
                'sigmas',
                0.5,
                groupnames=['parameters'],
                name='Driver',
                info=
                'The driver imperfection (between 0 and 1). Used only in follower models  SUMOKrauss, SKOrig',
                xmltag='sigma',
            ))

        self.add_col(
            am.ArrayConf(
                'dists_min',
                2.5,
                groupnames=['parameters'],
                name='Min. gap',
                unit='m',
                info="Minimum empty space after leader.",
                xmltag='minGap',
            ))

        self.add_col(
            am.ArrayConf(
                'times_boarding',
                0.5,
                groupnames=['parameters'],
                name='boarding time',
                unit='s',
                info="The time required by a person to board the vehicle.",
                xmltag='boardingDuration',
            ))

        self.add_col(
            am.ArrayConf(
                'times_loading',
                90.0,
                groupnames=['parameters'],
                name='loading time',
                unit='s',
                info="The time required by a person to board the vehicle.",
                xmltag='loadingDuration',
            ))

        self.add_col(
            am.IdsArrayConf(
                'ids_mode',
                net.modes,
                groupnames=['state'],
                choices=MODES,
                name='Mode',
                info='ID of transport mode.',
                xmltag='vClass',
            ))

        emissionclasses_xml = {}
        for key in EMISSIONCLASSES.keys():
            # yes, map onto itself, otherwise choice values are taken
            emissionclasses_xml[key] = key

        self.add_col(
            am.ArrayConf(
                'emissionclasses',
                'HBEFA3/HDV_D_EU4',
                dtype='object',
                groupnames=['parameters'],
                choices=get_inversemap(EMISSIONCLASSES),
                name='Emission',
                info=
                "HBEFA3 emission class, see sourceforge.net/apps/mediawiki/sumo/index.php?title=Simulation/Models/Emissions/HBEFA-based",
                xmltag='emissionClass',
                xmlmap=emissionclasses_xml,
            ))

        self.add_col(
            am.ArrayConf(
                'impatiences',
                -1000.0,
                groupnames=['parameters'],
                name='Impatience',
                info=
                "Impatience offset between -1000.0 and 1.0 (-100 or less equals off). Impatience grows at 1/teleport. If 1.0 is reached driver will disrigard priorities.",
                xmltag='impatience',
            ))

        self.add_col(
            am.ArrayConf(
                'shapes_gui',
                "passenger",
                dtype='object',
                groupnames=['parameters'],
                name='GUI shape',
                choices=GUISHAPES,
                info="How this vehicle is rendered.",
                xmltag='guiShape',
            ))

        self.add_col(
            am.ArrayConf(
                'colors',
                np.array((1.0, 1.0, 1.0, 1.0), np.float32),
                metatype='color',
                groupnames=['parameters'],
                name='Color',
                info=
                "This vehicle type's color as RGBA tuple with values from 0 to 1.0",
                xmltag='color',
            ))

        self.add_col(
            am.ArrayConf(
                'lanechange_strategies',
                1.0,
                groupnames=['parameters'],
                name='Lane strategy',
                info=
                "Lanechange model strategy factor. The eagerness for performing strategic lane changing. Higher values result in earlier lane-changing. default: 1.0, range [0-inf]",
                xmltag='lcStrategic',
            ))
        self.add_col(
            am.ArrayConf(
                'lanechange_coops',
                1.0,
                groupnames=['parameters'],
                name='Lane coop',
                info=
                "Lanechange model cooperative factor.The willingness for performing cooperative lane changing. Lower values result in reduced cooperation. default: 1.0, range [0-1]",
                xmltag='lcCooperative',
            ))

        self.add_col(
            am.ArrayConf(
                'lanechange_gains',
                1.0,
                groupnames=['parameters'],
                name='Lane gain',
                info=
                "Lanechange model gain factor.The eagerness for performing lane changing to gain speed. Higher values result in more lane-changing. default: 1.0, range [0-inf]",
                xmltag='lcSpeedGain',
            ))

        self.add_col(
            am.ArrayConf(
                'lanechange_rightkeepings',
                1.0,
                groupnames=['parameters'],
                name='Lane right',
                info=
                "Lanechange model keep right factor.The eagerness for following the obligation to keep right. Higher values result in earlier lane-changing. default: 1.0, range [0-inf]",
                xmltag='lcKeepRight',
            ))

        self.add_col(
            am.ArrayConf(
                'sublane_alignments_lat',
                ALIGNMMENTS_LAT[0],
                dtype='object',
                groupnames=['parameters'],
                choices=ALIGNMMENTS_LAT,
                name='sublane alignment',
                info='Lateral alignment within a lane. For sublane model only.',
                xmltag='latAlignment',
            ))

        self.add_col(
            am.ArrayConf(
                'sublane_speeds_max_lat',
                1.0,
                groupnames=['parameters'],
                name='Sublane max. speed',
                unit='m/s',
                info=
                "The vehicle's maximum velocity in lateral direction. For sublane model only.",
                xmltag='maxSpeedLat',
            ))

        self.add_col(
            am.ArrayConf(
                'sublane_gaps_min_lat',
                0.12,
                groupnames=['parameters'],
                name='Sublane min. gap',
                unit='m',
                info=
                "The vehicle's minimum distance to other vehicles in lateral direction. For sublane model only.",
                xmltag='minGapLat',
            ))

        self.add_col(
            am.ArrayConf(
                'sublane_alignments_eager',
                1.0,
                groupnames=['parameters'],
                name='Sublane eager',
                info=
                "The eagerness using the configured lateral alignment within the lane. Higher values result in increased willingness to sacrifice speed for alignment. default: 1.0, range [0-inf]. For sublane model only.",
                xmltag='lcSublane',
            ))

        self.add_col(
            am.ArrayConf(
                'sublane_pushyfactors',
                0.0,
                groupnames=['parameters'],
                name='Sublane pushy',
                info=
                "Willingness to encroach laterally on other drivers. default: 0.0, range 0 or 1. For sublane model only.",
                xmltag='lcPushy',
            ))
Exemple #5
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.',
                                         ))
    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.",
                                         ))