com.zepben.evolve.services.network.tracing.OpenTest.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of evolve-sdk Show documentation
Show all versions of evolve-sdk Show documentation
SDK for interaction with the evolve platform
/*
* Copyright 2020 Zeppelin Bend Pty Ltd
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.zepben.evolve.services.network.tracing
import com.zepben.evolve.cim.iec61970.base.core.ConductingEquipment
import com.zepben.evolve.cim.iec61970.base.wires.SinglePhaseKind
import com.zepben.evolve.cim.iec61970.base.wires.Switch
import com.zepben.evolve.services.network.tracing.phases.PhaseTrace
/**
* Functional interface that can be used by traces to specify what kind of open conditions to test on.
* See [PhaseTrace] for example usage.
*/
fun interface OpenTest {
fun isOpen(conductingEquipment: ConductingEquipment, phase: SinglePhaseKind?): Boolean
// Constant common implements of OpenTest
companion object {
@JvmField
val CURRENTLY_OPEN: OpenTest = OpenTest { conductingEquipment, phase ->
!conductingEquipment.inService || (conductingEquipment is Switch && conductingEquipment.isOpen(phase))
}
@JvmField
val NORMALLY_OPEN: OpenTest = OpenTest { conductingEquipment, phase ->
!conductingEquipment.normallyInService || (conductingEquipment is Switch && conductingEquipment.isNormallyOpen(phase))
}
@JvmField
val IGNORE_OPEN: OpenTest = OpenTest { _, _ ->
false
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy