コード例 #1
0
 def __init__(self, vid, length, width, height, weight, cat, axles, doublemount, studs, fuel, cc, maxspeed, maxdecel, maxaccel,
                    position = Point(0.0,0.0,0.0), direction = Direction(0.0,0.0), speed = 0.0, acceleration = 0.0):
   object.__init__(self)
   # unique vehicle ID
   self._vid          = vid
   # size properties
   self._length       = length       # in m
   self._width        = width        # in m
   self._height       = height       # in m
   self._weight       = weight       # in kg
   # emission related properties
   self._cat          = cat          # emission category (usually an integer), to be interpreted by the emission models
   self._axles        = axles        # integer, number of axles of vehicle
   self._doublemount  = doublemount  # boolean, true for double-mounted tires (for trucks)
   self._studs        = studs        # boolean, true if the vehicle has winter tires
   self._fuel         = fuel         # the type of fuel the vehicle uses (string, e.g. 'petrol', 'diesel', 'electric')
   self._cc           = cc           # the cilinder capacity (cc)
   # kinematic properties
   self._maxspeed     = maxspeed     # in km/h
   self._maxdecel     = maxdecel     # in m/s^2 (negative value)
   self._maxaccel     = maxaccel     # in m/s^2
   # dynamic properties
   self._position     = position     # position Point(x,y,z) - center of bottom plane - in m
   self._direction    = direction    # Direction(bearing,gradient) of the vehicle, in degrees (0-360)
   self._speed        = speed        # velocity (km/h)
   self._acceleration = acceleration # acceleration (m/s^2)
コード例 #2
0
 def clear(self):
     """ clear the simulation """
     self._t = 0.0
     self._passbys = []  # list with vehicle passbys (at the origin)
     self._passbytimes = {1: [], 3: []}
     self._history = []  # history of vehicles at each timestep
     self._factory = VehicleFactory(fleet=self._fleet,
                                    position=Point(self._xmin, 0.0, 0.0),
                                    direction=Direction(bearing=0.0),
                                    speed=self._vlimit,
                                    acceleration=0.0)
コード例 #3
0
 def createVehicle(self, tokens):
   """ create a Vehicle object based on the supplied logger line tokens """
   # fetch vehicle parameters
   vID = int(tokens[0])
   vLength = float(tokens[1])
   vPosition = Point(float(tokens[2]), float(tokens[3]))
   vDirection = Direction(bearing = float(tokens[4]))
   vSpeed = float(tokens[5])
   vAcceleration = float(tokens[6])
   # simple check between light and heavy vehicles
   vClass = {False: LightVehicle, True: HeavyVehicle}[(vLength>10.0)]
   return vClass(vid = vID, position = vPosition, direction = vDirection, speed = vSpeed, acceleration = vAcceleration)
コード例 #4
0
ファイル: propagation.py プロジェクト: kfilipan/noysim
        ix = [0, nx / 4, nx / 2, 3 * (nx / 4)]
        iy = [0, ny / 4, ny / 2, 3 * (ny / 4)]
        pylab.xticks(ix, [('%.1f' % self.recx[i]) for i in ix])
        pylab.yticks(iy, [('%.1f' % self.recy[i]) for i in iy])


#---------------------------------------------------------------------------------------------------
# Test code
#---------------------------------------------------------------------------------------------------

if __name__ == '__main__':

    # test of propagation model
    if 1:
        vehicle = QLDCar(position=Point(0.0, 0.0, 0.0),
                         direction=Direction(0.0, 0.0),
                         speed=70.0,
                         acceleration=0.0)
        emodel = ImagineModel()
        sources = emodel.sources(vehicle=vehicle)
        receiver = Receiver(position=Point(0.0, 10.0, 0.0))
        environment = ISO9613Environment(G=(0.0, 0.0, 0.0))
        pmodel = ISO9613Model(environment=environment)
        # switching corrections on/off
        pmodel.correction['geometricDivergence'] = True
        pmodel.correction['atmosphericAbsorption'] = True
        pmodel.correction['groundEffect'] = True
        pmodel.correction['sourceDirectivity'] = True
        # plotting both spectra at source and receiver
        pylab.figure()
        ncols = len(sources)
コード例 #5
0
 def __init__(self, vid = 0, length = 1.5, width = 0.5, height = 1.5, weight = 200.0,
                    cat = 5, axles = 2, doublemount = False, studs = False, fuel = 'petrol', cc = 1000,
                    maxspeed = 110.0, maxdecel = -6.0, maxaccel = 4.0,
                    position = Point(0.0,0.0,0.0), direction = Direction(0.0,0.0), speed = 0.0, acceleration = 0.0):
   Vehicle.__init__(self, vid, length, width, height, weight, cat, axles, doublemount, studs, fuel, cc,
                    maxspeed, maxdecel, maxaccel, position, direction, speed, acceleration)
コード例 #6
0
 def __init__(self, vid = 0, length = 25.0, width = 2.5, height = 3.5, weight = 30000.0,
                    cat = 3, axles = 4, doublemount = True, studs = False, fuel = 'petrol', cc = 8000,
                    maxspeed = 110.0, maxdecel = -2.75, maxaccel = 0.8,
                    position = Point(0.0,0.0,0.0), direction = Direction(0.0,0.0), speed = 0.0, acceleration = 0.0):
   Vehicle.__init__(self, vid, length, width, height, weight, cat, axles, doublemount, studs, fuel, cc,
                    maxspeed, maxdecel, maxaccel, position, direction, speed, acceleration)