/// <summary> /// Creates a new <see cref="PhasorDefinition"/> from specified parameters. /// </summary> /// <param name="parent">The <see cref="ConfigurationCell"/> parent of this <see cref="PhasorDefinition"/>.</param> /// <param name="index">Index of phasor within INI based configuration file.</param> /// <param name="entryValue">The entry value from the INI based configuration file.</param> public PhasorDefinition(ConfigurationCell parent, int index, string entryValue) : base(parent) { string[] entry = entryValue.Split(','); string entryType = entry[0].Trim().Substring(0, 1).ToUpper(); PhasorDefinition defaultPhasor; if (parent != null) { ConfigurationFrame configFile = this.Parent.Parent; if (entryType == "V") { PhasorType = PhasorType.Voltage; defaultPhasor = configFile.DefaultPhasorV; } else if (entryType == "I") { PhasorType = PhasorType.Current; defaultPhasor = configFile.DefaultPhasorI; } else { PhasorType = PhasorType.Voltage; defaultPhasor = configFile.DefaultPhasorV; } } else { defaultPhasor = new PhasorDefinition(null as ConfigurationCell); } if (entry.Length > 1) Ratio = double.Parse(entry[1].Trim()); else Ratio = defaultPhasor.Ratio; if (entry.Length > 2) CalFactor = double.Parse(entry[2].Trim()); else ConversionFactor = defaultPhasor.ConversionFactor; if (entry.Length > 3) Offset = double.Parse(entry[3].Trim()); else Offset = defaultPhasor.Offset; if (entry.Length > 4) Shunt = double.Parse(entry[4].Trim()); else Shunt = defaultPhasor.Shunt; if (entry.Length > 5) VoltageReferenceIndex = (int)double.Parse(entry[5].Trim()); else VoltageReferenceIndex = defaultPhasor.VoltageReferenceIndex; if (entry.Length > 6) Label = entry[6].Trim(); else Label = defaultPhasor.Label; this.Index = index; }
/// <summary> /// Creates a new <see cref="PhasorDefinition"/> from specified parameters. /// </summary> /// <param name="parent">The <see cref="ConfigurationCell"/> parent of this <see cref="PhasorDefinition"/>.</param> /// <param name="label">The label of this <see cref="PhasorDefinition"/>.</param> /// <param name="scale">The integer scaling value of this <see cref="PhasorDefinition"/>.</param> /// <param name="offset">The offset of this <see cref="PhasorDefinition"/>.</param> /// <param name="type">The <see cref="PhasorType"/> of this <see cref="PhasorDefinition"/>.</param> /// <param name="voltageReference">The associated <see cref="IPhasorDefinition"/> that represents the voltage reference (if any).</param> public PhasorDefinition(ConfigurationCell parent, string label, uint scale, double offset, PhasorType type, PhasorDefinition voltageReference) : base(parent, label, scale, offset, type, voltageReference) { }
// Delegate handler to create a new BPA PDCstream phasor definition internal static IPhasorDefinition CreateNewDefinition(IConfigurationCell parent, byte[] binaryImage, int startIndex, out int parsedLength) { IPhasorDefinition phasorDefinition = new PhasorDefinition(parent); parsedLength = phasorDefinition.Initialize(binaryImage, startIndex, 0); return phasorDefinition; }
// Static Methods // Calculates a BPA PDCstream phasor's custom conversion factor internal static double CustomConversionFactor(PhasorDefinition phasor) { if (phasor.PhasorType == PhasorType.Voltage) return phasor.CalFactor * phasor.Ratio; return phasor.CalFactor * phasor.Ratio / phasor.Shunt; }
/// <summary> /// Creates a new <see cref="PhasorValue"/> from specified parameters. /// </summary> /// <param name="parent">The <see cref="DataCell"/> parent of this <see cref="PhasorValue"/>.</param> /// <param name="phasorDefinition">The <see cref="PhasorDefinition"/> associated with this <see cref="PhasorValue"/>.</param> /// <param name="angle">The <see cref="TVA.Units.Angle"/> value (a.k.a., the argument) of this <see cref="PhasorValue"/>, in radians.</param> /// <param name="magnitude">The magnitude value (a.k.a., the absolute value or modulus) of this <see cref="PhasorValue"/>.</param> public PhasorValue(DataCell parent, PhasorDefinition phasorDefinition, Angle angle, double magnitude) : base(parent, phasorDefinition, angle, magnitude) { }
/// <summary> /// Creates a new <see cref="PhasorValue"/> from specified parameters. /// </summary> /// <param name="parent">The <see cref="DataCell"/> parent of this <see cref="PhasorValue"/>.</param> /// <param name="phasorDefinition">The <see cref="PhasorDefinition"/> associated with this <see cref="PhasorValue"/>.</param> /// <param name="real">The real value of this <see cref="PhasorValue"/>.</param> /// <param name="imaginary">The imaginary value of this <see cref="PhasorValue"/>.</param> public PhasorValue(DataCell parent, PhasorDefinition phasorDefinition, double real, double imaginary) : base(parent, phasorDefinition, real, imaginary) { }