ch.ninecode.cim.CIMTopologyOptions.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of CIMReader Show documentation
Show all versions of CIMReader Show documentation
Expose CIM data files as Spark RDD
package ch.ninecode.cim
import org.apache.spark.storage.StorageLevel
sealed trait State
case object ForceTrue extends State
case object ForceFalse extends State
case object Unforced extends State
/**
* Topological processing options.
*
* This class determines the behaviour of the CIMNetworkTopologyProcessor.
*
* @param identify_islands When true
, topological islands are identified in addition to
* topological nodes. That is, TopologicalNode
objects generated by the processor will have a valid
* TopologicalIsland
attributes that reference generated TopologicalIsland
objects.
* @param force_retain_switches Keep Switch and subclasses as two topological node elements irregardless of the
* retained
attribute, or the open
and normalOpen
* attributes.
* This is used for alternative scenario calculations.
* It allows the user to override the behaviour when the processor encounters a Switch
* or a Switch derived class (e.g. Disconnector),
* except Fuse and ProtectiveSwitch classes are not included by this flag.
* The default behaviour of Unforced
* will use the value of the retained
attribute to identify a node boundary
* only if the attribute is present in the CIM file and the value is true
.
* When set to ForceTrue
the behaviour is equivalent to each Switch having a retained
* attribute with value true
.
* When set to ForceFalse
the behaviour is equivalent to each Switch having a retained
* attribute with value false
.
* @param force_retain_fuses Keep Fuse, ProtectedSwitch and subclasses as two topological node elements irregardless of the
* retained
attribute, or the open
and normalOpen
* attributes.
* This is used for fuse specificity calculation.
* It allows the user to override the normal behaviour when a Fuse is encountered, which is to keep the two
* terminals as two topological nodes only if the retained
attribute is present and true
* or the open
attribute is present and has a value true
* or if open
attribute is not present and the normalOpen
attribute has a value true
.
* This has the same effect for Fuse objects as force_retain_switches
does for Switch objects.
* @param force_switch_separate_islands Extends the retain attribute to TopologicalIsland
processing
* for Switch
derived objects, except for Fuse
and ProtectedSwitch
objects.
* The default of Unforced
uses the open or normalOpen attributes, if present, or the
* default_switch_open_state
setting otherwise, to determine if a switch separates two islands.
* ForceTrue
keeps the switch in two islands, irregardless of the switch state, while
* ForceFalse
ensures the switch is in only one island.
* @param force_fuse_separate_islands Similar functionality as force_switch_separate_islands,
* but for Fuse
objects.
* @param default_switch_open_state Allows changing the behaviour when the processor encounters a Switch
* that has neither an open
attribute, nor normalOpen
attribute.
* The default behaviour of false is the same as if open
and normalOpen
* both specify false
.
* @param debug If true
additional tests are performed during topology processing:
*
- unique VertexId for every ConnectivityNode mRID (checks the hash function)
- all edges reference existing ConnectivityNode elements (checks for completeness)
- no voltage transitions (checks that edges that are joined have the same BaseVoltage)
* @param storage The storage level for new and replaced CIM RDD.
*/
case class CIMTopologyOptions
(
identify_islands: Boolean = false,
force_retain_switches: State = Unforced,
force_retain_fuses: State = Unforced,
force_switch_separate_islands: State = Unforced,
force_fuse_separate_islands: State = Unforced,
default_switch_open_state: Boolean = false,
debug: Boolean = false,
storage: StorageLevel = StorageLevel.MEMORY_AND_DISK_SER
)
object CIMTopologyOptions
{
def parseState (text: String): State =
text match
{
case "ForceTrue" => ForceTrue
case "ForceFalse" => ForceFalse
case _ => Unforced
}
}