Vous êtes sur la page 1sur 6

APPENDICES

APPENDIX A

Source Code

#include <LiquidCrystal.h>

LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

int pin = 13;

int relay_1 = 7;

int relay_2 = 8;

float rads = 57.29577951; // 1 radian = approx 57 deg.

float degree = 360;

float frequency = 60;

float nano = 1 * pow (10, -6); // Multiplication factor to convert nano seconds into
seconds

// Define floats to contain calculations

float pf;

float angle;

float pf_max = 0;

float angle_max = 0;

int ctr;
65

void setup()

pinMode(pin, INPUT);

pinMode(relay_1, OUTPUT);

pinMode(relay_2, OUTPUT);

Serial.begin(9600);

lcd.begin(16, 2);

void loop() {

//calculation of the input pulse from the XOR gate.

for (ctr = 0; ctr <= 4; ctr++) // Perform 4 measurements then reset

// 1st line calculates the phase angle in degrees from differentiated time pulse

// Function COS uses radians not Degree's hence conversion made by dividing
angle / 57.2958

angle = ((((pulseIn(pin, HIGH)) * nano) * degree) * frequency);

pf = cos(angle / rads);

if (angle > angle_max) // Test if the angle is maximum angle

angle_max = angle; // If maximum record in variable "angle_max"

pf_max = cos(angle_max / rads); // Calc PF from "angle_max"

}
66

if (angle_max > 360) // If the calculation is higher than 360 do following...

angle_max = 0; // assign the 0 to "angle_max"

pf_max = 1; // Assign the Unity PF to "pf_max"

if (angle_max == 0) // If the calculation is higher than 360 do following...

angle_max = 0; // assign the 0 to "angle_max"

pf_max = 1; // Assign the Unity PF to "pf_max"

//profiling part

if (pf < 0) { //Standby

digitalWrite(relay_1, LOW);}

if (pf >= 0.01 & pf <= 0.10) { //Study Lamp

digitalWrite(relay_1, LOW);

if (pf >= 0.30 & pf <= 0.40) { //Netbook

digitalWrite(relay_2, LOW);

if (pf >= 0.90 & pf <= 0.98) { //Electric Fan

digitalWrite(relay_2, LOW);
67

if (pf > 0.99) { //Flat Iron

digitalWrite(relay_2, LOW);

delay(5000);}

Serial.println(pf_max, 5);

lcd.clear();

lcd.setCursor(0, 0);

lcd.print("PF=");

lcd.setCursor(4, 0);

lcd.print(pf_max);

lcd.print(" ");

delay(500);

angle = 0; // Reset variables for next test

angle_max = 0;

}
68

APPENDIX B

Reference

[1] Y. Gao, A. Schay and D. Hou, "Home appliance detection from aggregated
energy consumption data on a single circuit," 2017 IEEE
(SmartWorld/SCALCOM/UIC/ATC/CBDCom/IOP/SCI), San Francisco, CA, 2017,
pp. 1-8

[2] G. Hoogsteen, J. O. Krist, V. Bakker and G. J. M. Smit, "Non-intrusive


appliance recognition," 2012 3rd IEEE PES Innovative Smart Grid Technologies
Europe (ISGT Europe), Berlin, 2012, pp. 1-7.

[3] Darby S. 2006. The effectiveness of feedback on energy consumption. A Review


for DEFRA of the Literature on Metering Billing and direct Displays.

[4] M. Ito, R. Uda, S. Ichimura, K. Tago, T. Hoshi and Y. Matsushita, "A method
of appliance detection based on features of power waveform," 2004 International
Symposium on Applications and the Internet. Proceedings., Tokyo, Japan, 2004, pp.
291-294

[5] Alexander, C.; Sadiku, M. 2013. Fundamentals of Electric Circuit, fifth edition.
Mc Graw hill companies Inc., 1221 avenue of the Americas, New York, NY. ISBN
978-0-07-338057-5

[6] Smapee. Retrieve from https://www.smappee.com/be_en/homepage

[7] Hambley, A. 1994. Electronics A Top – Down Approach to Computer – Aided


Circuit Design. Mcmillan publishing company, 866 third avenue New York, New
York 10022. ISBN 0-02-349335-6.

[8] Voltage Transformer. Retrieve from https://www.electronics-


tutorials.ws/transformer/transformer-basics.html
69

[9] Current Transformer. Retrieve from https://www.electronics-


tutorials.ws/transformer/current-transformer.html

[10] Zero Crossing Detection. Retrieve from https://www.elprocus.com/zero-


crossing-detector-circuit-and-working/

[11] Exclusive OR Gate. Retrieve from https://logic.ly/lessons/xor-gate/

[12] Relay. Retrieve from https://www.galco.com/comp/prod/relay.htm

Vous aimerez peut-être aussi