Open Access
This article is

- freely available
- re-usable

*Energies*
**2019**,
*12*(11),
2165;
https://doi.org/10.3390/en12112165

Article

A Hierarchical Optimisation of a Compressed Natural Gas Station for Energy and Fuelling Efficiency under a Demand Response Program

Centre of New Energy Systems, Department of Electrical, Electronic and Computer Engineering, University of Pretoria, Pretoria 0002, South Africa

^{*}

Author to whom correspondence should be addressed.

Received: 17 April 2019 / Accepted: 15 May 2019 / Published: 6 June 2019

## Abstract

**:**

Compressed natural gas stations serve customers who have chosen compressed natural gas powered vehicles as an alternative to diesel and petrol based ones, for cost or environmental reasons. The interaction between the compressed natural gas station and electricity grid requires an energy management strategy to minimise a significant component of the operating costs of the station where demand response programs exist. Such a strategy when enhanced through integration with a control strategy for optimising gas delivery can raise the appeal of the compressed natural gas, which is associated with reduced criteria air pollutants. A hierarchical operation optimisation approach adopted in this study seeks to achieve energy cost reduction for a compressed natural gas station in a time-of-use electricity tariff environment as well as increase the vehicle fuelling efficiency. This is achieved by optimally controlling the gas dispenser and priority panel valve function under an optimised schedule of compressor operation. The results show that electricity cost savings of up to 60.08% are achieved in the upper layer optimisation while meeting vehicle gas demand over the control horizon. Further, a reduction in filling times by an average of 16.92 s is achieved through a lower layer model predictive control of the pressure-ratio-dependent fuelling process.

Keywords:

optimal scheduling; demand response; model predictive control; hierarchical control; compressed natural gas## 1. Introduction

#### 1.1. Background

Global efforts to minimise environmental pollution have become a priority of many governments, with the transport industry targeted to replace diesel and petrol fuels with less polluting alternatives such as compressed natural gas (CNG) [1]. The use of CNG correlates with the lowest emissions of particulate matter, non-methane organic gases (NMOG), nitrogen oxides (NO

_{x}), carbon monoxide (CO) and other air toxics, among hydrocarbon fuels [2] as well as lower carbon dioxide emission for the same quantity of energy delivered [3]. The availability of the infrastructure to deliver CNG to vehicular customers is a major success factor in the growth of CNG as an alternative fuel for the transportation sector [4] because of fuelling convenience considerations [5]. There has been steady growth in the number of commercial fuelling stations in both developing [6] and developed [7] countries, which has corresponded to the increase in number of CNG vehicles on roads. For commercial fuelling stations, vehicles needing refuelling arrive randomly and are required to be filled quickly, hence the fast-fill CNG fuelling configuration has been the prominent design of choice [8]. In fast-fill stations, gas from the utility line is compressed into a pressurised cascade storage consisting of gas tanks in three pressure levels, from which arriving vehicles are filled [9]. In this type of operation, the compressor is cycled between the upper and lower limits of the cascade storage capacity [10]. Given that the compressor is the main electrical load in a CNG fast-fill station, the cycling of the compressor and its potential for being scheduled present opportunities for the improvement of operation efficiency.#### 1.2. Improving the CNG Station Operation Efficiency

The improvement of operation efficiency encompasses both energy cost reduction and ensuring performance levels in product delivery are sustained or improved, under the optimised energy cost operation. Operation optimisation for energy cost efficiency through equipment scheduling is a major area of consideration in demand response research [11]. Given the significant consequences of compressor energy consumption on the operating costs of the CNG station [12], it is necessary to study how proposed interventions for energy cost reduction, interact with other operation efficiency improvements at the gas dispensing level. Vehicle fuelling time has been studied as one of the major factors customers consider when deciding whether or not to transition to alternative fuels [13].

Kountz et al. [14] initiated the evaluation of the fast-fill CNG station with a study which involved the development of a model for the flow of gas from one of the cascade storage tanks into the target vehicle tank. Kountz [15] further developed an approach to the design of dispenser algorithm, to ensure correct quantities of gas are dispensed into the target vehicle tank with compensation for temperature effect [16]. Studies of the effects of other components of the CNG station on gas flow such as the hoses [17] and dispensers [18], have aided in developing a basis for their standardisation. Farzaneh et al. [19] developed a numerical method of analysing thermodynamic characteristics of gas flow in the reservoir filling process. The ratio of target vehicle tank pressure to the pressure of the storage tank and the evolution of this ratio as the vehicle tank gets filled are shown to have an effect on the vehicle filling time and profile [20]. Further, studies to determine the optimal location of CNG stations in a network that also includes petrol and diesel fuelling stations [21] have been carried out. Kuby [5] took a deeper look at evaluating the location problem for stations serving alternative fuel vehicles (AFVs) by reviewing the state of relevant research work, and thereby concluded that drivers of AFVs exhibit deliberate behaviour in choosing where to refuel within sparse refuelling networks, with convenience weighing more significantly than price.

Bang et al. [22] modelled the CNG residential refuelling system, and demonstrated the potential effects of an increase in the number of such systems on the existing electricity grid. The study of these effects is especially important, given the significant size of the compressor motor as an electric load in comparison with regular loads of petrol and diesel fuelling stations [23]. Cycling of the compressor in a fast-fill station to replenish the cascade storage may present an opportunity to minimise the energy cost of the CNG station, if the CNG station is located in an area where demand response programs have been implemented through time differentiated pricing [24]. Demand response programs are implemented with an overall goal of achieving lower fluctuations in electricity demand which has been shown to lead to more efficient operation of the grid [25] and to increase the reliability and stability of the grid network [11]. Electricity consumption patterns are modified by raising the price charge per unit of electricity at times when the system reliability is compromised by high demand [26]. This encourages consumers to shift their flexible loads to times when the rates charged are favourable, achieving for them lower overall energy costs [27].

In [12,28], a strategy to minimise electricity cost for a CNG fast fill station was undertaken for a station operating under a time-of-use (TOU) electricity tariff. The station was modelled as a mass balance system where the storage was modelled as a single reservoir with an outflow from a known demand profile and inflow from an optimally scheduled compressor. Further, in [29], an optimal control to determine the operation of the priority panel valves under a known demand profile for each of the three reservoirs of the cascade storage was carried out. These studies considered only the flow of quantity of gas in mass from the compressor to satisfy mass of gas demand at the dispenser. Without evaluating and optimising the pressure conditions during the flow of gas from the cascade storage to the vehicle tanks, it is impossible to guarantee that the level of fuelling time performance is maintained after energy cost saving operation interventions. Disruption of fuelling time performance threatens convenience and could sour consumer sentiment on use of CNG, even when costs are lowered [5].

In the present work, a novel study for the efficient operation of a CNG fast-fill station is presented. The hierarchical model includes an upper layer, which is an optimisation of compressor scheduling to minimise energy cost, and a lower layer to control the valves of the priority panel and the gas dispenser so as to achieve desirable conditions of pressure for minimum vehicle filling time. On the upper layer, the scheduling of the compressor operation to minimise electricity cost incurred under a TOU tariff is realised while minimising compressor switching frequency and meeting the gas demand in the control horizon. The compressor operation schedule obtained is implemented on the lower layer as an input for the optimal control of vehicle fuelling to achieve minimum filling time using a model predictive control strategy (MPC). MPC strategies are popular in modern control applications with demonstrated benefits of their closed loop robustness and stability [30,31], and the ability handle constraints in complex applications [32]. This study presents the first attempt to combine the optimal minimisation of CNG station energy cost through compressor scheduling, with the optimal control of the vehicle filling pressure conditions from the cascade storage to achieve minimum filling times. This proposed approach will safeguard the gains from energy cost savings, by ensuring a simultaneous improvement in gas transfer performance which is of great importance to fuelling convenience. The current work and case study highlight how adoption of alternative fuels intersects with electricity demand response programs, and how the operation optimisation for demand response must be enhanced with performance optimisation to secure the resulting complementary benefits.

## 2. System Modelling and Formulation

#### 2.1. The Energy Cost Minimisation Layer

