Skip to content

Commit

Permalink
add SvStatus to edges
Browse files Browse the repository at this point in the history
  • Loading branch information
derrickoswald committed Jun 14, 2016
1 parent 1be3bce commit f3324de
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/main/R/sample_Jahn_optimized.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ sqlContext = sparkRSQL.init (sc)
# file:///opt/data/dump_ews.xml
# hdfs://[email protected]:9000/data/dump_ews.xml
# hdfs:/user/root/dump_ews.xml
elements = sql (sqlContext, "create temporary table elements using ch.ninecode.cim options (path 'hdfs:/data/dump_ews.xml')")
elements = sql (sqlContext, "create temporary table elements using ch.ninecode.cim options (path 'hdfs:/data/NIS_CIM_Export_NS_INITIAL_FILL.rdf')")
head (sql (sqlContext, "select * from elements"))
edges = sql (sqlContext, "select * from edges")
redges = SparkR::collect (edges, stringsAsFactors=FALSE) # redges = SparkR::as.data.frame (edges)
Expand Down
15 changes: 9 additions & 6 deletions src/main/scala/ch/ninecode/cim/CIMRelation.scala
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ import org.apache.spark.sql.types.StructType
import ch.ninecode._

class Pair (val id_equ: String, var left: Terminal = null, var right: Terminal = null) extends Serializable
class PreEdge (var id_seq_1: String, var id_seq_2: String, var id_equ: String, var container: String, var length: Double, var voltage: String, var typ: String, var normalOpen: Boolean, var location: String, val power: Double, val commissioned: String) extends Serializable
class PreEdge (var id_seq_1: String, var id_seq_2: String, var id_equ: String, var container: String, var length: Double, var voltage: String, var typ: String, var normalOpen: Boolean, var location: String, val power: Double, val commissioned: String, val status: String) extends Serializable
class Extremum (val id_loc: String, var min_index: Int, var x1 : Double, var y1 : Double, var max_index: Int, var x2 : Double, var y2 : Double) extends Serializable
case class Edge (id_seq_1: String, id_seq_2: String, id_equ: String, container: String, length: Double, voltage: String, typ: String, normalOpen: Boolean, power: Double, commissioned: String, x1: Double, y1: Double, x2: Double, y2: Double)
case class Edge (id_seq_1: String, id_seq_2: String, id_equ: String, container: String, length: Double, voltage: String, typ: String, normalOpen: Boolean, power: Double, commissioned: String, status: String, x1: Double, y1: Double, x2: Double, y2: Double)

class CIMRelation(
override val paths: Array[String],
Expand Down Expand Up @@ -243,6 +243,7 @@ class CIMRelation(
var location = ""
var power = 0.0
var commissioned = ""
var status = ""
Some (e) match
{
case Some(o) if o.getClass () == classOf[PSRType] => { }
Expand Down Expand Up @@ -291,6 +292,7 @@ class CIMRelation(
voltage = ac.voltage
typ = ac.name
location = ac.location
status = ac.status
}
case Some(o) if o.getClass () == classOf[ACLineSegmentPhase] => { }
case Some(o) if o.getClass () == classOf[SwitchInfo] => { }
Expand Down Expand Up @@ -377,11 +379,12 @@ class CIMRelation(
normalOpen,
location,
power,
commissioned)
commissioned,
status)
}
case (s: String, (p: Pair, None)) =>
// shouldn't happen of course: if it does we have a terminal with an equipment reference to non-existant equipment
new PreEdge ("", "", "", "", 0.0, "", "", false, "", 0.0, "")
new PreEdge ("", "", "", "", 0.0, "", "", false, "", 0.0, "", "")
}
}
}
Expand Down Expand Up @@ -511,10 +514,10 @@ class CIMRelation(
j match
{
case (l: String, (e:PreEdge, Some (x:Extremum))) =>
Edge (e.id_seq_1, e.id_seq_2, e.id_equ, e.container, e.length, e.voltage, e.typ, e.normalOpen, e.power, e.commissioned, x.x1, x.y1, x.x2, x.y2)
Edge (e.id_seq_1, e.id_seq_2, e.id_equ, e.container, e.length, e.voltage, e.typ, e.normalOpen, e.power, e.commissioned, e.status, x.x1, x.y1, x.x2, x.y2)
case (l: String, (e:PreEdge, None)) =>
// shouldn't happen of course: if it does we have an equipment with a location reference to non-existant location
Edge (e.id_seq_1, e.id_seq_2, e.id_equ, e.container, e.length, e.voltage, e.typ, e.normalOpen, e.power, e.commissioned, 0.0, 0.0, 0.0, 0.0)
Edge (e.id_seq_1, e.id_seq_2, e.id_equ, e.container, e.length, e.voltage, e.typ, e.normalOpen, e.power, e.commissioned, e.status, 0.0, 0.0, 0.0, 0.0)
}
}
}
Expand Down

0 comments on commit f3324de

Please sign in to comment.