示例#1
0
def density_obstr(steps,
                  obstr):  # returns a traffic flow density at convergence zone
    # obstr - [[a, b]]
    q_c = 0
    for t in range(1200):
        for j in steps[t]:
            if mymodel.car_q(j[2]):
                if mymodel.what_zone(j[1], 0, obstr) == 'obstr-zone':
                    q_c += 1
    return q_c / 1200
示例#2
0
def density_conv(steps,
                 conv):  # returns a traffic flow density at convergence zone
    # conv - [[a, b]]
    q_c = 0
    for t in range(1200):
        for j in steps[t]:
            if mymodel.car_q(j[2]):
                if mymodel.what_zone(j[1], conv) == 'conv-zone':
                    q_c += 1
    return q_c / 1200
示例#3
0
def average_v_global(
        steps):  # returns an average speed of cars at the all road
    s_v = 0
    q_c = 0
    for t in range(1200):
        for j in steps[t]:
            if mymodel.car_q(j[2]):
                s_v += j[2]
                q_c += 1
    return s_v / q_c
示例#4
0
def average_v_obstr(
        steps,
        obstr):  # returns an average speed of cars at the convergence zone
    # obstr - [[a, b]]
    s_v = 0
    q_c = 0
    for t in range(1200):
        for j in steps[t]:
            if mymodel.car_q(j[2]):
                if mymodel.what_zone(j[1], 0, obstr) == 'obstr-zone':
                    q_c += 1
                    s_v += j[2]
    return s_v / q_c