/// <summary> /// Creates a new <see cref="DataCell"/> from specified parameters. /// </summary> /// <param name="parent">The reference to parent <see cref="DataFrame"/> of this <see cref="DataCell"/>.</param> /// <param name="configurationCell">The <see cref="ConfigurationCell"/> associated with this <see cref="DataCell"/>.</param> /// <param name="addEmptyValues">If <c>true</c>, adds empty values for each defined configuration cell definition.</param> public DataCell(DataFrame parent, ConfigurationCell configurationCell, bool addEmptyValues) : this(parent, configurationCell) { if (addEmptyValues) { int x; // Define needed phasor values for (x = 0; x < configurationCell.PhasorDefinitions.Count; x++) { PhasorValues.Add(new PhasorValue(this, configurationCell.PhasorDefinitions[x])); } // Define a frequency and df/dt FrequencyValue = new FrequencyValue(this, configurationCell.FrequencyDefinition); // Define any analog values for (x = 0; x < configurationCell.AnalogDefinitions.Count; x++) { AnalogValues.Add(new AnalogValue(this, configurationCell.AnalogDefinitions[x])); } // Define any digital values for (x = 0; x < configurationCell.DigitalDefinitions.Count; x++) { DigitalValues.Add(new DigitalValue(this, configurationCell.DigitalDefinitions[x])); } } }
/// <summary> /// Attempts to retrieve a <see cref="ConfigurationCell"/> from this <see cref="ConfigurationCellCollection"/> with the specified <paramref name="sectionEntry"/>. /// </summary> /// <param name="sectionEntry"><see cref="ConfigurationCell.SectionEntry"/> value to try to find.</param> /// <param name="configurationCell"><see cref="ConfigurationCell"/> with the specified <paramref name="sectionEntry"/> if found; otherwise <c>null</c>.</param> /// <returns><c>true</c> if <see cref="ConfigurationCell"/> with the specified <paramref name="sectionEntry"/> is found; otherwise <c>false</c>.</returns> public bool TryGetBySectionEntry(string sectionEntry, ref ConfigurationCell configurationCell) { for (int i = 0; i < Count; i++) { configurationCell = this[i]; if (string.Compare(configurationCell.SectionEntry, sectionEntry, true) == 0) return true; } configurationCell = null; return false; }
/// <summary> /// Creates a new <see cref="FrequencyDefinition"/> from the specified parameters. /// </summary> /// <param name="parent">The <see cref="ConfigurationCell"/> parent of this <see cref="FrequencyDefinition"/>.</param> /// <param name="entryValue">The entry value from the INI based configuration file.</param> public FrequencyDefinition(ConfigurationCell parent, string entryValue) : base(parent) { string[] entry = entryValue.Split(','); FrequencyDefinition defaultFrequency; if (parent != null) defaultFrequency = parent.Parent.DefaultFrequency; else defaultFrequency = new FrequencyDefinition(null as ConfigurationCell); // First entry is an F - we just ignore this if (entry.Length > 1) ScalingValue = uint.Parse(entry[1].Trim()); else ScalingValue = defaultFrequency.ScalingValue; if (entry.Length > 2) Offset = double.Parse(entry[2].Trim()); else Offset = defaultFrequency.Offset; if (entry.Length > 3) DfDtScalingValue = uint.Parse(entry[3].Trim()); else DfDtScalingValue = defaultFrequency.DfDtScalingValue; if (entry.Length > 4) DfDtOffset = double.Parse(entry[4].Trim()); else DfDtOffset = defaultFrequency.DfDtOffset; if (entry.Length > 5) m_dummy = int.Parse(entry[5].Trim()); else m_dummy = defaultFrequency.m_dummy; if (entry.Length > 6) Label = entry[6].Trim(); else Label = defaultFrequency.Label; }
// Static Methods // Delegate handler to create a new BPA PDCstream configuration cell internal static IConfigurationCell CreateNewCell(IChannelFrame parent, IChannelFrameParsingState<IConfigurationCell> state, int index, byte[] binaryImage, int startIndex, out int parsedLength) { ConfigurationCell configCell = new ConfigurationCell(parent as IConfigurationFrame); parsedLength = configCell.Initialize(binaryImage, startIndex, 0); return configCell; }
/// <summary> /// Creates a new <see cref="DigitalDefinition"/> from specified parameters. /// </summary> /// <param name="parent">The <see cref="ConfigurationCell"/> parent of this <see cref="DigitalDefinition"/>.</param> /// <param name="label">The label of this <see cref="DigitalDefinition"/>.</param> public DigitalDefinition(ConfigurationCell parent, string label) : base(parent, label) { }
/// <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) { }
/// <summary> /// Creates a new <see cref="AnalogDefinition"/> from specified parameters. /// </summary> /// <param name="parent">The <see cref="ConfigurationCell"/> parent of this <see cref="AnalogDefinition"/>.</param> /// <param name="label">The label of this <see cref="AnalogDefinition"/>.</param> /// <param name="scale">The integer scaling value of this <see cref="AnalogDefinition"/>.</param> /// <param name="offset">The offset of this <see cref="AnalogDefinition"/>.</param> /// <param name="type">The <see cref="AnalogType"/> of this <see cref="AnalogDefinition"/>.</param> public AnalogDefinition(ConfigurationCell parent, string label, uint scale, double offset, AnalogType type) : base(parent, label, scale, offset, type) { }