summaryrefslogtreecommitdiff
path: root/lib/dfatool.py
diff options
context:
space:
mode:
authorDaniel Friesel <daniel.friesel@uos.de>2019-11-15 14:34:18 +0100
committerDaniel Friesel <daniel.friesel@uos.de>2019-11-15 14:34:18 +0100
commitcd57ef9d7817529c86dfa798ce7350c8d4c21038 (patch)
tree726c7a893aec48815b8a8b943c21ba6c8eb51826 /lib/dfatool.py
parent4c50bd0cfe0ba90cd29e388902516c5b36cbef4d (diff)
todos
Diffstat (limited to 'lib/dfatool.py')
-rw-r--r--lib/dfatool.py19
1 files changed, 15 insertions, 4 deletions
diff --git a/lib/dfatool.py b/lib/dfatool.py
index 8a3217b..e01ed1c 100644
--- a/lib/dfatool.py
+++ b/lib/dfatool.py
@@ -2063,9 +2063,9 @@ class EnergyTraceLog:
data[i] = [timestamp, current, voltage, total_energy]
- interval_start_timestamp = data[:-1, 0] * 1e-6
- interval_duration = (data[1:, 0] - data[:-1, 0]) * 1e-6
- interval_power = ((data[1:, 3] - data[:-1, 3]) * 1e-9) / ((data[1:, 0] - data[:-1, 0]) * 1e-6)
+ self.interval_start_timestamp = data[:-1, 0] * 1e-6
+ self.interval_duration = (data[1:, 0] - data[:-1, 0]) * 1e-6
+ self.interval_power = ((data[1:, 3] - data[:-1, 3]) * 1e-9) / ((data[1:, 0] - data[:-1, 0]) * 1e-6)
m_duration_us = data[-1, 0] - data[0, 0]
m_energy_nj = data[-1, 3] - data[0, 3]
@@ -2074,7 +2074,11 @@ class EnergyTraceLog:
print('got {} samples with {} seconds of log data ({} Hz)'.format(data_count, m_duration_us * 1e-6, self.sample_rate))
- return interval_start_timestamp, interval_duration, interval_power
+ return self.interval_start_timestamp, self.interval_duration, self.interval_power
+
+ # TODO Hilfsfunktionen für offset -> timestamp und timestamp -> offset
+ # (letzteres am besten per binary search)
+ # Damit die anderen Funktionen unfucken, Zustandsleistung bestimmen etc.
def analyze_states(self, interval_start_timestamp, interval_duration, interval_power, traces, offline_index: int):
u"""
@@ -2127,6 +2131,13 @@ class EnergyTraceLog:
print('[!!!] mismatch: expected "{}", got "{}"'.format(name, bc))
print('{} estimated transition area: {:0.3f} .. {:0.3f} seconds'.format(offline_index, end, end + duration))
+ energy_trace.append({
+ 'isa': 'transition',
+ })
+ energy_trace.append({
+ 'isa': 'state'
+ })
+
return energy_trace
def find_first_sync(self, interval_ts, interval_power):