def __init__(self, ident='odintervals',  parent=None, net=None, zones=None, **kwargs):
        self._init_objman(ident, parent=parent,  # = demand
                          name='OD Demand',
                          info='Contains origin-to-destination zone transport demand for different time intervals.',
                          xmltag=('odintervals', 'odinteval', None), **kwargs)

        self.add_col(am.ArrayConf('times_start', 0,
                                  groupnames=['state'],
                                  perm='rw',
                                  name='Start time',
                                  unit='s',
                                  info='Start time of interval in seconds (no fractional seconds).',
                                  xmltag='t_start',
                                  ))

        self.add_col(am.ArrayConf('times_end', 3600,
                                  groupnames=['state'],
                                  perm='rw',
                                  name='End time',
                                  unit='s',
                                  info='End time of interval in seconds (no fractional seconds).',
                                  xmltag='t_end',
                                  ))

        self.add_col(cm.ObjsConf('odmodes',
                                 groupnames=['state'],
                                 is_save=True,
                                 name='OD modes',
                                 info='OD transport demand for all transport modes within the respective time interval.',
                                 ))
        self.add(cm.ObjConf(net, is_child=False, groups=['_private']))
        self.add(cm.ObjConf(zones, is_child=False, groups=['_private']))
Пример #2
0
    def _init_attributes(self):
        #vtypes = self.get_scenario().demand.vtypes
        net = self.get_scenario().net
        self.add(cm.AttrConf('length_default', 4.0,
                             groupnames=['parameters', 'options'],
                             name='Default length',
                             info='Default berth length.',
                             unit='m',
                             ))

        self.add_col(am.IdsArrayConf('ids_prtstop', self.parent,
                                     name='PRT stop ID',
                                     info='PRT stop ID',
                                     ))

        self.add_col(am.ArrayConf('states', default=BERTHSTATES['free'],
                                  dtype=np.int32,
                                  choices=BERTHSTATES,
                                  name='state',
                                  info='State of berth.',
                                  ))

        self.add_col(am.ArrayConf('stoppositions', default=0.0,
                                  dtype=np.float32,
                                  name='Stop position',
                                  info='Position on edge where vehicle stops',
                                  ))
Пример #3
0
 def __init__(self, ident, demand, net, **kwargs):
         self._init_objman(  ident,parent = demand,# = demand
                             name = 'Turnflow Demand',
                             info = 'Contains flows and turn probailities for different modes and time intervals. Here demand data is ordered by time intervals.',
                             xmltag = ('turnflows','interval',None), **kwargs)
         
         
         
         self.add_col(am.ArrayConf(  'times_start', 0,
                                 groupnames = ['state'], 
                                 perm='rw', 
                                 name = 'Start time', 
                                 unit = 's',
                                 info = 'Start time of interval in seconds (no fractional seconds).',
                                 xmltag = 't_start',
                                 ))
         
         self.add_col(am.ArrayConf('times_end', 3600,
                                 groupnames = ['state'], 
                                 perm='rw', 
                                 name = 'End time', 
                                 unit = 's',
                                 info = 'End time of interval in seconds (no fractional seconds).',
                                 xmltag = 't_end',
                                 ))
                                 
         self.add_col(cm.ObjsConf( 'turnflowmodes', 
                                 groupnames = ['state'], 
                                 is_save = True,
                                 name = 'Turnflows by modes', 
                                 info = 'Turnflow transport demand for all transport modes within the respective time interval.',
                                 )) 
Пример #4
0
    def __init__(self, ident, population, lanes, name='Activities'):
        self.init_stagetype(ident,
                            population,
                            name=name,
                            info='Do some activity  at a position of a lane.')

        # TODO: this structure needs review: the private vehicle is part of a person, not a stage
        # street parking at home and work could be in stage. Private garage is
        # part of person...
        self.add_col(
            am.IdsArrayConf(
                'id_lane',
                lanes,
                groupnames=['state'],
                name='ID lane',
                info='Lane ID at which activity takes place.',
            ))
        self.add_col(
            am.ArrayConf(
                'pos_lane',
                0.0,
                name='Lane pos.',
                unit='m',
                info='Position on Lane on where activity takes place.',
                xml='pos_start',
            ))

        self.add_col(
            am.ArrayConf(
                'activity',
                '',
                dtype=np.object,
                name='Activity',
                info='Type of activity performed during the stop.',
            ))
