summaryrefslogtreecommitdiff
path: root/simulator/opendc-simulator
diff options
context:
space:
mode:
Diffstat (limited to 'simulator/opendc-simulator')
-rw-r--r--simulator/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/power/AsymptoticPowerModel.kt12
-rw-r--r--simulator/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/power/CubicPowerModel.kt10
-rw-r--r--simulator/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/power/LinearPowerModel.kt10
-rw-r--r--simulator/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/power/MsePowerModel.kt27
-rw-r--r--simulator/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/power/SqrtPowerModel.kt10
-rw-r--r--simulator/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/power/SquarePowerModel.kt10
-rw-r--r--simulator/opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/power/PowerModelTest.kt1
7 files changed, 54 insertions, 26 deletions
diff --git a/simulator/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/power/AsymptoticPowerModel.kt b/simulator/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/power/AsymptoticPowerModel.kt
index fc08891d..ddc6d5b1 100644
--- a/simulator/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/power/AsymptoticPowerModel.kt
+++ b/simulator/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/power/AsymptoticPowerModel.kt
@@ -7,7 +7,7 @@ import kotlin.math.pow
* The asymptotic power model partially adapted from GreenCloud.
*
* @param maxPower The maximum power draw of the server in W.
- * @param staticPower The power draw of the server in halting state in W.
+ * @param idlePower The power draw of the server at its lowest utilization level in W.
* @param asymUtil A utilization level at which the server attains asymptotic,
* i.e., close to linear power consumption versus the offered load.
* For most of the CPUs,a is in [0.2, 0.5].
@@ -15,17 +15,17 @@ import kotlin.math.pow
*/
public class AsymptoticPowerModel(
private val maxPower: Double,
- private val staticPower: Double,
+ private val idlePower: Double,
private val asymUtil: Double,
private val isDvfsEnabled: Boolean,
) : PowerModel {
- private val factor: Double = (maxPower - staticPower) / 100
+ private val factor: Double = (maxPower - idlePower) / 100
public override fun computePower(utilization: Double): Double =
if (isDvfsEnabled)
- staticPower + (factor * 100) / 2 * (1 + utilization.pow(3) - E.pow(-utilization.pow(3) / asymUtil))
+ idlePower + (factor * 100) / 2 * (1 + utilization.pow(3) - E.pow(-utilization.pow(3) / asymUtil))
else
- staticPower + (factor * 100) / 2 * (1 + utilization - E.pow(-utilization / asymUtil))
+ idlePower + (factor * 100) / 2 * (1 + utilization - E.pow(-utilization / asymUtil))
- override fun toString(): String = "AsymptoticPowerModel[max=$maxPower,static=$staticPower,asymptotic=$asymUtil]"
+ override fun toString(): String = "AsymptoticPowerModel[max=$maxPower,idle=$idlePower,asymptotic=$asymUtil]"
}
diff --git a/simulator/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/power/CubicPowerModel.kt b/simulator/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/power/CubicPowerModel.kt
index 1fff01f9..9c44438a 100644
--- a/simulator/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/power/CubicPowerModel.kt
+++ b/simulator/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/power/CubicPowerModel.kt
@@ -6,14 +6,14 @@ import kotlin.math.pow
* The cubic power model partially adapted from CloudSim.
*
* @param maxPower The maximum power draw of the server in W.
- * @param staticPower The power draw of the server in halting state in W.
+ * @param idlePower The power draw of the server at its lowest utilization level in W.
*/
-public class CubicPowerModel(private val maxPower: Double, private val staticPower: Double) : PowerModel {
- private val factor: Double = (maxPower - staticPower) / 100.0.pow(3)
+public class CubicPowerModel(private val maxPower: Double, private val idlePower: Double) : PowerModel {
+ private val factor: Double = (maxPower - idlePower) / 100.0.pow(3)
public override fun computePower(utilization: Double): Double {
- return staticPower + factor * (utilization * 100).pow(3)
+ return idlePower + factor * (utilization * 100).pow(3)
}
- override fun toString(): String = "CubicPowerModel[max=$maxPower,static=$staticPower]"
+ override fun toString(): String = "CubicPowerModel[max=$maxPower,idle=$idlePower]"
}
diff --git a/simulator/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/power/LinearPowerModel.kt b/simulator/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/power/LinearPowerModel.kt
index 9ccf734b..0f45afae 100644
--- a/simulator/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/power/LinearPowerModel.kt
+++ b/simulator/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/power/LinearPowerModel.kt
@@ -4,17 +4,17 @@ package org.opendc.simulator.compute.power
* The linear power model partially adapted from CloudSim.
*
* @param maxPower The maximum power draw of the server in W.
- * @param staticPower The power draw of the server in halting state in W.
+ * @param idlePower The power draw of the server at its lowest utilization level in W.
*/
-public class LinearPowerModel(private val maxPower: Double, private val staticPower: Double) : PowerModel {
+public class LinearPowerModel(private val maxPower: Double, private val idlePower: Double) : PowerModel {
/**
* The linear interpolation factor of the model.
*/
- private val factor: Double = (maxPower - staticPower) / 100
+ private val factor: Double = (maxPower - idlePower) / 100
public override fun computePower(utilization: Double): Double {
- return staticPower + factor * utilization * 100
+ return idlePower + factor * utilization * 100
}
- override fun toString(): String = "LinearPowerModel[max=$maxPower,static=$staticPower]"
+ override fun toString(): String = "LinearPowerModel[max=$maxPower,idle=$idlePower]"
}
diff --git a/simulator/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/power/MsePowerModel.kt b/simulator/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/power/MsePowerModel.kt
new file mode 100644
index 00000000..8486d680
--- /dev/null
+++ b/simulator/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/power/MsePowerModel.kt
@@ -0,0 +1,27 @@
+package org.opendc.simulator.compute.power
+
+import kotlin.math.pow
+
+/**
+ * The power model that minimizes the mean squared error (MSE)
+ * to the actual power measurement by tuning the calibration parameter.
+ * @see <a href="https://dl.acm.org/doi/abs/10.1145/1273440.1250665">
+ * Fan et al., Power provisioning for a warehouse-sized computer, ACM SIGARCH'07</a>
+ *
+ * @param maxPower The maximum power draw of the server in W.
+ * @param idlePower The power draw of the server at its lowest utilization level in W.
+ * @param calibrationParam The parameter set to minimize the MSE.
+ */
+public class MsePowerModel(
+ private val maxPower: Double,
+ private val idlePower: Double,
+ private val calibrationParam: Double,
+) : PowerModel {
+ private val factor: Double = (maxPower - idlePower) / 100
+
+ public override fun computePower(utilization: Double): Double {
+ return idlePower + factor * (2 * utilization - utilization.pow(calibrationParam)) * 100
+ }
+
+ override fun toString(): String = "MsePowerModel[max=$maxPower,idle=$idlePower,MSE_param=$calibrationParam]"
+}
diff --git a/simulator/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/power/SqrtPowerModel.kt b/simulator/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/power/SqrtPowerModel.kt
index a4732e68..afa1d82f 100644
--- a/simulator/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/power/SqrtPowerModel.kt
+++ b/simulator/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/power/SqrtPowerModel.kt
@@ -6,14 +6,14 @@ import kotlin.math.sqrt
* The square root power model partially adapted from CloudSim.
*
* @param maxPower The maximum power draw of the server in W.
- * @param staticPower The power draw of the server in halting state in W.
+ * @param idlePower The power draw of the server at its lowest utilization level in W.
*/
-public class SqrtPowerModel(private val maxPower: Double, private val staticPower: Double) : PowerModel {
- private val factor: Double = (maxPower - staticPower) / sqrt(100.0)
+public class SqrtPowerModel(private val maxPower: Double, private val idlePower: Double) : PowerModel {
+ private val factor: Double = (maxPower - idlePower) / sqrt(100.0)
override fun computePower(utilization: Double): Double {
- return staticPower + factor * sqrt(utilization * 100)
+ return idlePower + factor * sqrt(utilization * 100)
}
- override fun toString(): String = "SqrtPowerModel[max=$maxPower,static=$staticPower]"
+ override fun toString(): String = "SqrtPowerModel[max=$maxPower,idle=$idlePower]"
}
diff --git a/simulator/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/power/SquarePowerModel.kt b/simulator/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/power/SquarePowerModel.kt
index eb78eebc..82a9d37d 100644
--- a/simulator/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/power/SquarePowerModel.kt
+++ b/simulator/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/power/SquarePowerModel.kt
@@ -6,14 +6,14 @@ import kotlin.math.pow
* The square power model partially adapted from CloudSim.
*
* @param maxPower The maximum power draw of the server in W.
- * @param staticPower The power draw of the server in halting state in W.
+ * @param idlePower The power draw of the server at its lowest utilization level in W.
*/
-public class SquarePowerModel(private val maxPower: Double, private val staticPower: Double) : PowerModel {
- private val factor: Double = (maxPower - staticPower) / 100.0.pow(2)
+public class SquarePowerModel(private val maxPower: Double, private val idlePower: Double) : PowerModel {
+ private val factor: Double = (maxPower - idlePower) / 100.0.pow(2)
override fun computePower(utilization: Double): Double {
- return staticPower + factor * (utilization * 100).pow(2)
+ return idlePower + factor * (utilization * 100).pow(2)
}
- override fun toString(): String = "SquarePowerModel[max=$maxPower,static=$staticPower]"
+ override fun toString(): String = "SquarePowerModel[max=$maxPower,idle=$idlePower]"
}
diff --git a/simulator/opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/power/PowerModelTest.kt b/simulator/opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/power/PowerModelTest.kt
index 60af0eb0..dd93302b 100644
--- a/simulator/opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/power/PowerModelTest.kt
+++ b/simulator/opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/power/PowerModelTest.kt
@@ -62,6 +62,7 @@ internal class PowerModelTest {
Arguments.of(SquarePowerModel(350.0, 200.0), 321.5),
Arguments.of(CubicPowerModel(350.0, 200.0), 309.35),
Arguments.of(SqrtPowerModel(350.0, 200.0), 342.302),
+ Arguments.of(MsePowerModel(350.0, 200.0, 1.4), 340.571),
Arguments.of(AsymptoticPowerModel(350.0, 200.0, 0.3, false), 338.765),
Arguments.of(AsymptoticPowerModel(350.0, 200.0, 0.3, true), 323.072),
)