|
| 1 | +# Electrical Load Identification |
| 2 | + |
| 3 | +This application is a prototype of **Electrical Load Identification** designed on ARC Iot DK, which can identify the type of appliance according to the current waveform, and display it through OLED. The analog signal of **current** is collected by **Current Transformer(CT)**, then converted into digital signal by **A/D(AD7991)**. The data is input to **ARC IoT DK** for data preprocessing, then the processed data is input to **Convolutional Neural Network(CNN)** for classification. Finally, the current type of electrical appliances is displayed on **OLED**. |
| 4 | + |
| 5 | +----------------------------------------- |
| 6 | + |
| 7 | +- [Electrical Load Identification](#electrical-load-identification) |
| 8 | + - [Introduction](#introduction) |
| 9 | + - [Function](#function) |
| 10 | + - [Appearance](#appearance) |
| 11 | + - [Video](#video) |
| 12 | + - [Hardware and Software Setup](#hardware-and-software-setup) |
| 13 | + - [Required Hardware](#required-hardware) |
| 14 | + - [Necessary Hardware](#necessary-hardware3) |
| 15 | + - [Required Software](#required-software) |
| 16 | + - [Hardware Connection](#hardware-connection) |
| 17 | + - [User Manual](#user-manual) |
| 18 | + - [Before Running This Application](#before-running-this-application) |
| 19 | + - [Run This Application](#run-this-application) |
| 20 | + - [Makefile](#makefile) |
| 21 | + - [Program flow chart](#program-flow-chart) |
| 22 | + - [Model](#model) |
| 23 | + - [Data Processing](#data-processing) |
| 24 | + - [OLED Display](#oled-display) |
| 25 | + |
| 26 | + |
| 27 | +------------------------------- |
| 28 | + |
| 29 | +## Introduction |
| 30 | +Non-intrusive load monitoring (NILM) is a conceptual framework for the development of power systems. Compared with traditional load monitoring methods, non-intrusive load monitoring is more intelligent. </br>NILM collects current and voltage signals during load operation by installing signal sensors at the entrance of sockets, then transfers the data to Iot DK development board, and carries out load identification through CNN built by ARC MLI library.</br>Users can make statistics and analysis of household energy consumption data, which can help users make rational use of electricity and reduce unnecessary losses. |
| 31 | + |
| 32 | +### Function |
| 33 | +* Identifying Electrical Appliances. *At present, it can identify three kinds of electrical appliances and their two previous combinations (hot water kettle, electric fan, mobile phone charger)* |
| 34 | +* Display the current types of electrical appliances |
| 35 | + |
| 36 | + |
| 37 | +### Appearance |
| 38 | +* **System View**</br> |
| 39 | +![System Overall][1] |
| 40 | + |
| 41 | + |
| 42 | +### Video |
| 43 | +[ Electrical Load Identification demo video ][2] |
| 44 | + |
| 45 | +## Hardware and Software Setup |
| 46 | + |
| 47 | +------------------------------- |
| 48 | +### Required Hardware |
| 49 | +* Necessary Hardware: |
| 50 | + - ARC IoT Development Kit(IoT DK) *1 |
| 51 | + - AD7991 *1 |
| 52 | + - ZMCT103C *1 |
| 53 | + - OLED(12864) *1 |
| 54 | + |
| 55 | +![Necessary Hardware][3] |
| 56 | +-------------------------------- |
| 57 | + |
| 58 | +--------------------------------- |
| 59 | + |
| 60 | +### Required Software |
| 61 | +* ARC GNU Toolchain 2019.03 |
| 62 | +* embarc_osp(Branch:embarc_mli): https://github.com/foss-for-synopsys-dwc-arc-processors/embarc_osp.git |
| 63 | +* Serial port terminal, such as SecureCRT or Xshell |
| 64 | +* Python3.6 |
| 65 | +* Pycharm |
| 66 | +* Tensorflow 1.13.1 |
| 67 | + |
| 68 | +### Hardware Connection |
| 69 | +1. Connect AD7991 module to IoT DK 2x18 Pin Extension Header(Using IIC0 interface). |
| 70 | +2. Connect analog output of current sensor to AD7991 CH1 channel. |
| 71 | +3. Connect OLED module to IoT DK 2x18 Pin Extension Header(Using IIC1 interface). |
| 72 | +4. Make sure your power regulator connect is correct,including the voltage and polarity. |
| 73 | +5. After all connector has been connected correctly,connect the Li-po battery to power up the design. |
| 74 | + |
| 75 | +## User Manual |
| 76 | + |
| 77 | +### Before Running This Application |
| 78 | +* Download source code of Electrical Load Identification from github. |
| 79 | +* Make sure all connection is correct again. |
| 80 | +* Passing Zero or Fire Wire of Socket Wire through Current Transformer. |
| 81 | + |
| 82 | + |
| 83 | +### Run This Application |
| 84 | +Here take IoT DK, CUR_CORE = arcem9d with ARC GNU Toolchain 2019.03 for example to show how to run this application. |
| 85 | +1. To build this applicaiton, select the proper board version, core configuration and build with selected toolchain using this command `make BOARD=iotdk BD_VER=10 CUR_CORE=arcem9d TOOLCHAIN=gnu run`. |
| 86 | +2. Open your serial terminal such as Tera-Term on PC, and configure it to right COM port and 115200bps. |
| 87 | +3. Interact using IoT DK and serial port terminal. |
| 88 | + |
| 89 | +#### Makefile |
| 90 | + |
| 91 | +- Selected embarc_mli here, then you can use [embarc_mli API][4] in your application: |
| 92 | + |
| 93 | +>> # Library |
| 94 | +>> LIB_SEL = embarc_mli |
| 95 | +
|
| 96 | +- Selected u8glib here, then you can use [u8glib API][5] in your application: |
| 97 | + |
| 98 | +>> # Middleware |
| 99 | +>> MID_SEL = common u8glib |
| 100 | +
|
| 101 | +- Selected AD7991 here: |
| 102 | + |
| 103 | +>> # Device |
| 104 | +>> EXT_DEV_LIST += adc/ad7991 |
| 105 | +
|
| 106 | +- Other Configure: |
| 107 | + |
| 108 | +>> # use -Hpurge option to optimize the code size |
| 109 | +>> ifeq ($(TOOLCHAIN), gnu) |
| 110 | +>> ADT_COPT += -ffunction-sections -fdata-sections |
| 111 | +>> ADT_LOPT += -Wl,--gc-sections |
| 112 | +>> else |
| 113 | +>> ADT_COPT += -Hpurge |
| 114 | +>> ADT_LOPT += -Hpurge |
| 115 | +>> endif |
| 116 | +
|
| 117 | + |
| 118 | +- Target options about EMSK and toolchain: |
| 119 | + |
| 120 | +>> TOOLCHAIN=gnu |
| 121 | +>> BOARD=iotdk |
| 122 | +>> BD_VER=10 |
| 123 | +>> CUR_CORE=arcem9d |
| 124 | +
|
| 125 | +- The relative series of the root directory, here the path of the Makefile is `./embarc_osp/application/electrical_load_identification/makefile`: |
| 126 | + |
| 127 | +>> # |
| 128 | +>> # root dir of embARC |
| 129 | +>> # |
| 130 | +>> EMBARC_ROOT = ../.. |
| 131 | +
|
| 132 | +- Directories of source files and header files, notice that it **is not recursive**: |
| 133 | + |
| 134 | +>> # application source dirs |
| 135 | +>> APPL_CSRC_DIR = . model |
| 136 | +>> APPL_ASMSRC_DIR = . |
| 137 | +
|
| 138 | +>> # application include dirs |
| 139 | +>> APPL_INC_DIR = . model |
| 140 | +>> APPL_DEFINES = APPL_DEFINES = -DUSE_APPL_MEM_CONFIG -DV2DSP_XY -DMODEL_BIT_DEPTH=16 -g |
| 141 | +
|
| 142 | + |
| 143 | +See [ embARC Example User Guide][6], **"Options to Hard-Code in the Application Makefile"** for more detailed information about **Makefile Options**. |
| 144 | + |
| 145 | +#### Program flow chart |
| 146 | +![Program flow chart][7] |
| 147 | + |
| 148 | + |
| 149 | + |
| 150 | + |
| 151 | +#### Model |
| 152 | + |
| 153 | +Placing the model source code in `./model` folder. |
| 154 | +Placing the C source and header file. |
| 155 | + |
| 156 | +| folder/file | Function | |
| 157 | +| ---------------------------------- | -------------------------------- | |
| 158 | +| load_identification_coefficients.c | Define weights and biases of CNN | |
| 159 | +| load_identification_constants.h | Define Constants of CNN | |
| 160 | +| load_identification_model.c | Define the structure of CNN | |
| 161 | +| load_identification_model.h | the header of CNN model | |
| 162 | +![Structural Chart of CNN Model][8] |
| 163 | + |
| 164 | +#### Data Processing |
| 165 | + |
| 166 | +Placing the data processing source code in `./` folder. |
| 167 | +Placing the C source and hearder file. |
| 168 | + |
| 169 | +| folder/file | Function | |
| 170 | +| -------------- | -------------------------------------------------- | |
| 171 | +| process.c | Processing the results input to CNN and CNN output | |
| 172 | +| process.h | the header of process | |
| 173 | +| input_buffer.c | Save collected current data | |
| 174 | +| input_buffer.h | the hearder of input_buffer | |
| 175 | + |
| 176 | + |
| 177 | +#### OLED Display |
| 178 | + |
| 179 | +Placing the INCLUDE source code in `./` folder. |
| 180 | +Placing the C source and header file. |
| 181 | + |
| 182 | +| folder/file | Function | |
| 183 | +| -------------------- | ------------------------------- | |
| 184 | +| oled_display.c | OLED display interface function | |
| 185 | +| oled_display.h | the hearder of oled_display | |
| 186 | +| ssd1306_app_config.h | Definition of OLED Interface | |
| 187 | + |
| 188 | + |
| 189 | +[1]: ./doc/pic/system.jpg |
| 190 | +[2]: https://v.youku.com/v_show/id_XNDI5MTM3MjQ4OA==.html?spm=a2h3j.8428770.3416059.1 "Electrical Load Identification" |
| 191 | +[3]: ./doc/pic/hardware.jpg |
| 192 | +[4]: https://embarc.org/embarc_mli/doc/build/html/index.html |
| 193 | +[5]: https://github.com/olikraus/u8glib/wiki |
| 194 | +[6]: https://embarc.org/embarc_osp/doc/build/html/index.html |
| 195 | +[7]: ./doc/pic/prog_chart.jpg |
| 196 | +[8]: ./doc/pic/CNN_graph.jpg |
| 197 | + |
0 commit comments