/// <summary> /// Returns formatted and unformatted values of the cell from the current OLAP slice. /// </summary> /// <param name="CurrentCell">The data cell from the current OLAP slice</param> /// <param name="Value">An unformatted value of the cell</param> /// <param name="Formatted">A formatting properties of the cell</param> /// <returns>True, if the cell contains a value</returns> public virtual bool GetCellFormattedValue(IDataCell CurrentCell, out object Value, out CellFormattingProperties Formatted) { var Address = CurrentCell.Address; Formatted = new CellFormattingProperties(); var Result = GetCellValue(Address, out Value, out Formatted); if (Result) { if (Formatted.FormattedValue == null || Address.Measure.FCubeMeasure != null && Address.Measure.DefaultFormat != Address.Measure.FCubeMeasure.DefaultFormat) { if (Value != null) { object V; Formatted.FormattedValue = Address.Measure.DoFormatMode(CurrentCell, Value, Address.MeasureMode, out V); Value = V; //if (Address.MeasureMode.Mode == MeasureShowModeType.smSpecifiedByEvent) // Value = V; return(true); } } } else { Formatted.FormattedValue = ""; } return(Result); }
// Static Methods // Delegate handler to create a new SEL Fast Message phasor value internal static IPhasorValue CreateNewValue(IDataCell parent, IPhasorDefinition definition, byte[] buffer, int startIndex, out int parsedLength) { IPhasorValue phasor = new PhasorValue(parent, definition); parsedLength = phasor.ParseBinaryImage(buffer, startIndex, 0); return(phasor); }
// Static Methods // Delegate handler to create a new IEEE C37.118 digital value internal static IDigitalValue CreateNewValue(IDataCell parent, IDigitalDefinition definition, byte[] buffer, int startIndex, out int parsedLength) { IDigitalValue digital = new DigitalValue(parent, definition); parsedLength = digital.ParseBinaryImage(buffer, startIndex, 0); return(digital); }
// Static Methods // Delegate handler to create a new Macrodyne frequency value internal static IFrequencyValue CreateNewValue(IDataCell parent, IFrequencyDefinition definition, byte[] buffer, int startIndex, out int parsedLength) { IFrequencyValue frequency = new FrequencyValue(parent, definition); parsedLength = frequency.ParseBinaryImage(buffer, startIndex, 0); return(frequency); }
// Static Methods // Delegate handler to create a new BPA PDCstream analog value internal static IAnalogValue CreateNewValue(IDataCell parent, IAnalogDefinition definition, byte[] buffer, int startIndex, out int parsedLength) { IAnalogValue analog = new AnalogValue(parent, definition); parsedLength = analog.ParseBinaryImage(buffer, startIndex, 0); return(analog); }
/// <summary> /// Creates a new <see cref="FrequencyValueBase"/> from specified parameters. /// </summary> /// <param name="parent">The <see cref="IDataCell"/> parent of this <see cref="FrequencyValueBase"/>.</param> /// <param name="frequencyDefinition">The <see cref="IFrequencyDefinition"/> associated with this <see cref="FrequencyValueBase"/>.</param> /// <param name="frequency">The floating point value that represents this <see cref="FrequencyValueBase"/>.</param> /// <param name="dfdt">The floating point value that represents the change in this <see cref="FrequencyValueBase"/> over time.</param> protected FrequencyValueBase(IDataCell parent, IFrequencyDefinition frequencyDefinition, double frequency, double dfdt) : base(parent, frequencyDefinition) { m_frequency = frequency; m_dfdt = dfdt; m_frequencyAssigned = !double.IsNaN(frequency); m_dfdtAssigned = !double.IsNaN(dfdt); }
static void parser_ReceivedDataFrame(object sender, EventArgs <IDataFrame> e) { // Increase the frame count each time a frame is received frameCount++; // Print information each time we receive 60 frames (every 2 seconds) if (frameCount % 60 == 0) { IDataCell device = e.Argument.Cells[0]; Console.WriteLine("Received {0} data frames so far...", frameCount); Console.WriteLine(" Last frequency: {0}Hz", device.FrequencyValue.Frequency); Console.WriteLine(" Last Timestamp: {0}", ((DateTime)device.Timestamp).ToString("yyyy-MM-dd HH:mm:ss.fff")); } }
private static void parser_ReceivedDataFrame(object sender, EventArgs <IDataFrame> e) { IDataFrame dataFrame = e.Argument; if (WriteLogs) { m_exportFile.WriteLine(dataFrame.Timestamp.ToString("yyyy-MM-dd HH:mm:ss.fff") + string.Concat(dataFrame.Cells.Select(cell => "," + cell.FrequencyValue.Frequency.ToString()))); } // Pass frame measurements to concentrator... if (TestConcentrator) { ExtractFrameMeasurements(dataFrame); } // Increase the frame count each time a frame is received frameCount++; //IDataCell device = dataFrame.Cells[0]; //Console.Write(device.FrequencyValue.Frequency.ToString("0.000Hz ")); // Print information each time we receive 60 frames (every 2 seconds for 30 frames per second) // Also check to assure the DataFrame has at least one Cell if (frameCount % 60 == 0) { Console.WriteLine("Received {0} data frames so far - parsed timesatmp = \"{1}\"...", frameCount, dataFrame.Timestamp.ToString("yyyy-MM-dd HH:mm:ss.fff")); if (dataFrame.Cells.Count > 0) { IDataCell device = dataFrame.Cells[0]; Console.WriteLine(" Last frequency: {0}Hz", device.FrequencyValue.Frequency); for (int x = 0; x < device.PhasorValues.Count; x++) { Console.WriteLine(" PMU {0} Phasor {1} Angle = {2}", device.IDCode, x, device.PhasorValues[x].Angle); Console.WriteLine(" PMU {0} Phasor {1} Magnitude = {2}", device.IDCode, x, device.PhasorValues[x].Magnitude); } Console.WriteLine(" Last Timestamp: {0}", device.GetStatusFlagsMeasurement().Timestamp.ToString("yyyy-MM-dd HH:mm:ss.fff")); } if ((object)concentrator != null) { Console.WriteLine(concentrator.Status); } } }
/// <summary> /// Returns formatted and unformatted values of the cells from the current OLAP /// slice. /// </summary> /// <returns>True, if the cell contains a value</returns> /// <param name="CurrentCell">The data cell from the current OLAP slice</param> /// <param name="Value">An unformatted value of the cell</param> /// <param name="Formatted">Formatting properties of the cell</param> public override bool GetCellFormattedValue(IDataCell CurrentCell, out object Value, out CellFormattingProperties Formatted) { var Address = CurrentCell.Address; Value = null; var M = GetMetaline(Address.FLevelsAndMembers.Keys); Formatted = new CellFormattingProperties(""); if (Address.Measure == null) { return(true); } if (CalculatedByServer(Address.Measure)) { if (IsNativeDataPresent(Address.MeasureMode)) { var L = M.GetLine(Address.FHierID, Address.Measure, Address.MeasureMode) as MdLine; var Result = L.GetCellFormatted(Address, out Value, out Formatted); if (!Result) { return(GetCalculatedCellValue(Address, out Value, out Formatted)); } return(true); } else { var L = M.GetLine(Address.FHierID, Address.Measure, IsNativeDataPresent(Address.MeasureMode) ? Address.MeasureMode : Address.Measure.ShowModes[0]) as MdLine; object V; var Result = L.GetCell(Address, out Value); if (Value != null) { Formatted.FormattedValue = Address.Measure.DoFormatMode(CurrentCell, Value, Address.MeasureMode, out V); Value = V; return(true); } return(false); } } return(GetCalculatedCellValue(Address, out Value, out Formatted)); }
public ShowMeasureArgs(object originalData, MeasureShowMode mode, IDataCell cell) { OriginalData = originalData; ReturnData = null; fValue = ""; fShowMode = mode; if (cell != null) { var member = cell.RowMember; if (member != null) { member = member.HierarchyMemberCell; } if (member != null) { for (var i = 0; i < member.SiblingsCount; i++) { var m = member.Siblings(i).Member; if (m != null) { fRowSiblings.Add(m); } } } member = cell.ColumnMember; if (member != null) { member = member.HierarchyMemberCell; } if (member != null) { for (var i = 0; i < member.SiblingsCount; i++) { var m = member.Siblings(i).Member; if (m != null) { fColumnSiblings.Add(m); } } } } }
public WritebackArgs(IDataCell cell, object NewValue) { Cell = cell; this.NewValue = NewValue; }
/// <summary> /// Creates a new <see cref="PhasorValueBase"/> from specified parameters. /// </summary> /// <param name="parent">The <see cref="IDataCell"/> parent of this <see cref="PhasorValueBase"/>.</param> /// <param name="phasorDefinition">The <see cref="IPhasorDefinition"/> associated with this <see cref="PhasorValueBase"/>.</param> /// <param name="angle">The <see cref="GSF.Units.Angle"/> value (a.k.a., the argument) of this <see cref="PhasorValueBase"/>, in radians.</param> /// <param name="magnitude">The magnitude value (a.k.a., the absolute value or modulus) of this <see cref="PhasorValueBase"/>.</param> protected PhasorValueBase(IDataCell parent, IPhasorDefinition phasorDefinition, Angle angle, double magnitude) : base(parent, phasorDefinition) { m_phasor = Complex.FromPolarCoordinates(magnitude, angle); }
// Static Methods // Delegate handler to create a new IEEE 1344 frequency value internal static IFrequencyValue CreateNewValue(IDataCell parent, IFrequencyDefinition definition, byte[] buffer, int startIndex, out int parsedLength) { IFrequencyValue frequency = new FrequencyValue(parent, definition); parsedLength = frequency.ParseBinaryImage(buffer, startIndex, 0); return frequency; }
/// <summary> /// Creates a new <see cref="DigitalValueBase"/>. /// </summary> /// <param name="parent">The <see cref="IDataCell"/> parent of this <see cref="DigitalValueBase"/>.</param> /// <param name="digitalDefinition">The <see cref="IDigitalDefinition"/> associated with this <see cref="DigitalValueBase"/>.</param> protected DigitalValueBase(IDataCell parent, IDigitalDefinition digitalDefinition) : base(parent, digitalDefinition) { }
/// <summary> /// Creates a new <see cref="AnalogValueBase"/> from specified parameters. /// </summary> /// <param name="parent">The <see cref="IDataCell"/> parent of this <see cref="AnalogValueBase"/>.</param> /// <param name="analogDefinition">The <see cref="IAnalogDefinition"/> associated with this <see cref="AnalogValueBase"/>.</param> /// <param name="value">The floating point value that represents this <see cref="AnalogValueBase"/>.</param> protected AnalogValueBase(IDataCell parent, IAnalogDefinition analogDefinition, double value) : base(parent, analogDefinition) { m_value = value; m_valueAssigned = !double.IsNaN(value); }
// Static Methods // Delegate handler to create a new BPA PDCstream analog value internal static IAnalogValue CreateNewValue(IDataCell parent, IAnalogDefinition definition, byte[] buffer, int startIndex, out int parsedLength) { IAnalogValue analog = new AnalogValue(parent, definition); parsedLength = analog.ParseBinaryImage(buffer, startIndex, 0); return analog; }
public void Send(IDataCell cell, IPEndPoint remoteIP) { byte[] buffer = cell.ToBuffer(); SendInternal(buffer, remoteIP); }
/// <summary> /// Creates a new <see cref="DigitalValueBase"/>. /// </summary> /// <param name="parent">The <see cref="IDataCell"/> parent of this <see cref="DigitalValueBase"/>.</param> /// <param name="digitalDefinition">The <see cref="IDigitalDefinition"/> associated with this <see cref="DigitalValueBase"/>.</param> protected DigitalValueBase(IDataCell parent, IDigitalDefinition digitalDefinition) : this(parent, digitalDefinition, ushort.MaxValue) { }
private int CountMappedMeasurements(IDataCell parsedDevice, List<IMeasurement> mappedMeasurements) { IFrequencyValue frequencyValue = parsedDevice.FrequencyValue; // Ignore frequency measurements when // frequency value is zero - some PDCs use // zero for missing frequency values return frequencyValue.Frequency == 0.0D ? mappedMeasurements.Count(measurement => !double.IsNaN(measurement.Value) && frequencyValue.Measurements.All(freq => measurement.Key != freq.Key)) : mappedMeasurements.Count(measurement => !double.IsNaN(measurement.Value)); }
/// <summary> /// Creates a new <see cref="FrequencyValueBase"/>. /// </summary> /// <param name="parent">The <see cref="IDataCell"/> parent of this <see cref="FrequencyValueBase"/>.</param> /// <param name="frequencyDefinition">The <see cref="IFrequencyDefinition"/> associated with this <see cref="FrequencyValueBase"/>.</param> protected FrequencyValueBase(IDataCell parent, IFrequencyDefinition frequencyDefinition) : base(parent, frequencyDefinition) { }
/// <summary> /// Creates a new <see cref="PhasorValueBase"/> from specified parameters. /// </summary> /// <param name="parent">The <see cref="IDataCell"/> parent of this <see cref="PhasorValueBase"/>.</param> /// <param name="phasorDefinition">The <see cref="IPhasorDefinition"/> associated with this <see cref="PhasorValueBase"/>.</param> /// <param name="real">The real value of this <see cref="PhasorValueBase"/>.</param> /// <param name="imaginary">The imaginary value of this <see cref="PhasorValueBase"/>.</param> protected PhasorValueBase(IDataCell parent, IPhasorDefinition phasorDefinition, double real, double imaginary) : base(parent, phasorDefinition) { m_phasor = new Complex(real, imaginary); }
/// <summary> /// Creates a new <see cref="ChannelValueBase{T}"/> from specified parameters. /// </summary> /// <param name="parent">The <see cref="IDataCell"/> parent of this <see cref="ChannelValueBase{T}"/>.</param> /// <param name="channelDefinition">The <see cref="IChannelDefinition"/> associated with this <see cref="ChannelValueBase{T}"/>.</param> protected ChannelValueBase(IDataCell parent, T channelDefinition) { m_parent = parent; m_definition = channelDefinition; }
// Static Methods // Delegate handler to create a new IEEE 1344 digital value internal static IDigitalValue CreateNewValue(IDataCell parent, IDigitalDefinition definition, byte[] binaryImage, int startIndex, out int parsedLength) { IDigitalValue digital = new DigitalValue(parent, definition); parsedLength = digital.Initialize(binaryImage, startIndex, 0); return digital; }
/// <summary> /// Creates a new <see cref="ChannelValueBase{T}"/> from serialization parameters. /// </summary> /// <param name="info">The <see cref="SerializationInfo"/> with populated with data.</param> /// <param name="context">The source <see cref="StreamingContext"/> for this deserialization.</param> protected ChannelValueBase(SerializationInfo info, StreamingContext context) { // Deserialize channel value m_parent = (IDataCell)info.GetValue("parent", typeof(IDataCell)); m_definition = (T)info.GetValue("definition", typeof(T)); }
/// <summary> /// Creates a new <see cref="AnalogValueBase"/>. /// </summary> /// <param name="parent">The <see cref="IDataCell"/> parent of this <see cref="AnalogValueBase"/>.</param> /// <param name="analogDefinition">The <see cref="IAnalogDefinition"/> associated with this <see cref="AnalogValueBase"/>.</param> protected AnalogValueBase(IDataCell parent, IAnalogDefinition analogDefinition) : this(parent, analogDefinition, double.NaN) { }
/// <summary> /// Creates a new <see cref="AnalogValue"/>. /// </summary> /// <param name="parent">The <see cref="IDataCell"/> parent of this <see cref="AnalogValue"/>.</param> /// <param name="analogDefinition">The <see cref="IAnalogDefinition"/> associated with this <see cref="AnalogValue"/>.</param> public AnalogValue(IDataCell parent, IAnalogDefinition analogDefinition) : base(parent, analogDefinition) { }
// Static Methods // Delegate handler to create a new IEEE C37.118 phasor value internal static IPhasorValue CreateNewValue(IDataCell parent, IPhasorDefinition definition, byte[] buffer, int startIndex, out int parsedLength) { IPhasorValue phasor = new PhasorValue(parent, definition); parsedLength = phasor.ParseBinaryImage(buffer, startIndex, 0); return phasor; }
/// <summary> /// Creates a new <see cref="FrequencyValue"/>. /// </summary> /// <param name="parent">The <see cref="IDataCell"/> parent of this <see cref="FrequencyValue"/>.</param> /// <param name="frequencyDefinition">The <see cref="IFrequencyDefinition"/> associated with this <see cref="FrequencyValue"/>.</param> public FrequencyValue(IDataCell parent, IFrequencyDefinition frequencyDefinition) : base(parent, frequencyDefinition) { }
/// <summary> /// Creates a new <see cref="AnalogValueBase"/>. /// </summary> /// <param name="parent">The <see cref="IDataCell"/> parent of this <see cref="AnalogValueBase"/>.</param> /// <param name="analogDefinition">The <see cref="IAnalogDefinition"/> associated with this <see cref="AnalogValueBase"/>.</param> protected AnalogValueBase(IDataCell parent, IAnalogDefinition analogDefinition) : base(parent, analogDefinition) { }
/// <summary> /// Creates a new <see cref="DigitalValueBase"/> from specified parameters. /// </summary> /// <param name="parent">The <see cref="IDataCell"/> parent of this <see cref="DigitalValueBase"/>.</param> /// <param name="digitalDefinition">The <see cref="IDigitalDefinition"/> associated with this <see cref="DigitalValueBase"/>.</param> /// <param name="value">The unsigned 16-bit integer value (composed of digital bits) that represents this <see cref="DigitalValueBase"/>.</param> protected DigitalValueBase(IDataCell parent, IDigitalDefinition digitalDefinition, ushort value) : base(parent, digitalDefinition) { m_value = value; m_valueAssigned = (value != ushort.MaxValue); }
// Could parsed measurements for this device private int CountParsedMeasurements(IDataCell parsedDevice) { int parsedMeasurementCount = 0; var phasorValues = parsedDevice.PhasorValues; var digitalValues = parsedDevice.DigitalValues; var analogValues = parsedDevice.AnalogValues; var frequencyValue = parsedDevice.FrequencyValue; int count; count = phasorValues.Count; for (int x = 0; x < count; x++) { foreach (IMeasurement measurement in phasorValues[x].Measurements) { if (!double.IsNaN(measurement.Value)) parsedMeasurementCount++; } } count = digitalValues.Count; for (int x = 0; x < count; x++) { foreach (IMeasurement measurement in digitalValues[x].Measurements) { if (!double.IsNaN(measurement.Value)) parsedMeasurementCount++; } } count = analogValues.Count; for (int x = 0; x < count; x++) { foreach (IMeasurement measurement in analogValues[x].Measurements) { if (!double.IsNaN(measurement.Value)) parsedMeasurementCount++; } } // Ignore frequency measurements when // frequency value is zero - some PDCs use // zero for missing frequency values if (frequencyValue.Frequency != 0.0D) { foreach (IMeasurement measurement in frequencyValue.Measurements) { if (!double.IsNaN(measurement.Value)) parsedMeasurementCount++; } } return parsedMeasurementCount; }
/// <summary> /// Creates a new <see cref="PhasorValue"/>. /// </summary> /// <param name="parent">The <see cref="IDataCell"/> parent of this <see cref="PhasorValue"/>.</param> /// <param name="phasorDefinition">The <see cref="IPhasorDefinition"/> associated with this <see cref="PhasorValue"/>.</param> public PhasorValue(IDataCell parent, IPhasorDefinition phasorDefinition) : base(parent, phasorDefinition) { }
/// <summary> /// Creates a new <see cref="DigitalValue"/>. /// </summary> /// <param name="parent">The <see cref="IDataCell"/> parent of this <see cref="DigitalValue"/>.</param> /// <param name="digitalDefinition">The <see cref="IDigitalDefinition"/> associated with this <see cref="DigitalValue"/>.</param> public DigitalValue(IDataCell parent, IDigitalDefinition digitalDefinition) : base(parent, digitalDefinition) { }
/// <summary> /// Creates a new <see cref="PhasorValueBase"/>. /// </summary> /// <param name="parent">The <see cref="IDataCell"/> parent of this <see cref="PhasorValueBase"/>.</param> /// <param name="phasorDefinition">The <see cref="IPhasorDefinition"/> associated with this <see cref="PhasorValueBase"/>.</param> protected PhasorValueBase(IDataCell parent, IPhasorDefinition phasorDefinition) : base(parent, phasorDefinition) { }
/// <summary> /// Creates a new <see cref="PhasorValueBase"/> from specified parameters. /// </summary> /// <param name="parent">The <see cref="IDataCell"/> parent of this <see cref="PhasorValueBase"/>.</param> /// <param name="phasorDefinition">The <see cref="IPhasorDefinition"/> associated with this <see cref="PhasorValueBase"/>.</param> /// <param name="real">The real value of this <see cref="PhasorValueBase"/>.</param> /// <param name="imaginary">The imaginary value of this <see cref="PhasorValueBase"/>.</param> protected PhasorValueBase(IDataCell parent, IPhasorDefinition phasorDefinition, double real, double imaginary) : base(parent, phasorDefinition) { m_phasor.Real = real; m_phasor.Imaginary = imaginary; }
/// <summary> /// Creates a new <see cref="PhasorValueBase"/> from specified parameters. /// </summary> /// <param name="parent">The <see cref="IDataCell"/> parent of this <see cref="PhasorValueBase"/>.</param> /// <param name="phasorDefinition">The <see cref="IPhasorDefinition"/> associated with this <see cref="PhasorValueBase"/>.</param> /// <param name="angle">The <see cref="Units.Angle"/> value (a.k.a., the argument) of this <see cref="PhasorValueBase"/>, in radians.</param> /// <param name="magnitude">The magnitude value (a.k.a., the absolute value or modulus) of this <see cref="PhasorValueBase"/>.</param> protected PhasorValueBase(IDataCell parent, IPhasorDefinition phasorDefinition, Angle angle, double magnitude) : base(parent, phasorDefinition) { m_phasor.Angle = angle; m_phasor.Magnitude = magnitude; }