Commit 238d39a9 authored by James Pallister's avatar James Pallister

Added average power to the measurement tuple

parent 63007101
......@@ -10,7 +10,7 @@ from logging import warning, error
# import multiprocessing
Measurement = namedtuple('Measurement', 'energy time peak_power peak_voltage peak_current n_samples avg_voltage avg_current')
Measurement = namedtuple('Measurement', 'energy time peak_power peak_voltage peak_current n_samples avg_voltage avg_current avg_power')
class EnergyMonitor(object):
MeasurementData = namedtuple('MeasurementData', 'energy_accum elapsed_time peak_power peak_voltage peak_current n_samples avg_current avg_voltage')
......@@ -41,7 +41,6 @@ class EnergyMonitor(object):
continue
s = self.getSerial(d)
print s
if s == serial:
sdevs.append(d)
......@@ -198,8 +197,9 @@ class EnergyMonitor(object):
pi = float(vref) / gain / resistor / 4096. * md.peak_current
av = float(vref) / 4096. * md.avg_voltage / md.n_samples * 2
ai = float(vref) / gain / resistor / 4096. * md.avg_current / md.n_samples
ap = en/el
m = Measurement(en, el, pp, pv, pi, md.n_samples, av, ai)
m = Measurement(en, el, pp, pv, pi, md.n_samples, av, ai, ap)
return m
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment