With SAS Analytics for IoT, you can analyze real-time streaming data to monitor energy consumption, equipment operations, lighting, and heating, ventilation and air conditioning (HVAC) systems to improve operational efficiencies. This drives business outcomes such as lower downtime, lower cost, and sustainability.
In this example we will use data from a smart parking lot with six floodlights. It consists of energy consumption (kW) values captured every five minutes from these floodlight circuits over a span of three months.
We will use the Subspace tracking (SST) algorithm packaged in SAS Event Stream Processing Studio (included in the SAS Analytics for IoT solution) to detect the outliers in real-time using streaming data. We frequently use SST in the IoT world when data is gathered from many sensors that are connected to each other and have high correlation. SST detects anomalies and system degradation in systems that generate high-frequency, high-dimensional data. It can also be used for data containing a single measure for sensors from various devices operating under similar conditions (e.g., energy output from multiple panels in a Solar farm), or multiple measures for sensors from a single device operating under similar conditions (e.g., turbofan in an aircraft).
Let's get started
This example takes you through the workflow to build an anomaly detection model using capabilities within SAS Analytics for IoT.
Data description
Our first step is to better understand our data. Each light circuit has sensors that measures the energy consumption of the floodlights which can be used for operational efficiency, energy savings, and monitoring usage.
Data exploration
Next, we’ll analyze the first 16 days of the data in SAS Visual Analytics. In Figure 1, we see that the energy consumption throughout the day is zero because the lights are off during the day. Light 2 has a dip in energy consumption for a couple of hours on the sixth night, indicating one of the lights controlled by the circuit was not functioning properly. During day 15, all lights have a spike in energy consumption during the day. A storm occurred on that day, creating enough darkness to trigger the lights to come on briefly. Just looking at the data it can be determined that there was no malfunction in the lights, saving any maintenance cost.
From analyzing the most recent 16 days of the data, Figure 2, we see that Light 4 starts to have many dips in energy consumption in the last 11 nights. Several of the lights on this circuit are starting to fail. Additionally, Light 5 dips in energy consumption, especially on the second-last night. This indicates that problems are occurring in this circuit as well and might need part replacement. The sooner we detect the issue the lower will be the floodlight downtime.
Building a streaming model
So far, the analysis has been done on static data. But how do we detect malfunctioning floodlights in real-time?
ESP Studio provides in-stream learning models to make real time decisions. For this example, we will use the SST method. SST is a streaming analytics method which converts a set of correlated variables to a set of linearly uncorrelated variables known as principal components. Because the first few principal components usually capture most of the variability in the data, they can be tracked over time to assess whether any changes have taken place in the subspace that is spanned by the data. We can use SST to detect malfunctioning circuits in the floodlights by tracking angle changes between principal components or by using principal component distances away from the mean.
Figure 3 shows the model built in ESP Studio.
Result interpretation
Our last step is to interpret the results. To do this, we can plot the output using SAS Visual Analytics. It shows the first principal component that is obtained after applying the SST method over the sliding windows of data.
This plot can help determine which floodlight circuits are malfunctioning. SST can give you a relatively clear indication of which part of the system is getting out of control.
Figure 5 displays the angle change of the first principal component between consecutive windows.
This method can help identify the issues in real time. Decisions can be put into place to trigger maintenance activities when the angle change value is above an acceptable level for more cost effective and energy efficient lighting system.
Summary
We can build in-stream models using the Subspace tracking (SST) algorithm. It can monitor the system in real-time to identify and alert on faulty lights. This method can be used in other systems like HVAC, solar farm, wind turbines, etc. that generate high-frequency, high-dimensional data to detect anomalies and degradation in real-time.
Download the files to try it yourself!
The CSV file for data and XML model file are available along with step by step instructions in GitHub.
Sources and more information
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
Data Literacy is for all, even absolute beginners. Jump on board with this free e-learning and boost your career prospects.