The diagrams will be drawn in JS And FE Codes And analysis will done with python , with libraries such as Pandas , sklearn , numpy and matplotlib

The references we are using are Traffic Engineering And Highways K.O Garber and Dr. Amini.Z's presentations

In this pseudo-article, We are going through drawing some important Transportation diagrams.

We start with trajectory diagrams.

Time-Space Diagrams

Trajctory diagrams are type of diagrams that show us the instant location of every vehicles due to the time. also its slope will show the velocity at the point.
In this section we made an animation to show this diagram and its features. From now to the end, every animation that you will see has been wrote in JS (JavaScript) Language to draw these diagrams in canvases.

More Details About Trajectory

Trajectories are curves in the time-space diagram that define a single position for every moment of time, π‘₯(𝑑). Both \(𝑑π‘₯ \over 𝑑𝑑\) = \(\dot π‘₯\), velocity, and \(𝑑^2π‘₯ \over 𝑑^2𝑑\) \(= \dot x\) , acceleration can be analyzed visually with the trajectories plot.

Arrival And Departure Diagram

Properties of the bottlenecks (or other connections between links such as traffic lights, i.e. β€œnodes” in general) determine the dynamics of traffic at links, properties of the shockwaves, etc.
Queueing theory is the mathematical study of waiting lines, or queues. A queueing model is constructed so that queue lengths and waiting time can be predicted.
The following diagram depicts the cumulative number of arrivals and departures as seen by the two observers

Fundamental Diagram

Traffif model separates into to types:

  • Macroscopic traffic flow model:

    A mathematical traffic model that formulates the relationships among traffic flow characteristics like density, flow, and mean speed of a traffic stream.

  • Microscopic traffic flow model:

    Simulate single vehicle-driver units, so the dynamic variables of the models represent microscopic properties like the position and velocity of single vehicles

  • Greenshield in the 1930’s conjectured that there was a linear relationship between speed and density.
    In fact, the equations we are using, based on Greenshield theory. The equations are:

    $${\bar u_s^2 = u_f - {u_f \over k_j}k,\space \space q = \bar u_s k \rightarrow q = u_f k -{u_f \over k_j}k^2}$$

    $$\small{\bar u_s^2 = u_f - {u_f \over k_j}k}$$
    $$\small{q = \bar u_s k \rightarrow q = u_f k -{u_f \over k_j}k^2}$$


In this section we are going through analysing and processing some sort of data. Data we are using has been collected from seattle roads from loop detectors which placed in the some sections that we explain more about and from this website
what we are analysing are the mean velocities of cars in different times (in period of 5 minutes). the dataframe we are processing consists of 105120 rows which every one specify velocity of different nodes in certain time.

Initializing Analysis

Now the first part of the analysing should be initialized. It means ,Libraries such as matplotlib, pandas, numpy should be imported.
After importing these libraries, we should call the data with pd.read_pickle() function. this function get one arguments as file address.
With using shape() function, we can find out the number of columns and rows of this data.
At last, we show the last five rows of this heavy data by using tail() function.
The result is shown in below:

As what has been shown in above, the data has 105120 rows and 323 columns which made this data heavy.
The table in above, is just a psudo-figure of the whole table just for understimate how to table has been shaped.

Drop Index, Add Column!

What we are going through, is to add the index of the table to columns as datetime and drop our index of table. we do this for processing the date of each row in the continue.

As you can see, the last column of above table, is our new column that we named after it timeframes

Get Dates as Unix Times

Unix Timestamp is a type of time which shows us how many seconds(or miliseconds) passed from beginning of 1970-1-1 until a certain time.
In this section, we are going to add unix times from the column that we added to our table in previous section into our table to our columns. We will name it timestamps. You can find it in the last column of below table.

Plotting the Vleocity

As you found out, we are going to process the velocity. For this reason, we are going to plot velocity of each nodes.


In below of each image, there is a search icon that you can enter a node(column) number(which started from 1 to maximum 322) to show the image of that node.

Differences of Velocity in Morning and Night

There is a question that what will be the differences of velocity due to the hour of the day? to process this problem, we will plot velocity of each node in 3AM and 3PM to find out the differences.

The plots showing us that sometimes velocity changes sharply. this change may be occured due to increasing the traffic of the node. but increasing the traffic flow is a gradual action. another reason that sounds more accurate is that the node has an accident in that time that caused changing velocity sharply.