summaryrefslogtreecommitdiff
path: root/opendc-simulator/opendc-simulator-power/src/test
diff options
context:
space:
mode:
authorHongyu He <hongyuhe.cs@googlemail.com>2021-06-10 13:27:56 +0200
committerFabian Mastenbroek <mail.fabianm@gmail.com>2021-06-11 17:05:09 +0200
commitf0c0c6d45165ad0ce398ec7300b11bf77c7ae5a6 (patch)
tree87cca1749779bdf34f7e7ca05ef0426caeba30b9 /opendc-simulator/opendc-simulator-power/src/test
parentb6acc74b38643615df02ef2131380c5e8eba00dd (diff)
simulator: Add power loss to SimPdu
This change adds a model for power loss to the Power Distribution Unit (PDU) model in OpenDC.
Diffstat (limited to 'opendc-simulator/opendc-simulator-power/src/test')
-rw-r--r--opendc-simulator/opendc-simulator-power/src/test/kotlin/org/opendc/simulator/power/SimPduTest.kt12
1 files changed, 12 insertions, 0 deletions
diff --git a/opendc-simulator/opendc-simulator-power/src/test/kotlin/org/opendc/simulator/power/SimPduTest.kt b/opendc-simulator/opendc-simulator-power/src/test/kotlin/org/opendc/simulator/power/SimPduTest.kt
index cef9a97a..b7f51ad3 100644
--- a/opendc-simulator/opendc-simulator-power/src/test/kotlin/org/opendc/simulator/power/SimPduTest.kt
+++ b/opendc-simulator/opendc-simulator-power/src/test/kotlin/org/opendc/simulator/power/SimPduTest.kt
@@ -54,6 +54,7 @@ internal class SimPduTest {
val pdu = SimPdu(interpreter)
source.connect(pdu)
pdu.newOutlet().connect(SimpleInlet())
+
assertEquals(50.0, source.powerDraw)
}
@@ -89,6 +90,17 @@ internal class SimPduTest {
}
@Test
+ fun testLoss() = runBlockingSimulation {
+ val interpreter = SimResourceInterpreter(coroutineContext, clock)
+ val source = SimPowerSource(interpreter, capacity = 100.0)
+ // https://download.schneider-electric.com/files?p_Doc_Ref=SPD_NRAN-66CK3D_EN
+ val pdu = SimPdu(interpreter, idlePower = 0.015, lossCoefficient = 0.015)
+ source.connect(pdu)
+ pdu.newOutlet().connect(SimpleInlet())
+ assertEquals(87.515, source.powerDraw, 0.01)
+ }
+
+ @Test
fun testOutletClose() = runBlockingSimulation {
val interpreter = SimResourceInterpreter(coroutineContext, clock)
val source = SimPowerSource(interpreter, capacity = 100.0)