The Yocto-Watt is a small module which is very convenient to measure by USB the voltage, the current, and the instantaneous real power of an electric circuit. As it is also able to integrate the power to compute the total energy for a given lapse of time, some users also employ it to measure the energy that a system consumes, and we have recently improved this feature.
As the energy meter is based on the integration of the consumed power, we must use the power object to access it. The get_meter() method directly returns the total energy in Wh (Watt * hour) since the last time the meter was reset to zero, or since the module was powered on. The meter can be reset to zero with the reset() method:
YPower P_bat = YPower.FindPower('battery');
// Reads the energy meter
double energy = P_bat.get_meter();
// Resets the meter
If the energy flows in both directions, the meter increases or decreases depending on the direction of the current flow: it increases when the energy goes from the input to the output of the Yocto-Watt, and decreases otherwise.
Up till now, you could only obtain the value of the total energy representing the difference between the energy provided on the output and the energy recovered in the other direction. For applications involving the periodic charging and discharging of a battery, for example, it has proved useful to obtain the two separate values. We have therefore added two attributes enabling us to obtain separately the energy provided on the output and the energy recovered in the other direction:
double delivered = P_bat.get_deliveredEnergyMeter();
// Reads the energy recovered in the other direction
double received = P_bat.get_receivedEnergyMeter();
To benefit from this function, you only need to update the firmware of your Yocto-Watt and to load an up-to-date version of the library containing these new methods.
Directions of energy flow on the Yocto-Watt
Furthermore, up till now, the energy meter integration was performed once per second on the basis of an estimated power for the period. With the latest firmware, integration is now done 10 times per second on the basis of actual measures of the instantaneous power sampled at 640Hz. The classification between provided energy and recovered energy thus depends of the energy balance for each period of 100ms.
As indicated in the User's guide, the measure of instantaneous real power is based on a sampling at precisely 640Hz. It works therefore also for alternative current, as long as the frequency stays within about 30Hz and 80Hz. Above 80Hz, the accuracy of the measure decreases significantly. Moreover, if the peak factor is too important (consummation peaks above 16A or of durations below 3ms), the energy also tends to be underestimated.
Furthermore, it is worth pointing out that the Yocto-Watt is a Cat.II measuring instrument. To perform measures on a primary electric circuit or in an electric cabinet for example, it's better to use a small embedded meter certified for this usage, with an RS485 interface, and to interface it with a Yocto-RS485-V2 as we demonstrated it previously in this post.