Пример #5
0
    def _init_attributes(self, edges=None):
        if edges is None:
            # recover edges from already initialized
            edges = self.ids_fromedge.get_linktab()

        if self.get_version() < 0.1:
            # update attrs from previous
            # IdsArrayConf not yet modifiable interactively, despite perm = 'rw',!!!
            self.ids_fromedge.set_perm('rw')
            self.ids_toedge.set_perm('rw')
        if hasattr(self, 'func_delete_row'):
            self.func_make_row._is_returnval = False
            self.func_delete_row._is_returnval = False

        self.add_col(am.IdsArrayConf('ids_fromedge', edges,
                                     groupnames=['state'],
                                     name='Edge ID from',
                                     info='Edge ID where turn starts.',
                                     xmltag='fromEdge',
                                     ))

        self.add_col(am.IdsArrayConf('ids_toedge', edges,
                                     groupnames=['state'],
                                     name='Edge ID to',
                                     info='Edge ID where turn ends.',
                                     xmltag='toEdge',
                                     ))

        self.add_col(am.ArrayConf('flows', 0,
                                  dtype=np.int32,
                                  groupnames=['state'],
                                  perm='rw',
                                  name='Flow',
                                  info='Absolute number of vehicles which pass from "fromedge" to "toedge" during a certain time interval.',
                                  xmltag='number',
                                  ))

        self.add_col(am.ArrayConf('probabilities', 0.0,
                                  dtype=np.float32,
                                  groupnames=['state'],
                                  perm='rw',
                                  name='Probab.',
                                  info='Probability to make a turn between "Edge ID from" and "Edge ID to" and .',
                                  xmltag='probability',
                                  ))

        self.add(cm.FuncConf('func_make_row', 'on_add_row', None,
                             groupnames=['rowfunctions', '_private'],
                             name='New turns',
                             info='Add a new turnflow.',
                             is_returnval=False,
                             ))

        self.add(cm.FuncConf('func_delete_row', 'on_del_row', None,
                             groupnames=['rowfunctions', '_private'],
                             name='Del turns',
                             info='Delete turns.',
                             is_returnval=False,
                             ))
    def __init__(self, parent, modes, zones, **kwargs):
        self._init_objman(ident='odflowtab', parent=parent,
                          name='OD flows',
                          info='Table with intervals, modes, OD and respective number of trips.',
                          #xmltag = ('odtrips','odtrip',None),
                          **kwargs)

        self.add_col(am.ArrayConf('times_start', 0,
                                  groupnames=['state'],
                                  perm='rw',
                                  name='Start time',
                                  unit='s',
                                  info='Start time of interval in seconds (no fractional seconds).',
                                  xmltag='t_start',
                                  ))

        self.add_col(am.ArrayConf('times_end', 3600,
                                  groupnames=['state'],
                                  perm='rw',
                                  name='End time',
                                  unit='s',
                                  info='End time of interval in seconds (no fractional seconds).',
                                  xmltag='t_end',
                                  ))

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

        self.add_col(am.IdsArrayConf('ids_orig', zones,
                                     groupnames=['state'],
                                     name='Orig.',
                                     choices=zones.ids_sumo.get_indexmap(),
                                     info='traffic assignment zone of origin of trip.',
                                     xmltag='id_orig',
                                     ))

        self.add_col(am.IdsArrayConf('ids_dest', zones,
                                     groupnames=['state'],
                                     name='Dest.',
                                     choices=zones.ids_sumo.get_indexmap(),
                                     info='ID of traffic assignment zone of destination of trip.',
                                     xmltag='id_dest',
                                     ))

        self.add_col(am.ArrayConf('tripnumbers', 0,
                                  groupnames=['state'],
                                  perm='rw',
                                  name='Trips',
                                  info='Number of trips from zone with ID Orig to zone with ID Dest.',
                                  xmltag='tripnumber',
                                  ))
