Ejemplo n.º 1
0
 def get_modechoices(self):
     """
     Returns a dictionary of modes for which there are 
     currently vehicles in the database.
     Key is mode name and value is mode ID
     """
     mode_vtypes = self.get_modes()
     mode_choice = OrderedDict()
     for mode, id_mode in MODES.iteritems():
         if id_mode in mode_vtypes:
             mode_choice[mode] = id_mode
     return mode_choice
Ejemplo n.º 2
0
 def get_modechoices(self):
     """
     Returns a dictionary of modes for which there are 
     currently vehicles in the database.
     Key is mode name and value is mode ID
     """
     mode_vtypes = self.get_modes()
     mode_choice = OrderedDict()
     for mode, id_mode in MODES.iteritems():
         if id_mode in mode_vtypes:
             mode_choice[mode] = id_mode
     return mode_choice
Ejemplo n.º 3
0
    def add_vtype(self, vtype, **kwargs):
        # print 'add_vtype',vtype
        if kwargs.has_key('mode'):
            id_mode = MODES.get(kwargs['mode'], 1)
            del kwargs['mode']
        else:
            id_mode = 1

        #_id = self.add_row( ids_sumo = vtype, ids_mode = id_mode,**kwargs)

        _id = self.add_row(ids_sumo=vtype,
                           accels=kwargs.get("accel", 2.9),
                           decels=kwargs.get("decel", 7.5),
                           taus=kwargs.get("tau", None),
                           sigmas=kwargs.get("sigma", 0.5),
                           lengths=kwargs.get("length", 4.3),
                           widths=kwargs.get("width", 1.8),
                           heights=kwargs.get("height", 1.50),
                           dists_min=kwargs.get("dist_min", 1.0),
                           speeds_max=kwargs.get("speed_max", 180.0 / 3.6),
                           ids_mode=id_mode,  # specifies mode for demand
                           colors=kwargs.get("color", np.array(
                               (185, 85, 255, 255), np.float32) / 255.0),
                           impatiences=kwargs.get("impatience", -1000),
                           shapes_gui=kwargs.get("shape_gui", 'passenger'),
                           numbers_persons=kwargs.get("number_persons", None),
                           capacities_persons=kwargs.get(
                               "capacity_persons", None),
                           emissionclasses=kwargs.get("emissionclass", None),
                           lanechanges=kwargs.get("lanechange", None),
                           lanechange_strategies=kwargs.get(
                               "lanechange_strategy", None),
                           lanechange_coops=kwargs.get(
                               "lanechange_coop", None),
                           lanechange_gains=kwargs.get(
                               "lanechange_gain", None),
                           lanechange_rightkeepings=kwargs.get(
                               "lanechange_rightkeeping", None),
                           sublane_alignments_lat=kwargs.get(
                               "sublane_alignment_lat", None),
                           sublane_speeds_max_lat=kwargs.get(
                               "sublane_speed_max_lat", None),
                           sublane_gaps_min_lat=kwargs.get(
                               "sublane_gap_min_lat", None),
                           sublane_alignments_eager=kwargs.get(
                               "sublane_alignment_eager", None),
                           sublane_pushyfactors=kwargs.get(
                               "sublane_pushyfactor", None),
                           )

        return _id
Ejemplo n.º 4
0
    def add_vtype(self, vtype, **kwargs):
        # print 'add_vtype',vtype
        if kwargs.has_key('mode'):
            id_mode = MODES.get(kwargs['mode'], 1)
            del kwargs['mode']
        else:
            id_mode = 1

        #_id = self.add_row( ids_sumo = vtype, ids_mode = id_mode,**kwargs)

        _id = self.add_row(ids_sumo=vtype,
                           accels=kwargs.get("accel", 2.9),
                           decels=kwargs.get("decel", 7.5),
                           taus=kwargs.get("tau", None),
                           sigmas=kwargs.get("sigma", 0.5),
                           lengths=kwargs.get("length", 4.3),
                           widths=kwargs.get("width", 1.8),
                           heights=kwargs.get("height", 1.50),
                           dists_min=kwargs.get("dist_min", 1.0),
                           speeds_max=kwargs.get("speed_max", 180.0 / 3.6),
                           ids_mode=id_mode,  # specifies mode for demand
                           colors=kwargs.get("color", np.array(
                               (185, 85, 255, 255), np.float32) / 255.0),
                           impatiences=kwargs.get("impatience", -1000),
                           shapes_gui=kwargs.get("shape_gui", 'passenger'),
                           numbers_persons=kwargs.get("number_persons", None),
                           capacities_persons=kwargs.get(
                               "capacity_persons", None),
                           emissionclasses=kwargs.get("emissionclass", None),
                           lanechanges=kwargs.get("lanechange", None),
                           lanechange_strategies=kwargs.get(
                               "lanechange_strategy", None),
                           lanechange_coops=kwargs.get(
                               "lanechange_coop", None),
                           lanechange_gains=kwargs.get(
                               "lanechange_gain", None),
                           lanechange_rightkeepings=kwargs.get(
                               "lanechange_rightkeeping", None),
                           sublane_alignments_lat=kwargs.get(
                               "sublane_alignment_lat", None),
                           sublane_speeds_max_lat=kwargs.get(
                               "sublane_speed_max_lat", None),
                           sublane_gaps_min_lat=kwargs.get(
                               "sublane_gap_min_lat", None),
                           sublane_alignments_eager=kwargs.get(
                               "sublane_alignment_eager", None),
                           sublane_pushyfactors=kwargs.get(
                               "sublane_pushyfactor", None),
                           )

        return _id