Poisson Process - Number of cars that a petrol station can service

**Question:**

A single-pump petrol station is running low on petrol. The total volume of petrol remaining for sale is 100 litres.

Suppose cars arrive to the station according to a Poisson process with rate $\displaystyle \lambda$, and that each car fills independently of all other cars and of the arrival process, an amount of petrol that is distributed as a uniform random variable over $\displaystyle (0, 50)$ - assume for example that all car tanks have a capacity of 50 litres and drivers decide "at random" when to refill. We assume that service is instantaneous so that there are no queues at the station.

(a) On average, how many cars will the petrol station fully service (sell the full amount requested) before it runs out of petrol (and before any refilling occurs)?

(b) How much time will it take on average before the station runs out of petrol (and before any refilling occurs)?

**Attempt:**

I'm not exactly sure where to start with this question part (a). Let $\displaystyle U$ be uniformly distributed over $\displaystyle (0,50)$, then each time a car arrives at the petrol station, the total volume of petrol decreases by $\displaystyle U$. So define $\displaystyle U_1$ to be the amount of petrol that the first arrival (an "arrival" here being when a car arrives at the petrol station and refills) and $\displaystyle U_2$ be that of the second arrival, and so on. Then each $\displaystyle U_i$ is identically and independently distributed as $\displaystyle U$. So by the $\displaystyle N$-th arrival, the station will have $\displaystyle 100-\sum_{i=1}^N U_i$ litres of petrol remaining. We stop once $\displaystyle 100-\sum_{i=1}^N U_i=0$ and we basically need to find $\displaystyle E[N]$?

----------

That's all I've got so far, if someone can provide a solution, that would be good.

Re: Poisson Process - Number of cars that a petrol station can service

You need to formulate the distribution of the sum of n uniform[0,50] and for each n determine the probability that the sum <= 100. I.e.

Let $U_k \sim Uniform[0,50]$

$G_n=\displaystyle{\sum_{k=1}^n}U_k$

To find the expected number of cars that can be serviced

$C_n=Pr[\text{n cars can be serviced}]=Pr[G_n \leq 100]$

$E[C]=\displaystyle{\sum_{n=1}^\infty}n C_n$

in practice taking $n$ to 10 is plenty.

The sum of $n$ uniform[0,1] rvs is called the Irwin-Hall distribution, and you can modify it readily enough to come up with the distribution for the sum of $n$ uniform[0,50] rvs.

I get an expected. See if you can match that.

Re: Poisson Process - Number of cars that a petrol station can service

Hi romsek, thank you very much for your help. I will try match your answer. In the mean while, is there a reason we didn't need to use the part of the question where it says "...cars arrive to the station according to a Poisson process with rate $\displaystyle \lambda$? Is that part only required for part (b)?

Re: Poisson Process - Number of cars that a petrol station can service

Quote:

Originally Posted by

**usagi_killer** Hi romsek, thank you very much for your help. I will try match your answer. In the mean while, is there a reason we didn't need to use the part of the question where it says "...cars arrive to the station according to a Poisson process with rate $\displaystyle \lambda$? Is that part only required for part (b)?

yes, that's only for part b. Part (a) is just about how many cars without concern for the rate at which they arrive. Given part (a) part (b) should be pretty straightforward.

Re: Poisson Process - Number of cars that a petrol station can service

Thanks. Also shouldn't the inequality be $\displaystyle 100-\sum_{k=1}^nU_k \le 0$? I.e., we stop once the total volume of petrol remaining in the petrol station is 0 or the first time it becomes negative? So then we would have $\displaystyle P[G_n \ge 100]$?

Re: Poisson Process - Number of cars that a petrol station can service

Quote:

Originally Posted by

**usagi_killer** Thanks. Also shouldn't the inequality be $\displaystyle 100-\sum_{k=1}^nU_k \le 0$? I.e., we stop once the total volume of petrol remaining in the petrol station is 0 or the first time it becomes negative? So then we would have $\displaystyle P[G_n \ge 100]$?

No. Cars can be serviced until the sum of the gas they fill with is equal too 100.

Re: Poisson Process - Number of cars that a petrol station can service

Yes, but the inequality $\displaystyle G_n \le 100$ means that if the sum is less than 100, the petrol station runs out of petrol. For example, if n = 2, and lets say $\displaystyle G_2 = 4$. That means if 2 cars filled a total of 4 litres, then the petrol station is out of fuel, but that's false because the petrol station still has 100-4 = 96 litres left?

Re: Poisson Process - Number of cars that a petrol station can service

Quote:

Originally Posted by

**usagi_killer** Yes, but the inequality $\displaystyle G_n \le 100$ means that if the sum is less than 100, the petrol station runs out of petrol. For example, if n = 2, and lets say $\displaystyle G_2 = 4$. That means if 2 cars filled a total of 4 litres, then the petrol station is out of fuel, but that's false because the petrol station still has 100-4 = 96 litres left?

If n cars can be serviced. Then the sum of the gas each car used must be <= 100. $G_n$ is the that sum.

Re: Poisson Process - Number of cars that a petrol station can service

Hi romsek,

I just want to get this question clearer, as I'm not sure how to exactly interpret the question.

So, define $U_k$ as the random variable that denotes the amount of petrol that car $k$ fills, $k = 1, 2, 3, \cdots$. Thus, $U_k, k = 1, 2, 3, \cdots$ are independently and identically distributed as a uniform random variable over $(0,50)$.

Let $N$ be the random variable that denotes the number of cars that the petrol station can *fully* service.

Now I don't quite get the question. Say we have the following scenario:

Car 1 comes with 10L remaining in its tank, so it will fill up 40L, hence the amount of petrol left in the station is now 100-40 = 60L.