Пример #7
0
    def _init_attributes(self):
        """
        Detector;Time;qPKW;qLKW;vPKW;vLKW
        myDet1;0;10;2;100;80
        ... further entries ...

        This means the first time has to name the entries (columns). Their order is not of importance, but at least the following columns must be included:

            Detector: A string holding the id of the detector this line describes; should be one of the ids used in <DETECTOR_FILE>
            Time: The time period begin that this entry describes (in minutes)
            qPKW: The number of passenger cars that drove over the detector within this time period
            vPKW: The average speed of passenger cars that drove over the detector within this time period in km/h

        The following columns may optionally be included:

            qLKW: The number of transport vehicles that drove over the detector within this time period
            vLKW: The average speed of transport vehicles that drove over the detector within this time period in km/h
        """

        self.add_col(am.IdsArrayConf('ids_detector', self.parent.detectors,
                                     name='ID Detector',
                                     info='Detector ID which measured this flow.',
                                     ))

        self.add_col(am.ArrayConf('timeperiods', 0.0,
                                  perm='rw',
                                  name='Time period',
                                  unit='s',
                                  info='Time period of flow measurement.',
                                  ))
        self.add_col(am.ArrayConf('flows_passenger', 0.0,
                                  perm='rw',
                                  name='Passenger car flow',
                                  info='Number of passenger cars detected during the corrisponding time period.',
                                  ))

        self.add_col(am.ArrayConf('flows_heavyduty', 0.0,
                                  perm='rw',
                                  name='Heavy duty vehicle flow',
                                  info='Number of heavy duty vehicles detected during the corrisponding time period.',
                                  ))

        self.add_col(am.ArrayConf('speeds_passenger', 0.0,
                                  perm='rw',
                                  name='Passenger car speed',
                                  unit='m/s',
                                  info='Average velocity of passenger cars, detected during the corrisponding time period.',
                                  ))

        self.add_col(am.ArrayConf('speeds_heavyduty', 0.0,
                                  perm='rw',
                                  name='Heavy duty vehicle speed',
                                  unit='m/s',
                                  info='Average velocity of heavy duty vehicles, detected during the corrisponding time period.',
                                  ))
Пример #8
0
    def __init__(self, polulation, **kwargs):
        """Plans database."""
        self._init_objman(
            ident='plans',
            parent=polulation,
            name='Plans',
            info='Mobility plan for virtual polulation.',
            #xmltag = ('plans','plan',None),
            **kwargs)

        self.add_col(
            am.IdsArrayConf(
                'ids_person',
                polulation,
                groupnames=['state'],
                name='Person ID',
                info='Person ID to who this plan belongs to.',
            ))

        self.add_col(
            am.ArrayConf(
                'probabilities',
                1.0,
                name='Probability',
                info='Plan execution probability.',
            ))

        self.add_col(
            am.ArrayConf(
                'times_est',
                0.0,
                name='Estim. time',
                info='Estimated time to execute plan.',
                unit='s',
            ))

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

        self.add_col(
            am.TabIdListArrayConf(
                'stagelists',
                name='Stages',
                info='Sequence of stages of this plan.',
            ))
Пример #9
0
    def __init__(self, ident, population, edges, name='Walks', info='walk from a position on a lane to another position of another lane.'):
        self.init_stagetype(ident, population, name=name, info=info)

        # TODO: this structure needs review: the private vehicle is part of a person, not a stage
        # street parking at home and work could be in stage. Private garage is
        # part of person...
        self.add_col(am.IdsArrayConf('ids_edge_from', edges,
                                     groupnames=['state'],
                                     name='ID Dep. edge',
                                     info='Edge ID at departure of walk.',
                                     ))

        self.add_col(am.IdsArrayConf('ids_edge_to', edges,
                                     groupnames=['state'],
                                     name='ID Arr. edge',
                                     info='Edge ID where walk finishes.',
                                     ))

        self.add_col(am.ArrayConf('positions_from', 0.0,
                                  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_ARRIVAL),
                                  ))

        self.add_col(am.ArrayConf('positions_to', 0.0,
                                  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', 0.8,
                                  dtype=np.float32,
                                  #choices = OPTIONMAP_SPEED_ARRIVAL,
                                  perm='r',
                                  name='Walk speed',
                                  unit='m/s',
                                  info='Average walking speed.',
                                  xmltag='speed',
                                  #xmlmap = get_inversemap(OPTIONMAP_SPEED_ARRIVAL),
                                  ))
