October 29, 2018
Optimal Control of a Rainwater Harvesting System
Domestic rainwater harvesting system
The domestic rainwater harvesting system of interest consists of a large tank with three intakes: rainwater collected from roof area (RW); municipal water addition (MW); and borehole water addition (BW). Rainwater collection depends on rainfall, while municipal or borehole water addition can be manipulated, subject to time-dependent availability (AMW: availability of municipal water; ABW: availability of borehole water) and maximum flow rates (MWmax and BWmax).
Water from the tank is used for household and garden purposes. The required rates of use (HUreq and GUreq) cannot be manipulated, i.e. the tank level should be maintained in order to meet the varying demands. If the demands are not met, penalties are incurred. The actual rates of use are HU and GU, and the differences between required and actual rates are ΔHU and ΔGU.
If water is added to the tank resulting in a level larger than Lmax, excess water is wasted via the overflow (OF).
Units for flow rates: m3/h (or kL/h)
Unit for level: m
Availability: 0 if not available, 1 if available
Controller Structure
A controller must be designed with the following structure:
- Sample time:
- 1 hour
- Inputs:
- Level measurements:
- [Lk, Lk-1, …, Lk-23]
- Actual usage measurements:
- [HUk-1, HUk-2, …, HUk-24]
- [GUk-1, GUk-2, …, GUk-24]
- Availability measurements:
- [AMWk-1, AMWk-2, …, AMWk-24]
- [ABWk-1, ABWk-2, …, ABWk-24]
- Level measurements:
- Outputs:
- Current specification for municipal water addition (MWspec,k)
- Current specification for borehole water addition (BWspec,k)
If municipal or borehole water is not available at specific time step, the specification of that time step cannot be met, resulting in MW and/or BW being equal to zero for that time step.
The designed controller function will be inserted in a provided simulation framework.
J = ∑ Nk=1 (cmwMWk + cbwBWk + cΔhuΔHUk + cΔguΔGUk)
- cmw = R 25 /klitre
- cbw = R 60 /klitre
- chu = R 150 /klitre
- cgu = R 70 /klitre
Available data
RW, HUreq, GUreq, AMW and ABW are stochastic (and realistic) disturbances to the system, some unmeasured, some with measurements of the previous time step available. Training data will be made available on the day of the hackathon that represents three different manifestations of a year period, e.g. disturbance set 1 with RW, HU, GU, AMW and ABW signals for one year (sample time of 1 hour); disturbance set 2 with a different manifestation of these signals; and disturbance set 3 with yet another manifestation of these signals. The designed controller will be tested on new (unseen) disturbance data.
Code
The following functions and script are available:
- ExampleSimulation – Do not modify
- Loads disturbance data
- Pre-allocates vectors
- Initializes model
- Runs closed-loop control system, calling:
- Controller
- TanksMassBalance
- Calculates performance
- Generates plots
- TanksMassBalance – Do not modify
- Calculates dynamic mass balance in tank
- Controller – Modify
- Determines MWspec and BWspec
- Designing this controller function is the purpose of the Hackathon
- A very simple control algorithm with three different set point options is included for demonstration purposes