Figure 1 shows the configuration of the CNG fast-fill station. Under normal operation, the compressor receives natural gas from the utility’s distribution pipeline at low to medium pressure, approximately 4–15 bar [20], and compresses it into a three level cascade storage system. The gas being compressed passes through a priority panel valve system that alternates the flow of CNG between the three levels of the cascade storage usually called the high pressure, medium pressure and low pressure levels according to their minimum allowed operating pressures [18]. The series of valves ${v}_{hp}$, ${v}_{mp}$ and ${v}_{lp}$ in the priority panel represent the inlet valves to the high pressure, medium pressure and low pressure tanks of the cascade storage respectively. When the upper pressure limit for all the cascade storage level is achieved, the compressor switch u is turned off so that no more gas flows into the cascade storage. Vehicles arriving at the dispenser have their tanks filled through the dispenser valves ${v}_{ohp}$, ${v}_{omp}$ and ${v}_{olp}$ for the high pressure, medium pressure and low pressure cascade storage tanks, respectively. The gas flow is alternated so that a lower limit of flow rate determines the tank from which the vehicle is filled, starting with the lowest pressure tank to the medium pressure tank as the vehicle tank fills up and topping off with the high pressure tank [33]. As CNG leaves the cascade storage, the pressure in storage drops and when the minimum pressure limits are reached, the compressor switch u comes on to replenish the storage [34] and the cycle is repeated. The gas demand at the dispenser, ${m}_{o}$, determines the cycling of the compressor and thus the total cost of electricity incurred in a TOU electricity tariff [24]. The energy cost minimisation layer is formulated as a mass flow problem, as we proposed in our previous study [29]. This means that the scheduling of the compressor operation is optimised around mass inflow to the cascade storage from the municipal supply line and mass outflow as determined by mass of gas demand at the dispenser over the control horizon.

#### 2.1.1. Objective Function

The objective of this layer is to minimise the cost of electricity incurred by the compressor operation over the control horizon so that the following objective function is used:
where t is the counter for the sampling instants, N is the total number of sampling instants over the control horizon, ${P}_{co}$ is the compressor power rating, ${P}_{e}\left(t\right)$ is a vector of the price of electricity per kWh in a TOU tariff, ${t}_{s}$ is the sampling period and $u\left(t\right)$ is the status of the compressor switch which is the control variable such that

$$J=\sum _{t=1}^{N}{P}_{co}{P}_{e}\left(t\right){t}_{s}u\left(t\right),$$

$$u\left(t\right)\in \{0,1\}\phantom{\rule{1.em}{0ex}}\mathrm{for}\phantom{\rule{1.em}{0ex}}1\le t\le N.$$

It is important to modify the objective function so that the switching frequency of the compressor is minimised as well. This is because the frequency of on/off instances positively correlates to increased wear and tear of moving components of the compressor [35,36]. For the optimised minimum cost of electricity incurred over the control horizon, this study seeks to achieve the lowest number of switching instances for the compressor. One of the methods considered is the one used in [12], where the approach involves the reduction of the ramp rate between successive instances of the switch so that the element of the objective function dealing with minimising compressor frequency is

$${J}_{q}=\sum _{t=1}^{N-1}{\left(u\right(t+1)-u(t\left)\right)}^{2}.$$

Elsewhere, in [29], the approach is based on the introduction of an auxiliary variable $s\left(t\right)$ [37,38] that assumes a value of 1 when a switch-on occurs and tries to minimise the summation of the auxiliary variable over the control horizon such that
and

$${J}_{pr}=\sum _{t=1}^{N}s\left(t\right),$$

$$u\left(1\right)-s\left(1\right)\le 0,$$

$$u\left(t\right)-u(t-i)-s\left(t\right)\le 0.$$

Although both methods have been found to be effective, in the present study, we propose to introduce a new method where the operation is optimised to prefer the occurrence of on-instances in succession of each other by minimising the summation of the negative product of successive instances of the solution to the control variable u, so that the objective function becomes
where $\varrho $ is a weighting factor. The weighting factor can be set to reduce the number of switching instances so that the minimum number possible is attained for the same energy cost incurred such as was the case in [29]. The method proposed in the current study for minimising the frequency of compressor switching involves a single mathematical operation and no additional constraints which reduces the computational complexity of the problem when compared with Equations (3) and (4).

$${J}_{U}=\varrho \sum _{t=1}^{N}{P}_{co}{P}_{e}{t}_{s}u\left(t\right)+(1-\varrho )\sum _{t=1}^{N-1}-\left(u\left(t\right)u(t+1)\right),$$

#### 2.1.2. Constraints

The constraints for this upper layer minimising energy cost are based on the total mass storage capacity of the cascade storage as well as the terminal conditions so that
where ${m}_{max}$ is the maximum mass limit of gas for the cascade storage corresponding to the maximum pressure limits, ${m}_{min}$ is the minimum mass limit of gas for the cascade storage at the minimum pressure limits and the mass of gas in the cascade storage $m\left(t\right)$ is
where ${m}_{o}\left(i\right)$ is the gas flowing out of the cascade storage into a vehicle in a sampling instant and $\dot{m}{}_{co}$ is the mass flow rate of the compressor which is obtained as [39]
where ${\rho}_{std}$ is the density of CNG under standard conditions (0 °C temperature and 10

$${m}_{min}\le m\left(t\right)\le {m}_{max},$$

$$m\left(t\right)=m\left(0\right)+{t}_{s}\sum _{i=0}^{t-1}{\dot{m}}_{co}u\left(i\right)-\sum _{i=0}^{t-1}{m}_{o}\left(i\right),$$

$${\dot{m}}_{co}={\rho}_{std}\times {Q}_{std}=\left(\frac{M{w}_{g}}{M{w}_{a}}\right)\times {\rho}_{a,std}\times {Q}_{std},$$

^{5}pascals pressure) [40], $M{w}_{g}$ is the molecular weight of the CNG, $M{w}_{a}$ is the molecular weight of air, ${\rho}_{a,std}$ is the air density under standard conditions and ${Q}_{std}$ is the capacity of the compressor under standard conditions.The mass limits of gas for the cascade storage capacity constraints ${m}_{min}$ and ${m}_{max}$ are derived from working pressure limits of the cascade storage and the physical properties of the gas
where P is the value of the pressure rating, V is the total volume of the cascade storage, z is the compressibility factor, R is the ideal gas constant and n the quantity of gas in moles which is correlated with the mass as
where M is the molar mass. The working mass limits for the cascade storage therefore become

$$PV=znRT,$$

$$n=\frac{m}{M},$$

$${m}_{max}=\frac{MV{P}_{max}}{zRT}\phantom{\rule{1.em}{0ex}}{m}_{min}=\frac{MV{P}_{min}}{zRT}.$$

#### 2.1.3. Algorithm

To solve the problem using OPTI toolbox SCIP solver interfaced in Matlab, the upper layer energy cost minimisation layer problem is formulated in the form

$$\begin{array}{cc}\hfill {\mathrm{minimise}}_{x}& f\left(x\right),\end{array}$$

$$\begin{array}{cc}\hfill \mathrm{subject}\phantom{\rule{4.pt}{0ex}}\mathrm{to}& Ax\le b,\end{array}$$

$$\begin{array}{c}{l}_{b}\le x\le {u}_{b},\end{array}$$

$$\begin{array}{c}x\in \{0,1\}.\end{array}$$

The objective function in Equation (1) is expressed as

$$f\left(x\right)=\left(\varrho {P}_{co}{P}_{e}{t}_{s}\times \left(u\left(1\right)+u\left(2\right)+\cdots +u\left(N\right)\right)\right)-\left((1-\varrho )\times \left(u\left(1\right)\times u\left(2\right)+u\left(2\right)\times u\left(3\right)+\cdots +u(N-1)\times u\left(N\right)\right)\right).$$

From the constraint in Equation (8) and the dynamic equation of mass in Equation (9), these linear inequalities can be expressed as
where

$$\begin{array}{c}\hfill Ax\le {b}_{1},\end{array}$$

$$\begin{array}{c}\hfill -Ax\le {b}_{2},\end{array}$$

$$A={\left[\begin{array}{cccc}-{t}_{s}{\dot{m}}_{co}& 0& \cdots & 0\\ -{t}_{s}{\dot{m}}_{co}& -{t}_{s}{\dot{m}}_{co}& \cdots & 0\\ \vdots & \vdots & \ddots & \vdots \\ -{t}_{s}{\dot{m}}_{co}& -{t}_{s}{\dot{m}}_{co}& \cdots & -{t}_{s}{\dot{m}}_{co}\end{array}\right]}_{N\times N},$$

$${b}_{1}={\left[\begin{array}{c}m\left(0\right)-{m}_{min}-{m}_{o}\left(1\right)\\ m\left(0\right)-{m}_{min}-\left({m}_{o}\left(1\right)+{m}_{o}\left(2\right)\right)\\ \vdots \\ m\left(0\right)-{m}_{min}-\left({m}_{o}\left(1\right)+{m}_{o}\left(2\right)+\cdots +{m}_{o}\left(N\right)\right)\end{array}\right]}_{N\times 1},$$

$${b}_{2}={\left[\begin{array}{c}{m}_{max}-m\left(0\right)+{m}_{o}\left(1\right)\\ {m}_{max}-m\left(0\right)+\left({m}_{o}\left(1\right)+{m}_{o}\left(2\right)\right)\\ \vdots \\ {m}_{max}-m\left(0\right)+\left({m}_{o}\left(1\right)+{m}_{o}\left(2\right)+\cdots +{m}_{o}\left(N\right)\right)\end{array}\right]}_{N\times 1}.$$