Пример #10
0
    def _init_attributes(self):
        # print 'maps._init_attributes'

        # self.add(cm.AttrConf(  'width_tile',500,
        #                    groupnames = ['state'],
        #                    perm='r',
        #                    name = 'Tile width',
        #                    unit = 'm',
        #                    info = 'Tile width in meter of quadratic tile. This is the real wdith of one tile that will be downloaded.',
        #                    ))

        # self.add(cm.AttrConf(  'size_tile',1280,
        #                    groupnames = ['state'],
        #                    perm='r',
        #                    name = 'Tile size',
        #                    info = 'Tile size in pixel. This is the size of one tile that will be downloaded.',
        #                    ))

        if self.has_attrname('width_tile'):
            # no longer attributes
            self.delete('width_tile')
            self.delete('size_tile')
            # put r/w permissione to older version
            # self.get_config('width_tile').set_perm('rw')
            # self.get_config('size_tile').set_perm('rw')

        self.add_col(
            am.ArrayConf(
                'bboxes',
                np.zeros((2, 2), dtype=np.float32),
                groupnames=['state'],
                perm='r',
                name='BBox',
                unit='m',
                info=
                'Bounding box of map in network coordinate system (lower left coord, upper right coord).',
                is_plugin=True,
            ))

        self.add_col(
            am.ArrayConf(
                'filenames',
                None,
                dtype=np.object,
                groupnames=['state'],
                perm='rw',
                metatype='filepath',
                name='File',
                info='Image file name.',
            ))
Пример #11
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.',
                                  ))
Пример #12
0
    def __init__(self,ident, parent, edges, **kwargs):
            self._init_objman(  ident, parent=parent, 
                                name = 'Truns',
                                info = 'The table contains turn probabilities between two edges during a given time interval.',
                                xmltag = ('odtrips','odtrip',None), **kwargs)
            
            self.add_col(am.IdsArrayConf( 'ids_fromedge', edges, 
                                    groupnames = ['state'], 
                                    name = 'Edge ID from',
                                    info = 'Edge ID where turn starts.',
                                    xmltag = 'fromEdge',
                                    ))

            self.add_col(am.IdsArrayConf( 'ids_toedge', edges, 
                                    groupnames = ['state'], 
                                    name = 'Edge ID to',
                                    info = 'Edge ID where turn ends.',
                                    xmltag = 'toEdge',
                                    ))
                                    
            self.add_col(am.ArrayConf( 'probabilities', 0.0,
                                    groupnames = ['state'], 
                                    perm = 'rw', 
                                    name = 'Probab.', 
                                    info = 'Probability to make a turn from start edge to end edge.',
                                    xmltag = 'number',
                                    ))
Пример #13
0
    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.",
                                         ))
Пример #14
0
    def __init__(self, ident, parent, modes, **kwargs):

        self._init_objman(ident, parent=parent, name='Mode shares',
                          version=0.0,
                          **kwargs)

        self.add_col(am.IdsArrayConf('ids_mode', modes,
                                     groupnames=['parameters'],
                                     name='Mode ID',
                                     info='Transport Mode ID.',
                                     ))

        self.add_col(am.ArrayConf('shares', '',
                                  dtype=np.float32,
                                  is_index=True,
                                  groupnames=['parameters'],
                                  perm='rw',
                                  name='Share',
                                  info='Mode share.',
                                  ))

        # self.add_col(am.ArrayConf( 'speeds_max', 50.0/3.6,
        #                            dtype = np.float32,
        #                            groupnames = ['parameters'],
        #                            perm='rw',
        #                            name = 'Max. Speed',
        #                            unit = 'm/s',
        #                            info = 'Maximum possible speed for this mode. Speed is used to estimate free flow link travel times, mainly for routig purposes. Note that speeds are usully limited by the lane speed attribute',
        #                            ))
        self._init_attributes()
        self.add_default()
    def __init__(self, ident, parent, zones, **kwargs):
        self._init_objman(ident, parent=parent,
                          name='OD trips',
                          info='Contains the number of trips between an origin and a destination zone.',
                          xmltag=('odtrips', 'odtrip', None), **kwargs)

        self.add_col(am.IdsArrayConf('ids_orig', zones,
                                     groupnames=['state'],
                                     name='Orig.',
                                     choices=zones.ids_sumo.get_indexmap(),
                                     info='traffic assignment zone of origin of trip.',
                                     xmltag='id_orig',
                                     ))

        self.add_col(am.IdsArrayConf('ids_dest', zones,
                                     groupnames=['state'],
                                     name='Dest.',
                                     choices=zones.ids_sumo.get_indexmap(),
                                     info='ID of traffic assignment zone of destination of trip.',
                                     xmltag='id_dest',
                                     ))

        self.add_col(am.ArrayConf('tripnumbers', 0,
                                  groupnames=['state'],
                                  perm='rw',
                                  name='Trips',
                                  info='Number of trips from zone with ID Orig to zone with ID Dest.',
                                  xmltag='tripnumber',
                                  ))

        self.add(cm.ObjConf(zones, is_child=False, groups=['_private']))
