tests: new trace format for the governor
And a new trace file
diff --git a/cr2/plot_utils.py b/cr2/plot_utils.py
index 59c93ba..c60fc97 100644
--- a/cr2/plot_utils.py
+++ b/cr2/plot_utils.py
@@ -114,7 +114,9 @@
"""
gov_dfr = thermal_gov.get_data_frame()
- control_temp_series = (gov_dfr["currT"] + gov_dfr["deltaT"]) / 1000
+ current_temp = gov_dfr["current_temperature"]
+ delta_temp = gov_dfr["delta_temperature"]
+ control_temp_series = (current_temp + delta_temp) / 1000
thermal.plot_temperature(control_temperature=control_temp_series, **kwords)
def plot_hist(data, title, bins, xlabel, xlim, ylim):
diff --git a/cr2/thermal.py b/cr2/thermal.py
index dde4341..2a31c6a 100644
--- a/cr2/thermal.py
+++ b/cr2/thermal.py
@@ -197,8 +197,7 @@
def plot_input_power(self, title="", width=None, height=None):
"""Plot input power"""
dfr = self.get_data_frame()
- in_cols = [s for s in dfr.columns
- if re.match("P.*_in", s) and s != "Ptot_in"]
+ in_cols = [s for s in dfr.columns if re.match("req_power[0-9]+", s)]
title = normalize_title("Input Power", title)
self.plot_multivalue(in_cols, title, width, height)
@@ -207,7 +206,7 @@
"""Plot output power"""
dfr = self.get_data_frame()
out_cols = [s for s in dfr.columns
- if re.match("P.*_out", s) and s != "Ptot_out"]
+ if re.match("granted_power[0-9]+", s)]
title = normalize_title("Output Power", title)
self.plot_multivalue(out_cols,
diff --git a/tests/test_pid.py b/tests/test_pid.py
index 5b7c869..e452424 100644
--- a/tests/test_pid.py
+++ b/tests/test_pid.py
@@ -12,7 +12,7 @@
self.assertTrue(len(df) > 0)
self.assertTrue("err_integral" in df.columns)
- self.assertEquals(df["err"].iloc[0], 7)
+ self.assertEquals(df["err"].iloc[0], 10)
def test_plot_controller(self):
"""Test PIDController.plot_controller()
diff --git a/tests/test_power.py b/tests/test_power.py
index 1334027..b15f812 100644
--- a/tests/test_power.py
+++ b/tests/test_power.py
@@ -58,7 +58,7 @@
df = InPower().get_data_frame()
self.assertTrue("load0" in df.columns)
- self.assertEquals(df["load0"].iloc[0], 1)
+ self.assertEquals(df["load0"].iloc[0], 2)
def test_inpower_get_all_freqs(self):
"""Test InPower.get_all_freqs()"""
@@ -66,13 +66,13 @@
self.assertEquals(dfr["A15"].iloc[0], 1900)
self.assertEquals(dfr["A7"].iloc[1], 1400)
- self.assertEquals(dfr["A15"].iloc[13], 1800)
+ self.assertEquals(dfr["A15"].iloc[55], 1800)
def test_inpower_get_load_data(self):
"""Test InPower.get_load_data()"""
load_data = InPower().get_load_data(self.map_label)
- self.assertEquals(load_data["A15"].iloc[0], 1 + 2 + 1 + 1)
+ self.assertEquals(load_data["A15"].iloc[0], 2 + 3 + 2 + 3)
self.assertEquals(load_data["A7"].iloc[3], 100 + 100 + 100 + 100)
self.assertEquals(load_data["A15"].iloc[0], load_data["A15"].iloc[1])
diff --git a/tests/test_thermal.py b/tests/test_thermal.py
index a61b040..bac63dc 100644
--- a/tests/test_thermal.py
+++ b/tests/test_thermal.py
@@ -74,7 +74,7 @@
df = Thermal().get_data_frame()
self.assertTrue("thermal_zone" in df.columns)
- self.assertEquals(df["temp"].iloc[0], 29000)
+ self.assertEquals(df["temp"].iloc[0], 24000)
def test_plot_temperature(self):
"""Test ThermalGovernor.plot_temperature()
@@ -117,11 +117,11 @@
def test_get_thermal_csv(self):
ThermalGovernor().write_thermal_csv()
- first_data_line = '720.741380,0,61,14,75,2608,5036,756,8400,8400,8511,50000,7000\n'
+ first_data_line = '523.424828,0,124,10,134,2718,5036,755,8509,8511,8511,47000,10000\n'
with open("thermal.csv") as f:
first_line = f.readline()
- self.assertTrue(first_line.startswith("Time,Pgpu_in"))
+ self.assertTrue(first_line.startswith("Time,req_power0"))
second_line = f.readline()
self.assertEquals(second_line, first_data_line)
@@ -130,8 +130,8 @@
df = ThermalGovernor().get_data_frame()
self.assertTrue(len(df) > 0)
- self.assertEquals(df["currT"].iloc[0], 50000)
- self.assertTrue("Ptot_out" in df.columns)
+ self.assertEquals(df["current_temperature"].iloc[0], 47000)
+ self.assertTrue("total_granted_power" in df.columns)
self.assertFalse("time" in df.columns)
def test_plot_input_power(self):
diff --git a/tests/trace.dat b/tests/trace.dat
index 45cee66..1c2171e 100644
--- a/tests/trace.dat
+++ b/tests/trace.dat
Binary files differ