The linear inequality constraints in the form of $Ax\le b$ become

$$\begin{array}{c}\hfill A={\left[\begin{array}{c}A\\ -A\end{array}\right]}_{2N\times N},b={\left[\begin{array}{c}{b}_{1}\\ {b}_{2}\end{array}\right]}_{2N\times 1}.\end{array}$$

The control vector for the problem, x, can be written in the standard form

$$x={[u\left(1\right),u\left(2\right)\cdots u\left(N\right)]}_{N\times 1}^{T}.$$

#### 2.2. Gas Flow Optimisation Layer

A model predictive control (MPC) strategy is implemented on the lower layer with a prediction horizon ${N}_{p}$ and the sampling time ${t}_{ss}$. The status of the compressor switch u is obtained from the solution of optimisation of the upper layer. Whenever switch u is on, gas flows into the three tank storage via valves ${v}_{hp}$, ${v}_{mp}$ and ${v}_{lp}$ of the priority panel. The gas flows in from the compressor at a constant mass flow rate ${\dot{m}}_{co}$. Each of the three tanks has maximum and minimum pressures, ${p}_{hp}^{max}$, ${p}_{mp}^{max}$, ${p}_{lp}^{max}$ and ${p}_{hp}^{min}$, and ${p}_{mp}^{min}$ and ${p}_{lp}^{min}$, respectively. Gas flows into the vehicle from the storage tanks via the dispenser valves ${v}_{ohp}$, ${v}_{omp}$ and ${v}_{olp}$. The initial pressure for each vehicle tank ${p}_{veh}$ is a known quantity from the demand data while the initial pressure for the high pressure tank ${p}_{hp}$, medium pressure tank ${p}_{mp}$ and low pressure tank ${p}_{lp}$ are measured from the final conditions after the previous control action.

#### 2.2.1. Objective Function

The objective of this layer is to minimise the difference between the vehicle tank pressure ${p}_{veh}(k+j)$ and the target pressure ${p}_{T}(k+j)$ which corresponds to the quantity of gas ordered by the customer for the vehicle at step j based on the current sampling instant k. This ensures continuous flow of gas from the cascade storage tanks to the vehicle tank. Additionally, we minimise the summation of dispenser valve action instances, which ensures minimisation of filling time. This is because lowering the total number of instances required for the dispenser valves to be on in order to fill the vehicle tank, corresponds to a shorter filling time of the vehicle tank. Therefore, the controller prefers the cascade filling profile with the least number of total dispenser valve open instances. The objective function based on the current sampling instant k is therefore to minimise
where $\varsigma $ is a weighting factor and ${v}_{ohp}(k+j)$, ${v}_{omp}(k+j)$ and ${v}_{olp}(k+j)$ are the dispenser statuses for the high pressure, medium pressure and low pressure cascade storage tanks, respectively. Gas flow from the cascade storage tanks to the vehicle tank, ${\dot{m}}_{veh}(k+j)$ ensures that the vehicle pressure approaches the target pressure value and is the sum of flow rates from the three tanks, so that based on the current sampling instant k

$${J}_{L}\left(k\right)=\left(\varsigma \right)\sum _{j=0}^{{N}_{p}-1}\left({p}_{T}(k+j)-{p}_{veh}(k+j)\right)+(1-\varsigma )\sum _{j=0}^{{N}_{p}-1}\left({v}_{ohp}(k+j)+{v}_{omp}(k+j)+{v}_{olp}(k+j)\right),$$

$${\dot{m}}_{veh}(k+j)={\dot{m}}_{hp}(k+j){v}_{ohp}(k+j)+{\dot{m}}_{mp}(k+j){v}_{omp}(k+j)+{\dot{m}}_{lp}(k+j){v}_{olp}(k+j).$$

The equations for the instantaneous flow rates ${\dot{m}}_{hp}(k+j)$, ${\dot{m}}_{mp}(k+j)$ and ${\dot{m}}_{lp}(k+j)$ between the high, medium and low pressure tanks of the cascade storage, respectively, and the vehicle tank, are based on the ideal gas model for an adiabatic system [41] and are governed by the pressure ratios between the storage tanks and the vehicle tank. i.e.,
and
and similarly for the ${\dot{m}}_{mp}(k+j)$
and
and for ${\dot{m}}_{lp}(k+j)$
and
where $\gamma $ is the ratio of specific heats
and ${c}_{p}$ is the specific heat capacity of the gas at constant pressure while ${c}_{v}$ is specific heat capacity of the gas at constant volume. ${C}_{d}$ is the coefficient of discharge of the dispenser valve orifice, ${A}_{orifice}$ is the area of the dispenser valve orifice and ${\rho}_{hp}$, ${\rho}_{mp}$ and ${\rho}_{lp}$ are the densities of the gas in the high pressure, medium pressure and low pressure reservoirs, respectively.

$$\begin{array}{cc}\hfill {\dot{m}}_{hp}(k+j)=& {C}_{d}{\rho}_{hp}(k+j){A}_{orifice}{\left(\frac{{p}_{veh}(k+j)}{{p}_{hp}(k+j)}\right)}^{\frac{1}{\gamma}}{\left\{\left(\frac{2\gamma}{\gamma -1}\right)\left(\frac{{p}_{hp}(k+j)}{{\rho}_{hp}(k+j)}\right)\left(1-{\left(\frac{{p}_{veh}(k+j)}{{p}_{hp}(k+j)}\right)}^{\frac{\gamma -1}{\gamma}}\right)\right\}}^{\frac{1}{2}}\hfill \\ & \mathrm{for}\phantom{\rule{1.em}{0ex}}\frac{{p}_{veh}(k+j)}{{p}_{hp}(k+j)}\le {\left(\frac{2}{\gamma +1}\right)}^{\frac{\gamma}{\gamma -1}},\hfill \end{array}$$

$${\dot{m}}_{hp}(k+j)={C}_{d}\sqrt{\gamma {p}_{hp}(k+j){\rho}_{hp}(k+j){A}_{orifice}}{\left(\frac{2}{\gamma +1}\right)}^{\frac{\gamma +1}{2(\gamma -1)}}\mathrm{for}\phantom{\rule{1.em}{0ex}}\frac{{p}_{veh}(k+j)}{{p}_{hp}(k+j)}\ge {\left(\frac{2}{\gamma +1}\right)}^{\frac{\gamma}{\gamma -1}},$$

$$\begin{array}{cc}\hfill {\dot{m}}_{mp}(k+j)=& {C}_{d}{\rho}_{mp}(k+j){A}_{orifice}{\left(\frac{{p}_{veh}(k+j)}{{p}_{mp}(k+j)}\right)}^{\frac{1}{\gamma}}{\left\{\left(\frac{2\gamma}{\gamma -1}\right)\left(\frac{{p}_{mp}(k+j)}{{\rho}_{mp}(k+j)}\right)\left(1-{\left(\frac{{p}_{veh}(k+j)}{{p}_{mp}(k+j)}\right)}^{\frac{\gamma -1}{\gamma}}\right)\right\}}^{\frac{1}{2}}\hfill \\ & \mathrm{for}\phantom{\rule{1.em}{0ex}}\frac{{p}_{veh}(k+j)}{{p}_{mp}(k+j)}\le {\left(\frac{2}{\gamma +1}\right)}^{\frac{\gamma}{\gamma -1}},\hfill \end{array}$$

$${\dot{m}}_{mp}(k+j)={C}_{d}\sqrt{\gamma {p}_{mp}(k+j){\rho}_{mp}(k+j){A}_{orifice}}{\left(\frac{2}{\gamma +1}\right)}^{\frac{\gamma +1}{2(\gamma -1)}}\mathrm{for}\phantom{\rule{1.em}{0ex}}\frac{{p}_{veh}(k+j)}{{p}_{mp}(k+j)}\ge {\left(\frac{2}{\gamma +1}\right)}^{\frac{\gamma}{\gamma -1}},$$

$$\begin{array}{cc}\hfill {\dot{m}}_{lp}(k+j)=& {C}_{d}{\rho}_{lp}(k+j){A}_{orifice}{\left(\frac{{p}_{veh}(k+j)}{{p}_{lp}(k+j)}\right)}^{\frac{1}{\gamma}}{\left\{\left(\frac{2\gamma}{\gamma -1}\right)\left(\frac{{p}_{lp}(k+j)}{{\rho}_{lp}(k+j)}\right)\left(1-{\left(\frac{{p}_{veh}(k+j)}{{p}_{lp}(k+j)}\right)}^{\frac{\gamma -1}{\gamma}}\right)\right\}}^{\frac{1}{2}}\hfill \\ & \mathrm{for}\phantom{\rule{1.em}{0ex}}\frac{{p}_{veh}(k+j)}{{p}_{lp}(k+j)}\le {\left(\frac{2}{\gamma +1}\right)}^{\frac{\gamma}{\gamma -1}},\hfill \end{array}$$