Пример #16
0
    def add_field(self, field):
        """
        Configures field array and returns fieldname
        """
        # print 'add_field',field,'len=',len(field)
        attrname, ftype, flen, fdigit = field
        attrname = attrname.strip()

        dtype = 'object'
        digits_fraction = None

        if ftype == 'C':
            dtype = 'object'
            default = ''

        elif ftype == 'N':
            if fdigit > 0:
                digits_fraction = fdigit
                dtype = 'float32'
                default = 0.0
            else:
                dtype = 'int32'
                default = 0

        self.add_col(am.ArrayConf(attrname, default,
                                  dtype=dtype,
                                  groupnames=['shapeattrs'],
                                  perm='rw',
                                  name=attrname,
                                  field=field,
                                  info='Shape attribute: '+attrname,
                                  ))
        return attrname
Пример #17
0
    def __init__(self, ident, parent, edges, **kwargs):
        self._init_objman(
            ident,
            parent=parent,
            name='Flows',
            info=
            'Contains the number of vehicles which start on the given edge during a certain time interval.',
            xmltag=('flows', 'flow', None),
            **kwargs)

        self.add_col(
            am.IdsArrayConf(
                'ids_edge',
                edges,
                groupnames=['state'],
                name='Edge ID',
                info='Edge ID of flow.',
                xmltag='from',
            ))

        self.add_col(
            am.ArrayConf(
                'flows',
                0,
                groupnames=['state'],
                perm='rw',
                name='Flow',
                info=
                'Absolute number of vehicles which start on the given edge during a certain time interval.',
                xmltag='number',
            ))
