PhasedEvaluated TFrom, TTo  ClassElecNetKit Documentation
PhasedEvaluated TFrom, TTo  applies transforms to the values from an underlying Phased T  in order to obtain new values.
Inheritance Hierarchy

OnlineSystem Object
  ElecNetKit.NetworkModelling.Phasing PhasedEvaluated TFrom, TTo 

Namespace: ElecNetKit.NetworkModelling.Phasing
Assembly: ElecNetKit.Core (in ElecNetKit.Core.dll) Version: 1.1.4771.27370 (1.1.0.0)
Syntax

public class PhasedEvaluated<TFrom, TTo> : Phased<TTo>, 
	IDictionary<int, TTo>, ICollection<KeyValuePair<int, TTo>>, IEnumerable<KeyValuePair<int, TTo>>, 
	IEnumerable 
where TFrom : struct, new()
where TTo : struct, new()
Type Parameters

TFrom
The type of the base phased object.
TTo
The type of the values of this phased object.
Remarks

PhasedEvaluated TFrom, TTo  is useful for providing phased convenience properties to classes when there is no difference in underlying data.
Examples

Consider the two properties of electrical network buses: voltage, and per-unit voltage. There is no point in storing these values twice in a network element model: The per-unit voltage would be redundant, as it is defined as (Voltage/BaseVoltage), and both of these values are stored in the network element. In such cases, it is best to use a PhasedEvaluated TFrom, TTo  for implementation:
public class Bus
{
    public Phased<Complex> VoltagePhased { private set; get; }

    public double BaseVoltage { set; get; }

    public Phased<Complex> VoltagePUPhased { private set; get; }

    public Bus() // or OnDeserializationCallback, whatever
    {
        VoltagePUPhased = new PhasedEvaluated<Complex,Complex>(
                from => from / this.BaseVoltage, //get
                to => to * this.BaseVoltage, //set
                VoltagePhased
                );
    }
}
See Also