@@ -98,24 +98,32 @@ namespace BPASmartClient.Academy.View
plotModel.Series.Clear();
plotModel = new PlotModel() { Title = "反应釜蒸汽压力曲线" };
chartGrid.Visibility = Visibility.Visible;
OxyPlot.Series.LineSeries line = new OxyPlot.Series.LineSeries() { LineStyle = LineStyle.Solid, Title = "反应釜蒸汽压力", MarkerFill = OxyColor.FromRgb(110, 79, 79), MarkerSize = 2, LineLegendPosition = OxyPlot.Series.LineLegendPosition.End };
OxyPlot.Series.LineSeries line2 = new OxyPlot.Series.LineSeries() { LineStyle = LineStyle.Solid, Title = "反应釜压力", MarkerFill = OxyColor.FromRgb(110, 79, 79), MarkerSize = 2, LineLegendPosition = OxyPlot.Series.LineLegendPosition.End };
List<DataPoint> steamPressure = new List<DataPoint>();
List<DataPoint> reactPressure = new List<DataPoint>();
SqliteOperate.GetInstance.QueryableById(PlcControl.GetInstance.id).ForEach(t =>
{
steamPressure.Add(new DataPoint(DateTimeAxis.ToDouble(t.Createtime), t.SteamPressure));
reactPressure.Add(new DataPoint(DateTimeAxis.ToDouble(t.Createtime), t.ReactPressure));
});
line.Points.AddRange(steamPressure);
line2.Points.AddRange(reactPressure);
if (!(plotModel.Axes.Count > 0))
{
plotModel.Axes.Add(new DateTimeAxis() { Position = OxyPlot.Axes.AxisPosition.Bottom, Title = "时间/s", StringFormat = "hh:mm:ss", Minimum = min, Maximum = max, MaximumRange = maxrange });
plotModel.Axes.Add(new DateTimeAxis() { Position = OxyPlot.Axes.AxisPosition.Bottom, Title = "时间/s", StringFormat = "hh:mm:ss", AbsoluteMinimum = min, AbsoluteMaximum = max, MaximumRange = maxrange });
plotModel.Axes.Add(new LinearAxis() { Key = "y1", Title = "压力/Mpa", Position = OxyPlot.Axes.AxisPosition.Left, LabelFormatter = value => value.ToString("f2"), IsZoomEnabled = false });
}
plotModel.Series.Add(line);
plotModel.Series.Add(line2);
List<HistoryDataPoint> point1 = new();
List<HistoryDataPoint> point2 = new();
datas.ForEach(t =>
{
var time = new DateTime((t.Createtime - startTime).Ticks);
point1.Add(new(time, t.SteamPressure));
point2.Add(new(time, t.ReactPressure));
});
AddOxyLineSeries("反应釜蒸汽压力", OxyColor.FromRgb(110, 79, 79), point1);
AddOxyLineSeries("反应釜压力", OxyColor.FromRgb(110, 79, 79), point2);
if (this.DataContext is DeviceChart50LViewModel viewModel && viewModel.ReferenceData != null)
{
List<HistoryDataPoint> refPoint1 = new();
List<HistoryDataPoint> refPoint2 = new();
refPoint1 = viewModel.ReferenceData.SteamPressure.Select(x => new HistoryDataPoint(x.DateTime, (float)x.Value)).ToList();
refPoint2 = viewModel.ReferenceData.ReactPressure.Select(x => new HistoryDataPoint(x.DateTime, (float)x.Value)).ToList();
AddOxyLineSeries("反应釜蒸汽压力_参考", OxyColor.FromRgb(110, 79, 79), refPoint1);
AddOxyLineSeries("反应釜压力_参考", OxyColor.FromRgb(110, 79, 79), refPoint2);
}
plotModel.InvalidatePlot(true);//重新加载曲线
chartView.Model = plotModel;
}
@@ -125,20 +133,24 @@ namespace BPASmartClient.Academy.View
plotModel.Series.Clear();
plotModel = new PlotModel() { Title = "比例阀开度曲线" };
chartGrid.Visibility = Visibility.Visible;
OxyPlot.Series.LineSeries line = new OxyPlot.Series.LineSeries() { LineStyle = LineStyle.Solid, Title = "蒸汽比例阀开度", MarkerFill = OxyColor.FromRgb(110, 79, 79), MarkerSize = 2, LineLegendPosition = OxyPlot.Series.LineLegendPosition.End };
List<DataPoint> open = new List<DataPoint>();
SqliteOperate.GetInstance.QueryableById(PlcControl.GetInstance.id).ForEach(t =>
{
open.Add(new DataPoint(DateTimeAxis.ToDouble(t.Createtime), t.ProportionalValveOpening));
});
line.Points.AddRange(open);
if (!(plotModel.Axes.Count > 0))
{
plotModel.Axes.Add(new DateTimeAxis() { Position = OxyPlot.Axes.AxisPosition.Bottom, Title = "时间/s", StringFormat = "hh:mm:ss", Minimum = min, Maximum = max, MaximumRange = maxrange });
plotModel.Axes.Add(new DateTimeAxis() { Position = OxyPlot.Axes.AxisPosition.Bottom, Title = "时间/s", StringFormat = "hh:mm:ss", AbsoluteMinimum = min, AbsoluteMaximum = max, MaximumRange = maxrange });
plotModel.Axes.Add(new LinearAxis() { Key = "y1", Title = "比例阀开度/%", Position = OxyPlot.Axes.AxisPosition.Left, LabelFormatter = value => value.ToString("f2"), IsZoomEnabled = false });
}
plotModel.Series.Add(line);
List<HistoryDataPoint> point1 = new();
datas.ForEach(t =>
{
var time = new DateTime((t.Createtime - startTime).Ticks);
point1.Add(new(time, t.ProportionalValveOpening));
});
AddOxyLineSeries("蒸汽比例阀开度", OxyColor.FromRgb(110, 79, 79), point1);
if (this.DataContext is DeviceChart50LViewModel viewModel && viewModel.ReferenceData != null)
{
List<HistoryDataPoint> refPoint1 = new();
refPoint1 = viewModel.ReferenceData.ProportionalValveOpening.Select(x => new HistoryDataPoint(x.DateTime, (float)x.Value)).ToList();
AddOxyLineSeries("蒸汽比例阀开度_参考", OxyColor.FromRgb(110, 79, 79), refPoint1);
}
plotModel.InvalidatePlot(true);//重新加载曲线
chartView.Model = plotModel;
}
@@ -149,25 +161,31 @@ namespace BPASmartClient.Academy.View
plotModel.Series.Clear();
plotModel = new PlotModel() { Title = "流量曲线" };
chartGrid.Visibility = Visibility.Visible;
OxyPlot.Series.LineSeries templine = new OxyPlot.Series.LineSeries() { LineStyle = LineStyle.Solid, Title = "反应釜蒸汽流量", MarkerFill = OxyColor.FromRgb(110, 79, 79), MarkerSize = 2, LineLegendPosition = OxyPlot.Series.LineLegendPosition.End };
OxyPlot.Series.LineSeries templine_1 = new OxyPlot.Series.LineSeries() { LineStyle = LineStyle.Solid, Title = "负压流量", MarkerFill = OxyColor.FromRgb(110, 79, 79), MarkerSize = 2, LineLegendPosition = OxyPlot.Series.LineLegendPosition.End };
List<DataPoint> twValues = new List<DataPoint>();
List<DataPoint> tvValues = new List<DataPoint>();
SqliteOperate.GetInstance.QueryableById(PlcControl.GetInstance.id).ForEach(t =>
if (!(plotModel.Axes.Count > 0))
{
twValues.Add(new DataPoint(DateTimeAxis.ToDouble(t.Createtime), t.SteamFlowRate));
tvValues.Add(new DataPoint(DateTimeAxis.ToDouble(t.Createtime), t.NegativePressureFlowRate));
plotModel.Axes.Add(new DateTimeAxis() { Position = OxyPlot.Axes.AxisPosition.Bottom, Title = "时间", StringFormat = "hh:mm:ss", AbsoluteMinimum = min, AbsoluteMaximum = max });
plotModel.Axes.Add(new LinearAxis() { Key = "y1", Title = "流量", Position = OxyPlot.Axes.AxisPosition.Left, LabelFormatter = value => value.ToString("f2") });
}
List<HistoryDataPoint> point1 = new();
List<HistoryDataPoint> point2 = new();
datas.ForEach(t =>
{
var time = new DateTime((t.Createtime - startTime).Ticks);
point1.Add(new(time, t.SteamFlowRate));
point2.Add(new(time, t.NegativePressureFlowRate));
});
templine.Points.AddRange(twValues);
templine_1.Points.AddRange(tvValues);
if (!(plotModel.Axes.Count > 0))
AddOxyLineSeries("反应釜蒸汽流量", OxyColor.FromRgb(110, 79, 79), point1 );
AddOxyLineSeries("负压流量", OxyColor.FromRgb(110, 79, 79), point2 );
if (this.DataContext is DeviceChart50LViewModel viewModel && viewModel.ReferenceData != null )
{
plotModel.Axes.Add(new DateTimeAxis() { Position = OxyPlot.Axes.AxisPosition.Bottom, Title = "时间", StringFormat = "hh:mm:ss", Minimum = min, Maximum = max });
plotModel.Axes.Add(new LinearAxis() { Key = "y1", Title = "流量", Position = OxyPlot.Axes.AxisPosition.Left, LabelFormatter = value => value.ToString("f2") });
List<HistoryDataPoint> refPoint1 = new();
List<HistoryDataPoint> refPoint2 = new();
refPoint1 = viewModel.ReferenceData.SteamFlowRate.Select(x => new HistoryDataPoint(x.DateTime, (float)x.Value)).ToList();
refPoint2 = viewModel.ReferenceData.NegativePressureFlowRate.Select(x => new HistoryDataPoint(x.DateTime, (float)x.Value)).ToList();
AddOxyLineSeries("反应釜蒸汽流量_参考", OxyColor.FromRgb(110, 79, 79), refPoint1);
AddOxyLineSeries("负压流量_参考", OxyColor.FromRgb(110, 79, 79), refPoint2);
}
plotModel.Series.Add(templine);
plotModel.Series.Add(templine_1);
plotModel.InvalidatePlot(true);//重新加载曲线
chartView.Model = plotModel;
}
@@ -177,25 +195,32 @@ namespace BPASmartClient.Academy.View
plotModel.Series.Clear();
plotModel = new PlotModel() { Title = "重量曲线" };
chartGrid.Visibility = Visibility.Visible;
List<DataPoint> ww = new List<DataPoint>();
List<DataPoint> ww1 = new List<DataPoint>();
OxyPlot.Series.LineSeries line_5 = new OxyPlot.Series.LineSeries() { Title = "冷却水罐重量", Color = OxyColor.FromRgb(110, 79, 79), LineStyle = LineStyle.Solid, LineLegendPosition = OxyPlot.Series.LineLegendPosition.End };
OxyPlot.Series.LineSeries line_6 = new OxyPlot.Series.LineSeries() { Title = "卤水罐重量", Color = OxyColor.FromRgb(110, 79, 79), LineStyle = LineStyle.Solid, LineLegendPosition = OxyPlot.Series.LineLegendPosition.End };
SqliteOperate.GetInstance.QueryableById(PlcControl.GetInstance.id).ForEach(t =>
{
ww.Add(new DataPoint(DateTimeAxis.ToDouble(t.Createtime), t.WeighingWaterTankWeight));
ww1.Add(new DataPoint(DateTimeAxis.ToDouble(t.Createtime), t.BrineTankWeight));
});
line_5.Points.AddRange(ww);
line_6.Points.AddRange(ww1);
if (!(plotModel.Axes.Count > 0))
{
plotModel.Axes.Add(new DateTimeAxis() { Position = OxyPlot.Axes.AxisPosition.Bottom, Title = "时间/s", StringFormat = "hh:mm:ss", Minimum = min, Maximum = max });
plotModel.Axes.Add(new DateTimeAxis() { Position = OxyPlot.Axes.AxisPosition.Bottom, Title = "时间/s", StringFormat = "hh:mm:ss", AbsoluteMinimum = min, AbsoluteMaximum = max });
plotModel.Axes.Add(new LinearAxis() { Key = "y1", Title = "重量/kg", Position = OxyPlot.Axes.AxisPosition.Left, LabelFormatter = value => value.ToString("f2") });
}
plotModel.Series.Add(line_5);
plotModel.Series.Add(line_6);
List<HistoryDataPoint> point1 = new();
List<HistoryDataPoint> point2 = new();
datas.ForEach(t =>
{
var time = new DateTime((t.Createtime - startTime).Ticks);
point1.Add(new(time, t.WeighingWaterTankWeight));
point2.Add(new(time, t.BrineTankWeight));
});
AddOxyLineSeries("冷却水罐重量", OxyColor.FromRgb(110, 79, 79), point1);
AddOxyLineSeries("卤水罐重量", OxyColor.FromRgb(110, 79, 79), point2);
if (this.DataContext is DeviceChart50LViewModel viewModel && viewModel.ReferenceData != null)
{
List<HistoryDataPoint> refPoint1 = new();
List<HistoryDataPoint> refPoint2 = new();
refPoint1 = viewModel.ReferenceData.WeighingWaterTankWeight.Select(x => new HistoryDataPoint(x.DateTime, (float)x.Value)).ToList();
refPoint2 = viewModel.ReferenceData.BrineTankWeight.Select(x => new HistoryDataPoint(x.DateTime, (float)x.Value)).ToList();
AddOxyLineSeries("冷却水罐重量_参考", OxyColor.FromRgb(110, 79, 79), refPoint1);
AddOxyLineSeries("卤水罐重量_参考", OxyColor.FromRgb(110, 79, 79), refPoint2);
}
plotModel.InvalidatePlot(true);//重新加载曲线
chartView.Model = plotModel;
}
@@ -205,20 +230,24 @@ namespace BPASmartClient.Academy.View
plotModel.Series.Clear();
plotModel = new PlotModel() { Title = "湿度曲线" };
chartGrid.Visibility = Visibility.Visible;
List<DataPoint> ww = new List<DataPoint>();
OxyPlot.Series.LineSeries line_5 = new OxyPlot.Series.LineSeries() { Title = "冷却水罐湿度", Color = OxyColor.FromRgb(110, 79, 79), LineStyle = LineStyle.Solid, LineLegendPosition = OxyPlot.Series.LineLegendPosition.End };
SqliteOperate.GetInstance.QueryableById(PlcControl.GetInstance.id).ForEach(t =>
{
ww.Add(new DataPoint(DateTimeAxis.ToDouble(t.Createtime), t.CondensateWaterHumidity));
});
line_5.Points.AddRange(ww);
if (!(plotModel.Axes.Count > 0))
{
plotModel.Axes.Add(new DateTimeAxis() { Position = OxyPlot.Axes.AxisPosition.Bottom, Title = "时间/s", StringFormat = "hh:mm:ss", Minimum = min, Maximum = max });
plotModel.Axes.Add(new DateTimeAxis() { Position = OxyPlot.Axes.AxisPosition.Bottom, Title = "时间/s", StringFormat = "hh:mm:ss", AbsoluteMinimum = min, AbsoluteMaximum = max });
plotModel.Axes.Add(new LinearAxis() { Key = "y1", Title = "湿度", Position = OxyPlot.Axes.AxisPosition.Left, LabelFormatter = value => value.ToString("f2") });
}
plotModel.Series.Add(line_5);
List<HistoryDataPoint> point1 = new();
datas.ForEach(t =>
{
var time = new DateTime((t.Createtime - startTime).Ticks);
point1.Add(new(time, t.CondensateWaterHumidity));
});
AddOxyLineSeries("冷却水罐湿度", OxyColor.FromRgb(110, 79, 79), point1);
if (this.DataContext is DeviceChart50LViewModel viewModel && viewModel.ReferenceData != null)
{
List<HistoryDataPoint> refPoint1 = new();
refPoint1 = viewModel.ReferenceData.CondensateWaterHumidity.Select(x => new HistoryDataPoint(x.DateTime, (float)x.Value)).ToList();
AddOxyLineSeries("冷却水罐湿度_参考", OxyColor.FromRgb(110, 79, 79), refPoint1);
}
plotModel.InvalidatePlot(true);//重新加载曲线
chartView.Model = plotModel;
}
@@ -228,20 +257,26 @@ namespace BPASmartClient.Academy.View
plotModel.Series.Clear();
plotModel = new PlotModel() { Title = "反应釜角度曲线" };
chartGrid.Visibility = Visibility.Visible;
List<DataPoint> ww = new List<DataPoint>();
OxyPlot.Series.LineSeries line_5 = new OxyPlot.Series.LineSeries() { Title = "反应釜角度", Color = OxyColor.FromRgb(110, 79, 79), LineStyle = LineStyle.Solid, LineLegendPosition = OxyPlot.Series.LineLegendPosition.End };
SqliteOperate.GetInstance.QueryableById(PlcControl.GetInstance.id).ForEach(t =>
{
ww.Add(new DataPoint(DateTimeAxis.ToDouble(t.Createtime), t.ReactEncoderValue));
});
line_5.Points.AddRange(ww);
if (!(plotModel.Axes.Count > 0))
{
plotModel.Axes.Add(new DateTimeAxis() { Position = OxyPlot.Axes.AxisPosition.Bottom, Title = "时间/s", StringFormat = "hh:mm:ss", Minimum = min, Maximum = max });
plotModel.Axes.Add(new DateTimeAxis() { Position = OxyPlot.Axes.AxisPosition.Bottom, Title = "时间/s", StringFormat = "hh:mm:ss", AbsoluteMinimum = min, AbsoluteMaximum = max });
plotModel.Axes.Add(new LinearAxis() { Key = "y1", Title = "角度/°", Position = OxyPlot.Axes.AxisPosition.Left, LabelFormatter = value => value.ToString("f2") });
}
plotModel.Series.Add(line_5);
List<HistoryDataPoint> point1 = new();
datas.ForEach(t =>
{
var time = new DateTime((t.Createtime - startTime).Ticks);
point1.Add(new(time, t.ReactEncoderValue));
});
AddOxyLineSeries("反应釜角度", OxyColor.FromRgb(110, 79, 79), point1);
if (this.DataContext is DeviceChart50LViewModel viewModel && viewModel.ReferenceData != null)
{
List<HistoryDataPoint> refPoint1 = new();
refPoint1 = viewModel.ReferenceData.ReactEncoderValue.Select(x => new HistoryDataPoint(x.DateTime, (float)x.Value)).ToList();
AddOxyLineSeries("反应釜角度_参考", OxyColor.FromRgb(110, 79, 79), refPoint1);
}
plotModel.InvalidatePlot(true);//重新加载曲线
chartView.Model = plotModel;
}
@@ -278,10 +313,6 @@ namespace BPASmartClient.Academy.View
}
record HistoryDataPoint(DateTime DateTime, float Value);
//class HistoryDataPoint
//{
// public DateTime DateTime { get; set; }
// public float Value { get; set; }
//}
}
}