Пример #18
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',
                                  ))
    def __init__(self, odintervals):
        # print 'AddOdWizzard',odintervals#,odintervals.times_start
        # print ' dir(odintervals)',dir(odintervals)
        zones = odintervals.get_zones()

        self._init_objman('odm_adder', parent=odintervals,
                          name='ODM Wizzard',
                          info='Wizzard to add origin zone to destination zone demand informations.',
                          )

        self.add_odoptions_common(odintervals.parent.get_scenario().net.modes, odintervals.parent.activitytypes)

        self.add_col(am.ArrayConf('names_orig', '',
                                  dtype='object',
                                  groupnames=['state'],
                                  choices=list(zones.ids_sumo.get_value()),
                                  name='Orig zone',
                                  info='Name of traffic assignment zone of origin of trip.',
                                  ))

        self.add_col(am.ArrayConf('names_dest', '',
                                  dtype='object',
                                  groupnames=['state'],
                                  choices=list(zones.ids_sumo.get_value()),
                                  name='Dest zone',
                                  info='Name of traffic assignment zone of destination of trip.',
                                  ))

        self.add_col(am.ArrayConf('tripnumbers', 0,
                                  groupnames=['state'],
                                  perm='rw',
                                  name='Trips',
                                  info='Number of trips from zone of origin to zone of destination.',
                                  xmltag='tripnumber',
                                  ))

        self.add(cm.FuncConf('func_make_row', 'on_add_row', None,
                             groupnames=['rowfunctions', '_private'],
                             name='New OD flow.',
                             info='Add a new OD flow.',
                             ))

        self.add(cm.FuncConf('func_delete_row', 'on_del_row', None,
                             groupnames=['rowfunctions', '_private'],
                             name='Del OD flow',
                             info='Delete OD flow.',
                             ))
    def _init_attributes(self, edges=None):
        if edges is None:
            # recover edges from already initialized
            edges = self.ids_edge.get_linktab()

        if self.get_version() < 0.1:
            # update attrs from previous
            # IdsArrayConf not yet modifiable interactively, despite perm = 'rw',!!!
            self.ids_edge.set_perm('rw')
        if hasattr(self, 'func_delete_row'):
            self.func_make_row._is_returnval = False
            self.func_delete_row._is_returnval = False

        self.add_col(
            am.IdsArrayConf(
                'ids_edge',
                edges,
                groupnames=['state'],
                name='Edge ID',
                perm='rw',
                info='Edge ID of flow.',
                xmltag='from',
            ))

        self.add_col(
            am.ArrayConf(
                'flows',
                0,
                dtype=np.int32,
                groupnames=['state'],
                perm='rw',
                name='Flow',
                info=
                'Absolute number of vehicles which start on the given edge during a certain time interval.',
                xmltag='number',
            ))

        self.add(
            cm.FuncConf(
                'func_make_row',
                'on_add_row',
                None,
                groupnames=['rowfunctions', '_private'],
                name='New flow.',
                info='Add a new flow.',
                is_returnval=False,
            ))

        self.add(
            cm.FuncConf(
                'func_delete_row',
                'on_del_row',
                None,
                groupnames=['rowfunctions', '_private'],
                name='Del flow',
                info='Delete flow.',
                is_returnval=False,
            ))
Пример #21
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.',
            ))
Пример #22
0
    def add_resultattr(self, attrname, **kwargs):

        # default cannot be kwarg
        default = kwargs['default']
        del kwargs['default']
        if kwargs.has_key('groupnames'):
            kwargs['groupnames'].append('results')
        else:
            kwargs['groupnames'] = ['results']

        self.add_col(am.ArrayConf(attrname, default, **kwargs))
Пример #23
0
    def init_stagetype(self, ident, polulation, name='', info="Stage of Plan"):

        self._init_objman(
            ident=ident,
            parent=polulation,
            name=name,
            info=info,
        )

        self.add_col(
            am.IdsArrayConf(
                'ids_plan',
                polulation.get_plans(),
                groupnames=['state'],
                name='ID plan',
                info='ID of plan.',
                xmltag='type',
            ))

        self.add_col(
            am.ArrayConf(
                'times_start',
                -1.0,
                name='Start time',
                unit='s',
                info=
                'Planned or estimated time when this stage starts. Value -1 means unknown.',
            ))

        self.add_col(
            am.ArrayConf(
                'durations',
                -1.0,
                name='Duration',
                unit='s',
                info=
                'Planned or estimated Duration for this stage starts. Value -1 means unknown.',
            ))
Пример #24
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.',
                                  ))
