### calibration

`voltage constant = 230 * 11 / (9+20%) = 234.26`

`current constant = (100 / 0.050) / 18 = 111.11`

this are the equations used to find I cal and V cal theoretically  and I cal and V cal and PF cal why they are actually used

also the shifted v is there in order to eliminate any distortion that may have rose due to the transformer and other components in the circuit??

thanks

### Re: calibration

"this are the equations used to find I cal and V cal theoretically "

Correct.

"and I cal and V cal and PF cal why they are actually used"

ICAL and VCAL are there because (1) you want to read normal units, Amps and Volts (not counts) on your display and (2) because the relationship between counts and those real units changes according to the actual value of the components you have. (Example, your burden resistor is 18 Ohms +/- 1%, so it could be 17.82 Ohms, 18.18 Ohms or anywhere between these values).

PFcal (PHASECAL) is there because voltage and current are measured one after the other, so there is a short time delay between the readings, which is the same as a phase shift.  The a.c. adapter also contributes a phase shift (see http://openenergymonitor.org/emon/buildingblocks/report-mascot-9v-acac-a...). PHASECAL corrects both those errors.

"also the shifted v is there in order to eliminate any distortion that may have rose due to the transformer and other components in the circuit??"

"phaseShiftedV" is the result of that correction.

### Re: calibration

for shifted v only i still cant understand the reason behind the equation please

### Re: calibration

Do you mean you understand why it is necessary to correct for phase shift, but you do not understand how the equation does that?

A agree it is difficult to understand the equation. You must draw on paper a sine wave, mark on it where it is sampled each time (about every 7 degrees in practice, but you need not choose that value to understand what happens; try every 15 degrees). Then you need to pick a number for PHASECAL (say 1.5), choose the first two samples - call the first "lastfiltered" and the second "filtered".  Calculate using the equation and draw on the paper where the point "phaseShifted" comes. Then repeat this, the old "filtered" (sample 2) becomes "lastfiltered" and the next sample (sample 3) becomes "filtered". Repeat this for a number of samples, and join up the new points you have marked with a smooth curve. Then choose a different number for PHASECAL and repeat the procedure.

### Re: calibration

thanks a lot.. i didnt understand actually the reason behind it this :

//Phase calibration goes here.
shiftedV = lastFilteredV + PHASECAL * (filteredV - lastFilteredV);

how can I come up with that

### Re: calibration

Do you understand now?

### Re: calibration

ok I understood what you mean.. so with that equation your doing a smoother sine wave. However the phase cal only needs to be set once. your just trying different in order to get the smoothest possible

### Re: calibration

I told you to join up the new points, to give a new wave. The new wave that you have drawn should be shifted in angle = shifted in time = shifted in phase,  in relation to the original!

So, if your original wave was phase shifted before you measured it, or you measured it late (in time), you can make a new wave that is shifted to where the original SHOULD have been. Then you use that to calculate power.

Your diagram should look like this.

### Re: calibration

ahh ok I understood. because now I did it personally :) thanks a lot

I wrote this part like this:

xbeeSerial.print(Real_Power);
xbeeSerial.print(' ');

xbeeSerial.print(Apparent_Power);
xbeeSerial.print(' ');

xbeeSerial.print(PF);
xbeeSerial.print(' ');

xbeeSerial.print(RMS_V);
xbeeSerial.print(' ');

xbeeSerial.print(RMS_I);
xbeeSerial.print(' ');

is it good or do I have to write the letters A, B in the blank here xbeeSerial.print(' ');   between the inverted commas??

### Re: calibration

It is your installation, you can do whatever you like. But there are many advantages in following what other people have used before and proven to work. So take a look at the program that receives the data and see what it expects.

If you choose not to use something that is known to work, you can change it and write whatever you like and send whatever you like. At the receiving end, you then have write the program to interpret what comes in over the link, convert the strings if necessary and assign the results to right variables.

It is generally easier to write a string than to interpret a string. So it makes sense to keep it simple and easy to interpret.

I say "1234.2 1563.2 0.79 234.5 6.65" is much easier to interpret (by a program) than "1234.2A1563.2B0.79C234.5D6.65" because you know that a space '  ' always separates the two numbers, and it is easier to always look for a space rather than a different symbol each time.

### Re: calibration

Im saying so becuase in the main sketch it is written like this:

void sendDataToXbee()
{
//----------XBEE SERIAL LINK - SEND DATA----------
//Send data via xbee link to ethernet unit
xbeeSerial.print(realPower);
xbeeSerial.print('A');
xbeeSerial.print(apparentPower);
xbeeSerial.print('B');
xbeeSerial.print(powerFactor);
xbeeSerial.print('C');
xbeeSerial.print(Vrms);
xbeeSerial.print('D');
xbeeSerial.print(Irms);
xbeeSerial.print('E');
xbeeSerial.print(freq);
xbeeSerial.print('F');
xbeeSerial.print(kwhTotal);
xbeeSerial.print('G');
//------------------------------------------------
}

Infact than on the Ethernet side it uses an array to converts the characters into float.. so if leave them as a space as I did them.. I wont need that array??

### Re: calibration

A yes, this is old code, the reason I used characters as identifiers was that it made it easy to identify a particular variable by the character, so for example A is always real power or whatever. This way you can add and remove variables relatively easily, anyway this is another topic.