Skip to content

implement off-ramp in METANET#5

Open
woodwm wants to merge 8 commits into
FilippoAiraldi:devfrom
woodwm:off-ramp
Open

implement off-ramp in METANET#5
woodwm wants to merge 8 commits into
FilippoAiraldi:devfrom
woodwm:off-ramp

Conversation

@woodwm
Copy link
Copy Markdown
Contributor

@woodwm woodwm commented May 28, 2024

Hi,

I implemented off-ramp in METANET. Could you take a look at?

I think the condition (9) in the network valid check function needs to be removed.

if any(self.out_links(node)):
msgs.append(
f"Expected node {node.name} to have no exiting links, as "
f"it is connected to destination {destination.name}."
)
if raises:
raise InvalidNetworkError(msgs[-1])

@FilippoAiraldi FilippoAiraldi self-assigned this May 28, 2024
@FilippoAiraldi
Copy link
Copy Markdown
Owner

FilippoAiraldi commented May 29, 2024

Hi @woodwm,

I took a look at your implementation of the off-ramp and pushed some new modifications to your pull request branch. Would you be so kind to take a look at them and see if they make sense to you as well?

In particular

  • I reworked condition (9) of Network.is_valid: if a node has exiting links and a destination, this must be an off-ramp
  • Node.get_downstream_density made sense to me, and I just refactored it to be a bit clearer
  • I made heavier modifications for Node.get_upstream_speed_and_flow. Your implementation required all destinations to have a get_flow method. While I understand that it is correct, I think adding an assertion clarifies this requirement. Moreover, the DestinationEngine.get_offramp_flow method was a bit unnecessary in my opinion, as it achieves the same as the NodesEngine.get_upstream_flow. I also expanded the OffRamp.get_flow to support different scenarios
  • I also added a new test and polished other small things, e.g., docstrings and missing implementations

@woodwm
Copy link
Copy Markdown
Contributor Author

woodwm commented Jun 5, 2024

Hi, @FilippoAiraldi thank you a lot for your changes.

In the function Node.get_upstream_speed_and_flow, the node is the upper node of a link and can only be Offramp if it connects a destination. In a normal network, the assertion should not happen, but it is good to have it just in case something abnormal happens.

Recently I have been thinking about the density of the off-ramp. Not many papers describe in detail how to set the density of the off-ramp. I think it should not be the density of the last incoming segment, which is fine for a normal destination. In this case, the off-ramp flow is only a part of the incoming flow in that node, which means that the speed of the off-ramp is much less than that of the incoming link in the mainstream, even though the speed of the off-ramp is not used. This is strange to me.

I think the density of the off-ramp should be the density of first segment in the other exiting link. The following are from the METANET documantation. What do you think about this?

image
image

@FilippoAiraldi
Copy link
Copy Markdown
Owner

Hi @woodwm,

thanks for the answer, and good question on the density. I also agree that not many papers explain this point clearly (at least, the ones that I used as references), so I do not have a definite answer.

I sort of understand your suggestion, and I have some points to address.

  • I have a counter-example that you may or may not agree with. Consider a very simple network with a single node, as below.

image

This node has one incoming link L_in, one exiting link L_out, and an off-ramp D. Suppose the turn-rate of the exiting link L_out is 0, and the turn-rate of the off-ramp D is 1, i.e., all the incoming vehicles from L_in are leaving the highway via the off-ramp D.

Now, intuitively speaking, I would expect the density of D to be equal to the density of L_in, and the density of L_out to be 0 (since no vehicle is turning into L_out). However, if we follow your reasoning, "the density of the off-ramp should be the density of first segment in the other exiting link", implying that the density of both D and L_out are 0.

Does this counter-example make sense, or am I overlooking something?

  • equation A28 from your image describes the dynamics of the density of an out-link. I admit that this is something that I did not quite take into consideration when building the package, and I am not sure it would be easy to implement

  • A minor thing, but how would you address the case of a node with an off-ramp and multiple exiting links?

@woodwm
Copy link
Copy Markdown
Contributor Author

woodwm commented Jun 6, 2024

Hi, @FilippoAiraldi

I think your mentioned case is considered in the condition 3 as well. When the turn rate of $L_{out}$ is 0, it is the same as there is only one exit link and the density of the off-ramp should be the same as the last segment of $L{in}$, and the anticipation term in the link speed update equation is 0. This is the same as a normal destination node.

I think no need to implement equation A(28). The currently implemented downstream boundary conditions are good and enough.

I am also not sure how to set the density of off-ramp when there are multiple exit links except for the off-ramp. My current think is that the density of the off-ramp is used to calculate the virtual density in the case of multiple exit links (including the off-ramp). The idea is that the density of the off-ramp should not change significantly the virtual density.

$$\frac{\sum {\rho_{out}^2} + \rho_{off}^2 }{\sum{\rho_{out}} + \rho_{off} } = \frac{\sum {\rho_{out}^2} }{\sum{\rho_{out}} }$$

Then, we have
$$\rho_{off} = \frac{\sum {\rho_{out}^2}}{\sum{\rho_{out}}}$$

What do you think on this?

@FilippoAiraldi
Copy link
Copy Markdown
Owner

FilippoAiraldi commented Jun 6, 2024

Hi @woodwm,

You are right, I did not pay enough attention to the third condition!

Regarding the case with one off-ramp and multiple exiting links, the only equation that came up in my mind is also the virtual downstream density $\rho_{off} = \frac{\sum {\rho_{out}^2}}{\sum{\rho_{out}}}$. It is unclear how one could otherwise compute it.

Other solutions that I can think of are

  • we check in Network.is_valid that every node with an off-ramp has at most one exiting link, so that we don't have to address the issue of multiple exiting links
  • similarly to congested destinations, we define the downstream density offered by an off-ramp as a user-defined value (in other words, an external disturbance signal affecting the system). At this point, it is up to the user whether to set this value high (emulating a congested off-ramp) or low (small anticipation term in the velocity update)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants