Over a given discretized time frame *T*, a given power profile is characterized by an aggregated effect of several loads. In particular we are given the power profile as series of P-Q (active and reactive) points *p*_{t} and *q*_{t},∀*t*∈*T*. We are given a set of controllable electrical loads *L* each characterized by a nominal power *p*_{l} and a nominal reactive power *q*_{l},∀*l*∈*L*. We are also given an invariant representative dataset of non-controllable profiles *S* that are used to represent the contribution of the uncontrollable component of the power profile, each characterized by a given P-Q power point at time *t* defined by *p*_{s,t} and *q*_{s,t}. The NILM problem consists in determining at which moment in time load *l* was absorbing power and which combination of power profile *s* is the most appropriate to represent non-controllable loads.

### Mixed integer quadratic problem (MIQP) formulation

Let *x*_{l,t}∈{0,1} be the controllable load variables (i.e. *x*_{l,t} takes value 1 if load *l* is estimated to absorb power at time *t*), *y*_{s}∈[0,1] be the non-controllable profile selection variables (note *y*_{s} is a continuous variable and can therefore represent the selection of any convenient fraction of the representative non-controllable load profile *s*). Let *w**p*_{t} and *w**q*_{t} be auxiliary variables used to represent the estimation error at time *t*.

$$\begin{array}{*{20}l} z = & \min \sum_{t \in T} (wp^{2}_{t} + wq^{2}_{t}) \end{array} $$

(1)

$$\begin{array}{*{20}l} & wp_{t} = \left | p_{t} - \sum_{l \in L} p_{l} \cdot x_{l,t} - \sum_{s \in S} p_{s,t} \cdot y_{s} \right|\qquad\qquad\qquad\forall t \in T \end{array} $$

(2)

$$\begin{array}{*{20}l} & wq_{t} = \left | q_{t} - \sum_{l \in L} q_{l} \cdot x_{l,t} - \sum_{s \in S} q_{s,t} \cdot y_{s} \right|\qquad\qquad\qquad\forall t \in T \end{array} $$

(3)

$$\begin{array}{*{20}l} & \sum_{s \in S} y_{s} = 1 \end{array} $$

(4)

$$\begin{array}{*{20}l} & x_{l,t} \in \{0,1\} \qquad\forall l \in L, t \in T \end{array} $$

(5)

$$\begin{array}{*{20}l} & y_{s} \in [0,1] \qquad \quad \forall s \in S \end{array} $$

(6)

Objective (1) is a convenient formulation to minimize the RMS error between the given power profile *p*_{t} and *q*_{t} and the aggregation of controllable and non controllable loads. Constraints (2) and (3) compute the absolute error as the difference between the meter reading *p*_{t} and *q*_{t} and the estimated contribution of loads *l*∈*L* and the reference power profiles *s*∈*S* at time *t*. Constraints (4) ensure that a convex combination of reference power profiles is selected.

Each controllable load *l* is connected to an actuation device and sometimes the metering infrastructure is able to provide, together with the regular power metering measurements, the status of the actuation device as an additional data series. Let *u*_{l,t}∈{0,1},∀*l*∈*L*,*t*∈*T* be the representation of the state of the actuation device: 1, if the load *l* is connected to the grid, i.e. it can absorb power, at time *t*, 0 otherwise. We can conveniently exploit this knowledge in the MIQP formulation by setting upper bounds to variables *x*_{l,t} as follows:

$$\begin{array}{*{20}l} & x_{l,t} \leq u_{l,t}\qquad\qquad\qquad \forall l \in L, t \in T \end{array} $$

(7)

The MIQP formulation can be further improved by the analysis of the type of electrical loads to be monitored. Indeed, some of the controllable electrical loads *l* are used to heat materials characterized by a considerable inertia (e.g. water, air, concrete and furnitures). We can incorporate this knowledge in MIQP. First, we have to capture the state change (first derivative) by adding continuous auxiliary variables 0≤*f*_{l,t}≤1,*l*∈*L*,*t*∈*T*∖*t*_{0} that are linked with expected activation variables *x*_{l,t}, then we limit the total number of state changes as follows:

$$\begin{array}{*{20}l} & f_{l,t} \geq x_{l,t} - x_{l,t-1}\qquad\qquad\qquad \forall l \in L, t \in T \setminus{t_{0}} \end{array} $$

(8)

$$\begin{array}{*{20}l} & \sum_{t \in T\setminus{t_{0}}} f_{l,t} \leq \theta_{l}\qquad\qquad\qquad \forall l \in L \end{array} $$

(9)

with the set of constraints (8) and (9) we ensure that the expected number of activations of the electrical load *l* is limited by a constant *θ*_{l}.

### Photovoltaic non intrusive monitoring

In presence of PV installations, their power production can be absorbed by local electrical loads in what is commonly referred as *self-consumption*. In such cases, the metering infrastructure records the net power consumption only. While PV installations may have a dedicated monitoring infrastructure and the load power profile can be easily computed, more and more installations are not monitored as the PV production is no more subsidized in many countries. This is the case of the PV installation in the LIC area. Figure 2 illustrates the case where some loads activate during the period when PV is producing power.

When the PV installations are not monitored, the methodologies for NILM must be enriched in order to account for PV production. One possibility is to enlarge the set of uncontrollable load profiles *S* with power profiles accounting for PV production, i.e. power profiles with negative values corresponding to the estimated PV production. This approach has been adopted in (Sossan et al. 2018; Nespoli and Medici 2017).

Another approach is to exploit global horizontal irradiance (GHI) data coming from weather services and estimate the PV power production based on each installation’s nominal data (nominal ac and dc power). In order to do so, software libraries are normally used. One popular software library is PvLib, a community supported tool that provides a set of functions and classes for simulating the performance of photovoltaic energy systems (Holmgren et al. 2018). This latter approach is usually more accurate than the first one in case weather and nominal data are accurate. In our case, accurate weather data is not available. Therefore we reconstruct an approximation of the global irradiance data exploiting the metering data of all installations that are close to one another. The rationale behind this approach is that not all major loads are absorbing power simultaneously and the effect of PV installations is directly visible in the metering data.

Let *H* be the set of metering infrastructures reading neighbourhood households equipped with PV installations, *p*_{t,h} identifies the power reading at time *t*∈*T* of household *h*∈*H*. Let *G**C*_{t} be the global irradiance in clear sky conditions at time *t*∈*T*, computed using PvLib. Let \(\hat {p}_{t,h}\) be an upper bound on the power production of the PV installation of household *h* computed with PvLib using the known nominal data of the installation and the global irradiance with clear sky conditions and *r*_{t,h} be the ratio between the upper bound and the negative portion of the power reading limited by an upper bound \(\hat {r}\) (equal to 1.1 in our tests to allow for some additional freedom) and \(\hat {r}_{t}\) be the maximum of such ratios for *t*∈*T*:

$$\begin{array}{*{20}l} & r_{t,h} = \min\{\hat{r}, \min\{0,p_{t,h}\}/\hat{p}_{t,h}\}\qquad\qquad\qquad \forall t \in T, h \in H \end{array} $$

(10)

$$\begin{array}{*{20}l} & r_{t} = \max_{h \in H} \{r_{t,h}\}\qquad\qquad\qquad \forall t \in T \end{array} $$

(11)

Using *r*_{t} we approximate the global irradiance \(\tilde {I}_{t}\) as a fraction of the clear sky global irradiance *G**C*_{t} and estimate the PV installation power production \(\tilde {p}_{t,h}\) of household *h* with PvLib.

$$\begin{array}{*{20}l} & \tilde{I}_{t} = GC_{t} \cdot r_{t}\qquad\qquad\qquad \forall t \in T \end{array} $$

(12)