2

Say that you have a reservoir of fixed capacity, $V_{max} [m^3]$ and some level of fill $V [m^3]$.
Liquid is flowing in a stochastic, but observable rate: $$x(t) [m^3\cdot s^{-1}]$$ You are given a valve that can drain the pool at any rate: $$y(t) [m^3\cdot s^{-1}]$$

I want the pool to never overflow or underflow. At the same time I want the output to change smoothly. Say that the turbine downstream does not like having its rotational speed change a lot within a given time window. I prefer not to make any assumptions about the input rate statistics.

Is this solvable as presented? Or will people typically attack this kind of problem with a crude regulator plus some ad-hoc nonlinearity? Is there a way to phrase a similar problem such that a definitive answer can be found?

Edit: As was suggested in the comments, there are sub-variants of this question. Such as:

  1. Cases where we dont care about the actuall reservoir fill, only the output flow. For the case of an input that is symmetric about its mean, we probably want the nominal reservoir fill to be 50%
  2. Asymmetric cases where we want nominal fill to be something else
  3. «hard» limits where under/overflow are to be avoided at all costs (or are physically impossible).
  4. «soft» limits where under/overflow have a cost that can be included in the optimization

I would be happy to know good answers to (1,3)

Come to think of it, is this not similar to adaptive cruise control? We have a car in front whose speed can only be observed. We have our own car whose speed can be regulated. We have a «reservoir» of distance between the cars. Hitting the other car is not acceptable. The driver sets a nominal distance. At the same time we want to offer the driver (and anyone behind) a «smooth» experience?

Knut Inge
  • 3,384
  • 1
  • 8
  • 13
  • Is the difference between $V_{max}$ and $V_{nominal}$ equal to the difference between $V_{nominal}$ and $V_{min}$? – robert bristow-johnson Aug 17 '22 at 22:06
  • "Is this solvable as presented? Or will people typically attack..." Uh -- what? How folks typically choose to solve problems and how they could be solved are two different things. In order to know if your "smoothness" criteria could be met you'd need to both specify what you mean by "smooth" (i.e., some criteria that can be expressed numerically) and you'd need to put some bounds on the dynamic behavior of $x(t)$ somehow. Otherwise someone could always come back and say "that's not smooth enough", or "what if I used this for $x(t)$?" – TimWescott Aug 17 '22 at 22:22
  • @robertbristow-johnson you are asking if I am targeting a nominal fill rate of 50%? Yes, that seems to make the problem more symmetric.

    I have had real problems like this that were and that were not symmetric. Sometimes you eant to avoid overflow, but underflow is no issue.

    – Knut Inge Aug 18 '22 at 04:01
  • @TimWescott if the input is a step function whose step height exceed the total capacity of the dam, then logically a (hard) requirement not to overflow is going to cause a discontinuity in the outflow that is (soft) required to be «smooth». Yet, there should be better and worse ways to regulate this? I have a very crude understanding of control theory, therefore I wanted to ask for input on how to specify the requirements – Knut Inge Aug 18 '22 at 04:08

2 Answers2

2

This is not solvable.

If inflow suddenly drops to zero and an angel tells you it will remain zero for the foreseeable future, the best strategy is to reduce outflow linearly over time so that it reaches zero the exact moment the reservoir runs empty. If you expect inflow to resume, the best strategy is to reduce outflow at a slower rate or not reduce it at all. If you pick the second strategy and inflow does not resume, you have to reduce outflow much more quickly later on.

Whatever you do, you place a bet on future inflow or absence thereof. How can the problem be modified to make is solvable? A few suggestions:

  • Given an inflow distribution and acceptable probability of failure, find the control strategy that minimizes rate of change of the outflow.

  • Given an inflow distribution and allowed rate of change of the outflow, find the control strategy that minimizes probability of failure.

  • Given an inflow distribution and cost function (of rate of change of the outflow), find the control strategy that minimizes expected cost (integral over time).

I like the third option best, especially if you use a simple cost function like rate of change squared. The problem can then be formulated as

$$\text{minimize} \int_0^\infty \left(\frac{d}{dt}y(t)\right)^2 dt$$

and this should be solvable for a given inflow distribution. What else can be done?

You may tackle the problem with simplifying assumptions, for example that inflow is small compared to reservoir size and fluctuates wildly. In this case, outflow rate should only be a function of fill level. For starters, you can use something like

$$y(V) = \frac{V^2}{1-V} $$

which is smooth over the interval [0,1) and goes to zero and infinity. This allows you to analyze the outflow distribution under a given inflow distribution and later to parametrize and optimize the control law. You still need to pick an optimization goal, as discussed in the previous paragraph. It really simplifies things if you specify inflow to be a white noise process, because you provably cannot draw any conclusion from current inflow rate, only from inflow distribution and fill level.

You can also go the opposite route where inflow is large and stable compared to reservoir size, in which case outflow closely tracks inflow with a bit of smoothing if there is a step change. Your example with adaptive cruise control falls into this category. It is probably easiest to model inflow as a random walk where the change in inflow is a white noise process.

Long story short: you have to pick an inflow distribution to proceed.

Rainer P.
  • 531
  • 2
  • 6
  • 1
    The third solution with the quadratic cost will make for the easiest math, but the cost criterion may not match reality well. In particular, there's no inherent guarantee that the algorithm won't call for a negative outflow (i.e, an inflow). – TimWescott Aug 18 '22 at 03:51
2

You can try to apply control theory here, but a simple heuristic starting point may do the trick.

  1. Fill the pool to half
  2. Determine $y(t)$ by low-pass filtering $x(t)$
  3. Dial in the low-pass filter to get the desired trade off between overflow/underflow risk and smoothnesses.

That's purely feed forward, so you probably will have to wrap a very slow control loop around it to keep the long term fill level at half. You can also augment this with non-linear/time-variant adjustments that kick in when the pool gets close to full or empty.

Any solution will have to be optimized based on the statistical signal properties of $x(t)$, there is no "one-size-fits-all" solution.

Hilmar
  • 44,604
  • 1
  • 32
  • 63
  • No «on size fits all» and «it depends on the input statistics» was what I suspected but hoped not. What you describe is close to how I would solve this problem. Ad-hoc and manual labour, but not satisfying and tends to be non-evident for anyone taking up my work in the future.

    Thanks for your response

    – Knut Inge Aug 18 '22 at 16:13
  • I like this solution. The fill level is essentially a high-pass filtered, then integrated version of the input signal. For a given input distribution and transfer function of the filter, calculating the distribution of fill levels is easy and you can calculate things like probability of overflow/underrun as well. – Rainer P. Aug 18 '22 at 16:29