Пример #25
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)
Пример #26
0
    def _init_attributes(self):
        net = self.parent
        self.add_col(am.ArrayConf('stopnames', default='',
                                  dtype='object',
                                  perm='rw',
                                  name='Short name',
                                  symbol='Short N.',
                                  is_index=True,
                                  info='This is a unique name or number of the stop or station.',
                                  xmltag='id',
                                  ))

        self.add_col(am.ArrayConf('stopnames_human', default='',
                                  dtype=np.object,
                                  perm='rw',
                                  name='Long name',
                                  symbol='Long N.',
                                  info='This is a human readable name of the stop or station.',
                                  xmltag='name',
                                  ))

        self.add_col(am.IdsArrayConf('ids_lane', net.lanes,
                                     name='ID Lane',
                                     info='ID of lane for this parking position. ',
                                     xmltag='lane',
                                     ))

        self.add_col(am.ArrayConf('positions_from', 0.0,
                                  perm='r',
                                  name='Start pos',
                                  unit='m',
                                  xmltag='startPos',
                                  info='Position on lane where stop starts.',
                                  ))

        self.add_col(am.ArrayConf('positions_to', 0.0,
                                  perm='r',
                                  name='End pos',
                                  unit='m',
                                  xmltag='endPos',
                                  info='Position on lane where stop ends.',
                                  ))

        self.add_col(am.ArrayConf('is_rightside', True,
                                  dtype=np.bool,
                                  perm='rw',
                                  name='Right side?',
                                  info='If true, stop is on the right side of the lane.',
                                  ))

        self.add_col(am.ArrayConf('widths', 1.5,
                                  perm='rw',
                                  name='Width',
                                  unit='m',
                                  info='Width of stop.',
                                  ))

        self.add_col(am.ArrayConf('centroids', np.array([0.0, 0.0, 0.0], dtype=np.float32),
                                  dtype=np.float32,
                                  perm='r',
                                  name='Centroid',
                                  unit='m',
                                  info='Central coordinates of this stop.',
                                  ))

        self.add_col(am.ArrayConf('are_friendly_pos', False,
                                  dtype=np.bool,
                                  perm='rw',
                                  name='Is friendly pos.',
                                  symbol='friendly pos.',
                                  xmltag='friendlyPos',
                                  info='If True, invalid stop positions will be corrected automatically.',
                                  ))
Пример #27
0
    def __init__(self,
                 ident='odintervals',
                 parent=None,
                 net=None,
                 zones=None,
                 **kwargs):
        self._init_objman(
            ident,
            parent=parent,  # = demand
            name='OD Demand',
            info=
            'Contains origin-to-destination zone transport demand for different time intervals.',
            xmltag=('odintervals', 'odinteval', None),
            **kwargs)

        self.add_col(
            am.ArrayConf(
                'times_start',
                0,
                groupnames=['state'],
                perm='rw',
                name='Start time',
                unit='s',
                info=
                'Start time of interval in seconds (no fractional seconds).',
                xmltag='t_start',
            ))

        self.add_col(
            am.ArrayConf(
                'times_end',
                3600,
                groupnames=['state'],
                perm='rw',
                name='End time',
                unit='s',
                info='End time of interval in seconds (no fractional seconds).',
                xmltag='t_end',
            ))

        activitytypes = self.parent.activitytypes
        self.add_col(
            am.IdsArrayConf(
                'ids_activitytype_orig',
                activitytypes,
                groupnames=['parameters'],
                perm='rw',
                #choices = activitytypes.names.get_indexmap(),
                name='Activity type at orig.',
                symbol='Act. orig.',
                info='Type of activity performed at origin, before the trip.',
                #xmltag = 'actType',
                #xmlmap = get_inversemap( activitytypes.names.get_indexmap()),
            ))

        self.add_col(
            am.IdsArrayConf(
                'ids_activitytype_dest',
                activitytypes,
                groupnames=['parameters'],
                perm='rw',
                #choices = activitytypes.names.get_indexmap(),
                name='Activity type at dest.',
                symbol='Act. dest.',
                info=
                'Type of activity performed at destination, after the trip.',
                #xmltag = 'actType',
                #xmlmap = get_inversemap( activitytypes.names.get_indexmap()),
            ))

        self.add_col(
            cm.ObjsConf(
                'odmodes',
                groupnames=['state'],
                is_save=True,
                name='OD modes',
                info=
                'OD transport demand for all transport modes within the respective time interval.',
            ))
        self.add(cm.ObjConf(net, is_child=False, groups=['_private']))
        self.add(cm.ObjConf(zones, is_child=False, groups=['_private']))