$${\dot{m}}_{lp}(k+j)={C}_{d}\sqrt{\gamma {p}_{lp}(k+j){\rho}_{lp}(k+j){A}_{orifice}}{\left(\frac{2}{\gamma +1}\right)}^{\frac{\gamma +1}{2(\gamma -1)}}\mathrm{for}\phantom{\rule{1.em}{0ex}}\frac{{p}_{veh}(k+j)}{{p}_{lp}(k+j)}\ge {\left(\frac{2}{\gamma +1}\right)}^{\frac{\gamma}{\gamma -1}},$$

$$\gamma =\frac{{c}_{p}}{{c}_{v}},$$

#### 2.2.2. Constraints

The valves at the dispenser and the priority panel, as the control variables, are subject to operational constraints. The valves of the priority panel open one at a time when the compressor is filling the cascade storage reservoirs which gives the constraint in Equation (35). The valves of the dispenser also open one at a time during the filling of the vehicle from the cascade storage as represented by the constraint in Equation (36).

$$\begin{array}{c}\hfill {v}_{hp}(k+j)+{v}_{mp}(k+j)+{v}_{lp}(k+j)-u(k+j)=0,\end{array}$$

$${v}_{ohp}(k+j)+{v}_{omp}(k+j)+{v}_{olp}(k+j)\le 1,$$

$${v}_{ohp}(k+j),{v}_{omp}(k+j),{v}_{olp}(k+j),{v}_{hp}(k+j),{v}_{mp}(k+j),{v}_{lp}(k+j),u(k+j)\in \{0,1\}.$$

Further, the vehicle tank pressure ${p}_{veh}$ and the pressure in the three cascade reservoirs ${p}_{hp}$, ${p}_{mp}$ and ${p}_{lp}$, as the states of the gas flow optimisation layer, are also subject to operational constraints. The limits of pressure for the vehicle tank and each of the reservoirs of the cascade storage are such that

$$\begin{array}{c}\hfill {p}_{hp}^{min}\le {p}_{hp}(k+j)\le {p}_{hp}^{max},\end{array}$$

$$\begin{array}{c}\hfill {p}_{mp}^{min}\le {p}_{mp}(k+j)\le {p}_{mp}^{max},\end{array}$$

$$\begin{array}{c}\hfill {p}_{lp}^{min}\le {p}_{lp}(k+j)\le {p}_{lp}^{max},\end{array}$$

$$\begin{array}{c}\hfill {p}_{veh}(k+{N}_{p}+1-j)\ge {p}_{T}\left(k\right),\end{array}$$

Equations (37)–(39) ensure that the maximum and minimum working pressures of the cascade storage tanks are not exceeded, while Equation (40) ensures that, at the end of the control horizon, the vehicle tank is filled to the target pressure corresponding to the requested quantity of gas by the customer.

Based on the described flow of gas for the proposed approach, the general differential equations for pressure change in the vehicle and cascade storage reservoirs are
where the constants ${K}_{1}$, ${K}_{hp}$, ${K}_{mp}$ and ${K}_{lp}$ are
where ${V}_{veh}$, ${V}_{hp}$, ${V}_{mp}$ and ${V}_{lp}$ are the volumes of the vehicle tank, high pressure reservoir, medium pressure reservoir and low pressure reservoir, respectively. This yields the following discrete equations of pressure, for the current sampling instant k

$$\begin{array}{c}\hfill \frac{d}{dt}{p}_{veh}\left(t\right)={\dot{m}}_{veh}\left(t\right){K}_{1},\end{array}$$

$$\begin{array}{c}\hfill \frac{d}{dt}{p}_{hp}\left(t\right)=-{\dot{m}}_{hp}\left(t\right){K}_{hp}{v}_{ohp}\left(t\right)+{\dot{m}}_{co}{v}_{hp}\left(t\right),\end{array}$$

$$\begin{array}{c}\hfill \frac{d}{dt}{p}_{mp}\left(t\right)=-{\dot{m}}_{mp}\left(t\right){K}_{mp}{v}_{omp}\left(t\right)+{\dot{m}}_{co}{v}_{mp}\left(t\right),\end{array}$$

$$\begin{array}{c}\hfill \frac{d}{dt}{p}_{lp}\left(t\right)=-{\dot{m}}_{lp}\left(t\right){K}_{lp}{v}_{olp}\left(t\right)+{\dot{m}}_{co}{v}_{lp}\left(t\right),\end{array}$$

$${K}_{1}=T\left(\frac{{c}_{p}}{{c}_{v}}\frac{R}{{V}_{veh}}\right),\phantom{\rule{1.em}{0ex}}{K}_{hp}=T\left(\frac{{c}_{p}}{{c}_{v}}\frac{R}{{V}_{hp}}\right),\phantom{\rule{1.em}{0ex}}{K}_{mp}=T\left(\frac{{c}_{p}}{{c}_{v}}\frac{R}{{V}_{mp}}\right)\phantom{\rule{1.em}{0ex}}\mathrm{and}\phantom{\rule{1.em}{0ex}}{K}_{lp}=T\left(\frac{{c}_{p}}{{c}_{v}}\frac{R}{{V}_{lp}}\right),$$

$$\begin{array}{c}\hfill {p}_{veh}(k+j)={p}_{veh}\left(k\right)+{t}_{ss}{K}_{1}\sum _{\tau =k}^{k+j}{\dot{m}}_{veh}\left(\tau \right),\end{array}$$

$$\begin{array}{c}\hfill {p}_{hp}(k+j)={p}_{hp}\left(k\right)-{t}_{ss}{K}_{hp}\sum _{\tau =k}^{k+j}{\dot{m}}_{veh}\left(\tau \right){v}_{ohp}\left(\tau \right)+{t}_{ss}{\dot{m}}_{co}\sum _{\tau =k}^{k+j}{v}_{hp}\left(\tau \right),\end{array}$$

$$\begin{array}{c}\hfill {p}_{mp}(k+j)={p}_{mp}\left(k\right)-{t}_{ss}{K}_{mp}\sum _{\tau =k}^{k+j}{\dot{m}}_{veh}\left(\tau \right){v}_{omp}\left(\tau \right)+{t}_{ss}{\dot{m}}_{co}\sum _{\tau =k}^{k+j}{v}_{mp}\left(\tau \right),\end{array}$$

$$\begin{array}{c}\hfill {p}_{lp}(k+j)={p}_{lp}\left(k\right)-{t}_{ss}{K}_{lp}\sum _{\tau =k}^{k+j}{\dot{m}}_{veh}\left(\tau \right){v}_{olp}\left(\tau \right)+{t}_{ss}{\dot{m}}_{co}\sum _{\tau =k}^{k+j}{v}_{lp}\left(\tau \right).\end{array}$$

#### 2.2.3. Algorithm

To solve the gas flow optimisation layer problem using the Mixed Integer Distributed Ant Colony Optimisation (MIDACO) solver, the components of the problem have to be formulated as

$$\begin{array}{ccc}\hfill \mathrm{minimise}& f\left(x\right)& (\mathrm{objective}\phantom{\rule{4.pt}{0ex}}\mathrm{function})\hfill \end{array}$$

$$\begin{array}{ccc}\hfill \mathrm{subject}\phantom{\rule{4.pt}{0ex}}\mathrm{to}& g\left(x\right)=0& (\mathrm{equality}\phantom{\rule{4.pt}{0ex}}\mathrm{constraints})\hfill \end{array}$$

$$\begin{array}{cc}h\left(x\right)\ge 0& (\mathrm{inequality}\phantom{\rule{4.pt}{0ex}}\mathrm{constraints})\hfill \end{array}$$

The control vector consists of the conditions of the three priority panel valves and the three dispenser valves, and for each sampling instant k, x can be written in the standard form

$$\begin{array}{c}\hfill x=[{v}_{hp}(k+1),{v}_{hp}(k+2),\cdots {v}_{hp}(k+{N}_{p}),{v}_{mp}(k+1),{v}_{mp}(k+2),\cdots {v}_{mp}(k+{N}_{p}),{v}_{lp}(k+1),\\ \hfill {v}_{lp}(k+2),\cdots {v}_{lp}(k+{N}_{p}),{v}_{ohp}(k+1),{v}_{ohp}(k+2),\cdots {v}_{ohp}(k+{N}_{p}),{v}_{omp}(k+1),\\ \hfill {v}_{omp}(k+2),\cdots {v}_{omp}(k+{N}_{p}),{v}_{olp}(k+1),{v}_{olp}(k+2),\cdots {v}_{olp}(k+{N}_{p}){,]}_{6{N}_{p}\times 1}^{T}.\end{array}$$

The objective function in Equation (26),

