Optimisation Reference Problem

I’m evaluating optimisation systems for application to a large scale solar energy optimisation project. My primary concerns are with efficiency, flexibility and usability. Ideally I’d like to evaluate all of them on a single, well defined problem. And, furthermore, that problem should at least resemble the solar energy project.

Proxy Project

The solar energy project will involve optimising a system of solar panels and batteries. The proxy project I settled on was a simple water supply system consisting of a tank (or reservoir), a pump feeding the tank from a water source and a second pump draining the tank to satisfy some external demand. This has many similar elements to the solar energy project but is substantially lower in complexity, making it ideal for evaluating the various optimisation packages.

Parameters & Variables

We’ll be optimising the following variables:

  • \(p_\mathrm{i}\) — the flow rate of the input pump
  • \(p_\mathrm{o}\) — the flow rate of the output pump and
  • \(h\) — the current level of the tank (given as a volume).

The current level of the tank is actually derived directly from the two flow rates, so it’s not really being optimised directly. The following externally imposed parameters specify the details of the problem:

  • \(D^\mathrm{max}\) — the maximum demand
  • \(C\) — the tank capacity (given as a volume)
  • \(p_\mathrm{i}^\mathrm{max}\) — the maximum flow rate of the input pump and
  • \(p_\mathrm{o}^\mathrm{max}\) — the maximum flow rate of the output pump.

For the purpose of optimisation these can be regarded as constants.

Bounds & Constraints

Bounds and constraints place limits on the problem. However, they are subtly different. Bounds are simple limits on the individual variables of the optimisation problem. They apply independently to each variable and define a range of permissible values for the variable (although that range can be unbounded below and/or above). Constraints are more general conditions that must be satisfied by one (or more) problem variables. Constraints can be either equalities or inequalities, and are often a mixture of both.

The following bounds are applied to the optimisation variables

$$ \begin{align} 0 &\leq p_\mathrm{i}(t) \leq p_\mathrm{i}^\mathrm{max} \\ 0 &\leq p_\mathrm{o}(t) \leq p_\mathrm{o}^\mathrm{max} \\ 0 &\leq h(t) \leq C \end{align} $$

and the variables are linked via the mass balance constraint

$$ \begin{align} \frac{\mathrm{d}h(t)}{\mathrm{d}t} & = p_\mathrm{i}(t) - p_\mathrm{o}(t) \end{align} $$

which ensures that the rate of change of the tank level is equal to the net inflow into the tank.

They can be summarised as

  • the flows from the input and output pumps vary with time and must be less than specified maximum flow rates;
  • the water level in the tank varies with time and cannot exceed the capacity of the tank; and
  • the demand varies with time and can never exceed some maximum value.

Objective

In the interests of keeping things simple the objective was defined to minimise the difference between the flow of the output pump and the demand.

A second smoothing term was added to the objective function that suppressed the change between successive values of the flow rate for the input and output pumps.

Extensions

This project could be extended in a number of ways:

  • multiple storage tanks, possibly with connecting piping;
  • energy constraints on the pumps; or
  • optimise to minimuse energy consumed by pumps.

Pump Efficiency

📢 Digression alert. I’m going down a little rabbit hole.

Since pumps are central to this problem and I really don’t know much about them, I did some research. I was most interested in their power requirements. There are two things to consider: (i) the hydraulic (mechanical) power required to pump a volume of water between two heights (this is the “head”) and (ii) the electrical power required to produce that mechanical power (in a perfect world these would be the same, but no pump is 100% efficient).

The hydraulic power is given by

$$ P = \rho g Q H $$

where

  • \(P\) is power (W)
  • \(\rho\) is the density of the fluid (assuming water, this would be 1000 kg/m3)
  • \(g\) is gravitation acceleration (9.8 m/s2)
  • \(Q\) is flow rate (m3/s) and
  • \(H\) is head (m).

To calculate the electrical power consumption you need to factor in the pump efficiency, \(\eta\), which is a number between 0 (completely inefficient) and 1 (perfectly efficient), as \(P / \eta\).

Where does the efficiency come from? There’s no simple way to derive it. However, there are some simple models that can be applied. For example:

$$ \eta = \eta^\mathrm{max} \Big[ 1 - a (Q/\hat{Q} -1 )^2 \Big] $$

where

  • \(a\) is a shape factor (normally close to 1)
  • \(\hat{Q}\) is the flow rate at the Best Efficiency Point (BEP) and
  • \(\eta^\mathrm{max}\) is the peak efficiency (achieved at the BEP).

This model dictates that a pump is most efficient close to its Best Efficiency Point. If it operates off-design (too high or too low flow rates), efficiency drops, increasing power consumption.

Is it better to pump quickly or slowly? There are a number of considerations.

  1. From an energy consumption perspective it’s best to pump as close as possible to the Best Efficiency Point, which means that you’re getting your most bang for your buck (maximum volume of fluid moved per unit cost of electricity).
  2. Higher flow rates can lead to increased mechanical stress on pump components, leading to faster wear and tear. Conversely, low flow rates can cause overheating or increased sediment deposition.
  3. With narrow pipes or valves, high flow rates can increase friction losses and require more energy to overcome resistance. Pumping slowly can reduce head losses, but this must be balanced with operational time.

This is all very interesting, but not really germane to our simple optimisation problem. So these ramblings about pumps can be safely ignored.