本文整理汇总了C#中DataGroup.FromData方法的典型用法代码示例。如果您正苦于以下问题:C# DataGroup.FromData方法的具体用法?C# DataGroup.FromData怎么用?C# DataGroup.FromData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataGroup
的用法示例。
在下文中一共展示了DataGroup.FromData方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Write
public static void Write(string connectionString, int eventID, string originalFilePath, string filePath)
{
MeterInfoDataContext meterInfo = new MeterInfoDataContext(connectionString);
FaultLocationInfoDataContext faultLocationInfo = new FaultLocationInfoDataContext(connectionString);
MeterData.EventRow eventRow;
Meter meter;
DataGroup waveFormData;
FaultLocationData.FaultCurveDataTable faultCurveTable;
List<FaultSegment> segments;
using (EventTableAdapter eventAdapter = new EventTableAdapter())
{
eventAdapter.Connection.ConnectionString = connectionString;
eventRow = eventAdapter.GetDataByID(eventID).FirstOrDefault();
}
if ((object)eventRow == null)
throw new InvalidOperationException(string.Format("Event with ID {0} not found", eventID));
meter = meterInfo.Meters.FirstOrDefault(dbMeter => dbMeter.ID == eventRow.MeterID);
waveFormData = new DataGroup();
waveFormData.FromData(meter, eventRow.Data);
using (FaultCurveTableAdapter faultCurveAdapter = new FaultCurveTableAdapter())
{
faultCurveAdapter.Connection.ConnectionString = connectionString;
faultCurveTable = faultCurveAdapter.GetDataBy(eventID);
}
segments = faultLocationInfo.FaultSegments
.Where(segment => segment.EventID == eventID)
.OrderBy(segment => segment.StartSample)
.ToList();
Write(meter, waveFormData, faultCurveTable, segments, originalFilePath, filePath);
}
示例2: ToDataSeries
/// <summary>
/// ToDataSeries
/// </summary>
/// <param name="faultCurve"></param>
/// <returns></returns>
private DataGroup ToDataSeries(MeterData.EventDataRow faultCurve)
{
DataGroup dataGroup = new DataGroup();
dataGroup.FromData(faultCurve.FrequencyDomainData);
return dataGroup;
}
示例3: FetchMeterEventDataByID
private eventSet FetchMeterEventDataByID(string EventInstanceID)
{
eventSet theset = new eventSet();
theset.data = new List<signalDetail>();
MeterData.EventDataTable events;
DataGroup eventDataGroup = new DataGroup();
using (MeterInfoDataContext meterInfo = new MeterInfoDataContext(ConnectionString))
using (EventTableAdapter eventAdapter = new EventTableAdapter())
using (EventDataTableAdapter eventDataAdapter = new EventDataTableAdapter())
{
eventAdapter.Connection.ConnectionString = ConnectionString;
eventDataAdapter.Connection.ConnectionString = ConnectionString;
events = eventAdapter.GetDataByID(Convert.ToInt32(EventInstanceID));
theset.Yaxis0name = "Voltage";
theset.Yaxis1name = "Current";
foreach (MeterData.EventRow evt in events)
{
Meter meter = meterInfo.Meters.Single(m => m.ID == evt.MeterID);
FaultData.Database.Line line = meterInfo.Lines.Single(l => l.ID == evt.LineID);
//eventDataAdapter.GetTimeDomainData(evt.EventDataID);
eventDataGroup.FromData(meter, eventDataAdapter.GetTimeDomainData(evt.EventDataID));
int i = 0;
foreach (DataSeries theseries in eventDataGroup.DataSeries)
{
int datacount = eventDataGroup.DataSeries[i].DataPoints.Count();
theset.xAxis = new string[datacount];
signalDetail theitem = new signalDetail();
string measurementType = "I"; // Assume Current, sorry this is ugly
if (theseries.SeriesInfo.Channel.MeasurementType.Name.Equals("Voltage"))
{
measurementType = "V";
}
if (theseries.SeriesInfo.Channel.MeasurementType.Name.Equals("Power"))
{
measurementType = "P";
}
if (theseries.SeriesInfo.Channel.MeasurementType.Name.Equals("Energy"))
{
measurementType = "E";
}
if (theseries.SeriesInfo.SeriesType.Name.Substring(0, 3) == "Min") continue;
if (theseries.SeriesInfo.SeriesType.Name.Substring(0, 3) == "Max") continue;
//theitem.name = theseries.SeriesInfo.SeriesType.Name.Substring(0, 3) + " " + measurementType + theseries.SeriesInfo.Channel.Phase.Name;
theitem.name = measurementType + theseries.SeriesInfo.Channel.Phase.Name;
theitem.data = new double[datacount];
theitem.type = "line";
theitem.yAxis = 0;
if (theitem.name.Contains("Angle"))
{
theitem.showInTooltip = false;
theitem.visible = false;
theitem.showInLegend = false;
}
if (theitem.name.Contains("RMS"))
{
theitem.showInTooltip = false;
theitem.visible = false;
}
if (theitem.name.Contains("RES"))
{
theitem.showInTooltip = false;
theitem.visible = false;
}
if (theitem.name.Contains("Peak"))
{
theitem.showInTooltip = false;
theitem.visible = false;
}
if (theseries.SeriesInfo.Channel.MeasurementType.Name.Equals("Current"))
{
theitem.yAxis = 1;
}
int j = 0;
DateTime beginticks = eventDataGroup.DataSeries[i].DataPoints[0].Time;
foreach (FaultData.DataAnalysis.DataPoint thepoint in eventDataGroup.DataSeries[i].DataPoints)
{
double elapsed = thepoint.Time.Subtract(beginticks).TotalSeconds;
theset.xAxis[j] = elapsed.ToString();
theitem.data[j] = thepoint.Value;
j++;
//.........这里部分代码省略.........
示例4: ToDataGroup
public DataGroup ToDataGroup(Meter meter, byte[] data)
{
DataGroup dataGroup = new DataGroup();
dataGroup.FromData(meter, data);
return dataGroup;
}
示例5: getSignalDataByIDAndType
public eventSet getSignalDataByIDAndType(string EventInstanceID, String DataType)
{
eventSet theset = new eventSet();
theset.data = new List<signalDetail>();
MeterData.EventDataTable events;
DataGroup eventDataGroup = new DataGroup();
using (MeterInfoDataContext meterInfo = new MeterInfoDataContext(ConnectionString))
using (EventTableAdapter eventAdapter = new EventTableAdapter())
using (EventDataTableAdapter eventDataAdapter = new EventDataTableAdapter())
{
eventAdapter.Connection.ConnectionString = ConnectionString;
eventDataAdapter.Connection.ConnectionString = ConnectionString;
events = eventAdapter.GetDataByID(Convert.ToInt32(EventInstanceID));
foreach (MeterData.EventRow evt in events)
{
Meter meter = meterInfo.Meters.Single(m => m.ID == evt.MeterID);
FaultData.Database.Line line = meterInfo.Lines.Single(l => l.ID == evt.LineID);
eventDataGroup.FromData(meter, eventDataAdapter.GetTimeDomainData(evt.EventDataID));
//eventDataGroup.FromData(meter, evt.Data);
int i = -1;
int datacount = eventDataGroup.DataSeries[0].DataPoints.Count();
theset.xAxis = new string[datacount];
foreach (DataSeries theseries in eventDataGroup.DataSeries)
{
i++;
signalDetail theitem = new signalDetail();
string measurementType = "I"; // Assume Current, sorry this is ugly
string phasename = theseries.SeriesInfo.Channel.Phase.Name;
if (theseries.SeriesInfo.Channel.MeasurementType.Name.Equals("Voltage"))
{
measurementType = "V";
}
if (theseries.SeriesInfo.Channel.MeasurementType.Name.Equals("Power"))
{
measurementType = "P";
}
if (theseries.SeriesInfo.Channel.MeasurementType.Name.Equals("Energy"))
{
measurementType = "E";
}
if (theseries.SeriesInfo.Channel.MeasurementType.Name.Equals("Digital"))
{
if (theseries.SeriesInfo.Channel.MeasurementCharacteristic.Name == "None")
continue;
measurementType = "D";
phasename = theseries.SeriesInfo.Channel.Description;
}
if (DataType != null)
{
if (measurementType != DataType)
{
continue;
}
}
if (theseries.SeriesInfo.SeriesType.Name.Substring(0, 3) == "Min") continue;
if (theseries.SeriesInfo.SeriesType.Name.Substring(0, 3) == "Max") continue;
theset.Yaxis0name = "Current";
if (measurementType == "V")
{
theset.Yaxis0name = "Voltage";
}
if (measurementType == "D")
{
theset.Yaxis0name = "Breakers";
}
//theitem.name = theseries.SeriesInfo.SeriesType.Name.Substring(0, 3) + " " + measurementType + theseries.SeriesInfo.Channel.Phase.Name;
theitem.name = measurementType + phasename;
theitem.data = new double[datacount];
theitem.type = "line";
theitem.yAxis = 0;
if (theitem.name.Contains("IRES"))
{
theitem.showInTooltip = false;
theitem.visible = false;
}
int j = 0;
//.........这里部分代码省略.........
示例6: LoadMeterDataSets
private List<MeterDataSet> LoadMeterDataSets(DbAdapterContainer dbAdapterContainer, FileGroup fileGroup)
{
List<MeterDataSet> meterDataSets = new List<MeterDataSet>();
MeterInfoDataContext meterInfo = dbAdapterContainer.GetAdapter<MeterInfoDataContext>();
EventTableAdapter eventAdapter = dbAdapterContainer.GetAdapter<EventTableAdapter>();
EventDataTableAdapter eventDataAdapter = dbAdapterContainer.GetAdapter<EventDataTableAdapter>();
MeterData.EventDataTable eventTable = eventAdapter.GetDataByFileGroup(fileGroup.ID);
MeterDataSet meterDataSet;
DataGroup dataGroup;
foreach (IGrouping<int, MeterData.EventRow> eventGroup in eventTable.GroupBy(evt => evt.MeterID))
{
meterDataSet = new MeterDataSet();
meterDataSet.Meter = meterInfo.Meters.SingleOrDefault(meter => meter.ID == eventGroup.Key);
foreach (MeterData.EventRow evt in eventGroup)
{
dataGroup = new DataGroup();
dataGroup.FromData(meterDataSet.Meter, eventDataAdapter.GetTimeDomainData(evt.EventDataID));
foreach (DataSeries dataSeries in dataGroup.DataSeries)
meterDataSet.DataSeries.Add(dataSeries);
}
meterDataSets.Add(meterDataSet);
}
return meterDataSets;
}
示例7: GetFaultLocationData
private static DataGroup GetFaultLocationData(Meter meter, FaultLocationData.FaultCurveDataTable faultCurveTable)
{
DataGroup faultLocationData = new DataGroup();
DataGroup parsedGroup = new DataGroup();
foreach (FaultLocationData.FaultCurveRow faultCurveRow in faultCurveTable)
{
parsedGroup.FromData(meter, faultCurveRow.Data);
foreach (DataSeries series in parsedGroup.DataSeries)
faultLocationData.Add(series);
}
return faultLocationData;
}
示例8: GetVIDataGroup
private VIDataGroup GetVIDataGroup()
{
MeterInfoDataContext meterInfo = m_dbAdapterContainer.GetAdapter<MeterInfoDataContext>();
EventTableAdapter eventAdapter = m_dbAdapterContainer.GetAdapter<EventTableAdapter>();
EventDataTableAdapter eventDataAdapter = m_dbAdapterContainer.GetAdapter<EventDataTableAdapter>();
MeterData.EventRow eventRow = eventAdapter.GetDataByID(m_eventID)[0];
MeterData.EventDataRow eventDataRow = eventDataAdapter.GetDataBy(m_eventID)[0];
Meter meter = meterInfo.Meters.Single(m => m.ID == eventRow.MeterID);
DataGroup dataGroup = new DataGroup();
dataGroup.FromData(meter, eventDataRow.TimeDomainData);
return new VIDataGroup(dataGroup);
}
示例9: GetFaultCurveLookup
private Dictionary<string, DataSeries> GetFaultCurveLookup()
{
FaultCurveTableAdapter faultCurveAdapter = m_dbAdapterContainer.GetAdapter<FaultCurveTableAdapter>();
FaultLocationData.FaultCurveDataTable faultCurveTable = faultCurveAdapter.GetDataBy(m_eventID);
Func<FaultLocationData.FaultCurveRow, DataSeries> toDataSeries = faultCurve =>
{
DataGroup dataGroup = new DataGroup();
dataGroup.FromData(faultCurve.Data);
return dataGroup[0];
};
return faultCurveTable.ToDictionary(faultCurve => faultCurve.Algorithm, toDataSeries);
}