ch.ninecode.model.LoadDynamics.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.model
import com.esotericsoftware.kryo.Kryo
import com.esotericsoftware.kryo.Serializer
import com.esotericsoftware.kryo.io.Input
import com.esotericsoftware.kryo.io.Output
import org.apache.spark.sql.Row
import ch.ninecode.cim.CIMClassInfo
import ch.ninecode.cim.CIMContext
import ch.ninecode.cim.CIMParseable
import ch.ninecode.cim.CIMRelationship
import ch.ninecode.cim.CIMSerializer
/**
* Aggregate loads are used to represent all or part of the real and reactive load from one or more loads in the static (power flow) data.
*
* This load is usually the aggregation of many individual load devices and the load model is an approximate representation of the aggregate response of the load devices to system disturbances.
* Standard aggregate load model comprised of static and/or dynamic components. A static load model represents the sensitivity of the real and reactive power consumed by the load to the amplitude and frequency of the bus voltage. A dynamic load model can be used to represent the aggregate response of the motor components of the load.
*
* @param LoadDynamics [[ch.ninecode.model.LoadDynamics LoadDynamics]] Reference to the superclass object.
* @param LoadMotor [[ch.ninecode.model.LoadMotor LoadMotor]] Aggregate motor (dynamic) load associated with this aggregate load.
* @param LoadStatic [[ch.ninecode.model.LoadStatic LoadStatic]] Aggregate static load associated with this aggregate load.
* @group LoadDynamics
* @groupname LoadDynamics Package LoadDynamics
* @groupdesc LoadDynamics Dynamic load models are used to represent the dynamic real and reactive load behaviour of a load from the static power flow model.
Dynamic load models can be defined as applying either to a single load (energy consumer) or to a group of energy consumers.
Large industrial motors or groups of similar motors can be represented by a synchronous machine model (SynchronousMachineDynamics) or an asynchronous machine model (AsynchronousMachineDynamics), which are usually represented as generators with negative active power output in the static (power flow) data.
*/
final case class LoadAggregate
(
LoadDynamics: LoadDynamics = null,
LoadMotor: String = null,
LoadStatic: String = null
)
extends
Element
{
/**
* Return the superclass object.
*
* @return The typed superclass nested object.
* @group Hierarchy
* @groupname Hierarchy Class Hierarchy Related
* @groupdesc Hierarchy Members related to the nested hierarchy of CIM classes.
*/
override def sup: LoadDynamics = LoadDynamics
//
// Row overrides
//
/**
* Return a copy of this object as a Row.
*
* Creates a clone of this object for use in Row manipulations.
*
* @return The copy of the object.
* @group Row
* @groupname Row SQL Row Implementation
* @groupdesc Row Members related to implementing the SQL Row interface
*/
override def copy (): Row = { clone ().asInstanceOf[Row] }
override def export_fields: String =
{
implicit val s: StringBuilder = new StringBuilder (sup.export_fields)
implicit val clz: String = LoadAggregate.cls
def emitattr (position: Int, value: Any): Unit = if (mask (position)) emit_attribute (LoadAggregate.fields (position), value)
emitattr (0, LoadMotor)
emitattr (1, LoadStatic)
s.toString
}
override def export: String =
{
"\t\n%s\t ".format (id, export_fields)
}
}
object LoadAggregate
extends
CIMParseable[LoadAggregate]
{
override val fields: Array[String] = Array[String] (
"LoadMotor",
"LoadStatic"
)
override val relations: List[CIMRelationship] = List (
CIMRelationship ("LoadMotor", "LoadMotor", "0..1", "1"),
CIMRelationship ("LoadStatic", "LoadStatic", "0..1", "1")
)
val LoadMotor: Fielder = parse_attribute (attribute (cls, fields(0)))
val LoadStatic: Fielder = parse_attribute (attribute (cls, fields(1)))
def parse (context: CIMContext): LoadAggregate =
{
implicit val ctx: CIMContext = context
implicit val bitfields: Array[Int] = Array(0)
val ret = LoadAggregate (
LoadDynamics.parse (context),
mask (LoadMotor (), 0),
mask (LoadStatic (), 1)
)
ret.bitfields = bitfields
ret
}
def serializer: Serializer[LoadAggregate] = LoadAggregateSerializer
}
object LoadAggregateSerializer extends CIMSerializer[LoadAggregate]
{
def write (kryo: Kryo, output: Output, obj: LoadAggregate): Unit =
{
val toSerialize: Array[() => Unit] = Array (
() => output.writeString (obj.LoadMotor),
() => output.writeString (obj.LoadStatic)
)
LoadDynamicsSerializer.write (kryo, output, obj.sup)
implicit val bitfields: Array[Int] = obj.bitfields
writeBitfields (output)
writeFields (toSerialize)
}
def read (kryo: Kryo, input: Input, cls: Class[LoadAggregate]): LoadAggregate =
{
val parent = LoadDynamicsSerializer.read (kryo, input, classOf[LoadDynamics])
implicit val bitfields: Array[Int] = readBitfields (input)
val obj = LoadAggregate (
parent,
if (isSet (0)) input.readString else null,
if (isSet (1)) input.readString else null
)
obj.bitfields = bitfields
obj
}
}
/**
* Combined static load and induction motor load effects.
*
* The dynamics of the motor are simplified by linearizing the induction machine equations.
*
* @param LoadDynamics [[ch.ninecode.model.LoadDynamics LoadDynamics]] Reference to the superclass object.
* @param epfd Active load-frequency dependence index (dynamic) (Epfd).
* Typical value = 1,5.
* @param epfs Active load-frequency dependence index (static) (Epfs).
* Typical value = 1,5.
* @param epvd Active load-voltage dependence index (dynamic) (Epvd).
* Typical value = 0,7.
* @param epvs Active load-voltage dependence index (static) (Epvs).
* Typical value = 0,7.
* @param eqfd Reactive load-frequency dependence index (dynamic) (Eqfd).
* Typical value = 0.
* @param eqfs Reactive load-frequency dependence index (static) (Eqfs).
* Typical value = 0.
* @param eqvd Reactive load-voltage dependence index (dynamic) (Eqvd).
* Typical value = 2.
* @param eqvs Reactive load-voltage dependence index (static) (Eqvs).
* Typical value = 2.
* @param h Inertia constant (H) (>= 0).
* Typical value = 2,5.
* @param lfac Loading factor (Lfac).
* The ratio of initial P to motor MVA base. Typical value = 0,8.
* @param pfrac Fraction of constant-power load to be represented by this motor model (PFRAC) (>= 0,0 and <= 1,0).
* Typical value = 0,5.
* @group LoadDynamics
* @groupname LoadDynamics Package LoadDynamics
* @groupdesc LoadDynamics Dynamic load models are used to represent the dynamic real and reactive load behaviour of a load from the static power flow model.
Dynamic load models can be defined as applying either to a single load (energy consumer) or to a group of energy consumers.
Large industrial motors or groups of similar motors can be represented by a synchronous machine model (SynchronousMachineDynamics) or an asynchronous machine model (AsynchronousMachineDynamics), which are usually represented as generators with negative active power output in the static (power flow) data.
*/
final case class LoadComposite
(
LoadDynamics: LoadDynamics = null,
epfd: Double = 0.0,
epfs: Double = 0.0,
epvd: Double = 0.0,
epvs: Double = 0.0,
eqfd: Double = 0.0,
eqfs: Double = 0.0,
eqvd: Double = 0.0,
eqvs: Double = 0.0,
h: Double = 0.0,
lfac: Double = 0.0,
pfrac: Double = 0.0
)
extends
Element
{
/**
* Return the superclass object.
*
* @return The typed superclass nested object.
* @group Hierarchy
* @groupname Hierarchy Class Hierarchy Related
* @groupdesc Hierarchy Members related to the nested hierarchy of CIM classes.
*/
override def sup: LoadDynamics = LoadDynamics
//
// Row overrides
//
/**
* Return a copy of this object as a Row.
*
* Creates a clone of this object for use in Row manipulations.
*
* @return The copy of the object.
* @group Row
* @groupname Row SQL Row Implementation
* @groupdesc Row Members related to implementing the SQL Row interface
*/
override def copy (): Row = { clone ().asInstanceOf[Row] }
override def export_fields: String =
{
implicit val s: StringBuilder = new StringBuilder (sup.export_fields)
implicit val clz: String = LoadComposite.cls
def emitelem (position: Int, value: Any): Unit = if (mask (position)) emit_element (LoadComposite.fields (position), value)
emitelem (0, epfd)
emitelem (1, epfs)
emitelem (2, epvd)
emitelem (3, epvs)
emitelem (4, eqfd)
emitelem (5, eqfs)
emitelem (6, eqvd)
emitelem (7, eqvs)
emitelem (8, h)
emitelem (9, lfac)
emitelem (10, pfrac)
s.toString
}
override def export: String =
{
"\t\n%s\t ".format (id, export_fields)
}
}
object LoadComposite
extends
CIMParseable[LoadComposite]
{
override val fields: Array[String] = Array[String] (
"epfd",
"epfs",
"epvd",
"epvs",
"eqfd",
"eqfs",
"eqvd",
"eqvs",
"h",
"lfac",
"pfrac"
)
val epfd: Fielder = parse_element (element (cls, fields(0)))
val epfs: Fielder = parse_element (element (cls, fields(1)))
val epvd: Fielder = parse_element (element (cls, fields(2)))
val epvs: Fielder = parse_element (element (cls, fields(3)))
val eqfd: Fielder = parse_element (element (cls, fields(4)))
val eqfs: Fielder = parse_element (element (cls, fields(5)))
val eqvd: Fielder = parse_element (element (cls, fields(6)))
val eqvs: Fielder = parse_element (element (cls, fields(7)))
val h: Fielder = parse_element (element (cls, fields(8)))
val lfac: Fielder = parse_element (element (cls, fields(9)))
val pfrac: Fielder = parse_element (element (cls, fields(10)))
def parse (context: CIMContext): LoadComposite =
{
implicit val ctx: CIMContext = context
implicit val bitfields: Array[Int] = Array(0)
val ret = LoadComposite (
LoadDynamics.parse (context),
toDouble (mask (epfd (), 0)),
toDouble (mask (epfs (), 1)),
toDouble (mask (epvd (), 2)),
toDouble (mask (epvs (), 3)),
toDouble (mask (eqfd (), 4)),
toDouble (mask (eqfs (), 5)),
toDouble (mask (eqvd (), 6)),
toDouble (mask (eqvs (), 7)),
toDouble (mask (h (), 8)),
toDouble (mask (lfac (), 9)),
toDouble (mask (pfrac (), 10))
)
ret.bitfields = bitfields
ret
}
def serializer: Serializer[LoadComposite] = LoadCompositeSerializer
}
object LoadCompositeSerializer extends CIMSerializer[LoadComposite]
{
def write (kryo: Kryo, output: Output, obj: LoadComposite): Unit =
{
val toSerialize: Array[() => Unit] = Array (
() => output.writeDouble (obj.epfd),
() => output.writeDouble (obj.epfs),
() => output.writeDouble (obj.epvd),
() => output.writeDouble (obj.epvs),
() => output.writeDouble (obj.eqfd),
() => output.writeDouble (obj.eqfs),
() => output.writeDouble (obj.eqvd),
() => output.writeDouble (obj.eqvs),
() => output.writeDouble (obj.h),
() => output.writeDouble (obj.lfac),
() => output.writeDouble (obj.pfrac)
)
LoadDynamicsSerializer.write (kryo, output, obj.sup)
implicit val bitfields: Array[Int] = obj.bitfields
writeBitfields (output)
writeFields (toSerialize)
}
def read (kryo: Kryo, input: Input, cls: Class[LoadComposite]): LoadComposite =
{
val parent = LoadDynamicsSerializer.read (kryo, input, classOf[LoadDynamics])
implicit val bitfields: Array[Int] = readBitfields (input)
val obj = LoadComposite (
parent,
if (isSet (0)) input.readDouble else 0.0,
if (isSet (1)) input.readDouble else 0.0,
if (isSet (2)) input.readDouble else 0.0,
if (isSet (3)) input.readDouble else 0.0,
if (isSet (4)) input.readDouble else 0.0,
if (isSet (5)) input.readDouble else 0.0,
if (isSet (6)) input.readDouble else 0.0,
if (isSet (7)) input.readDouble else 0.0,
if (isSet (8)) input.readDouble else 0.0,
if (isSet (9)) input.readDouble else 0.0,
if (isSet (10)) input.readDouble else 0.0
)
obj.bitfields = bitfields
obj
}
}
/**
* Load whose behaviour is described by reference to a standard model or by definition of a user-defined model.
* A standard feature of dynamic load behaviour modelling is the ability to associate the same behaviour to multiple energy consumers by means of a single load definition.
*
* The load model is always applied to individual bus loads (energy consumers).
*
* @param IdentifiedObject [[ch.ninecode.model.IdentifiedObject IdentifiedObject]] Reference to the superclass object.
* @param EnergyConsumer [[ch.ninecode.model.EnergyConsumer EnergyConsumer]] Energy consumer to which this dynamics load model applies.
* @group LoadDynamics
* @groupname LoadDynamics Package LoadDynamics
* @groupdesc LoadDynamics Dynamic load models are used to represent the dynamic real and reactive load behaviour of a load from the static power flow model.
Dynamic load models can be defined as applying either to a single load (energy consumer) or to a group of energy consumers.
Large industrial motors or groups of similar motors can be represented by a synchronous machine model (SynchronousMachineDynamics) or an asynchronous machine model (AsynchronousMachineDynamics), which are usually represented as generators with negative active power output in the static (power flow) data.
*/
final case class LoadDynamics
(
IdentifiedObject: IdentifiedObject = null,
EnergyConsumer: List[String] = null
)
extends
Element
{
/**
* Return the superclass object.
*
* @return The typed superclass nested object.
* @group Hierarchy
* @groupname Hierarchy Class Hierarchy Related
* @groupdesc Hierarchy Members related to the nested hierarchy of CIM classes.
*/
override def sup: IdentifiedObject = IdentifiedObject
//
// Row overrides
//
/**
* Return a copy of this object as a Row.
*
* Creates a clone of this object for use in Row manipulations.
*
* @return The copy of the object.
* @group Row
* @groupname Row SQL Row Implementation
* @groupdesc Row Members related to implementing the SQL Row interface
*/
override def copy (): Row = { clone ().asInstanceOf[Row] }
override def export_fields: String =
{
implicit val s: StringBuilder = new StringBuilder (sup.export_fields)
implicit val clz: String = LoadDynamics.cls
def emitattrs (position: Int, value: List[String]): Unit = if (mask (position) && (null != value)) value.foreach (x => emit_attribute (LoadDynamics.fields (position), x))
emitattrs (0, EnergyConsumer)
s.toString
}
override def export: String =
{
"\t\n%s\t ".format (id, export_fields)
}
}
object LoadDynamics
extends
CIMParseable[LoadDynamics]
{
override val fields: Array[String] = Array[String] (
"EnergyConsumer"
)
override val relations: List[CIMRelationship] = List (
CIMRelationship ("EnergyConsumer", "EnergyConsumer", "0..*", "0..1")
)
val EnergyConsumer: FielderMultiple = parse_attributes (attribute (cls, fields(0)))
def parse (context: CIMContext): LoadDynamics =
{
implicit val ctx: CIMContext = context
implicit val bitfields: Array[Int] = Array(0)
val ret = LoadDynamics (
IdentifiedObject.parse (context),
masks (EnergyConsumer (), 0)
)
ret.bitfields = bitfields
ret
}
def serializer: Serializer[LoadDynamics] = LoadDynamicsSerializer
}
object LoadDynamicsSerializer extends CIMSerializer[LoadDynamics]
{
def write (kryo: Kryo, output: Output, obj: LoadDynamics): Unit =
{
val toSerialize: Array[() => Unit] = Array (
() => writeList (obj.EnergyConsumer, output)
)
IdentifiedObjectSerializer.write (kryo, output, obj.sup)
implicit val bitfields: Array[Int] = obj.bitfields
writeBitfields (output)
writeFields (toSerialize)
}
def read (kryo: Kryo, input: Input, cls: Class[LoadDynamics]): LoadDynamics =
{
val parent = IdentifiedObjectSerializer.read (kryo, input, classOf[IdentifiedObject])
implicit val bitfields: Array[Int] = readBitfields (input)
val obj = LoadDynamics (
parent,
if (isSet (0)) readList (input) else null
)
obj.bitfields = bitfields
obj
}
}
/**
* Generic non-linear dynamic (GNLD) load.
*
* This model can be used in mid-term and long-term voltage stability simulations (i.e., to study voltage collapse), as it can replace a more detailed representation of aggregate load, including induction motors, thermostatically controlled and static loads.
*
* @param LoadDynamics [[ch.ninecode.model.LoadDynamics LoadDynamics]] Reference to the superclass object.
* @param bs Steady state voltage index for reactive power (BS).
* @param bt Transient voltage index for reactive power (BT).
* @param genericNonLinearLoadModelType Type of generic non-linear load model.
* @param ls Steady state voltage index for active power (LS).
* @param lt Transient voltage index for active power (LT).
* @param tp Time constant of lag function of active power (TP) (> 0).
* @param tq Time constant of lag function of reactive power (TQ) (> 0).
* @group LoadDynamics
* @groupname LoadDynamics Package LoadDynamics
* @groupdesc LoadDynamics Dynamic load models are used to represent the dynamic real and reactive load behaviour of a load from the static power flow model.
Dynamic load models can be defined as applying either to a single load (energy consumer) or to a group of energy consumers.
Large industrial motors or groups of similar motors can be represented by a synchronous machine model (SynchronousMachineDynamics) or an asynchronous machine model (AsynchronousMachineDynamics), which are usually represented as generators with negative active power output in the static (power flow) data.
*/
final case class LoadGenericNonLinear
(
LoadDynamics: LoadDynamics = null,
bs: Double = 0.0,
bt: Double = 0.0,
genericNonLinearLoadModelType: String = null,
ls: Double = 0.0,
lt: Double = 0.0,
tp: Double = 0.0,
tq: Double = 0.0
)
extends
Element
{
/**
* Return the superclass object.
*
* @return The typed superclass nested object.
* @group Hierarchy
* @groupname Hierarchy Class Hierarchy Related
* @groupdesc Hierarchy Members related to the nested hierarchy of CIM classes.
*/
override def sup: LoadDynamics = LoadDynamics
//
// Row overrides
//
/**
* Return a copy of this object as a Row.
*
* Creates a clone of this object for use in Row manipulations.
*
* @return The copy of the object.
* @group Row
* @groupname Row SQL Row Implementation
* @groupdesc Row Members related to implementing the SQL Row interface
*/
override def copy (): Row = { clone ().asInstanceOf[Row] }
override def export_fields: String =
{
implicit val s: StringBuilder = new StringBuilder (sup.export_fields)
implicit val clz: String = LoadGenericNonLinear.cls
def emitelem (position: Int, value: Any): Unit = if (mask (position)) emit_element (LoadGenericNonLinear.fields (position), value)
def emitattr (position: Int, value: Any): Unit = if (mask (position)) emit_attribute (LoadGenericNonLinear.fields (position), value)
emitelem (0, bs)
emitelem (1, bt)
emitattr (2, genericNonLinearLoadModelType)
emitelem (3, ls)
emitelem (4, lt)
emitelem (5, tp)
emitelem (6, tq)
s.toString
}
override def export: String =
{
"\t\n%s\t ".format (id, export_fields)
}
}
object LoadGenericNonLinear
extends
CIMParseable[LoadGenericNonLinear]
{
override val fields: Array[String] = Array[String] (
"bs",
"bt",
"genericNonLinearLoadModelType",
"ls",
"lt",
"tp",
"tq"
)
val bs: Fielder = parse_element (element (cls, fields(0)))
val bt: Fielder = parse_element (element (cls, fields(1)))
val genericNonLinearLoadModelType: Fielder = parse_attribute (attribute (cls, fields(2)))
val ls: Fielder = parse_element (element (cls, fields(3)))
val lt: Fielder = parse_element (element (cls, fields(4)))
val tp: Fielder = parse_element (element (cls, fields(5)))
val tq: Fielder = parse_element (element (cls, fields(6)))
def parse (context: CIMContext): LoadGenericNonLinear =
{
implicit val ctx: CIMContext = context
implicit val bitfields: Array[Int] = Array(0)
val ret = LoadGenericNonLinear (
LoadDynamics.parse (context),
toDouble (mask (bs (), 0)),
toDouble (mask (bt (), 1)),
mask (genericNonLinearLoadModelType (), 2),
toDouble (mask (ls (), 3)),
toDouble (mask (lt (), 4)),
toDouble (mask (tp (), 5)),
toDouble (mask (tq (), 6))
)
ret.bitfields = bitfields
ret
}
def serializer: Serializer[LoadGenericNonLinear] = LoadGenericNonLinearSerializer
}
object LoadGenericNonLinearSerializer extends CIMSerializer[LoadGenericNonLinear]
{
def write (kryo: Kryo, output: Output, obj: LoadGenericNonLinear): Unit =
{
val toSerialize: Array[() => Unit] = Array (
() => output.writeDouble (obj.bs),
() => output.writeDouble (obj.bt),
() => output.writeString (obj.genericNonLinearLoadModelType),
() => output.writeDouble (obj.ls),
() => output.writeDouble (obj.lt),
() => output.writeDouble (obj.tp),
() => output.writeDouble (obj.tq)
)
LoadDynamicsSerializer.write (kryo, output, obj.sup)
implicit val bitfields: Array[Int] = obj.bitfields
writeBitfields (output)
writeFields (toSerialize)
}
def read (kryo: Kryo, input: Input, cls: Class[LoadGenericNonLinear]): LoadGenericNonLinear =
{
val parent = LoadDynamicsSerializer.read (kryo, input, classOf[LoadDynamics])
implicit val bitfields: Array[Int] = readBitfields (input)
val obj = LoadGenericNonLinear (
parent,
if (isSet (0)) input.readDouble else 0.0,
if (isSet (1)) input.readDouble else 0.0,
if (isSet (2)) input.readString else null,
if (isSet (3)) input.readDouble else 0.0,
if (isSet (4)) input.readDouble else 0.0,
if (isSet (5)) input.readDouble else 0.0,
if (isSet (6)) input.readDouble else 0.0
)
obj.bitfields = bitfields
obj
}
}
/**
* Aggregate induction motor load.
*
* This model is used to represent a fraction of an ordinary load as "induction motor load". It allows a load that is treated as an ordinary constant power in power flow analysis to be represented by an induction motor in dynamic simulation. This model is intended for representation of aggregations of many motors dispersed through a load represented at a high voltage bus but where there is no information on the characteristics of individual motors.
* Either a "one-cage" or "two-cage" model of the induction machine can be modelled. Magnetic saturation is not modelled.
* This model treats a fraction of the constant power part of a load as a motor. During initialisation, the initial power drawn by the motor is set equal to Pfrac times the constant P part of the static load. The remainder of the load is left as a static load.
* The reactive power demand of the motor is calculated during initialisation as a function of voltage at the load bus. This reactive power demand can be less than or greater than the constant Q component of the load. If the motor's reactive demand is greater than the constant Q component of the load, the model inserts a shunt capacitor at the terminal of the motor to bring its reactive demand down to equal the constant Q reactive load.
* If an induction motor load model and a static load model are both present for a load, the motor Pfrac is assumed to be subtracted from the power flow constant P load before the static load model is applied. The remainder of the load, if any, is then represented by the static load model.
*
* @param IdentifiedObject [[ch.ninecode.model.IdentifiedObject IdentifiedObject]] Reference to the superclass object.
* @param d Damping factor (D).
* Unit = delta P/delta speed. Typical value = 2.
* @param h Inertia constant (H) (>= 0).
* Typical value = 0,4.
* @param lfac Loading factor (Lfac).
* The ratio of initial P to motor MVA base. Typical value = 0,8.
* @param lp Transient reactance (Lp).
* Typical value = 0,15.
* @param lpp Subtransient reactance (Lpp).
* Typical value = 0,15.
* @param ls Synchronous reactance (Ls).
* Typical value = 3,2.
* @param pfrac Fraction of constant-power load to be represented by this motor model (Pfrac) (>= 0,0 and <= 1,0).
* Typical value = 0,3.
* @param ra Stator resistance (Ra).
* Typical value = 0.
* @param tbkr Circuit breaker operating time (Tbkr) (>= 0).
* Typical value = 0,08.
* @param tpo Transient rotor time constant (Tpo) (>= 0).
* Typical value = 1.
* @param tppo Subtransient rotor time constant (Tppo) (>= 0).
* Typical value = 0,02.
* @param tv Voltage trip pickup time (Tv) (>= 0).
* Typical value = 0,1.
* @param vt Voltage threshold for tripping (Vt).
* Typical value = 0,7.
* @param LoadAggregate [[ch.ninecode.model.LoadAggregate LoadAggregate]] Aggregate load to which this aggregate motor (dynamic) load belongs.
* @group LoadDynamics
* @groupname LoadDynamics Package LoadDynamics
* @groupdesc LoadDynamics Dynamic load models are used to represent the dynamic real and reactive load behaviour of a load from the static power flow model.
Dynamic load models can be defined as applying either to a single load (energy consumer) or to a group of energy consumers.
Large industrial motors or groups of similar motors can be represented by a synchronous machine model (SynchronousMachineDynamics) or an asynchronous machine model (AsynchronousMachineDynamics), which are usually represented as generators with negative active power output in the static (power flow) data.
*/
final case class LoadMotor
(
IdentifiedObject: IdentifiedObject = null,
d: Double = 0.0,
h: Double = 0.0,
lfac: Double = 0.0,
lp: Double = 0.0,
lpp: Double = 0.0,
ls: Double = 0.0,
pfrac: Double = 0.0,
ra: Double = 0.0,
tbkr: Double = 0.0,
tpo: Double = 0.0,
tppo: Double = 0.0,
tv: Double = 0.0,
vt: Double = 0.0,
LoadAggregate: String = null
)
extends
Element
{
/**
* Return the superclass object.
*
* @return The typed superclass nested object.
* @group Hierarchy
* @groupname Hierarchy Class Hierarchy Related
* @groupdesc Hierarchy Members related to the nested hierarchy of CIM classes.
*/
override def sup: IdentifiedObject = IdentifiedObject
//
// Row overrides
//
/**
* Return a copy of this object as a Row.
*
* Creates a clone of this object for use in Row manipulations.
*
* @return The copy of the object.
* @group Row
* @groupname Row SQL Row Implementation
* @groupdesc Row Members related to implementing the SQL Row interface
*/
override def copy (): Row = { clone ().asInstanceOf[Row] }
override def export_fields: String =
{
implicit val s: StringBuilder = new StringBuilder (sup.export_fields)
implicit val clz: String = LoadMotor.cls
def emitelem (position: Int, value: Any): Unit = if (mask (position)) emit_element (LoadMotor.fields (position), value)
def emitattr (position: Int, value: Any): Unit = if (mask (position)) emit_attribute (LoadMotor.fields (position), value)
emitelem (0, d)
emitelem (1, h)
emitelem (2, lfac)
emitelem (3, lp)
emitelem (4, lpp)
emitelem (5, ls)
emitelem (6, pfrac)
emitelem (7, ra)
emitelem (8, tbkr)
emitelem (9, tpo)
emitelem (10, tppo)
emitelem (11, tv)
emitelem (12, vt)
emitattr (13, LoadAggregate)
s.toString
}
override def export: String =
{
"\t\n%s\t ".format (id, export_fields)
}
}
object LoadMotor
extends
CIMParseable[LoadMotor]
{
override val fields: Array[String] = Array[String] (
"d",
"h",
"lfac",
"lp",
"lpp",
"ls",
"pfrac",
"ra",
"tbkr",
"tpo",
"tppo",
"tv",
"vt",
"LoadAggregate"
)
override val relations: List[CIMRelationship] = List (
CIMRelationship ("LoadAggregate", "LoadAggregate", "1", "0..1")
)
val d: Fielder = parse_element (element (cls, fields(0)))
val h: Fielder = parse_element (element (cls, fields(1)))
val lfac: Fielder = parse_element (element (cls, fields(2)))
val lp: Fielder = parse_element (element (cls, fields(3)))
val lpp: Fielder = parse_element (element (cls, fields(4)))
val ls: Fielder = parse_element (element (cls, fields(5)))
val pfrac: Fielder = parse_element (element (cls, fields(6)))
val ra: Fielder = parse_element (element (cls, fields(7)))
val tbkr: Fielder = parse_element (element (cls, fields(8)))
val tpo: Fielder = parse_element (element (cls, fields(9)))
val tppo: Fielder = parse_element (element (cls, fields(10)))
val tv: Fielder = parse_element (element (cls, fields(11)))
val vt: Fielder = parse_element (element (cls, fields(12)))
val LoadAggregate: Fielder = parse_attribute (attribute (cls, fields(13)))
def parse (context: CIMContext): LoadMotor =
{
implicit val ctx: CIMContext = context
implicit val bitfields: Array[Int] = Array(0)
val ret = LoadMotor (
IdentifiedObject.parse (context),
toDouble (mask (d (), 0)),
toDouble (mask (h (), 1)),
toDouble (mask (lfac (), 2)),
toDouble (mask (lp (), 3)),
toDouble (mask (lpp (), 4)),
toDouble (mask (ls (), 5)),
toDouble (mask (pfrac (), 6)),
toDouble (mask (ra (), 7)),
toDouble (mask (tbkr (), 8)),
toDouble (mask (tpo (), 9)),
toDouble (mask (tppo (), 10)),
toDouble (mask (tv (), 11)),
toDouble (mask (vt (), 12)),
mask (LoadAggregate (), 13)
)
ret.bitfields = bitfields
ret
}
def serializer: Serializer[LoadMotor] = LoadMotorSerializer
}
object LoadMotorSerializer extends CIMSerializer[LoadMotor]
{
def write (kryo: Kryo, output: Output, obj: LoadMotor): Unit =
{
val toSerialize: Array[() => Unit] = Array (
() => output.writeDouble (obj.d),
() => output.writeDouble (obj.h),
() => output.writeDouble (obj.lfac),
() => output.writeDouble (obj.lp),
() => output.writeDouble (obj.lpp),
() => output.writeDouble (obj.ls),
() => output.writeDouble (obj.pfrac),
() => output.writeDouble (obj.ra),
() => output.writeDouble (obj.tbkr),
() => output.writeDouble (obj.tpo),
() => output.writeDouble (obj.tppo),
() => output.writeDouble (obj.tv),
() => output.writeDouble (obj.vt),
() => output.writeString (obj.LoadAggregate)
)
IdentifiedObjectSerializer.write (kryo, output, obj.sup)
implicit val bitfields: Array[Int] = obj.bitfields
writeBitfields (output)
writeFields (toSerialize)
}
def read (kryo: Kryo, input: Input, cls: Class[LoadMotor]): LoadMotor =
{
val parent = IdentifiedObjectSerializer.read (kryo, input, classOf[IdentifiedObject])
implicit val bitfields: Array[Int] = readBitfields (input)
val obj = LoadMotor (
parent,
if (isSet (0)) input.readDouble else 0.0,
if (isSet (1)) input.readDouble else 0.0,
if (isSet (2)) input.readDouble else 0.0,
if (isSet (3)) input.readDouble else 0.0,
if (isSet (4)) input.readDouble else 0.0,
if (isSet (5)) input.readDouble else 0.0,
if (isSet (6)) input.readDouble else 0.0,
if (isSet (7)) input.readDouble else 0.0,
if (isSet (8)) input.readDouble else 0.0,
if (isSet (9)) input.readDouble else 0.0,
if (isSet (10)) input.readDouble else 0.0,
if (isSet (11)) input.readDouble else 0.0,
if (isSet (12)) input.readDouble else 0.0,
if (isSet (13)) input.readString else null
)
obj.bitfields = bitfields
obj
}
}
/**
* General static load.
*
* This model represents the sensitivity of the real and reactive power consumed by the load to the amplitude and frequency of the bus voltage.
*
* @param IdentifiedObject [[ch.ninecode.model.IdentifiedObject IdentifiedObject]] Reference to the superclass object.
* @param ep1 First term voltage exponent for active power (Ep1).
* Used only when .staticLoadModelType = exponential.
* @param ep2 Second term voltage exponent for active power (Ep2).
* Used only when .staticLoadModelType = exponential.
* @param ep3 Third term voltage exponent for active power (Ep3).
* Used only when .staticLoadModelType = exponential.
* @param eq1 First term voltage exponent for reactive power (Eq1).
* Used only when .staticLoadModelType = exponential.
* @param eq2 Second term voltage exponent for reactive power (Eq2).
* Used only when .staticLoadModelType = exponential.
* @param eq3 Third term voltage exponent for reactive power (Eq3).
* Used only when .staticLoadModelType = exponential.
* @param kp1 First term voltage coefficient for active power (Kp1).
* Not used when .staticLoadModelType = constantZ.
* @param kp2 Second term voltage coefficient for active power (Kp2).
* Not used when .staticLoadModelType = constantZ.
* @param kp3 Third term voltage coefficient for active power (Kp3).
* Not used when .staticLoadModelType = constantZ.
* @param kp4 Frequency coefficient for active power (Kp4) (not = 0 if .staticLoadModelType = zIP2).
* Used only when .staticLoadModelType = zIP2.
* @param kpf Frequency deviation coefficient for active power (Kpf).
* Not used when .staticLoadModelType = constantZ.
* @param kq1 First term voltage coefficient for reactive power (Kq1).
* Not used when .staticLoadModelType = constantZ.
* @param kq2 Second term voltage coefficient for reactive power (Kq2).
* Not used when .staticLoadModelType = constantZ.
* @param kq3 Third term voltage coefficient for reactive power (Kq3).
* Not used when .staticLoadModelType = constantZ.
* @param kq4 Frequency coefficient for reactive power (Kq4) (not = 0 when .staticLoadModelType = zIP2).
* Used only when .staticLoadModelType - zIP2.
* @param kqf Frequency deviation coefficient for reactive power (Kqf).
* Not used when .staticLoadModelType = constantZ.
* @param staticLoadModelType Type of static load model.
* Typical value = constantZ.
* @param LoadAggregate [[ch.ninecode.model.LoadAggregate LoadAggregate]] Aggregate load to which this aggregate static load belongs.
* @group LoadDynamics
* @groupname LoadDynamics Package LoadDynamics
* @groupdesc LoadDynamics Dynamic load models are used to represent the dynamic real and reactive load behaviour of a load from the static power flow model.
Dynamic load models can be defined as applying either to a single load (energy consumer) or to a group of energy consumers.
Large industrial motors or groups of similar motors can be represented by a synchronous machine model (SynchronousMachineDynamics) or an asynchronous machine model (AsynchronousMachineDynamics), which are usually represented as generators with negative active power output in the static (power flow) data.
*/
final case class LoadStatic
(
IdentifiedObject: IdentifiedObject = null,
ep1: Double = 0.0,
ep2: Double = 0.0,
ep3: Double = 0.0,
eq1: Double = 0.0,
eq2: Double = 0.0,
eq3: Double = 0.0,
kp1: Double = 0.0,
kp2: Double = 0.0,
kp3: Double = 0.0,
kp4: Double = 0.0,
kpf: Double = 0.0,
kq1: Double = 0.0,
kq2: Double = 0.0,
kq3: Double = 0.0,
kq4: Double = 0.0,
kqf: Double = 0.0,
staticLoadModelType: String = null,
LoadAggregate: String = null
)
extends
Element
{
/**
* Return the superclass object.
*
* @return The typed superclass nested object.
* @group Hierarchy
* @groupname Hierarchy Class Hierarchy Related
* @groupdesc Hierarchy Members related to the nested hierarchy of CIM classes.
*/
override def sup: IdentifiedObject = IdentifiedObject
//
// Row overrides
//
/**
* Return a copy of this object as a Row.
*
* Creates a clone of this object for use in Row manipulations.
*
* @return The copy of the object.
* @group Row
* @groupname Row SQL Row Implementation
* @groupdesc Row Members related to implementing the SQL Row interface
*/
override def copy (): Row = { clone ().asInstanceOf[Row] }
override def export_fields: String =
{
implicit val s: StringBuilder = new StringBuilder (sup.export_fields)
implicit val clz: String = LoadStatic.cls
def emitelem (position: Int, value: Any): Unit = if (mask (position)) emit_element (LoadStatic.fields (position), value)
def emitattr (position: Int, value: Any): Unit = if (mask (position)) emit_attribute (LoadStatic.fields (position), value)
emitelem (0, ep1)
emitelem (1, ep2)
emitelem (2, ep3)
emitelem (3, eq1)
emitelem (4, eq2)
emitelem (5, eq3)
emitelem (6, kp1)
emitelem (7, kp2)
emitelem (8, kp3)
emitelem (9, kp4)
emitelem (10, kpf)
emitelem (11, kq1)
emitelem (12, kq2)
emitelem (13, kq3)
emitelem (14, kq4)
emitelem (15, kqf)
emitattr (16, staticLoadModelType)
emitattr (17, LoadAggregate)
s.toString
}
override def export: String =
{
"\t\n%s\t ".format (id, export_fields)
}
}
object LoadStatic
extends
CIMParseable[LoadStatic]
{
override val fields: Array[String] = Array[String] (
"ep1",
"ep2",
"ep3",
"eq1",
"eq2",
"eq3",
"kp1",
"kp2",
"kp3",
"kp4",
"kpf",
"kq1",
"kq2",
"kq3",
"kq4",
"kqf",
"staticLoadModelType",
"LoadAggregate"
)
override val relations: List[CIMRelationship] = List (
CIMRelationship ("LoadAggregate", "LoadAggregate", "1", "0..1")
)
val ep1: Fielder = parse_element (element (cls, fields(0)))
val ep2: Fielder = parse_element (element (cls, fields(1)))
val ep3: Fielder = parse_element (element (cls, fields(2)))
val eq1: Fielder = parse_element (element (cls, fields(3)))
val eq2: Fielder = parse_element (element (cls, fields(4)))
val eq3: Fielder = parse_element (element (cls, fields(5)))
val kp1: Fielder = parse_element (element (cls, fields(6)))
val kp2: Fielder = parse_element (element (cls, fields(7)))
val kp3: Fielder = parse_element (element (cls, fields(8)))
val kp4: Fielder = parse_element (element (cls, fields(9)))
val kpf: Fielder = parse_element (element (cls, fields(10)))
val kq1: Fielder = parse_element (element (cls, fields(11)))
val kq2: Fielder = parse_element (element (cls, fields(12)))
val kq3: Fielder = parse_element (element (cls, fields(13)))
val kq4: Fielder = parse_element (element (cls, fields(14)))
val kqf: Fielder = parse_element (element (cls, fields(15)))
val staticLoadModelType: Fielder = parse_attribute (attribute (cls, fields(16)))
val LoadAggregate: Fielder = parse_attribute (attribute (cls, fields(17)))
def parse (context: CIMContext): LoadStatic =
{
implicit val ctx: CIMContext = context
implicit val bitfields: Array[Int] = Array(0)
val ret = LoadStatic (
IdentifiedObject.parse (context),
toDouble (mask (ep1 (), 0)),
toDouble (mask (ep2 (), 1)),
toDouble (mask (ep3 (), 2)),
toDouble (mask (eq1 (), 3)),
toDouble (mask (eq2 (), 4)),
toDouble (mask (eq3 (), 5)),
toDouble (mask (kp1 (), 6)),
toDouble (mask (kp2 (), 7)),
toDouble (mask (kp3 (), 8)),
toDouble (mask (kp4 (), 9)),
toDouble (mask (kpf (), 10)),
toDouble (mask (kq1 (), 11)),
toDouble (mask (kq2 (), 12)),
toDouble (mask (kq3 (), 13)),
toDouble (mask (kq4 (), 14)),
toDouble (mask (kqf (), 15)),
mask (staticLoadModelType (), 16),
mask (LoadAggregate (), 17)
)
ret.bitfields = bitfields
ret
}
def serializer: Serializer[LoadStatic] = LoadStaticSerializer
}
object LoadStaticSerializer extends CIMSerializer[LoadStatic]
{
def write (kryo: Kryo, output: Output, obj: LoadStatic): Unit =
{
val toSerialize: Array[() => Unit] = Array (
() => output.writeDouble (obj.ep1),
() => output.writeDouble (obj.ep2),
() => output.writeDouble (obj.ep3),
() => output.writeDouble (obj.eq1),
() => output.writeDouble (obj.eq2),
() => output.writeDouble (obj.eq3),
() => output.writeDouble (obj.kp1),
() => output.writeDouble (obj.kp2),
() => output.writeDouble (obj.kp3),
() => output.writeDouble (obj.kp4),
() => output.writeDouble (obj.kpf),
() => output.writeDouble (obj.kq1),
() => output.writeDouble (obj.kq2),
() => output.writeDouble (obj.kq3),
() => output.writeDouble (obj.kq4),
() => output.writeDouble (obj.kqf),
() => output.writeString (obj.staticLoadModelType),
() => output.writeString (obj.LoadAggregate)
)
IdentifiedObjectSerializer.write (kryo, output, obj.sup)
implicit val bitfields: Array[Int] = obj.bitfields
writeBitfields (output)
writeFields (toSerialize)
}
def read (kryo: Kryo, input: Input, cls: Class[LoadStatic]): LoadStatic =
{
val parent = IdentifiedObjectSerializer.read (kryo, input, classOf[IdentifiedObject])
implicit val bitfields: Array[Int] = readBitfields (input)
val obj = LoadStatic (
parent,
if (isSet (0)) input.readDouble else 0.0,
if (isSet (1)) input.readDouble else 0.0,
if (isSet (2)) input.readDouble else 0.0,
if (isSet (3)) input.readDouble else 0.0,
if (isSet (4)) input.readDouble else 0.0,
if (isSet (5)) input.readDouble else 0.0,
if (isSet (6)) input.readDouble else 0.0,
if (isSet (7)) input.readDouble else 0.0,
if (isSet (8)) input.readDouble else 0.0,
if (isSet (9)) input.readDouble else 0.0,
if (isSet (10)) input.readDouble else 0.0,
if (isSet (11)) input.readDouble else 0.0,
if (isSet (12)) input.readDouble else 0.0,
if (isSet (13)) input.readDouble else 0.0,
if (isSet (14)) input.readDouble else 0.0,
if (isSet (15)) input.readDouble else 0.0,
if (isSet (16)) input.readString else null,
if (isSet (17)) input.readString else null
)
obj.bitfields = bitfields
obj
}
}
private[ninecode] object _LoadDynamics
{
def register: List[CIMClassInfo] =
{
List (
LoadAggregate.register,
LoadComposite.register,
LoadDynamics.register,
LoadGenericNonLinear.register,
LoadMotor.register,
LoadStatic.register
)
}
}