速度降低速度会降低吗?

图片

不久前,开始讨论以超速10公里/小时的速度罚款。 传统上,它们是针对Internet进行的破坏性操作,因此,我通常不支持此类手段的任何方面。

大众汽车拥护者的论点简化为“我需要”,这当然是不一样的。 每天被迫开车50公里穿过公共交通不覆盖的地点的工作人员中,有相当一部分不低于驾车前往“面包房”的人的比例,这可以从早上一开始就留在这些机器上清楚地看出小雪。

都市主义者经常听到一些单方面的论点,一些欧洲国家的私人典范,这些国家的人口有时可以与莫斯科的日常交通量相提并论。

当发生这种情况时,没有什么比放下其他人的情感并拜访两个公正的助手-Matan和Python更好的了。

车主地位的弱点-他们没有提出解决问题的方法(我认为解决方案是取消大城市和发达地区中每块免费土地的自发开发,这样人们就不必处​​理劳动力迁移到其祖国首都的问题,但是我是谁例如提供这类东西?)。 都市主义者总是有一套由数据支持的论点和交钥匙解决方案。 但是有时这些是对严肃制度的研究,有时如果没有适当的定量分配,统计数字就不太容易理解。 在大多数情况下,这些数据推动了城市速度普遍下降的想法。 她最赞成的论点是:
“无论如何,由于交通信号灯,您不能一直以最大速度行驶,您的平均速度将低于允许的速度,那么为什么不降低稍微允许的速度呢?”

“嗯,”我一直想起这种说法。 如果降低允许的最大值,则平均值也会略有下降。 这证明了什么–可以再次减少? 这什么类型的失语症 ? 您需要检查这是多么真实。

我谨向您介绍另一篇文章,以建设性的方式在评论中提出批评:

-是的,我知道代码的编写很丑陋,但是对我来说更重要的是,它可以正常工作,我自己也不是程序员,因此最好在PM中编写有关代码的注释。
-是的,我知道模拟可能会变得更加困难,更加全面和更加现实。 但是我不会接受这样的指责,即白天的交通密度没有变化,不同的汽车有不同的动力,天气情况, 月相,作者的母亲 ,但明智的言论,算法缺陷的迹象,针对任何未考虑情况的模型修改。 以我的理解,从数学的观点出发,回答一个简单的问题就足够了: 鉴于交通信号灯造成的强烈运动离散性,各个路段的最大允许速度的降低是否会严重影响行驶时间?

我的模型的本质很简单。 由于交通信号灯是现成的程序周期,因此模拟是围绕道路的一部分建立的,交通信号灯的末端和各个阶段均处于该状态。 下一次迭代是路线的下一段,其长度,允许的速度以及终点处的交通信号灯相位。
赛车分为三个运动阶段:匀速加速,以给定路段允许的最大速度运动,同样缓慢。 它们以9个版本实现。

  • 如果汽车以允许的相同速度移动到当前路段,则它会移动而不会发生变化;
  • 如果他走得更慢(或站着)-那么他首先会加速;
  • 没有选项“他移动得更快”,这就是原因:如果下一个段中允许的速度较低,他会降低速度。 这合乎逻辑吗?

更多选项添加到这些选项:

  • 汽车在行驶或减速时行驶,并以红色到达分段的结尾。 这意味着您需要在交通信号灯前停车。 假设它总是以相同的加速度减速,我们推迟了从红绿灯制动所需的路径。 类似于飞机的临界起飞速度,这是临界距离。 现在,如果根据条件汽车从红灯通过,则应该从临界点开始减速至零;
  • 该死的,或者那段路太短,或者那辆车太蔬菜了,以至于没有时间在Skrit发作之前获得最大的速度? 尽管程序他仍然需要在交通信号灯前放慢速度,但程序baganet仍在继续分散? 如果发生这种情况,我们将迫使他不要选择高于Scrit点所达到的速度,然后我们将执行其中一种选择。 结果如下:

    图片

然后,您需要在代码中实现它。 这是我的操作方式,并提供了详细的评论:

印度教模式
import random
import math

#  :
redlight = ("100",
            "10",
            "90",
            "1", #   "-" .       .   1   
            "1") #  1  ,   0.          .      .
#  :
greenlight = ("30",
              "120",
              "30",
              "1",
              "1")
#   :
distance = ("400",
            "400",
            "250",
            "500",
            "500")
#   
velocity = ("60",
            "60",
            "60",
            "60",
            "40")

#-  
r=0
g=0
d=0
v=0


