Maker Pro
Particle

Detecting Unstable Electrical Grid with TinyML

June 12, 2022 by Alex Miller
Share
banner

How to apply a TinyML approach to prevent electrical grid overloads.

Hardware

Software

1 Neuton Tiny ML Neuton
1 Particle Build Web IDE

Introduction

Electricity is the heart of modern social and economic development. More and more countries strive to transfer to sustainable energy systems, which is quite a challenging process, as it causes increasingly unstable power generation and grid overloads. The unstable electrical grid can endanger people's lives and the safety of their property. This means that power systems should undergo timely monitoring and optimization, which AI and machine learning can easily handle.

In fact, artificial intelligence has become an essential tool in the power industry. It provides unique self-learning solutions for energy consumption analysis and grid monitoring under dynamically changing circumstances. In this project, we’ll explore how to leverage a machine learning model for efficient monitoring of the electrical grid as shown on the video.

Renewable Energy Sources & Smart EconomyThe ascent of renewable energy sources provide the global community with a much demanded alternative to traditional, finite, and climate-unfriendly fossil fuels. However, their adoption poses a set of new paradigms, the two of which deserve particular attention:

  • , end-users (households and enterprises) now not only consume energy but have the ability to produce and supply it. Also, for a reliable ecosystem, people need to ensure that energy grids are smarter and equipped with accurate detection of threats and faults.
  • becomes not only a concern but a major requirement.

Put simply, the objective is to understand and plan for both energy production and/or consumption disturbances and fluctuations introduced by system participants in a dynamic way, taking into consideration not only technical aspects but also how participants respond to changes in the associated economic aspects (energy costs).

The Challenges of Applying AI to Smart Electric Grids

  • there aren’t enough data samples that meet the requirements of diverse AI technology applications, and sample collection can be a time-consuming process.
  • although AI technology applied to power systems demonstrates high levels of problem identification, it doesn’t always meet the requirements of practical application.
  • applying AI is based on abundant data samples, advanced computing power, and distributed communication collaboration. However, the supporting capacity and level of relevant infrastructure resources such as quick production AI algorithms, and distributed collaboration platforms need improvement.
  • compared to perception, prediction, and security maintenance, algorithm adaptability of AI in power systems is still weak.

In this project, we will explore how we can predict electric grid stability with a free platform, Neuton TinyML, and an integrated IoT Platform-as-a-Service, Particle IoT that helps to deploy software applications to connected devices, from edge to cloud and back.

Also, we will explore the communication infrastructure for such electric grid operations. With the combined knowledge of AI and IoT, we will try to solve some parts of the above-mentioned challenges.

The original dataset contains 10, 000 observations. It also contains 12 primary predictive features and two dependent variables.

Predictive features:

  • 'tau1' to 'tau4': the reaction time of each network participant, a real value within the range 0.5 to 10 ('tau1' corresponds to the supplier node, 'tau2' to 'tau4' to the consumer nodes);
  • 'p1' to 'p4': nominal power produced (positive) or consumed (negative) by each network participant, a real value within the range -2.0 to -0.5 for consumers ('p2' to 'p4'). As the total power consumed equals the total power generated, p1 (supplier node) = - (p2 + p3 + p4);
  • 'g1' to 'g4': price elasticity coefficient for each network participant, a real value within the range 0.05 to 1.00 ('g1' corresponds to the supplier node, 'g2' to 'g4' to the consumer nodes; 'g' stands for 'gamma');

Dependent variables:

  • 'stab': the maximum real part of the characteristic differentia equation root (if positive, the system is linearly unstable; if negative, linearly stable);
  • 'stabf': a categorical (binary) label ('stable' or 'unstable').

As there is a direct relationship between 'stab' and 'stabf', 'stab' will be dropped and 'stabf' will remain as the sole dependent variable. Here is the link to the dataset:https://archive.ics.uci.edu/ml/datasets/Electrical+Grid+Stability+Simulated+Data+

On the Neuton platform, we will upload the dataset for our use case and select 'stabf' as the target variable.

In the training parameters, set the Input data type FLOAT32 andNormalization type "Unique scale for each feature". Then proceed to model training.

Step 2: Training and Exploratory Data Analysis

Once the training has started, we see the model data analysis which helps us to understand the close relationship between the original dependent and independent variables.

Correlation:

It is important to verify the correlation between each numerical feature and the dependent variable, as well as the correlation among numerical features leading to potential undesired collinearity. The heatmap below provides an overview of the correlation between the dependent variable ('stabf' or 'target') and the top 10 numerical features with the highest binary correlation to the target.

After the training is over, we can see the model metrics: the model accuracy is 0.921435!

We can also see the classification performance using the generated confusion matrix.

Download the model for further deployment on our IoT device.

We have selected the Particle Argon board for this project (although you can use any Particle board without the need to reprogram each board). The Particle Argon is a powerful Wi-Fi development kit that you can use on Wi-Fi networks.

Equipped with the Nordic nRF52840 and Espressif ESP32 processors, the Argon has built-in battery charging circuitry which makes it easier to connect a Li-Po battery and 20 mixed-signal GPIOs to interface with sensors, actuators, and other electronics.

Particle IoT boards are secure and fully equipped to allow Smart Grid Infrastructure to deliver data and updates on grid failures at a faster and cheaper rate.

Setting up Particle IDEand Workbench:

Add your downloaded Neuton model inside the Particle Workbench project folder. Your folder structure will look like this (checksum, parser, protocol, application and StatFunctions) These files are required to make predictions on data received over serial communication using the CSV uploader tool.

Here is the most important function:

Compile the application in the cloud or locally. Once compiled, you are ready to flash it to your device. Make sure you have selected the correct Particle OS for your device.

CSV data upload utility:

We are going to test our predictions by sending the test data features from our test dataset CSV file over a USB serial port.

  • Install dependencies,
  • Clone this repo,
  • Run “make” to build the binaries,

Once it's done, you can send the CSV file over USB.

The prediction is printed on the Particle IoT cloud.

Monitoring the stability of the electrical grid helps to reveal "unreliable" energy sources and avoid serious damage. The best strategy for such AI+IoT projects is not only making predictions but also collecting and reporting data in order to improve models for future devices like Particle and make OTA updates easier.

Related Content

Comments


You May Also Like