Car 2 comes with 10L remaining in its tank, so it will fill up 40L, hence the amount of petrol left in the station is now 60-40 = 20L.

Car 3 comes with 20L remaining in its tank, so it will fill up 30L, but the petrol station only has 20L left, so does this mean Car 3 just leaves the petrol station filling 0L? My gut feeling is that this cannot happen because each car can only fill an amount BETWEEN 0 and 50, ie, (0,50) [note that the end points are not included].

Hence in this scenario, the petrol station runs "out" of petrol at N=3 because it does not have enough to FULLY service Car 3, even though it still has 20L left in the pump. Thus, the petrol station can only service N=2 cars.

Is this interpretation correct?

Also how did you compute the infinite sum for the expectation? And can you give me a guide on how I can derive the distribution of $G_n$?

Re: Poisson Process - Number of cars that a petrol station can service

Quote:

Originally Posted by

**usagi_killer** Hi romsek,

I just want to get this question clearer, as I'm not sure how to exactly interpret the question.

So, define $U_k$ as the random variable that denotes the amount of petrol that car $k$ fills, $k = 1, 2, 3, \cdots$. Thus, $U_k, k = 1, 2, 3, \cdots$ are independently and identically distributed as a uniform random variable over $(0,50)$.

Let $N$ be the random variable that denotes the number of cars that the petrol station can *fully* service.

Now I don't quite get the question. Say we have the following scenario:

Car 1 comes with 10L remaining in its tank, so it will fill up 40L, hence the amount of petrol left in the station is now 100-40 = 60L.

Car 2 comes with 10L remaining in its tank, so it will fill up 40L, hence the amount of petrol left in the station is now 60-40 = 20L.

Car 3 comes with 20L remaining in its tank, so it will fill up 30L, but the petrol station only has 20L left, so does this mean Car 3 just leaves the petrol station filling 0L? My gut feeling is that this cannot happen because each car can only fill an amount BETWEEN 0 and 50, ie, (0,50) [note that the end points are not included].

Hence in this scenario, the petrol station runs "out" of petrol at N=3 because it does not have enough to FULLY service Car 3, even though it still has 20L left in the pump. Thus, the petrol station can only service N=2 cars.

Is this interpretation correct?

Also how did you compute the infinite sum for the expectation? And can you give me a guide on how I can derive the distribution of $G_n$?

Ok, you're right. Cars have to be fully serviced. This is a much more complicated problem. I'll have to think about this.

$G_n$ is the Irwin-Hall distribution with everything scaled by 50. The easiest way to deal with it is just use the regular IH distribution but set the amount of gas the station has to 2 liters.

I just took the sum of the first 20 or so terms.

It occurs to me if the station either provides the exact amount a car requests or does not service the car you're going to end up in a sort of Xeno's paradox. The probability of selecting an exact amount of gas is 0. So you will end up getting arbitrarily close to the station being out of gas without ever actually reaching it. As long as there is a nonzero amount of gas left there is still a chance that a car will come in and ask for that last nanoliter (less maybe a picoliter) and thus the problem continues infinitely as we have to wait for the car that wants that last picoliter.

This is a pretty absurdly difficult problem for a homework set.

Re: Poisson Process - Number of cars that a petrol station can service

I should note that given the refusal scenario $G_n$ is no longer Irwin-Hall. $G_m$, where $m$ is the number of cars that has been serviced is but there are going to be cars who arrived without getting serviced and that's going to have to be figured in.

Re: Poisson Process - Number of cars that a petrol station can service

Simming this shows that the Xeno's paradox thing is exactly what occurs.

Attachment 30749

One fix for this is to quantize everything and say that gas must be purchased in integer numbers of liters or some such.

The other is my original solution that says the last arrival takes what the station has and then the station is empty.

Re: Poisson Process - Number of cars that a petrol station can service

Hmmm, however I think the process will terminate ONCE the petrol station cannot FULLY service a car. This is because a car has to fill BETWEEN 0 and 50 litres (note 0 and 50 are NOT included). Hence, say a car arrives that REQUESTS 30L to be filled, but the petrol pump only has 20L remaining. When this scenario happens, the car cannot just drive away, i.e., it cannot fill 0L. It has to fill an amount BETWEEN 0 and 50. Thus, because the question states "...how many cars will the petrol station** fully service (sell the full amount requested)** before it runs out of petrol (and **before any refilling occurs**)?" ... meaning that the process will terminate at this car. This is because the station CANNOT sell the amount REQUESTED before it starts to REFILL the cars tank, even though it may still may have 20L remaining, it is basically "empty".

Hopefully my message is clear... haha

Re: Poisson Process - Number of cars that a petrol station can service

ok, that makes sense. Let me rethink it.

The average of the number of cars fully serviced is simming to $\dfrac {11}{3}$

You realize of course that under your scenario that the way n cars are fully serviced is that $G_n \leq 100$ i.e. the original condition I specified. (Nod)

1 Attachment(s)

Re: Poisson Process - Number of cars that a petrol station can service

Attachment 30751

The top half of this sheet is the Monte Carlo analysis of the sim showing an expected 3.67 cars until stopping.

The bottom half derives the distribution of n cars until stopping. Going through each line

a) a table s of probabilities is created each being the probability that the sum of n cars gas requests is greater than 100, i.e. that n cars would trigger a stop.

b) (a) is the Cumulative distribution and we want just the distribution function so we take the difference of adjacent elements in the cumulative distribution, and cap it off with a 0.

c) we then find the expectation in the usual way

there's definitely a clearer way of deriving all this but I've already spent way too much time on it.

At least now you have an idea what the answer is and a rough idea of how to derive it.