#  :
vcurrent=float(0)
#    :
t=0
#    :
gtime=0
#,      100 /  15 .
#      :
accel=float(100/(3.6*15))
#,      .
#      :
decel = float(accel*2)

#     ,   ( ,    0):
while r<=2:
    red=float(redlight[r])
    grn=float(greenlight[g])
    dis=float(distance[d])
    vel=float(float(velocity[v])/3.6)
    vnext=float(float(velocity[v+1])/3.6)
    #         accel     :
    #saccel = float(((vcurrent*vel-vcurrent)/accel) + ((vel-vcurrent)*((vel-vcurrent)/(2*accel)
    saccel = float((vcurrent*(vel-vcurrent)/accel) + (vel-vcurrent)*(vel-vcurrent)/(2*accel))
    # :     ,           decel:
    scrit = float(dis-(vel/decel) - (vel*vel)/(2*decel))
# ,        .
#         :
    startingred = random.randint(0, (int(grn)-1))
    print ("startingred= ", startingred)
    
    #    ,    __  -      :
    if vcurrent == vel:
        
        #         ,   ,     :
        if vnext>= vcurrent:
            t = int (dis/vel)
            # ,   :
            if (t+startingred)%(red+grn)<=red:
                t = int (scrit/vel + (vel/decel) + red-((t+startingred)%(red+grn))) ### 2
                vcurrent = 0
                print ("        , ")
                
            # ,  :
            else:
                t = int (dis/vel)### 1
                vcurrent = vel
                print ("        , ", " v=", vcurrent)
                
        #       ,  ,   scrit:
        else:
            t = int ((scrit/vel) +
                         (vcurrent - (vnext)/((vcurrent*(vcurrent - (vnext/(dis-scrit))-
                                                           ((vcurrent - vnext)*(vcurrent - vnext)/(2*(dis-scrit))))))))
            #  ,  :
            if (t+startingred)%(red+grn)<=red:
                t = int (scrit/vel +  (vel/decel)+ red-((t+startingred)%(red+grn)))### 2
                vcurrent = 0
                print ("      , ")
                
            #   -   ,    ,    scrit  :
            else:
                t = int (scrit/vel +
                         (vcurrent - vnext)/((vcurrent*(vcurrent - (vnext/(dis-scrit))-
                                                           ((vcurrent - vnext)*(vcurrent - vnext)/(2*(dis-scrit)))))))### 3
                vcurrent = float(vnext/3.6)
                print ("      , ", " v=", vcurrent)

    
    #    ,    __  -        :
    elif vcurrent < vel:
       
        #  ,    scrit:
        vcrit=math.sqrt(2*accel*scrit+vcurrent*vcurrent)
        #        scrit,      scrit,   vcrit  ,   :
        if saccel >= scrit:
            
                   
            #          -      ,  
            if vnext >= vcrit:
                t = int(((vcrit-vcurrent)/ accel) + (dis-scrit)/vcrit)
                # ,  :   
                if (t+startingred)%(red+grn)<=red:
                    t = int(((vcrit-vcurrent)/ accel) + ((dis-scrit)*2/vcrit) + red-((t+startingred)%(red+grn)))### 8
                    vcurrent = 0
                    print ("         ,  , ")
                    
                # ,     :
                else:
                    t = int(((vcrit-vcurrent)/ accel) + (dis-scrit)/vcrit) ### 7
                    vcurrent = vcrit
                    print ("         ,  , ", " v=", vcurrent)
                
            #       -    
            else:
                t = int(((vcrit-vcurrent)/ accel) + (vcrit - vnext)/((vcrit*(vcrit - vnext)/(dis-scrit))-
                                                           ((vcrit - vnext)*(vcrit - vnext)/(2*(dis-scrit)))))
                # ,  :
                if (t+startingred)%(red+grn)<=red:
                    t = int(((vcrit-vcurrent)/ accel) + ((dis-scrit)*2/vcrit) + red-((t+startingred)%(red+grn))    ) ### 8
                    vcurrent = 0
                    print ("       ,  , ")
                
                #  -   ,    ,    scrit  :
                else:
                    t = int(((vcrit-vcurrent)/ accel) + (vcrit - vnext)/((vcrit*(vcrit - vnext)/(dis-scrit))-
                                                           ((vcrit - vnext)*(vcrit - vnext)/(2*(dis-scrit))))) ### 9
                    vcurrent = vnext
                    print ("       ,  , ", " v=", vcurrent)

        #        scrit,   ,    :
        else:
            
            #         ,   ,     :
            if vnext>= vel:
                t = int(((vel- vcurrent)/accel) + (dis-saccel)/vel)
                
                # ,  :
                if (t+startingred)%(red+grn)<=red:
                    t = int (((vel- vcurrent)/accel) + (scrit-saccel)/vel + (vel/decel)+ red-((t+startingred)%(red+grn)))### 5
                    vcurrent = 0
                    print ("         , ")

                # ,  :
                else:
                    t = int (((vel- vcurrent)/accel) + (dis-saccel)/vel)### 4
                    vcurrent = vel
                    print ("         , ", " v=", vcurrent)
            
            else:
                                
                # ,  :
                if (t+startingred)%(red+grn)<=red:
                    t = int (((vel- vcurrent)/accel) + (scrit-saccel)/vel + (vel/decel)+ red-((t+startingred)%(red+grn)))### 5
                    vcurrent = 0
                    print ("       , ")
                
                #  -   ,    ,    scrit  :
                else:
                    print ("scrit ", scrit)
                    print ("vcurrent ", vcurrent)
                    t = int (((vel- vcurrent)/accel) +(scrit-saccel)/vel + (vel - vnext)/((vel*(vel - vnext)/(dis-scrit))-((vel - vnext)*(vel - vnext)/(2*(dis-scrit))))) ### 6
                    vcurrent = vnext
                    print ("       , ", " v=", vcurrent)
    
   
    #    ,    __  -    ,      :
    else:
        print ("ERROR: v current > v next")

    print (t)
    r+=1
    g+=1
    d+=1
    v+=1
    
    gtime+=t

