Henry-2000 / NILM_with_PLAID_dataset

In this repository are available codes in python for implementation of classification of loads and event detection using PLAID dataset
GNU General Public License v2.0
20 stars 5 forks source link

power #4

Open WKKO opened 11 months ago

WKKO commented 11 months ago

I'm sorry to bother you again, but may I ask why the power here is in such a waveform. In an AC circuit, power should not be directly voltage times current. 1

Henry-2000 commented 10 months ago

Hi, sorry for the delay. Can you say how did you come up with this plot? Which part of code did u use?

WKKO commented 10 months ago

Hi,Sorry for taking so long to respond to you. I would like to ask you another question. Why did you not normalize the voltage and current when drawing the V-I trajectory diagram of the appliance? Just like this formula. image

Henry-2000 commented 10 months ago

Hi there.

I indeed haven't applied this formula for normalization directly, but I did limit the current ranges by the maximum current for each type of load, as if I'm considering imin =0 (in the formula). From the harmonic_dictionary, we extract the maximum current ("max_current" or imax) of every sample from each category of appliances. See function construct_harmonics_dict in process_data.py code. In the plotting part, I'm limiting the y-axis plotting to this max_current (range from -imax to +imax). See lines 592-598 and 716-717 of generate_graphs.py.

The voltage values (x-axis), on the other hand, are basically the same for each sample, since it is the grid voltage and it dont have any abrupt variations between cycles. The matplotlib.pyplot.plot function in this case will adjust the view limits of the graph with the range of the voltage (see the documentation: https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.plot.html, scalex default value is true), so there is no significant difference in normalizing it or not.

I understand that the code is a little bit confusing in some parts, I need to add more comments there, sorry.

Hope I answered your question. If not, let me know. Don't know why i haven't just applied the formula though... u.u

WKKO commented 10 months ago

Hi there.

I indeed haven't applied this formula for normalization directly, but I did limit the current ranges by the maximum current for each type of load, as if I'm considering imin =0 (in the formula). From the harmonic_dictionary, we extract the maximum current ("max_current" or imax) of every sample from each category of appliances. See function construct_harmonics_dict in process_data.py code. In the plotting part, I'm limiting the y-axis plotting to this max_current (range from -imax to +imax). See lines 592-598 and 716-717 of generate_graphs.py.

The voltage values (x-axis), on the other hand, are basically the same for each sample, since it is the grid voltage and it dont have any abrupt variations between cycles. The matplotlib.pyplot.plot function in this case will adjust the view limits of the graph with the range of the voltage (see the documentation: https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.plot.html, scalex default value is true), so there is no significant difference in normalizing it or not.

I understand that the code is a little bit confusing in some parts, I need to add more comments there, sorry.

Hope I answered your question. If not, let me know. Don't know why i haven't just applied the formula though... u.u

Thank you very much for your answer. I think I understand what you mean. Wishing you all the best.

WKKO commented 10 months ago

I'm sorry to ask you another question. How did you extract steady data from a single electrical appliance and draw a VI diagram? There may be extremely high unstable currents in the appliance, how did you handle it?

Henry-2000 commented 10 months ago

Indeed, there were many samples that were discarded because no steady state current (at least for the minimal number of cycles) were obtained for some appliances, like laptop. The steady state capture is done in the pre-processing part, in steady_samples.py code. The criteria used is that, for a minimal number of cycles, the mean of the the rms signal doens't change more than 10% from one cycle to another (this value was obtained empirically, cause, if very low, would discard most of the samples, and very high would get unstable signal). Also, the mean of the rms signal needed to be higher than some threshold (I think I used 30mA), because the signals with a very low current were always unstable due to low resolution of measuring instruments or just residual current sampled (too low to be considered an operating load).

Hope I have answered your question.

WKKO commented 10 months ago

Indeed, there were many samples that were discarded because no steady state current (at least for the minimal number of cycles) were obtained for some appliances, like laptop. The steady state capture is done in the pre-processing part, in steady_samples.py code. The criteria used is that, for a minimal number of cycles, the mean of the the rms signal doens't change more than 10% from one cycle to another (this value was obtained empirically, cause, if very low, would discard most of the samples, and very high would get unstable signal). Also, the mean of the rms signal needed to be higher than some threshold (I think I used 30mA), because the signals with a very low current were always unstable due to low resolution of measuring instruments or just residual current sampled (too low to be considered an operating load).

Hope I have answered your question.

I observed that you took 12 cycles of current and voltage data to draw a VI graph, but after careful observation, I found that the data points you took were less than 6000, and I also noticed that other literature only took data for one cycle, and the voltage mostly started from 0. I'm a bit curious, is it theoretically feasible for you to do this? Please forgive me for having too many questions, as I mainly started learning NILM from your code. Sorry to bother you.