$$\begin{array}{c}\hfill f=[\varsigma \times \left({P}_{T}-{P}_{veh}(k+1)+{P}_{T}-{P}_{veh}(k+2)\cdots {P}_{T}-{P}_{veh}(k+{N}_{p})\right)+(1-\varsigma )\times ({v}_{ohp}(k+1)+\\ \hfill {v}_{omp}(k+1)+{v}_{olp}(k+1)+{v}_{ohp}(k+2)+{v}_{omp}(k+2)+{v}_{olp}(k+2)\cdots \\ \hfill {v}_{ohp}(k+{N}_{p})+{v}_{omp}(k+{N}_{p})+{v}_{olp}(k+{N}_{p})\left)\right].\end{array}$$

The equality constraint in Equation (35) yields the $g\left(x\right)=0$ set for the algorithm so that
while the inequality in Equation (36) yields the first set of $h\left(x\right)\ge 0$ such that

$$g\left(x\right)={\left[\begin{array}{c}{v}_{hp}(k+1)+{v}_{mp}(k+1)+{v}_{lp}(k+1)-u(k+1)\\ {v}_{hp}(k+2)+{v}_{mp}(k+2)+{v}_{lp}(k+2)-u(k+2)\\ \vdots \\ {v}_{hp}(k+{N}_{p})+{v}_{mp}(k+{N}_{p})+{v}_{lp}(k+{N}_{p})-u(k+{N}_{p})\end{array}\right]}_{{N}_{p}\times 1},$$

$${h}_{1}\left(x\right)={\left[\begin{array}{c}1-\left({v}_{ohp}(k+1)+{v}_{omp}(k+1)+{v}_{olp}(k+1)\right)\\ 1-\left({v}_{ohp}(k+2)+{v}_{omp}(k+2)+{v}_{olp}(k+2)\right)\\ \vdots \\ 1-\left({v}_{ohp}(k+{N}_{p})+{v}_{omp}(k+{N}_{p})+{v}_{olp}(k+{N}_{p})\right)\end{array}\right]}_{{N}_{p}\times 1}.$$

The next set of inequality constraints is derived from Equations (37)–(39) such that

$${h}_{2}\left(x\right)={\left[\begin{array}{c}{p}_{hp}^{max}-{p}_{hp}(k+1)\\ \vdots \\ {p}_{hp}^{max}-{p}_{hp}(k+{N}_{p})\\ {p}_{mp}^{max}-{p}_{mp}(k+1)\\ \vdots \\ {p}_{mp}^{max}-{p}_{mp}(k+{N}_{p})\\ {p}_{lp}^{max}-{p}_{lp}(k+1)\\ \vdots \\ {p}_{lp}^{max}-{p}_{lp}(k+{N}_{p})\\ {p}_{hp}(k+1)-{p}_{hp}^{min}\\ \vdots \\ {p}_{hp}(k+{N}_{p})-{p}_{hp}^{min}\\ {p}_{mp}(k+1)-{p}_{mp}^{min}\\ \vdots \\ {p}_{mp}(k+{N}_{p})-{p}_{mp}^{min}\\ {p}_{lp}(k+1)-{p}_{lp}^{min}\\ \vdots \\ {p}_{lp}(k+{N}_{p})-{p}_{lp}^{min}\end{array}\right]}_{6{N}_{p}\times 1}.$$

The final element of the inequality constraints is derived from Equation (40), yielding

$${h}_{3}\left(x\right)={\left[\begin{array}{c}{p}_{veh}(k+N+1-j)-{p}_{T}\left(k\right)\end{array}\right]}_{1\times 1}.$$

The combined set of inequality constraints therefore becomes

$$\begin{array}{c}\hfill h\left(x\right)={\left[\begin{array}{c}{h}_{1}\left(x\right)\\ {h}_{2}\left(x\right)\\ {h}_{3}\left(x\right)\end{array}\right]}_{(7{N}_{p}+1)\times 1}.\end{array}$$

At the current sampling instant k, an open loop optimisation problem is solved by the controller for the prediction horizon ${N}_{p}$. Only the first elements of the control variables ${v}_{hp}$, ${v}_{mp}$, ${v}_{lp}$, ${v}_{ohp}$, ${v}_{omp}$ and ${v}_{olp}$ are implemented on the CNG filling station plant. The vehicle pressure ${p}_{veh}$ and the pressure in the cascade storage tanks ${p}_{hp}$, ${p}_{mp}$ and ${p}_{lp}$, which are the system states, are measured and the values fed back to the MPC controller, forming the initial states for the following sampling instant $k+1$. The input variables are then updated and the cycle repeated until all control actions for the intended period are implemented.

The MPC controller workflow is such that:

- For the current sampling instant k, the controller minimises the objective function in Equation (26) and finds an optimum solution for the control variables ${v}_{hp}$, ${v}_{mp}$, ${v}_{lp}$, ${v}_{ohp}$, ${v}_{omp}$ and ${v}_{olp}$, subject to the constraints set out in Section 2.2.2.
- From the solution, only the first elements of the solution ${v}_{hp}\left(k\right|k)$, ${v}_{mp}\left(k\right|k)$, ${v}_{lp}\left(k\right|k)$, ${v}_{ohp}\left(k\right|k)$, ${v}_{omp}\left(k\right|k)$ and ${v}_{olp}\left(k\right|k)$ are implemented.
- The states ${p}_{veh}(k+1)$, ${p}_{hp}(k+1)$, ${p}_{mp}(k+1)$ and ${p}_{lp}(k+1)$ are measured to be fed back.
- The value of k is set to $k=k+1$ and system states, inputs and outputs are updated.
- Steps 1–4 are repeated until k reaches a value predetermined to mark the end of the control period.

## 3. Case Study

The case study involves a roadside vehicle fuelling station based in Johannesburg South Africa, that is currently in operation, located in an industrial zone, as shown on the map in Figure 2.

The average hourly demand profile for a 24-h period, which is the upper layer control horizon N, is shown in Figure 3. The station serves vehicles mainly in the public transportation sector and fleets of courier and security firms. Both individual and fleet customers arrive one by one on their individual need basis, and there is currently no scheduled fleet refuelling at this station. Vehicles serviced by the fuelling station are hybrid fuelled, with combined CNG and diesel/petrol powered engines. The vehicles are run on CNG and resort to diesel and petrol power when the CNG in their tanks runs out. The station itself obtains gas from a municipal line, which is compressed by a 132 kW motor powered compressor, into three levels of the cascade storage, which are 2000 L each. The three level tanks have a maximum operating pressure of 250 bar and are in the baseline operated at minimum pressures of 75 bar, 150 bar and 210 bar for the low pressure, medium pressure and high pressure reservoirs, respectively. The compressor pumps gas into the storage at a rate of 900 m

