diff --git a/wlauto/instrumentation/daq/__init__.py b/wlauto/instrumentation/daq/__init__.py index 09976e34..33a7eb07 100644 --- a/wlauto/instrumentation/daq/__init__.py +++ b/wlauto/instrumentation/daq/__init__.py @@ -39,6 +39,7 @@ sys.path.pop(0) UNITS = { + 'energy': 'Joules', 'power': 'Watts', 'voltage': 'Volts', } @@ -165,6 +166,8 @@ class Daq(Instrument): metric_name = '{}_{}'.format(port, metric) context.result.add_metric(metric_name, round(value, 3), UNITS[metric]) self._results[key][metric_name] = round(value, 3) + energy = sum(data[metrics.index('power')]) * (self.sampling_rate / 1000000) + context.result.add_metric('{}_energy'.format(port), round(energy, 3), UNITS['energy']) def teardown(self, context): self.logger.debug('Terminating session.')