Ejemplo n.º 1
0
    def add_speedoptions(self):
        attrsman = self.get_attrsman()

        self.add_option(
            'speed_depart',
            OPTIONMAP_SPEED_DEPARTURE['max'],
            groupnames=['options'],
            cml='--departspeed',
            name='Departure speed',
            unit='m/s',
            info="Departure speed of vehicle.\n\nSpecial values:\n" +
            dict_to_str(OPTIONMAP_SPEED_DEPARTURE, intend=2),
            cmlvaluemap=get_inversemap(OPTIONMAP_SPEED_DEPARTURE),
        )

        self.add_option(
            'speed_arrival',
            OPTIONMAP_SPEED_ARRIVAL['current'],
            groupnames=['options'],
            cml='--arrivalspeed',
            name='Arival speed',
            unit='m/s',
            info="Arival speed of vehicle.\n\nSpecial values:\n" +
            dict_to_str(OPTIONMAP_SPEED_ARRIVAL, intend=2),
            cmlvaluemap=get_inversemap(OPTIONMAP_SPEED_ARRIVAL),
        )
Ejemplo n.º 2
0
    def add_laneoptions(self):
        attrsman = self.get_attrsman()

        self.add_option(
            'ind_lane_depart',
            OPTIONMAP_LANE_DEPART['best'],
            groupnames=['options'],
            cml='--departlane',
            name='Depart lane',
            info=
            "Departure lane index. 0 is rightmost lane or sidewalk, if existant.\n\nSpecial values:\n"
            + dict_to_str(OPTIONMAP_LANE_DEPART, intend=2),
            cmlvaluemap=get_inversemap(OPTIONMAP_LANE_DEPART),
        )

        self.add_option(
            'ind_lane_arrival',
            OPTIONMAP_LANE_ARRIVAL['current'],
            groupnames=['options'],
            cml='--arrivallane',
            name='Arrival lane',
            info=
            "Arrival lane index. 0 is rightmost lane or sidewalk, if existant.\n\nSpecial values:\n"
            + dict_to_str(OPTIONMAP_LANE_ARRIVAL, intend=2),
            cmlvaluemap=get_inversemap(OPTIONMAP_LANE_ARRIVAL),
        )
Ejemplo n.º 3
0
    def add_posoptions(self):
        attrsman = self.get_attrsman()

        self.add_option(
            'pos_depart',
            OPTIONMAP_POS_DEPARTURE['base'],
            groupnames=['options'],
            cml='--departpos',
            name='Departure position',
            unit='m',
            info="Departure position of vehicle.\n\nSpecial values:\n" +
            dict_to_str(OPTIONMAP_POS_DEPARTURE, intend=2),
            cmlvaluemap=get_inversemap(OPTIONMAP_POS_DEPARTURE),
        )

        self.add_option(
            'pos_arrival',
            OPTIONMAP_POS_ARRIVAL['max'],
            groupnames=['options'],
            cml='--arrivalpos',
            name='Arival position',
            unit='m',
            info="Arival position of vehicle.\n\nSpecial values:\n" +
            dict_to_str(OPTIONMAP_POS_ARRIVAL, intend=2),
            cmlvaluemap=get_inversemap(OPTIONMAP_POS_ARRIVAL),
        )
def nodes_to_shapefile(net,
                       filepath,
                       dataname='nodeshapedata',
                       parent=None,
                       log=None):
    """
    Export network nodes to shapefile.
    """
    nodes = net.nodes
    shapedata = Shapedata(parent,
                          dataname,
                          name='Node shape data',
                          filepath=filepath,
                          shapetype=SHAPETYPES['Point'],
                          projparams_shape=net.get_projparams(),
                          offset=net.get_offset(),
                          log=log)

    #attrname, ftype, flen, fdigit = field
    attrlist = [
        ('id', 'id', 'ID_NODE', 'N', 12, 0),
        ('types', 'val', 'TYPE', 'C', 20, 0),
        # ('radii','val','RADIUS','N',5,3),
    ]

    map_nodetypes = get_inversemap(nodes.types.choices)
    nodetypes = np.zeros(max(map_nodetypes.keys()) + 1, dtype=np.object)
    nodetypes[map_nodetypes.keys()] = map_nodetypes.values()

    print 'nodes_to_shapefile', filepath

    for attr in attrlist:
        shapedata.add_field(attr[2:])

    ids_node = nodes.get_ids()

    ids_shape = shapedata.add_rows(len(nodes))
    # print '  shapedata.ID_ARC',shapedata.ID_ARC,'dir',dir(shapedata.ID_ARC)
    shapedata.ID_NODE[ids_shape] = ids_node
    shapedata.coords[ids_shape] = nodes.coords[ids_node]
    shapedata.TYPE[ids_shape] = nodetypes[nodes.types[ids_node]]

    # copy rest of attributes
    for netattrname, gettype, shapeattrname, x1, x2, x3 in attrlist:
        if netattrname not in ('id', 'types'):
            getattr(shapedata,
                    shapeattrname)[ids_shape] = getattr(nodes,
                                                        netattrname)[ids_node]

    shapedata.adjust_fieldlength()
    shapedata.export_shapefile()
    return True
Ejemplo n.º 5
0
 def print_route(self, ids_link):
     typemap = get_inversemap(self.types.choices)
     for id_link, id_type, id_line, id_fromstop, id_tostop in\
             zip(ids_link,
                 self.types[ids_link],
                 self.ids_line[ids_link],
                 self.ids_fromstop[ids_link],
                 self.ids_tostop[ids_link]
                 ):
         if id_line >= 0:
             line = self.parent.linenames[id_line]
         else:
             line = 'X'
         print '%4d %06s  fromstop=%3d tostop=%3d %06s' % (id_link, line, id_fromstop, id_tostop, typemap[id_type])
Ejemplo n.º 6
0
def nodes_to_shapefile(net, filepath, dataname='nodeshapedata',
                       parent=None, log=None):
    """
    Export network nodes to shapefile.
    """
    nodes = net.nodes
    shapedata = Shapedata(parent, dataname, name='Node shape data',
                          filepath=filepath,
                          shapetype=SHAPETYPES['Point'],
                          projparams_shape=net.get_projparams(),
                          offset=net.get_offset(), log=log)

    #attrname, ftype, flen, fdigit = field
    attrlist = [
        ('id', 'id', 'ID_NODE', 'N', 12, 0),
        ('types', 'val', 'TYPE', 'C', 20, 0),
        # ('radii','val','RADIUS','N',5,3),
    ]

    map_nodetypes = get_inversemap(nodes.types.choices)
    nodetypes = np.zeros(max(map_nodetypes.keys())+1, dtype=np.object)
    nodetypes[map_nodetypes.keys()] = map_nodetypes.values()

    print 'nodes_to_shapefile', filepath

    for attr in attrlist:
        shapedata.add_field(attr[2:])

    ids_node = nodes.get_ids()

    ids_shape = shapedata.add_rows(len(nodes))
    # print '  shapedata.ID_ARC',shapedata.ID_ARC,'dir',dir(shapedata.ID_ARC)
    shapedata.ID_NODE[ids_shape] = ids_node
    shapedata.coords[ids_shape] = nodes.coords[ids_node]
    shapedata.TYPE[ids_shape] = nodetypes[nodes.types[ids_node]]

    # copy rest of attributes
    for netattrname, gettype, shapeattrname, x1, x2, x3 in attrlist:
        if netattrname not in ('id', 'types'):
            getattr(shapedata, shapeattrname)[ids_shape] = getattr(nodes, netattrname)[ids_node]

    shapedata.adjust_fieldlength()
    shapedata.export_shapefile()
    return True
Ejemplo n.º 7
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.',
                                         ))
Ejemplo n.º 8
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',
            ))
Ejemplo n.º 9
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',
                                  ))
Ejemplo n.º 10
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.',
                                         ))