^{3}/h. Although the station has two installed compressors and three dispensers, the station only operates one compressor and fills vehicles from one dispenser, since the current number of customers visiting the station is modest and no congestion or queuing problem has arisen. The station compressor operates between the limits of the quantity of gas in storage with the compressor being switched on at the lower limit to fill the cascade storage, and once the compressor is on, stays on to fill the cascade storage to the upper limit. The compressed natural gas station purchases electricity from South Africa’s national utility firm Eskom based on a time-of-use tariff known as the Miniflex tariff (http://eskom.co.za/tariffs) which is priced in South African Rands as
$${p}_{e}\left(t\right)=\left\{\begin{array}{cc}{p}_{offpeak}\phantom{\rule{1.em}{0ex}}=0.5157\mathrm{R}/\mathrm{kWh}\hfill & \mathrm{if}\phantom{\rule{4.pt}{0ex}}t\in [0,6]\cup [22,24]\hfill \\ {p}_{standard}\phantom{\rule{1.em}{0ex}}=0.9446\mathrm{R}/\mathrm{kWh}\hfill & \mathrm{if}\phantom{\rule{4.pt}{0ex}}t\in [9,17]\cup [19,22]\hfill \\ {p}_{peak}\phantom{\rule{1.em}{0ex}}=3.1047\mathrm{R}/\mathrm{kWh}\hfill & \mathrm{if}\phantom{\rule{4.pt}{0ex}}t\in [6,9]\cup [17,19]\hfill \end{array}\right.$$

The tariff is divided into peak, offpeak and standard times during the day, reflecting the times during the day when electricity demand is high, low and intermediate, respectively.

A sampling time of 15 min is used for the upper layer of this study with a control horizon of 24 h. For the lower layer MPC problem, a sampling time of 20 s for a receding prediction horizon ${N}_{p}$ of five minutes is used. During existing baseline operation, vehicle tank filling starts at the low pressure reservoir and the transfer to medium and high pressure reservoir occurs when the flow rate between the reservoir and the vehicle tank falls to a set point. This study seeks to allow the flexibility of the transfer of vehicle filling between the reservoirs through optimised control of the dispenser valves in the lower layer. The priority panel valves and the dispenser valves are modelled as binary valves with orifice diameters of 5 mm each. There are two sizes of vehicle cylinders for the vehicles fuelled in the 24 h control horizon at 80 and 100 L respectively. The initial vehicle tank pressure is assumed to be 1 bar since the vehicles are hybrid CNG and petrol/diesel powered and typically refill CNG tanks on empty.

The solution of the upper layer compressor schedule obtained from optimisation for the average 24-h demand is applied to the MPC receding horizon control of vehicle filling, for a day in which 143 vehicles fuel at the CNG station with gas demand as shown in Figure 4. Table 1 shows additional parameters and constants

Figure 5 demonstrates the functioning of the compressor under the baseline cycling operation. The compressor cycles between the minimum and maximum limits of the storage to maintain the level of gas within designed operation limits. Indeed, in Figure 5a, it is clear that the compressor operates during the peak electricity pricing period in the morning, as well as during the standard electricity pricing period during the rest of the day. This means that, under baseline operation, the station does not take advantage of the low electricity prices of the offpeak electricity pricing periods. The total cost of electricity incurred as a result of this baseline operation profile is R440.23. The main component of this cost is the cost of electricity consumed as a result of the compressor-on status during the significantly expensive peak electricity pricing period and an optimal avoidance of this occurrence should lower the cost considerably.

## 4. Results

#### 4.1. Energy Cost Minimisation Layer Results

The optimised results for the operation schedule of the compressor are shown in Figure 6. The proposed approach is successful in preventing compressor-on instances during both peak electricity demand periods for the average 24-h gas demand of the control horizon. Preceding the first peak demand period between 06:00 and 09:00, the compressor switches on to replenish the gas in storage so as to sustain demand during the peak electricity pricing period during which the compressor stays off. There are two instances when the compressor is turned on during the standard electricity pricing period to meet the gas demand as well as to refill the cascade storage before the second peak electricity demand period of the 24 h. Prior to the second peak, the cascade storage is refilled. The level of gas is thereafter enough to sustain the demand until the end of the second standard electricity pricing time at 22:00.

The delay in switching on the compressor after the second peak demand period is a desirable outcome of the optimisation strategy. This is in response to the pricing of the standard electricity demand period that is higher than the pricing during the offpeak electricity demand period, which causes the controller to prefer delaying compressor-on status beyond the peak electricity demand period [42]. The delay is an important quality of the realised schedule as it reduces the contribution of the CNG station to the grid comeback load associated with the surge in electricity demand immediately following the end of the peak pricing period [43,44]. A total of four switching instances occur over the control horizon, which is comparable with observed results for alternative strategies observed in [12,29]. This implies the superiority of the current method as it matches the performance of previously proposed techniques with the added benefit of fewer mathematical operations, thereby achieving the goal of reducing computational complexity of the problem. The computing time achieved for the upper layer using the proposed approach was 15.15 s, compared to 20.22 s for the method using Equation (3) and 35.58 s for the method in Equation (4). The strategy reduces the cost of electricity over the 24-h horizon from the baseline R440.23 to R175.74, which represents a 60.08% reduction in energy cost. This is a significant reduction in cost of operation through a strategy that involves only a change in the operation schedule, without additional investment in new hardware.

#### 4.2. Gas Flow Optimisation Layer Results

The compressor scheduling results from the energy cost minimisation layer are passed onto the lower layer, for the implementation of the MPC strategy in the vehicle tank filling for each of 143 vehicles fuelled over 24 h. These upper layer results determine the status of the compressor switch for a particular sampling instant in the lower layer. In the lower layer problem, four scenarios emerge, with each having a different priority panel and dispenser status combination. To ascertain the validity of the proposed approach, the system operation must remain valid and consistent with the system constraints under the four scenarios. These four scenarios are, vehicle tank filling with compressor off, vehicle tank filling with compressor on, compressor on without a vehicle filling at the dispenser, and compressor off without a vehicle filling at the dispenser.

#### 4.2.1. Vehicle Filling with the Compressor Off

The results of optimised MPC filling process when a vehicle is at the dispenser and the compressor is off is shown in Figure 7. The results show the filling profile of the fourth vehicle of the 143 filled over the 24-h control horizon of the upper layer. The priority panel remains inactive since no gas flows into the cascade storage from the compressor given the off-status of the compressor switch, which is scheduled from the optimisation of the upper layer. All levels of cascade storage are utilised in the implemented control actions of the filling process to attain the pressure corresponding to the target level of gas to be filled in the vehicle.

The dispenser valves from the three cascade storage tanks switch between each other to fill the vehicle’s tank, as shown in Figure 7b, producing the optimal pressure profile of the filling shown in Figure 7c. In Figure 7b, the MPC controller shuffles the operation of the dispenser valves between the three levels of the cascade storage in the filling process which is dependent on the pressure ratio between the vehicle tank and the reservoirs. This is different from the baseline operation where filling is sequentially scheduled and switching occurs at the set point of the dropping flow rate. A comparison of the pressure increase in the vehicle tank under the optimal control strategy and the baseline can be seen in Figure 7c. A filling time of 200 s is achieved, which is shorter than the 220 s achieved under the baseline operation.

#### 4.2.2. Vehicle Filling with the Compressor On

When the vehicle is filled as the compressor is filling the cascade storage, the profile of operation is shown in Figure 8. The results show the profile of the filling process for 38th vehicle of the 143 filled over the 24-h control horizon. A smooth filling profile is obtained with a filling time of 200 s, which is shorter by 20 s from the baseline filling profile.

Similar to the filling of the vehicle while the compressor is off, the dispenser valves switches between levels of cascade storage to produce the optimal filling profile of the vehicle tank so that the targeted quantity of gas is transferred. The priority panel valves alternate the filling of the gas from the compressor into the cascade storage between the three levels.

For both cases in Section 4.2.1 and Section 4.2.2, the proposed control strategy produces an efficient accelerated filling of the vehicle tank by switching optimally between the dispenser valves to achieve the minimum possible number of total dispenser valve-on instances to reach the targeted transfer of gas to the vehicle, which corresponds to the shortest possible filling time under the given constraints. This filling profile represents the optimal increase in pressure in the vehicle tank as achieved through the MPC strategy of the lower layer.

Under this novel optimised MPC filling approach, the improvement in filling time is achieved with a median of 20 s reduction in filling time for an average saving of 16.92 s for the 143 vehicles. This outcome confirms that, by altering the operation of the dispenser valves through optimisation, better CNG fuelling performance can be achieved, which would further justify the optimisation of the CNG station operations, beyond the minimising of electricity costs.

#### 4.2.3. Cascade Reservoir Filling without Vehicle Fuelling

As dictated by the energy cost optimisation layer schedule, during the interval when there is no vehicle fuelling at the dispenser but the compressor is on, the profile for the filling of the cascade storage from the compressor is shown in Figure 9.

A preference to keep the high pressure reservoir of the cascade storage at high pressure is observed under the MPC strategy for the lower layer. The pressure level is flexibly controlled to fulfil the optimal control goals of vehicle filling and meet the conditions of the operation constraints. By successfully keeping the dispenser valves in the off position, the strategy demonstrates feasibility under this condition and achieves the expected performance profile for the given operational constraints.

#### 4.2.4. Control Action during Idle Time

It is necessary to report on the system performance during idle time when the compressor is off and there is no vehicle fuelling at the dispenser. The state of the control variables and the pressure in the cascade storage for the lower layer is shown in Figure 10. The results show that the dispenser valves and priority panel valves remain in the off position over the entire control period demonstrating that the MPC strategy for the lower layer remains feasible when there is no inflow or outflow of gas from the cascade storage of the filling station. This indicates that the strategy is sufficiently constrained for all operation scenarios of the CNG filling station.

The proposed two-layer optimisation for the reduction of energy cost and improvement filling efficiency shows a feasibility demonstrated in the results with a significant reduction in energy cost and vehicle filling times. The achieved reduction in the cost of electricity for the CNG fast-fill station by 60.08% can be passed on to consumers on cost per unit because of the lowered cost of gas delivery. Further, shorter filling times are achieved for vehicles fuelling at the station with a median reduction in filling time of 20 s and an average reduction by 16.92 s for all the vehicles through the MPC strategy for the lower layer. Reduced fuelling time is a welcome improvement in fuelling convenience that could serve to maintain existing CNG vehicle customers and lower the level of concern for new CNG vehicle users. The benefits from the optimisation of the two layers can be viewed as complementary to one another, given the cascaded improvement in financial and technical performance of the CNG station that has been realised.

#### 4.3. Sensitivity Analysis

An analysis was carried out to scrutinise the validity of the model’s output under disturbances, which originate from scenarios that alter the input parameters. A random change in the gas demand, which is an important parameter for compressor scheduling, is the most probable source of disturbance for the proposed optimal operation approach and could affect the feasibility of the compressor schedule solution. Consequently, an inspection of the possible effects of random disturbances, implemented as random percentage increase or decrease in hourly gas demand, on the quantity of gas in storage was done. The disturbance demand profiles are shown in Figure 11a.

It is evident in Figure 11b that the solution of the compressor schedule obtained through the optimal scheduling remains valid through the series of variations in hourly gas demand of up to 20%. This means that the limits of the quantity of gas stored in the cascade storage are not violated if the schedule obtained is implemented, even if some variation in demand occur. However, when effecting the optimal schedule solution to the existing station controller, it is necessary to include safety interrupts to tackle circumstances where large disturbances cause a violation of operating limits, as shown in Figure 11b for the 25% variation in demand. These interrupts would correct the violation by either shutting off the compressor outside of schedule when the maximum quantity of gas limit in the cascade storage is reached, or by turning on the compressor outside of schedule when the minimum limit is reached as a result of unexpected gas demand circumstances. The feedback characteristic of the MPC strategy in the lower layer allows for the controller to adapt to disturbances in the system inputs [32], which means that when disturbances in the quantity of gas condition in the cascade storage occur, the controller updates operation control to attain the lower layer objectives.

Table 2 shows the fuelling time for each of the two vehicles in Section 4.2.1 and Section 4.2.2 when gas level disturbances in one of the three cascade storage cylinders are implemented. By feeding back the conditions of the system states to the controller input, the approach allows for new calculation of future control action so as to meet the set optimisation goals. The solutions from the proposed approach to optimal CNG station operation have thus been shown to be valid for the predicted operating conditions as well as under some variations to these conditions.

## 5. Conclusions

Participation of CNG delivery infrastructure in demand response programs not only saves cost for the station operators and CNG users, but it is also a participation in contributing to the wider goals of such programs in increasing grid reliability and efficiency for all electricity users in society. Cities seeking to expand the use of alternative fuels as cleaner means of transportation also need the associated infrastructure to develop responsibly with regard to use of electricity, which is an indispensable resource.

This study provides an expansive perspective of the operation profile of an optimised CNG fast-fill station, which is the major component of gas delivery infrastructure, incorporating both energy savings and pressure conditions management. The proposed approach achieves a huge reduction in the cost of electricity for the CNG fast-fill station, and delivers on shorter filling times for vehicles fuelling at the station. The results demonstrate savings of up to 60.08% in electricity cost for the upper layer as well as average savings of 16.92 s in vehicle fuelling times for the lower layer. Further, the sensitivity analysis shows an ability of the solutions obtained to withstand some disturbances in the inputs, which is important for the station operation reliability.

Implementation of energy cost reduction strategies by energy users should remain sensitive to other performance considerations that may affect the business under consideration. For compressed natural gas vehicle users, vehicle fuelling time cannot be jeopardised as it is one of the main consideration consumers make when deciding on adoption of cleaner gaseous alternative fuels. The study demonstrates that benefits associated with adoption of CNG can be amplified by optimally operating delivery infrastructure with respect to existing demand response programs while simultaneously improving customer convenience. As an introductory study on the implementation of a combined energy cost and filling time optimisation, this study is a timely highlight to an important intersection between different approaches to better use of energy and system performance.

## Author Contributions

The research work and manuscript drafting was done by C.K. under the guidance and supervision of L.Z. and X.X., who also provided critical review of the manuscript.

## Funding

This research received no external funding.

## Conflicts of Interest

The authors declare no conflict of interest.

## Nomenclature

${A}_{orifice}$ | Area of dispenser valve orifice (m^{2}) |

${C}_{d}$ | Co-efficient of discharge of dispenser valve orifice |

${c}_{p}$ | Specific heat capacity of CNG at constant pressure (J/KgK) |

${c}_{v}$ | Specific heat capacity of CNG at constant volume (J/KgK) |

${J}_{U}$ | Objective function of the upper layer |

${J}_{L}$ | Objective function of the lower layer |

m | Mass of gas (kg) |

${m}_{max}$ | Maximum mass of gas for the cascade storage (kg) |

${m}_{min}$ | Minimum mass of gas for the cascade storage (kg) |

${m}_{o}$ | Gas demand (kg) |

${\dot{m}}_{hp}^{max},{\dot{m}}_{mp}^{max},{\dot{m}}_{lp}^{max}$ | Instantaneous mass flow rate from high pressure, medium pressure and low |

pressure reservoirs to vehicle tank (kg/h) | |

${\dot{m}}_{veh}$ | Instantaneous total mass flow rate from cascade storage to vehicle tank (kg/h) |

${\dot{m}}_{co}$ | Compressor outlet mass flow rate (kg/h) |

M | Molar mass (kg) |

$M{w}_{a}$ | Molecular weight of the air (g) |

$M{w}_{g}$ | Molecular weight of the gas (g) |

N | Upper layer control horizon |

${N}_{p}$ | Lower layer model predictive control prediction horizon |

n | Gas quantity (moles) |

P | Pressure (bars) |

${p}_{co}$ | Compressor motor power rating (kW) |

${p}_{e}$ | Price of electricity under TOU tariff (currency/kW h) |

${P}_{hp},{P}_{mp},{P}_{lp}$ | Pressure in high, medium and low pressure reservoirs (bars) |

${P}_{hp}^{max},{P}_{mp}^{max},{P}_{lp}^{max}$ | Maximum pressure for high pressure, medium pressure and low pressure reservoirs (bars) |

${P}_{hp}^{min},{P}_{mp}^{min},{P}_{lp}^{min}$ | Minimum pressure for high pressure, medium pressure and low pressure reservoirs (bars) |

${P}_{T}$ | Target vehicle pressure (bars) |

${P}_{veh}$ | Vehicle pressure (bars) |

${Q}_{std}$ | Capacity of the compressor under standard conditions (Nm^{3}/h) |

R | Universal gas constant (L bar/K mol) |

${t}_{s}$ | Sampling period (s) |

T | Absolute temperature (K) |

u | State of compressor switch |

${v}_{hp},{v}_{mp},{v}_{lp}$ | State of priority panel valves for high pressure, medium pressure and low pressure reservoirs |

${v}_{ohp},{v}_{omp},{v}_{olp}$ | State of dispenser valves for high pressure, medium pressure and low pressure reservoirs |

V | Volume of cascade reservoir tanks (L) |

${V}_{hp},{V}_{mp},{V}_{lp}$ | Volume of high, medium and low pressure reservoirs (L) |

z | Compressibility factor of CNG |

ϱ | Weighting factor for the upper layer |

ς | Weighting factor for the lower layer |

γ | ratio of specific heats |

${\rho}_{a,std}$ | Density of air under standard conditions (kg/m^{3}) |

${\rho}_{hp},{\rho}_{mp},{\rho}_{lp}$ | Density of gas in high pressure, medium pressure and low pressure reservoirs (kg/m^{3}) |

## References

- Davies, J.; Grant, M.; Venezia, J.; Aamidor, J. US Transportation Sector Greenhouse Gas Emissions: Trends, Uncertainties and Methodological Improvements. In TRB 2007 Annual Meeting; Transport Research Board: Washington, DC, USA, 2007. [Google Scholar]
- Yeh, S. An empirical analysis on the adoption of alternative fuel vehicles: The case of natural gas vehicles. Energy Policy
**2007**, 35, 5865–5875. [Google Scholar] [CrossRef] - Ou, X.; Zhang, X.; Zhang, X.; Zhang, Q. Life cycle GHG of NG-based fuel and electric vehicle in China. Energies
**2013**, 6, 2644–2662. [Google Scholar] [CrossRef] - Mikolajková-Alifov, M.; Pettersson, F.; Björklund-Sänkiaho, M.; Saxén, H. A Model of Optimal Gas Supply to a Set of Distributed Consumers. Energies
**2019**, 12, 351. [Google Scholar] [CrossRef] - Kuby, M. The opposite of ubiquitous: How early adopters of fast-filling alt-fuel vehicles adapt to the sparsity of stations. J. Transp. Geogr.
**2019**, 75, 46–57. [Google Scholar] [CrossRef] - Chala, G.; Abd Aziz, A.; Hagos, F. Natural Gas Engine Technologies: Challenges and Energy Sustainability Issue. Energies
**2018**, 11, 2934. [Google Scholar] [CrossRef] - Greene, D.L. Survey evidence on the importance of fuel availability to the choice of alternative fuels and vehicles. Energy Stud. Rev.
**1998**, 8, 215–231. [Google Scholar] [CrossRef] - Newhouse, N.L.; Liss, W.E. Fast Silling of NGV Fuel Containers; Technical Report; SAE Technical Paper; SAE: Warrendale, PA, USA, 1999. [Google Scholar]
- Chen, S.; Xie, G.; LI, Q.; Chang, K. Comparison among LNG, CNG and L-CNG Filling Stations. Gas Heat
**2007**, 7, 006. [Google Scholar] - Khadem, J.; Saadat-Targhi, M.; Farzaneh-Gord, M. Mathematical modeling of fast filling process at CNG refueling stations considering connecting pipes. J. Nat. Gas Sci. Eng.
**2015**, 26, 176–184. [Google Scholar] [CrossRef] - Albadi, M.H.; El-Saadany, E. A summary of demand response in electricity markets. Electr. Power Syst. Res.
**2008**, 78, 1989–1996. [Google Scholar] [CrossRef] - Kagiri, C.; Zhang, L.; Xia, X. Optimal energy cost management of a CNG fuelling station. In Proceedings of the Control Conference Africa, Johannesburg, South Africa, 7–8 December 2017; Volume 50, pp. 94–97. [Google Scholar]
- Khamforoush, M.; Moosavi, R.; Hatami, T. Compressed natural gas behavior in a natural gas vehicle fuel tank during fast filling process: Mathematical modeling, thermodynamic analysis, and optimization. J. Nat. Gas Sci. Eng.
**2014**, 20, 121–131. [Google Scholar] [CrossRef] - Kountz, K.; Blazek, C.; Liss, W. A new natural gas dispenser control system. In International Gas Research Conference; Government Institutes Inc.: Rockville, MD, USA, 1998; Volume 4, pp. 135–145. [Google Scholar]
- Kountz, K.J.; Blazek, C.F.; Christopher, F. NGV Fuelling Station and Dispenser Control Systems; Technical Report; Gas Research Institute: Chicago, IL, USA, 1997. [Google Scholar]
- Kountz, K. Modeling the fast fill process in natural gas vehicle storage cylinders. In 207th ACS National Meeting-Division of Fuel Chemistry; American Chemical Society: San Diego, CA, USA, 1994. [Google Scholar]
- Farzaneh-Gord, M. Compressed natural gas-Single reservoir filling process. Int. Gas Eng. Manag.
**2008**, 48, 16–18. [Google Scholar] - Thomas, G.; Goulding, J.; Munteam, C. Measurement, Approval and Verification of CNG Dispensers; Technical Report; National Weights and Measures Laboratory: London, UK, 1999.
- Farzaneh-gord, M.; Hashemi, S.; Farzaneh-kord, A. Thermodynamics Analysis of Cascade Reserviors Filling Process of Natural Gas Vehicle Cylinders. World Appl. Sci.
**2008**, 5, 143–149. [Google Scholar] - Deymi-Dashtebayaz, M.; Gord, M.F.; Rahbari, H.R. Studying transmission of fuel storage bank to NGV cylinder in CNG fast filling station. J. Braz. Soc. Mech. Sci. Eng.
**2012**, 34, 429–435. [Google Scholar] [CrossRef] - Frick, M.; Axhausen, K.W.; Carle, G.; Wokaun, A. Optimization of the distribution of compressed natural gas (CNG) refueling stations: Swiss case studies. Transp. Res. Part D Transp. Environ.
**2007**, 12, 10–22. [Google Scholar] [CrossRef] - Bang, H.J.; Stockar, S.; Muratori, M.; Rizzoni, G. Modeling and analysis of a CNG residential refueling system. In ASME 2014 Dynamic Systems and Control Conference; American Society of Mechanical Engineers: New York, NY, USA, 2014. [Google Scholar]
- Smith, M.; Gonzales, J. Costs Associated with Compressed Natural Gas Vehicle Fueling Infrastructure; Technical Report; National Renewable Energy Laboratory (NREL): Golden, CO, USA, 2014.
- Kagiri, C.; Zhang, L.; Xia, X. Compressor and priority panel optimization for an energy efficient CNG fuelling station. In Proceedings of the IEEE 11th Asian Control Conference (ASCC), Gold Coast, QLD, Australia, 17–20 December 2017; pp. 2200–2203. [Google Scholar]
- Xia, X.; Zhang, J.; Cass, W. Energy management of commercial buildings—A case study from a POET perspective of energy efficiency. J. Energy S. Afr.
**2012**, 23, 23–31. [Google Scholar] - Spees, K.; Lave, L.B. Demand response and electricity market efficiency. Electr. J.
**2007**, 20, 69–85. [Google Scholar] [CrossRef] - Xia, X.; Zhang, L. Industrial energy systems in view of energy efficiency and operation control. Annu. Rev. Control
**2016**, 42, 299–308. [Google Scholar] [CrossRef] - Kagiri, C.; Zhang, L.; Xia, X. Optimization of a compressed natural gas station operation to minimize energy cost. In Proceedings of the 9th International Conference on Applied Energy, Cardiff, UK, 21–24 August 2017; pp. 2003–2008. [Google Scholar]
- Kagiri, C.; Wanjiru, E.M.; Zhang, L.; Xia, X. Optimized response to electricity time-of-use tariff of a compressed natural gas fuelling station. Appl. Energy
**2018**, 222, 244–256. [Google Scholar] [CrossRef] - Allgöwer, F.; Zheng, A. Nonlinear Model Predictive Control; Birkhäuser: Basel, Switzerland, 2012; Volume 26. [Google Scholar]
- Qin, S.J.; Badgwell, T.A. A survey of industrial model predictive control technology. Control Eng. Pract.
**2003**, 11, 733–764. [Google Scholar] [CrossRef] - Xia, X.; Zhang, J. Operation efficiency optimisation modelling and application of model predictive control. IEEE/CAA J. Autom. Sin.
**2015**, 2, 166–172. [Google Scholar] - Kountz, K.J.; Liss, W.E.; Blazek, C.F. Automated Process and System for Dispensing Compressed Natural Gas. U.S. Patent 5,810,058, 22 September 1998. [Google Scholar]
- Shipley, E. Study of Natural Gas Vehicles (NGV) during the Fast Fill Process. Master’s Thesis, West Virginia University, Morgantown, WV, USA, 2002. [Google Scholar]
- Nguyen, H.H.; Uraikul, V.; Chan, C.W.; Tontiwachwuthikul, P. A comparison of automation techniques for optimization of compressor scheduling. Adv. Eng. Softw.
**2008**, 39, 178–188. [Google Scholar] [CrossRef] - Nguyen, H.H.; Chan, C.W. Applications of artificial intelligence for optimization of compressor scheduling. Eng. Appl. Artif. Intell.
**2006**, 19, 113–126. [Google Scholar] [CrossRef] - Mathaba, T.; Xia, X.; Zhang, J. Analysing the economic benefit of electricity price forecast in industrial load scheduling. Electr. Power Syst. Res.
**2014**, 116, 158–165. [Google Scholar] [CrossRef] - Wanjiru, E.M.; Xia, X. Energy-water optimization model incorporating rooftop water harvesting for lawn irrigation. Appl. Energy
**2015**, 160, 521–531. [Google Scholar] [CrossRef] - Saadat-Targhi, M.; Khadem, J.; Farzaneh-Gord, M. Thermodynamic analysis of a CNG refueling station considering the reciprocating compressor. J. Nat. Gas Sci. Eng.
**2016**, 29, 453–461. [Google Scholar] [CrossRef] - Calvert, J.G. Glossary of atmospheric chemistry terms (Recommendations 1990). Pure Appl. Chem.
**1990**, 62, 2167–2219. [Google Scholar] [CrossRef] - Farzaneh-Gord, M.; Deymi-Dashtebayaz, M. Optimizing natural gas fueling station reservoirs pressure based on ideal gas model. Pol. J. Chem. Technol.
**2013**, 15, 88–96. [Google Scholar] [CrossRef] - Cilliers, C.; van der Zee, L.; Kleingeld, M. Cost savings on mine dewatering pumps by reducing preparation-and comeback loads. In Proceedings of the IEEE International Conference on the Industrial and Commercial Use of Energy (ICUE), Cape Town, South Africa, 19–20 August 2014; pp. 1–8. [Google Scholar]
- Cilliers, C. Cost Savings on Mine Dewatering Pumps by Reducing Preparation- and Comeback Loads. Master’s Thesis, North West University, Potchefstroom, South Africa, 2014. [Google Scholar]
- van Tonder, A.; Kleingeld, M.; Marais, J. Investigating demand response potential in a mining group. In Proceedings of the IEEE Industrial and Commercial Use of Energy Conference (ICUE), Cape Town, South Africa, 20–21 August 2013; pp. 1–5. [Google Scholar]

Parameter | Value |
---|---|

${\rho}_{a,std}$ | 1.225 kg/m^{3} |

${C}_{d}$ | 0.61 |

$\gamma $ | 1.304 |

$M{w}_{a}$ | 0.028966 g |

$M{w}_{g}$ | 0.0164 g |

R | 0.083145 LbarK^{−1}mol^{−1} |

T | 294.15 K |

Gas Level Disturbance | 4th Vehicle(s) | 38th Vehicle(s) |
---|---|---|

5% | 200 | 200 |

10% | 200 | 200 |

15% | 200 | 200 |

20% | 200 | 200 |

© 2019 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (http://creativecommons.org/licenses/by/4.0/).