print (gtime)


.

0 100 15 , . , — , .

, , , . , — , . , 3-5 . , , — , . …

, . , . . — .

, . , , , . , : , . — ( ). , , :

t = int (scrit/vel + (vel/decel) + red-((t+startingred)%(red+grn)) <b>+ (red+grn)</b>)

- ? , , , . . , , / .

, , ? .

, . , . , , , , .

image

. , , , , 10000 :

import random
import math
n=0
overalltime=0
while n<=10000:
 
    redlight = ("100",
                "10",
                "90",
                "20",
                "60",
                "20",
                "20",
                "20",
                "20",
                "60",
                "20",
                "20",
                "90",
                "90",
                "100",
                "60",
                "100",
                "80",
                "80",
                "60",
                "90",
                "60",
                "120",
                "60",
                "80",
                "60",
                "1",
                "1")
 
    greenlight = ("30",
                  "120",
                  "30",
                  "120",
                  "40",
                  "120",
                  "120",
                  "120",
                  "120",
                  "40",
                  "120",
                  "120",
                  "40",
                  "15",
                  "20",
                  "20",
                  "20",
                  "20",
                  "20",
                  "40",
                  "30",
                  "20",
                  "40",
                  "40",
                  "20",
                  "40",
                  "1",
                  "1")
 
    distance = ("400",
                "400",
                "250",
                "250",
                "250",
                "450",
                "300",
                "650",
                "1000",
                "450",
                "500",
                "900",
                "450",
                "400",
                "1100",
                "900",
                "600",
                "1000",
                "450",
                "450",
                "400",
                "450",
                "200",
                "500",
                "350",
                "400",
                "500",
                "500")
 
    velocity = ("80",
                "80",
                "80",
                "80",
                "80",
                "80",
                "60",
                "80",
                "80",
                "80",
                "80",
                "80",
                "80",
                "80",
                "80",
                "80",
                "80",
                "60",
                "80",
                "80",
                "80",
                "80",
                "80",
                "60",
                "80",
                "80",
                "80",
                "40")

 
    r=0
    g=0
    d=0
    v=0

    vcurrent=float(0)
    t=0
    gtime=0
    accel=float(100/(3.6*15))
    decel = float(accel*2)
 
    while r<=26:
        red=float(redlight[r])
        grn=float(greenlight[g])
        dis=float(distance[d])
        vel=float(float(velocity[v])/3.6)
        vnext=float(float(velocity[v+1])/3.6)
        saccel = float((vcurrent*(vel-vcurrent)/accel) + (vel-vcurrent)*(vel-vcurrent)/(2*accel))
        scrit = float(dis-(vel/decel) - (vel*vel)/(2*decel))
        startingred = random.randint(0, (int(grn)-1))
        
        if vcurrent == vel:
                 
            if vnext>= vcurrent:
                t = int (dis/vel)
             
                if (t+startingred)%(red+grn)<=red:
                    t = int (scrit/vel + (vel/decel) + red-((t+startingred)%(red+grn))) ### 2
                    vcurrent = 0
               
                else:
                    t = int (dis/vel)### 1
                    vcurrent = vel
                
            else:
                t = int ((scrit/vel) +
                         (vcurrent - (vnext)/((vcurrent*(vcurrent - (vnext/(dis-scrit))-
                                                           ((vcurrent - vnext)*(vcurrent - vnext)/(2*(dis-scrit))))))))
             
                if (t+startingred)%(red+grn)<=red:
                    t = int (scrit/vel +  (vel/decel)+ red-((t+startingred)%(red+grn)))### 2
                    vcurrent = 0
            
                else:
                    t = int (scrit/vel +
                         (vcurrent - vnext)/((vcurrent*(vcurrent - (vnext/(dis-scrit))-
                                                           ((vcurrent - vnext)*(vcurrent - vnext)/(2*(dis-scrit)))))))### 3
                    vcurrent = float(vnext/3.6)
    
        elif vcurrent < vel:
       
            vcrit=math.sqrt(2*accel*scrit+vcurrent*vcurrent)
        
            if saccel >= scrit:
              
                if vnext >= vcrit:
                    t = int(((vcrit-vcurrent)/ accel) + (dis-scrit)/vcrit)
                 
                    if (t+startingred)%(red+grn)<=red:
                        t = int(((vcrit-vcurrent)/ accel) + ((dis-scrit)*2/vcrit) + red-((t+startingred)%(red+grn)))### 8
                        vcurrent = 0
                                      
                    else:
                        t = int(((vcrit-vcurrent)/ accel) + (dis-scrit)/vcrit) ### 7
                        vcurrent = vcrit
                                                   
                else:
                    t = int(((vcrit-vcurrent)/ accel) + (vcrit - vnext)/((vcrit*(vcrit - vnext)/(dis-scrit))-
                                                           ((vcrit - vnext)*(vcrit - vnext)/(2*(dis-scrit)))))
                
                    if (t+startingred)%(red+grn)<=red:
                        t = int(((vcrit-vcurrent)/ accel) + ((dis-scrit)*2/vcrit) + red-((t+startingred)%(red+grn))    ) ### 8
                        vcurrent = 0
                        
                    else:
                        t = int(((vcrit-vcurrent)/ accel) + (vcrit - vnext)/((vcrit*(vcrit - vnext)/(dis-scrit))-
                                                           ((vcrit - vnext)*(vcrit - vnext)/(2*(dis-scrit))))) ### 9
                        vcurrent = vnext
                 
            else:
                        
                if vnext>= vel:
                    t = int(((vel- vcurrent)/accel) + (dis-saccel)/vel)
                               
                    if (t+startingred)%(red+grn)<=red:
                        t = int (((vel- vcurrent)/accel) + (scrit-saccel)/vel + (vel/decel)+ red-((t+startingred)%(red+grn)))### 5
                        vcurrent = 0
                                          
                    else:
                        t = int (((vel- vcurrent)/accel) + (dis-saccel)/vel)### 4
                        vcurrent = vel
                                   
                else:                                    
               
                    if (t+startingred)%(red+grn)<=red:
                        t = int (((vel- vcurrent)/accel) + (scrit-saccel)/vel + (vel/decel)+ red-((t+startingred)%(red+grn)))### 5
                        vcurrent = 0
                        
                    else:
                         
                        t = int (((vel- vcurrent)/accel) +(scrit-saccel)/vel + (vel - vnext)/((vel*(vel - vnext)/(dis-scrit))-((vel - vnext)*(vel - vnext)/(2*(dis-scrit))))) ### 6
                        vcurrent = vnext   
    
        else:
            print ("ERROR: v current > v next")
    
        #print (t)
        r+=1
        g+=1
        d+=1
        v+=1
    
        gtime+=t
        dev=(1476-gtime)*(1476-gtime)
        #print (gtime)
        
    n+=1
    dev+=dev
    overalltime+=gtime
    
print ("mean= ", overalltime/n)
print ("deviation=  ", math.sqrt(dev/n))


« » — , .

: 10 /, , 50 /.

10 000 , raw data:

(, /; , ; ):

90	1466,6	0,5
80	1475,6	0,4
70	1479,7	0,9
60	1593,7	0,8
50	1701,3	0,5
40	1869,8	0,6

image

. , , Y , .

. -, . - 70 / . -, , 8% 13% « ». , , , . , , «» 10% .

, (, ), — .

Source: https://habr.com/ru/post/zh-CN442602/


All Articles