Пример #28
0
    def _init_attributes(self, zones=None):
        # print '_init_attributes',self.ident
        if not self.has_attrname('zones'):
            self.add(cm.ObjConf(zones, is_child=False, groups=['_private']))
        else:
            # zones is already an attribute
            zones = self.zones.get_value()

        if self.get_version() < 0.1:
            # update attrs from previous
            # IdsArrayConf not yet modifiable interactively, despite perm = 'rw',!!!
            self.ids_orig.set_perm('rw')
            self.ids_dest.set_perm('rw')

        if hasattr(self, 'func_delete_row'):
            self.func_make_row._is_returnval = False
            self.func_delete_row._is_returnval = False

        self.add_col(
            am.IdsArrayConf(
                'ids_orig',
                zones,
                groupnames=['state'],
                perm='rw',
                name='Orig.',
                #choices =  zones.ids_sumo.get_indexmap(),
                info='traffic assignment zone of origin of trip.',
                xmltag='id_orig',
            ))

        self.add_col(
            am.IdsArrayConf(
                'ids_dest',
                zones,
                groupnames=['state'],
                perm='rw',
                name='Dest.',
                #choices =  zones.ids_sumo.get_indexmap(),
                info='ID of traffic assignment zone of destination of trip.',
                xmltag='id_dest',
            ))

        self.add_col(
            am.ArrayConf(
                'tripnumbers',
                0,
                groupnames=['state'],
                perm='rw',
                name='Trips',
                info=
                'Number of trips from zone with ID Orig to zone with ID Dest.',
                xmltag='tripnumber',
            ))

        # print '  pre add func_make_row'
        self.add(
            cm.FuncConf(
                'func_make_row',
                'on_add_row',
                None,
                groupnames=['rowfunctions', '_private'],
                name='New OD flow.',
                info='Add a new OD flow.',
                is_returnval=False,
            ))
        # print '  post add func_make_row'
        self.add(
            cm.FuncConf(
                'func_delete_row',
                'on_del_row',
                None,
                groupnames=['rowfunctions', '_private'],
                name='Del OD flow',
                info='Delete OD flow.',
                is_returnval=False,
            ))
Пример #29
0
    def __init__(self, odintervals):
        # print 'AddOdWizzard',odintervals#,odintervals.times_start
        # print ' ',dir(odintervals)
        zones = odintervals.get_zones()

        self._init_objman('odm_adder', parent=odintervals,
                          name='ODM Wizzard',
                          info='Wizzard to add origin zone to destination zone demand informations.',
                          )

        self.add(am.AttrConf('t_start', 0,
                             groupnames=['state'],
                             perm='rw',
                             name='Start time',
                             unit='s',
                             info='Start time of interval',
                             ))

        self.add(am.AttrConf('t_end', 3600,
                             groupnames=['state'],
                             perm='rw',
                             name='End time',
                             unit='s',
                             info='End time of interval',
                             ))

        # here we ged classes not vehicle type
        # specific vehicle type within a class will be generated later
        self.add(am.AttrConf('id_mode',   MODES['passenger'],
                             groupnames=['state'],
                             choices=odintervals.parent.vtypes.get_modechoices(),
                             name='ID mode',
                             info='ID of transport mode.',
                             ))

        self.add(cm.AttrConf('scale', 1.0,
                             groupnames=['options'],
                             perm='rw',
                             name='Scale',
                             info='Scale demand by this factor before adding. Value od 1.0 means no scaling.'
                             ))

        self.add_col(am.ArrayConf('names_orig', '',
                                  dtype='object',
                                  groupnames=['state'],
                                  choices=list(zones.ids_sumo.get_value()),
                                  name='Orig zone',
                                  info='Name of traffic assignment zone of origin of trip.',
                                  ))

        self.add_col(am.ArrayConf('names_dest', '',
                                  dtype='object',
                                  groupnames=['state'],
                                  choices=list(zones.ids_sumo.get_value()),
                                  name='Dest zone',
                                  info='Name of traffic assignment zone of destination of trip.',
                                  ))

        self.add_col(am.ArrayConf('tripnumbers', 0,
                                  groupnames=['state'],
                                  perm='rw',
                                  name='Trips',
                                  info='Number of trips from zone with ID Orig to zone with ID Dest.',
                                  xmltag='tripnumber',
                                  ))

        self.add(cm.FuncConf('func_make_row', 'on_add_row', None,
                             groupnames=['rowfunctions', '_private'],
                             name='New row',
                             info='Add a new row.',
                             ))

        self.add(cm.FuncConf('func_delete_row', 'on_del_row', None,
                             groupnames=['rowfunctions', '_private'],
                             name='Del row',
                             info='Delete a row.',
                             ))
Пример #30
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')