trip length distribution over a link

Hi all,

I would like to get trip length distribution for vehicles that passes over one link in my model. 

Do you have any examples of how it could be done?

Thank you in advance!

Best regards, 

Milan 

  • Hi Milan,

    I think that your question refers to obtaining a Skim matrix for DISTANCE and/or TIME (e.g., congested time TIME_1) between O and D relations over paths selected through a SELECTLINK sub-keyword in a Highway assignment. Then you can use a Matrix program to generate Trip Length Distribution (TLFD).

    You should include your SELECTLINK statement in the HW assignment, generating an extra volume field (Vi_1), by declaring a VOL[i] sub-keyword under the SELECTLINK keyword for the flows crossing the link (within the PATHLOAD control statement), for example MW[1]=MI.1.1 SELECTLINK=(L=467-468) VOL[2]=MW[1].

    To obtain travel times and distance (for example) along the paths deriving from the select link, you can use the FUNCTION=BUILDPATH (Shortest Path utility included in Cube Voyager). Details on this Voyager function can be found within the Cube Voyager Reference Guide: Home > 16 Utilities > Shortest Path > Examples > Command Line & Voyager System Command.

    For example, you can specify something like below (note "Linkselection" specification):

    In this example, the output is in .dbf format. A final Matrix program can be used to create the final “Skim” matrix in .mat format from the .dbf produced by the Shortest Path function.

    Answer Verified By: Oliver Charlesworth 

  • Hi Filippo,

    Thanks a lot for your answer ! 

    It takes a little bit time to answer, as there was a break for the project I am working with. 

    I have several other questions.

    I have attached my code. 

    ----------------------------------

    When I run the code, I get .MAT file that has twelve different matrices, each of them showing trafikk passes the link chosen in the script. 

    I used VOL [i] to assign the traffic for each of twelve matrices, and I have 12 different VOL[i] values for each link.

    Now, if I want to do produce .MAT file for several links (not just one) are there a way to do this?

    For example, I want to this for 12 000 links so that it will produce 12 000 matrices.

    Intuiutivily, I think this could be done by creating a list of links, but I am not sure ( i can do Python programming quite well, but do not have so much experience in using CUBE Voyager). 

    Is there a way to create a folder with the name of selected link (xxxx-xxxx) and then to move the produced matrix to this file and repeat for others?

    That way i will have one matrix that belongs to each link.  

    ----------------------------------

    Also I can do FUNCTION=BUILDPATH for one VOL[i], but how to do it for twelve? Is it to just to reapat the same code twelve times in the same .txt (.S) file?

    If yes, than how to itterate this for every link  (like I mentioned in my case with 12000 links)?

    Again is there a way to move every produced .dbf here to every folder that belongs to the same link?

    ----------------------------------

    Even more complex now :) 

    Are there a way to get results that will show the lenght of travel that each of twelve different classes has done until the chosen link? And the lenght of travel that remains after they pass the link?

    ----------------------------------

    Finally, I did not work with MATRIX program to genereate the TLFD but I think I will do this step after.

    ----------------------------------

    I would like to thank you so much for your help and support! 

    Best reagrds, 

    Milan 

     

    ; Do not change filenames or add or remove FILEI/FILEO statements using an editor. Use Cube/Application Manager.
    RUN PGM=HIGHWAY PRNFILE="E:\NTM6_v1.48.03 - Copy\APPLIKASJONER\NTM6\NETTUTLEGGING\NETTUTLEGGING_BIL\00HWY00A.PRN"
    FILEO PATHO[2] = "E:\NTM6_v1.48.03 - Copy\applikasjoner\NTM6\nettutlegging\nettutlegging_bil\test_2.PTH"
    FILEO PATHO[1] = "E:\NTM6_v1.48.03 - Copy\applikasjoner\NTM6\nettutlegging\nettutlegging_bil\test_1.PTH"
    FILEO MATO[1] = "E:\NTM6_v1.48.03 - Copy\applikasjoner\NTM6\nettutlegging\nettutlegging_bil\test.MAT",
          MO=1,2,3,4,5,6,7,8,9,10,11,12 NAME=bf_1_tje,bf_1_arb, bf_1_fri, bf_m_tje,bf_m_arb, bf_m_fri, bp_1_tje, bp_1_arb, bp_1_fri, bp_m_tje, bp_m_arb, bp_m_fri 
    FILEI TURNPENI = "{CATALOG_DIR}\resultat\{scenario_code}\svingeforbud_{scenario_code}.pen"
    FILEI MATI[4] = "{CATALOG_DIR}\resultat\{scenario_code}\turmat_CP_M_{scenario_code}.mat"
    FILEI MATI[3] = "{CATALOG_DIR}\resultat\{scenario_code}\turmat_CD_M_{scenario_code}.mat"
    FILEI MATI[2] = "{CATALOG_DIR}\resultat\{scenario_code}\turmat_CP_L_{scenario_code}.mat"
    FILEI MATI[1] = "{CATALOG_DIR}\resultat\{scenario_code}\turmat_CD_L_{scenario_code}.mat"
    FILEI NETI = "{CATALOG_DIR}\resultat\{scenario_code}\transportnettverk_{scenario_code}.NET"
    FILEI LOOKUPI[1] = "{CATALOG_DIR}\inndata\styrefiler\tidsverdier.DBF"
    FILEO NETO = "E:\NTM6_v1.48.03 - Copy\APPLIKASJONER\NTM6\NETTUTLEGGING\NETTUTLEGGING_BIL\00HWY00A.NET"
    
    LOOKUP LOOKUPI=1,
           NAME=tidsverdier,
             LOOKUP[1]=NR, RESULT=BIL,
             LOOKUP[2]=NR, RESULT=FLY,
             LOOKUP[3]=NR, RESULT=BBT,
           FAIL[1]=0,FAIL[2]=0,FAIL[3]=0
    
    _vot_fritid=tidsverdier(1,1)       
    _vot_arbeid=tidsverdier(1,2)       
    _vot_tjeneste=tidsverdier(1,3)       
       
           
    zones={NTM6_antsoner}
    
    PARAMETERS COMBINE=ITE MAXITERS = 1
    
    
    PROCESS PHASE=LINKREAD
    
    IF (lI.LINKTYPE > 7 & LI.LINKTYPE<19) ADDTOGROUP=1
    IF (lI.LINKTYPE =21 | LI.LINKTYPE=22) ADDTOGROUP=1
    
    lw.gk_tjeneste=_vot_tjeneste*li.tid/60+2.1*li.avstand+0.8*(li.takstf+li.bombf)
    lw.gk_arbeid=_vot_arbeid*li.tid/60+2.1*li.avstand+0.8*(li.takstf+li.bombf)
    lw.gk_fritid=_vot_fritid*li.tid/60+2.1*li.avstand+0.8*(li.takstf+li.bombf)
    
    ENDPROCESS
    
    PROCESS PHASE=ILOOP
    
    PATHLOAD PATH=lw.gk_tjeneste, PENI=1, DEC=F2, EXCLUDEGROUP=1, 
          
                    MW[1] = MI.1.5,
                    SELECTLINK  = (L=269356-269393),
                    ;PATHO=1, NAME = "bf_1_tje"
                    VOL[1]=MI.1.5
    
    PATHLOAD PATH=lw.gk_arbeid, PENI=1, DEC=F2, EXCLUDEGROUP=1, 
          
                    MW[2] = MI.1.1,
                    SELECTLINK  = (L=269356-269393),
                    ; PATHO=2, NAME = "bf_1_arb"
                    VOL[2]=MI.1.1
    
    PATHLOAD PATH=lw.gk_fritid, PENI=1, DEC=F2, EXCLUDEGROUP=1, 
          
                    MW[3] = MI.1.2+MI.1.3+MI.1.4,
                    SELECTLINK  = (L=269356-269393),
                    ;PATHO=2, NAME = "bf_1_fri",
                    VOL[3]=MI.1.2+MI.1.3+MI.1.4
    
    PATHLOAD PATH=lw.gk_tjeneste, PENI=1, DEC=F2, EXCLUDEGROUP=1, 
          
                    MW[4] = MI.3.5,
                    SELECTLINK  = (L=269356-269393),
                    VOL[4]=MI.3.5
    
    
    PATHLOAD PATH=lw.gk_arbeid, PENI=1, DEC=F2, EXCLUDEGROUP=1, 
          
                    MW[5] = MI.3.1,
                    SELECTLINK  = (L=269356-269393),
                    VOL[5]=MI.3.1
    
    PATHLOAD PATH=lw.gk_fritid, PENI=1, DEC=F2, EXCLUDEGROUP=1, 
          
                    MW[6] = MI.3.2+MI.3.3+MI.3.4,
                    SELECTLINK  = (L=269356-269393),
                    VOL[6]=MI.3.2+MI.3.3+MI.3.4
    
    PATHLOAD PATH=lw.gk_tjeneste, PENI=1, DEC=F2, EXCLUDEGROUP=1, 
          
                    MW[7] = MI.2.5,
                    SELECTLINK  = (L=269356-269393),
                    VOL[7]=MI.2.5
    
    PATHLOAD PATH=lw.gk_arbeid, PENI=1, DEC=F2, EXCLUDEGROUP=1, 
          
                    MW[8] = MI.2.1,
                    SELECTLINK  = (L=269356-269393),
                    VOL[8]=MI.2.1
    
    PATHLOAD PATH=lw.gk_fritid, PENI=1, DEC=F2, EXCLUDEGROUP=1, 
          
                    MW[9] = MI.2.2+MI.2.3+MI.2.4,
                    SELECTLINK  = (L=269356-269393),
                    VOL[9]=MI.2.2+MI.2.3+MI.2.4
    
    PATHLOAD PATH=lw.gk_tjeneste, PENI=1, DEC=F2, EXCLUDEGROUP=1, 
          
                    MW[10] = MI.4.5,
                    SELECTLINK  = (L=269356-269393),
                    VOL[10]=MI.4.5
    
    PATHLOAD PATH=lw.gk_arbeid, PENI=1, DEC=F2, EXCLUDEGROUP=1, 
          
                    MW[11] = MI.4.1,
                    SELECTLINK  = (L=269356-269393),
                    VOL[11]=MI.4.1
    
    PATHLOAD PATH=lw.gk_fritid, PENI=1, DEC=F2, EXCLUDEGROUP=1,
    
                    MW[12] = MI.4.2+MI.4.3+MI.4.4,
                    SELECTLINK  = (L=269356-269393),
                    VOL[12]=MI.4.2+MI.4.3+MI.4.4
    
    ENDPROCESS
    
    
    ENDRUN
    

  • Hi, 

    I am not sure if I should have replyed here in order for you to see it?

    Anyways, I posted  my reply below (with some questions aso).

    Thank you!

    Best, 

    Milan

  • Hi Milan.

    The method I was suggesting requires one single function for each vehicle class and link. Alternatively the usage of our API could be a better option. Nevertheless, to try to think about the most efficient solution, could you please clarify what is the final outcome/purpose of the process that you are trying to implement?