Convert power cap limits to input power for users
The OCC power values are output/DC power values. Users specify the power
values as input/AC power.
The bounds/limits come from OCC, so they need to be converted.
input power = output power / efficiency
Change-Id: I65754ce20d02a274416ec6eba240eeb471d900cf
Signed-off-by: Chris Cain <cjcain@us.ibm.com>
diff --git a/powercap.cpp b/powercap.cpp
index c95c279..682131c 100644
--- a/powercap.cpp
+++ b/powercap.cpp
@@ -39,8 +39,8 @@
{
minFile >> cap;
minFile.close();
- // Convert to Watts
- capHardMin = cap / 1000000;
+ // Convert to Input Power in Watts (round up)
+ capHardMin = ((cap / (PS_DERATING_FACTOR / 100.0) / 1000000) + 0.9);
}
else
{
@@ -55,8 +55,8 @@
{
maxFile >> cap;
maxFile.close();
- // Convert to Watts
- capMax = cap / 1000000;
+ // Convert to Input Power in Watts (truncate remainder)
+ capMax = cap / (PS_DERATING_FACTOR / 100.0) / 1000000;
}
else
{