作成者 | SHA1 | メッセージ | 日付 |
---|---|---|---|
ZhaoGang | d9d4e36e32 | 50L实时数据对照功能添加 | 1ヶ月前 |
ZhaoGang | 06ac6b28ed | 50L实时曲线显示修改 | 1ヶ月前 |
@@ -180,7 +180,7 @@ | |||
Margin="20" Orientation="Vertical" Visibility="Visible"> | |||
<lvc:CartesianChart | |||
x:Name="ppp" Height="270" HorizontalAlignment="Stretch" VerticalAlignment="Top" | |||
AnimationsSpeed="0:0:1" | |||
AnimationsSpeed="0:0:1" | |||
DataTooltip="{x:Null}" | |||
Hoverable="False" MouseDoubleClick="DataView_CLick" ToolTip="温度曲线"> | |||
<lvc:CartesianChart.Series> | |||
@@ -197,12 +197,12 @@ | |||
<lvc:LineSeries | |||
Fill="Transparent" LineSmoothness="1" | |||
PointGeometry="{x:Null}" | |||
Stroke="Tomato" StrokeThickness="2" | |||
Stroke="Yellow" StrokeThickness="2" | |||
Values="{Binding PartReferenceData.Temperature}" /> | |||
<lvc:LineSeries | |||
Fill="Transparent" LineSmoothness="1" | |||
PointGeometry="{x:Null}" | |||
Stroke="AliceBlue" StrokeThickness="2" | |||
Stroke="Green" StrokeThickness="2" | |||
Values="{Binding PartReferenceData.CondensateWaterTemperature}" /> | |||
</lvc:CartesianChart.Series> | |||
<lvc:CartesianChart.AxisY> | |||
@@ -213,7 +213,7 @@ | |||
</lvc:Axis> | |||
</lvc:CartesianChart.AxisY> | |||
<lvc:CartesianChart.AxisX> | |||
<lvc:Axis LabelFormatter="{Binding DateTimeFormatter}" Unit="{Binding AxisUnit}"> | |||
<lvc:Axis LabelFormatter="{Binding DateTimeFormatter}" Unit="{Binding AxisUnit}" MinValue="{Binding AxisXMinValue}" MaxValue="{Binding AxisXMaxValue}"> | |||
<lvc:Axis.Separator> | |||
<lvc:Separator IsEnabled="False" Step="{Binding AxisStep}" /> | |||
</lvc:Axis.Separator> | |||
@@ -229,6 +229,12 @@ | |||
<Rectangle | |||
Width="20" Height="2" Margin="10,0,0,2" Fill="Blue" /> | |||
<TextBlock Foreground="White" Text="冷凝水罐温度" /> | |||
<Rectangle | |||
Width="20" Height="2" Margin="10,0,0,2" Fill="Yellow" /> | |||
<TextBlock Foreground="White" Text="反应釜温度_参考" /> | |||
<Rectangle | |||
Width="20" Height="2" Margin="10,0,0,2" Fill="Green" /> | |||
<TextBlock Foreground="White" Text="冷凝水罐温度_参考" /> | |||
</StackPanel> | |||
</StackPanel> | |||
@@ -243,20 +249,23 @@ | |||
<lvc:LineSeries | |||
Fill="Transparent" LineSmoothness="1" | |||
PointGeometry="{x:Null}" | |||
Stroke="#07F80C" StrokeThickness="2" | |||
Stroke="Red" StrokeThickness="2" | |||
Values="{Binding DataFeedback.SteamPressure}" /> | |||
<lvc:LineSeries | |||
Fill="Transparent" LineSmoothness="1" | |||
PointGeometry="{x:Null}" | |||
Stroke="#FFFFFF" StrokeThickness="2" | |||
Stroke="Blue" StrokeThickness="2" | |||
Values="{Binding DataFeedback.ReactPressure}" /> | |||
<!--<lvc:LineSeries | |||
Fill="Transparent" | |||
LineSmoothness="1" | |||
PointGeometry="{x:Null}" | |||
Stroke="#423FFD" | |||
StrokeThickness="2" | |||
Values="{Binding DataFeedback.M102_Speed}" />--> | |||
<lvc:LineSeries | |||
Fill="Transparent" LineSmoothness="1" | |||
PointGeometry="{x:Null}" | |||
Stroke="Yellow" StrokeThickness="2" | |||
Values="{Binding PartReferenceData.SteamPressure}" /> | |||
<lvc:LineSeries | |||
Fill="Transparent" LineSmoothness="1" | |||
PointGeometry="{x:Null}" | |||
Stroke="Green" StrokeThickness="2" | |||
Values="{Binding PartReferenceData.ReactPressure}" /> | |||
</lvc:CartesianChart.Series> | |||
<lvc:CartesianChart.AxisY> | |||
<lvc:Axis | |||
@@ -277,18 +286,18 @@ | |||
</lvc:CartesianChart> | |||
<StackPanel Margin="0,10,0,0" Orientation="Horizontal"> | |||
<TextBlock Foreground="White" Text="压力曲线/MPa" /> | |||
<!--<Rectangle | |||
Width="20" | |||
Height="2" | |||
Margin="10,0,0,2" | |||
Fill="#423FFD" /> | |||
<TextBlock Foreground="White" Text="物料罐转速" />--> | |||
<Rectangle | |||
Width="20" Height="2" Margin="10,0,0,2" Fill="#F44F15" /> | |||
Width="20" Height="2" Margin="10,0,0,2" Fill="Red" /> | |||
<TextBlock Foreground="White" Text="反应釜蒸汽压力" /> | |||
<Rectangle | |||
Width="20" Height="2" Margin="10,0,0,2" Fill="#FFFFFF" /> | |||
Width="20" Height="2" Margin="10,0,0,2" Fill="Blue" /> | |||
<TextBlock Foreground="White" Text="反应釜压力" /> | |||
<Rectangle | |||
Width="20" Height="2" Margin="10,0,0,2" Fill="Yellow" /> | |||
<TextBlock Foreground="White" Text="反应釜蒸汽压力_参考" /> | |||
<Rectangle | |||
Width="20" Height="2" Margin="10,0,0,2" Fill="Green" /> | |||
<TextBlock Foreground="White" Text="反应釜压力_参考" /> | |||
</StackPanel> | |||
</StackPanel> | |||
@@ -303,8 +312,13 @@ | |||
<lvc:LineSeries | |||
Fill="Transparent" LineSmoothness="1" | |||
PointGeometry="{x:Null}" | |||
Stroke="White" StrokeThickness="2" | |||
Stroke="Red" StrokeThickness="2" | |||
Values="{Binding DataFeedback.ProportionalValveOpening}" /> | |||
<lvc:LineSeries | |||
Fill="Transparent" LineSmoothness="1" | |||
PointGeometry="{x:Null}" | |||
Stroke="Yellow" StrokeThickness="2" | |||
Values="{Binding PartReferenceData.ProportionalValveOpening}" /> | |||
</lvc:CartesianChart.Series> | |||
<lvc:CartesianChart.AxisY> | |||
<lvc:Axis MaxValue="110" MinValue="-10"> | |||
@@ -324,8 +338,11 @@ | |||
<StackPanel Margin="0,10,0,0" Orientation="Horizontal"> | |||
<TextBlock Foreground="White" Text="比例阀开度曲线" /> | |||
<Rectangle | |||
Width="20" Height="2" Margin="20,0,0,2" Fill="White" /> | |||
Width="20" Height="2" Margin="20,0,0,2" Fill="Red" /> | |||
<TextBlock Foreground="White" Text="蒸汽比例阀开度" /> | |||
<Rectangle | |||
Width="20" Height="2" Margin="20,0,0,2" Fill="Yellow" /> | |||
<TextBlock Foreground="White" Text="蒸汽比例阀开度_参考" /> | |||
</StackPanel> | |||
</StackPanel> | |||
@@ -345,8 +362,18 @@ | |||
<lvc:LineSeries | |||
Fill="Transparent" LineSmoothness="1" | |||
PointGeometry="{x:Null}" | |||
Stroke="#F1C74B" StrokeThickness="2" | |||
Stroke="Blue" StrokeThickness="2" | |||
Values="{Binding DataFeedback.NegativePressureFlowRate}" /> | |||
<lvc:LineSeries | |||
Fill="Transparent" LineSmoothness="1" | |||
PointGeometry="{x:Null}" | |||
Stroke="Yellow" StrokeThickness="2" | |||
Values="{Binding PartReferenceData.SteamFlowRate}" /> | |||
<lvc:LineSeries | |||
Fill="Transparent" LineSmoothness="1" | |||
PointGeometry="{x:Null}" | |||
Stroke="Green" StrokeThickness="2" | |||
Values="{Binding PartReferenceData.NegativePressureFlowRate}" /> | |||
</lvc:CartesianChart.Series> | |||
<lvc:CartesianChart.AxisY> | |||
<lvc:Axis LabelFormatter="{Binding doubleFormatter}"> | |||
@@ -369,8 +396,14 @@ | |||
Width="20" Height="2" Margin="20,0,0,2" Fill="Red" /> | |||
<TextBlock Foreground="White" Text="反应釜蒸汽流量" /> | |||
<Rectangle | |||
Width="20" Height="2" Margin="20,0,0,2" Fill="#F1C74B" /> | |||
Width="20" Height="2" Margin="20,0,0,2" Fill="Blue" /> | |||
<TextBlock Foreground="White" Text="负压流量" /> | |||
<Rectangle | |||
Width="20" Height="2" Margin="20,0,0,2" Fill="Yellow" /> | |||
<TextBlock Foreground="White" Text="反应釜蒸汽流量_参考" /> | |||
<Rectangle | |||
Width="20" Height="2" Margin="20,0,0,2" Fill="Green" /> | |||
<TextBlock Foreground="White" Text="负压流量_参考" /> | |||
</StackPanel> | |||
</StackPanel> | |||
@@ -385,13 +418,23 @@ | |||
<lvc:LineSeries | |||
Fill="Transparent" LineSmoothness="1" | |||
PointGeometry="{x:Null}" | |||
Stroke="Blue" StrokeThickness="2" | |||
Stroke="Red" StrokeThickness="2" | |||
Values="{Binding DataFeedback.WeighingWaterTankWeight}" /> | |||
<lvc:LineSeries | |||
Fill="Transparent" LineSmoothness="1" | |||
PointGeometry="{x:Null}" | |||
Stroke="Brown" StrokeThickness="2" | |||
Stroke="Blue" StrokeThickness="2" | |||
Values="{Binding DataFeedback.BrineTankWeight}" /> | |||
<lvc:LineSeries | |||
Fill="Transparent" LineSmoothness="1" | |||
PointGeometry="{x:Null}" | |||
Stroke="Yellow" StrokeThickness="2" | |||
Values="{Binding PartReferenceData.WeighingWaterTankWeight}" /> | |||
<lvc:LineSeries | |||
Fill="Transparent" LineSmoothness="1" | |||
PointGeometry="{x:Null}" | |||
Stroke="Green" StrokeThickness="2" | |||
Values="{Binding PartReferenceData.BrineTankWeight}" /> | |||
</lvc:CartesianChart.Series> | |||
<lvc:CartesianChart.AxisY> | |||
<lvc:Axis | |||
@@ -413,11 +456,17 @@ | |||
<StackPanel Margin="0,10,0,0" Orientation="Horizontal"> | |||
<TextBlock Foreground="White" Text="重量曲线/kg" /> | |||
<Rectangle | |||
Width="20" Height="2" Margin="20,0,0,2" Fill="Blue" /> | |||
Width="20" Height="2" Margin="20,0,0,2" Fill="Red" /> | |||
<TextBlock Foreground="White" Text="冷却水罐重量" /> | |||
<Rectangle | |||
Width="20" Height="2" Margin="20,0,0,2" Fill="Brown" /> | |||
Width="20" Height="2" Margin="20,0,0,2" Fill="Blue" /> | |||
<TextBlock Foreground="White" Text="卤水罐重量" /> | |||
<Rectangle | |||
Width="20" Height="2" Margin="20,0,0,2" Fill="Yellow" /> | |||
<TextBlock Foreground="White" Text="冷却水罐重量_参考" /> | |||
<Rectangle | |||
Width="20" Height="2" Margin="20,0,0,2" Fill="Green" /> | |||
<TextBlock Foreground="White" Text="卤水罐重量_参考" /> | |||
</StackPanel> | |||
</StackPanel> | |||
@@ -432,8 +481,13 @@ | |||
<lvc:LineSeries | |||
Fill="Transparent" LineSmoothness="1" | |||
PointGeometry="{x:Null}" | |||
Stroke="White" StrokeThickness="2" | |||
Stroke="Red" StrokeThickness="2" | |||
Values="{Binding DataFeedback.CondensateWaterHumidity}" /> | |||
<lvc:LineSeries | |||
Fill="Transparent" LineSmoothness="1" | |||
PointGeometry="{x:Null}" | |||
Stroke="Yellow" StrokeThickness="2" | |||
Values="{Binding PartReferenceData.CondensateWaterHumidity}" /> | |||
</lvc:CartesianChart.Series> | |||
<lvc:CartesianChart.AxisY> | |||
<lvc:Axis MaxValue="110" MinValue="0"> | |||
@@ -453,8 +507,11 @@ | |||
<StackPanel Margin="0,10,0,0" Orientation="Horizontal"> | |||
<TextBlock Foreground="White" Text="湿度曲线" /> | |||
<Rectangle | |||
Width="20" Height="2" Margin="20,0,0,2" Fill="White" /> | |||
Width="20" Height="2" Margin="20,0,0,2" Fill="Red" /> | |||
<TextBlock Foreground="White" Text="冷凝水罐湿度" /> | |||
<Rectangle | |||
Width="20" Height="2" Margin="20,0,0,2" Fill="Yellow" /> | |||
<TextBlock Foreground="White" Text="冷凝水罐湿度_参考" /> | |||
</StackPanel> | |||
</StackPanel> | |||
@@ -469,8 +526,13 @@ | |||
<lvc:LineSeries | |||
Fill="Transparent" LineSmoothness="1" | |||
PointGeometry="{x:Null}" | |||
Stroke="White" StrokeThickness="2" | |||
Stroke="Red" StrokeThickness="2" | |||
Values="{Binding DataFeedback.ReactEncoderValue}" /> | |||
<lvc:LineSeries | |||
Fill="Transparent" LineSmoothness="1" | |||
PointGeometry="{x:Null}" | |||
Stroke="Yellow" StrokeThickness="2" | |||
Values="{Binding PartReferenceData.ReactEncoderValue}" /> | |||
</lvc:CartesianChart.Series> | |||
<lvc:CartesianChart.AxisY> | |||
<lvc:Axis MaxValue="400" MinValue="-10"> | |||
@@ -490,8 +552,11 @@ | |||
<StackPanel Margin="0,10,0,0" Orientation="Horizontal"> | |||
<TextBlock Foreground="White" Text="反应釜角度曲线" /> | |||
<Rectangle | |||
Width="20" Height="2" Margin="20,0,0,2" Fill="White" /> | |||
Width="20" Height="2" Margin="20,0,0,2" Fill="Red" /> | |||
<TextBlock Foreground="White" Text="反应釜编码器角度值" /> | |||
<Rectangle | |||
Width="20" Height="2" Margin="20,0,0,2" Fill="Yellow" /> | |||
<TextBlock Foreground="White" Text="反应釜编码器角度值_参考" /> | |||
</StackPanel> | |||
</StackPanel> | |||
@@ -18,6 +18,8 @@ using System.Windows.Navigation; | |||
using System.Windows.Shapes; | |||
using ThingsGateway.Foundation.Core; | |||
using BPASmartClient.Academy._50L; | |||
using ThingsGateway.Foundation.Extension.String; | |||
using BPASmartClient.CustomResource.UserControls.MessageShow; | |||
namespace BPASmartClient.Academy.View | |||
{ | |||
@@ -38,11 +40,22 @@ namespace BPASmartClient.Academy.View | |||
public PlotModel plotModel { get; set; } = new PlotModel(); | |||
private void DataView_CLick(object sender, MouseButtonEventArgs e) | |||
{ | |||
var datas = SqliteOperate.GetInstance.QueryableById(PlcControl.GetInstance.id); | |||
if (datas is null || datas.Count==0) | |||
{ | |||
NoticeDemoViewModel.OpenMsg(EnumPromptType.Error,App.MainWindow,"无数据","当前无曲线数据。"); | |||
return; | |||
} | |||
ooo.Visibility = Visibility.Collapsed; | |||
double min = DateTimeAxis.ToDouble(System.DateTime.Now.AddMinutes(-10)); | |||
double max = DateTimeAxis.ToDouble(System.DateTime.Now); | |||
double maxrange = max - min; | |||
CartesianChart liveCharts = sender as CartesianChart; | |||
double min = DateTimeAxis.ToDouble(DateTime.MinValue); | |||
DateTime startTime = datas.Select(x => x.Createtime).Min(); | |||
double max = DateTimeAxis.ToDouble(new DateTime((datas.Select(x=>x.Createtime).Max().AddMinutes(6) - startTime).Ticks)); | |||
//double min = DateTimeAxis.ToDouble(DateTime.Now.AddMinutes(-10)); | |||
//double max = DateTimeAxis.ToDouble(DateTime.Now); | |||
double maxrange = max - min; | |||
switch (liveCharts.ToolTip) | |||
{ | |||
@@ -51,27 +64,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>(); | |||
ConcurrentDictionary<DateTime,float> keyValues = new ConcurrentDictionary<DateTime,float>(); | |||
SqliteOperate.GetInstance.QueryableById(PlcControl.GetInstance.id).ForEach(t => | |||
{ | |||
twValues.Add(new DataPoint(DateTimeAxis.ToDouble(t.Createtime), t.Temperature)); | |||
tvValues.Add(new DataPoint(DateTimeAxis.ToDouble(t.Createtime), t.CondensateWaterTemperature)); | |||
keyValues[t.Createtime] = t.Temperature; | |||
}); | |||
templine.Points.AddRange(twValues); | |||
templine_1.Points.AddRange(tvValues); | |||
//line_2.Points.AddRange(tmValues); | |||
if (!(plotModel.Axes.Count > 0)) | |||
{ | |||
plotModel.Axes.Add(new DateTimeAxis() { Position = OxyPlot.Axes.AxisPosition.Bottom, Title = "时间", StringFormat = "hh:mm:ss", Minimum = min, Maximum = max }); | |||
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") }); | |||
} | |||
plotModel.Series.Add(templine); | |||
plotModel.Series.Add(templine_1); | |||
List<HistoryDataPoint> reactorTemp = new(); | |||
List<HistoryDataPoint> CWTTemp = new(); | |||
datas.ForEach(t => | |||
{ | |||
var time =new DateTime((t.Createtime - startTime).Ticks); | |||
reactorTemp.Add(new(time, t.Temperature)); | |||
CWTTemp.Add(new(time, t.CondensateWaterTemperature)); | |||
}); | |||
AddOxyLineSeries("反应釜温度", OxyColor.FromRgb(110, 79, 79), reactorTemp); | |||
AddOxyLineSeries("冷凝水罐温度", OxyColor.FromRgb(110, 79, 79), CWTTemp); | |||
if (this.DataContext is DeviceChart50LViewModel viewModel && viewModel.ReferenceData != null) | |||
{ | |||
List<HistoryDataPoint> refReactorTemp = new(); | |||
List<HistoryDataPoint> refCWTTemp = new(); | |||
refReactorTemp = viewModel.ReferenceData.Temperature.Select(x => new HistoryDataPoint(x.DateTime, (float)x.Value)).ToList(); | |||
refCWTTemp = viewModel.ReferenceData.CondensateWaterTemperature.Select(x => new HistoryDataPoint(x.DateTime, (float)x.Value)).ToList(); | |||
AddOxyLineSeries("反应釜温度_参考", OxyColor.FromRgb(110, 79, 79), refReactorTemp); | |||
AddOxyLineSeries("冷凝水罐温度_参考", OxyColor.FromRgb(110, 79, 79), refCWTTemp); | |||
} | |||
plotModel.InvalidatePlot(true);//重新加载曲线 | |||
chartView.Model = plotModel; | |||
} | |||
@@ -81,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; | |||
} | |||
@@ -108,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; | |||
} | |||
@@ -132,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; | |||
} | |||
@@ -160,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; | |||
} | |||
@@ -188,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; | |||
} | |||
@@ -211,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; | |||
} | |||
@@ -233,7 +285,7 @@ namespace BPASmartClient.Academy.View | |||
break; | |||
} | |||
} | |||
private void AddOxyLineSeries(string title,OxyColor markerFill, ConcurrentDictionary<DateTime, float> keyValues) | |||
private void AddOxyLineSeries(string title,OxyColor markerFill, List<HistoryDataPoint> dataPoints) | |||
{ | |||
OxyPlot.Series.LineSeries templine = new OxyPlot.Series.LineSeries() | |||
{ LineStyle = LineStyle.Solid, | |||
@@ -243,9 +295,9 @@ namespace BPASmartClient.Academy.View | |||
LineLegendPosition = OxyPlot.Series.LineLegendPosition.End | |||
}; | |||
List<DataPoint> twValues = new List<DataPoint>(); | |||
foreach (var item in keyValues) | |||
foreach (var item in dataPoints) | |||
{ | |||
twValues.Add(new DataPoint(DateTimeAxis.ToDouble(item.Key), item.Value)); | |||
twValues.Add(new DataPoint(DateTimeAxis.ToDouble(item.DateTime), item.Value)); | |||
} | |||
templine.Points.AddRange(twValues); | |||
plotModel.Series.Add(templine); | |||
@@ -259,5 +311,8 @@ namespace BPASmartClient.Academy.View | |||
plotModel.InvalidatePlot(true); | |||
chartView.Model = plotModel; | |||
} | |||
record HistoryDataPoint(DateTime DateTime, float Value); | |||
} | |||
} |
@@ -89,6 +89,7 @@ | |||
</Style> | |||
</UserControl.Resources> | |||
<Grid> | |||
<!--#region 设备类型选择 --> | |||
<Grid | |||
Height="50" HorizontalAlignment="Right" VerticalAlignment="Top"> | |||
<Border Margin="0,0,100,0" HorizontalAlignment="Center"> | |||
@@ -99,6 +100,7 @@ | |||
Style="{StaticResource ButtonStyle}" /> | |||
</Border> | |||
</Grid> | |||
<!--#endregion--> | |||
<Grid | |||
x:Name="ooo" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" d:IsHitTestVisible="True" | |||
d:Opacity="1" IsHitTestVisible="False" Opacity="0.5"> | |||
@@ -107,6 +109,7 @@ | |||
<RowDefinition Height="0" /> | |||
</Grid.RowDefinitions> | |||
<Grid> | |||
<!--#region 控件显示主体 --> | |||
<Grid Margin="0,100"> | |||
<Viewbox Stretch="Uniform"> | |||
<Canvas | |||
@@ -212,9 +215,10 @@ | |||
<!--#region 阀门4 回水阀--> | |||
<TextBlock | |||
Canvas.Left="507" Canvas.Top="220" FontSize="10" | |||
Canvas.Left="507" Canvas.Top="220" HorizontalAlignment="Left" VerticalAlignment="Center" | |||
FontSize="10" | |||
Foreground="{Binding DeviceStatus.VX103, Converter={StaticResource deviceConvert}, ConverterParameter=4}" | |||
Text="回水阀" HorizontalAlignment="Left" VerticalAlignment="Center" /> | |||
Text="回水阀" /> | |||
<StackPanel | |||
Canvas.Left="427" Canvas.Top="200" Orientation="Horizontal"> | |||
<bpa:PipeLineH | |||
@@ -460,10 +464,10 @@ | |||
Foreground="{Binding DeviceStatus.VX109, Converter={StaticResource deviceConvert}, ConverterParameter=4}" | |||
Text="蒸汽疏水阀" /> | |||
<bpa:PipeLineV | |||
Width="12" Height="43" | |||
Canvas.Left="348" Canvas.Top="287" Width="12" Height="43" | |||
Direction="{Binding DeviceStatus.VX109, Converter={StaticResource deviceConvert}, ConverterParameter=1}" | |||
Fill="{Binding DeviceStatus.VX109, Converter={StaticResource deviceConvert}, ConverterParameter=2}" | |||
LineWidth="4" Canvas.Left="348" Canvas.Top="287" /> | |||
LineWidth="4" /> | |||
<bpa:HandValve | |||
Width="35" Height="35" Margin="341,296,402,154" | |||
OpenEnable="{Binding DeviceStatus.VX109}" | |||
@@ -513,9 +517,10 @@ | |||
<!--#region 阀门12 冷却水排水阀--> | |||
<TextBlock | |||
Canvas.Left="23" Canvas.Top="306" FontSize="10" | |||
Canvas.Left="23" Canvas.Top="306" HorizontalAlignment="Left" VerticalAlignment="Center" | |||
FontSize="10" | |||
Foreground="{Binding DeviceStatus.VX111, Converter={StaticResource deviceConvert}, ConverterParameter=4}" | |||
Text="冷却水排水阀" HorizontalAlignment="Left" VerticalAlignment="Center" /> | |||
Text="冷却水排水阀" /> | |||
<bpa:PipeLineV | |||
Width="12" Height="50" Margin="105,290,402,154" | |||
Direction="{Binding DeviceStatus.VX111, Converter={StaticResource deviceConvert}, ConverterParameter=1}" | |||
@@ -681,9 +686,10 @@ | |||
</bpa:HandValve> | |||
</StackPanel> | |||
<TextBlock | |||
Canvas.Left="178" Canvas.Top="340" FontSize="10" | |||
Canvas.Left="178" Canvas.Top="340" HorizontalAlignment="Left" VerticalAlignment="Center" | |||
FontSize="10" | |||
Foreground="{Binding DeviceStatus.VX114, Converter={StaticResource deviceConvert}, ConverterParameter=4}" | |||
Text="出料阀" HorizontalAlignment="Left" VerticalAlignment="Center" /> | |||
Text="出料阀" /> | |||
<!--#endregion--> | |||
<!--#region 水罐--> | |||
@@ -717,20 +723,23 @@ | |||
<!--#region 仪器标注--> | |||
<TextBlock | |||
Canvas.Left="107" Canvas.Top="84" FontSize="10" Foreground="Blue" | |||
Text="配料罐" HorizontalAlignment="Left" VerticalAlignment="Center" /> | |||
Canvas.Left="107" Canvas.Top="84" HorizontalAlignment="Left" VerticalAlignment="Center" | |||
FontSize="10" Foreground="Blue" Text="配料罐" /> | |||
<TextBlock | |||
Canvas.Left="92" Canvas.Top="70" Width="60" Foreground="Red" | |||
Text="{Binding DeviceStatus.TempMaterial, StringFormat='{}{0}℃'}" | |||
TextAlignment="Center" /> | |||
<TextBlock | |||
Canvas.Left="217" Canvas.Top="290" Foreground="Blue" Text="反应釜" FontSize="10" HorizontalAlignment="Left" VerticalAlignment="Center"/> | |||
Canvas.Left="217" Canvas.Top="290" HorizontalAlignment="Left" VerticalAlignment="Center" | |||
FontSize="10" Foreground="Blue" Text="反应釜" /> | |||
<TextBlock | |||
Canvas.Left="203" Canvas.Top="250" Width="60" Foreground="Red" FontSize="10" | |||
Canvas.Left="203" Canvas.Top="250" Width="60" FontSize="10" | |||
Foreground="Red" | |||
Text="{Binding DeviceStatus.TempWok, StringFormat='{}{0}℃'}" | |||
TextAlignment="Center" /> | |||
<TextBlock | |||
Canvas.Left="203" Canvas.Top="270" Width="60" Foreground="Red" FontSize="10" | |||
Canvas.Left="203" Canvas.Top="270" Width="60" FontSize="10" | |||
Foreground="Red" | |||
Text="{Binding DeviceStatus.PressureWok, StringFormat='{}{0:f2}mpa'}" | |||
TextAlignment="Center" /> | |||
<StackPanel | |||
@@ -750,18 +759,21 @@ | |||
Text="{Binding DeviceStatus.OpenValue, StringFormat='{}{0:f2}%'}" /> | |||
</StackPanel> | |||
<TextBlock | |||
Canvas.Left="573" Canvas.Top="88" Foreground="Blue" Text="冷凝器" FontSize="10" HorizontalAlignment="Left" VerticalAlignment="Center"/> | |||
Canvas.Left="573" Canvas.Top="88" HorizontalAlignment="Left" VerticalAlignment="Center" | |||
FontSize="10" Foreground="Blue" Text="冷凝器" /> | |||
<TextBlock | |||
Canvas.Left="389" Canvas.Top="30" Width="150" d:Text="反应釜排气温度:12.33℃" | |||
FontSize="10" Foreground="Red" | |||
Text="{Binding DeviceStatus.TempVent, StringFormat='反应釜排气温度:{0}℃'}" | |||
TextAlignment="Center" /> | |||
<TextBlock | |||
Canvas.Left="573" Canvas.Top="168" Foreground="Blue" Text="蒸馏罐" FontSize="10" HorizontalAlignment="Left" VerticalAlignment="Center"/> | |||
Canvas.Left="573" Canvas.Top="168" HorizontalAlignment="Left" VerticalAlignment="Center" | |||
FontSize="10" Foreground="Blue" Text="蒸馏罐" /> | |||
<TextBlock | |||
Canvas.Left="590" Canvas.Top="312" Foreground="Blue" Text="水罐" FontSize="10" HorizontalAlignment="Left" VerticalAlignment="Center"/> | |||
Canvas.Left="590" Canvas.Top="312" HorizontalAlignment="Left" VerticalAlignment="Center" | |||
FontSize="10" Foreground="Blue" Text="水罐" /> | |||
<TextBlock | |||
Canvas.Left="570" Canvas.Top="295" Width="60" FontSize="10" | |||
Canvas.Left="570" Canvas.Top="295" Width="60" FontSize="10" | |||
Foreground="Red" | |||
Text="{Binding DeviceStatus.WeightWok, StringFormat='{}{0:f2}g'}" | |||
TextAlignment="Center" /> | |||
@@ -772,7 +784,7 @@ | |||
<!--#region 水罐重量清零--> | |||
<Button | |||
Canvas.Left="480" Canvas.Top="370" Width="100" Height="22" | |||
Canvas.Left="480" Canvas.Top="370" Width="100" Height="22" | |||
VerticalAlignment="Center" Click="ClearBtn_CLick" Content="水罐重量清零" FontSize="10" | |||
Style="{StaticResource ButtonStyle}" /> | |||
<!--#endregion--> | |||
@@ -865,7 +877,8 @@ | |||
Text="⬛" TextAlignment="Center" /> | |||
</StackPanel> | |||
<StackPanel | |||
Canvas.Left="483" Canvas.Top="86" Orientation="Vertical" HorizontalAlignment="Left" VerticalAlignment="Center"> | |||
Canvas.Left="483" Canvas.Top="86" HorizontalAlignment="Left" VerticalAlignment="Center" | |||
Orientation="Vertical"> | |||
<RadioButton | |||
Width="55" Height="22" Margin="0,0,0,2" BorderThickness="0" | |||
Click="Open_Click" Content="回油阀:开" FontSize="8" Foreground="White" | |||
@@ -947,7 +960,7 @@ | |||
<RadioButton | |||
Width="70" Height="22" Margin="0,0,0,2" BorderThickness="0" | |||
Click="Open_Click" Content="配料釜蒸汽阀:开" FontSize="8" Foreground="White" | |||
GroupName="8" | |||
GroupName="10" | |||
Style="{StaticResource radiobutton}" | |||
Tag="10" /> | |||
<RadioButton | |||
@@ -957,8 +970,9 @@ | |||
Style="{StaticResource radiobutton}" | |||
Tag="10" /> | |||
</StackPanel> | |||
<StackPanel Canvas.Top="248" HorizontalAlignment="Left" VerticalAlignment="Center" | |||
Orientation="Vertical" Canvas.Left="10"> | |||
<StackPanel | |||
Canvas.Left="10" Canvas.Top="248" HorizontalAlignment="Left" VerticalAlignment="Center" | |||
Orientation="Vertical"> | |||
<RadioButton | |||
Width="55" Height="22" Margin="0,0,0,2" BorderThickness="0" | |||
Click="Open_Click" Content="蒸汽阀:开" FontSize="8" Foreground="White" | |||
@@ -973,7 +987,8 @@ | |||
Tag="11" /> | |||
</StackPanel> | |||
<StackPanel | |||
Canvas.Left="272" Canvas.Top="318" Orientation="Vertical" HorizontalAlignment="Left" VerticalAlignment="Center"> | |||
Canvas.Left="272" Canvas.Top="318" HorizontalAlignment="Left" VerticalAlignment="Center" | |||
Orientation="Vertical"> | |||
<RadioButton | |||
Width="70" Height="22" Margin="0,0,0,2" BorderThickness="0" | |||
Click="Open_Click" Content="蒸汽疏水阀:开" FontSize="8" Foreground="White" | |||
@@ -988,7 +1003,8 @@ | |||
Tag="12" /> | |||
</StackPanel> | |||
<StackPanel | |||
Canvas.Left="396" Canvas.Top="255" Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Top"> | |||
Canvas.Left="396" Canvas.Top="255" HorizontalAlignment="Center" VerticalAlignment="Top" | |||
Orientation="Vertical"> | |||
<RadioButton | |||
Width="70" Height="22" Margin="0,0,0,2" BorderThickness="0" | |||
Click="Open_Click" Content="冷却水给水阀:开" FontSize="8" Foreground="White" | |||
@@ -1002,8 +1018,9 @@ | |||
Style="{StaticResource radiobutton}" | |||
Tag="13" /> | |||
</StackPanel> | |||
<StackPanel Canvas.Top="322" HorizontalAlignment="Center" VerticalAlignment="Top" | |||
Orientation="Vertical" Canvas.Left="19"> | |||
<StackPanel | |||
Canvas.Left="19" Canvas.Top="322" HorizontalAlignment="Center" VerticalAlignment="Top" | |||
Orientation="Vertical"> | |||
<RadioButton | |||
Width="70" Height="22" Margin="0,0,0,2" BorderThickness="0" | |||
Click="Open_Click" Content="冷却水排水阀:开" FontSize="8" Foreground="White" | |||
@@ -1018,7 +1035,8 @@ | |||
Tag="18" /> | |||
</StackPanel> | |||
<StackPanel | |||
Canvas.Left="770" Canvas.Top="128" Orientation="Vertical" HorizontalAlignment="Left" VerticalAlignment="Center"> | |||
Canvas.Left="770" Canvas.Top="128" HorizontalAlignment="Left" VerticalAlignment="Center" | |||
Orientation="Vertical"> | |||
<RadioButton | |||
Width="70" Height="22" Margin="0,0,0,2" BorderThickness="0" | |||
Click="Open_Click" Content="分馏真空阀:开" FontSize="8" Foreground="White" | |||
@@ -1049,7 +1067,8 @@ | |||
Tag="20" /> | |||
</StackPanel> | |||
<StackPanel | |||
Canvas.Left="773" Canvas.Top="279" Orientation="Vertical" HorizontalAlignment="Left" VerticalAlignment="Center"> | |||
Canvas.Left="773" Canvas.Top="279" HorizontalAlignment="Left" VerticalAlignment="Center" | |||
Orientation="Vertical"> | |||
<RadioButton | |||
Width="55" Height="22" Margin="0,0,0,2" BorderThickness="0" | |||
Click="Open_Click" Content="真空泵:开" FontSize="8" Foreground="White" | |||
@@ -1437,6 +1456,8 @@ | |||
</Canvas> | |||
</Viewbox> | |||
</Grid> | |||
<!--#endregion--> | |||
<!--#region 底部参数设置窗体 --> | |||
<Grid> | |||
<Grid Margin="8,-3,-8,3"> | |||
<Grid.RowDefinitions> | |||
@@ -1625,16 +1646,20 @@ | |||
</Grid> | |||
</Grid> | |||
</Grid> | |||
<!--#endregion--> | |||
</Grid> | |||
</Grid> | |||
<!--#region 未连接遮罩 --> | |||
<TextBlock | |||
x:Name="state" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="100" | |||
FontWeight="Black" Text="设备未连接" Visibility="Collapsed" /> | |||
<!--#endregion--> | |||
<!--#region 搅拌频率设置弹窗 --> | |||
<Grid | |||
x:Name="hzSet" Width="800" Height="500" Visibility="Collapsed"> | |||
<Grid.Background> | |||
@@ -1674,5 +1699,6 @@ | |||
</StackPanel> | |||
</UniformGrid> | |||
</Grid> | |||
<!--#endregion--> | |||
</Grid> | |||
</UserControl> |
@@ -1118,7 +1118,7 @@ | |||
<Grid | |||
Canvas.Left="384" Canvas.Top="399" Panel.ZIndex="8"> | |||
Canvas.Left="384" Canvas.Top="399" Panel.ZIndex="8" MouseLeftButtonDown="Canvas_MouseDown"> | |||
<bpa:HandValve | |||
Canvas.Right="400" | |||
EdgeColor="{Binding DeviceStatus.ReactPressureAirInValve, ConverterParameter=2, Converter={StaticResource deviceConvert}}" | |||
@@ -43,43 +43,38 @@ namespace BPASmartClient.Academy.ViewModel | |||
InspectDataCommand = new BPARelayCommand<string>(s => { OxyInit(s); }); | |||
CheckedCommand = new BPARelayCommand<string>(async s => | |||
{ | |||
if (int.TryParse(s, out int index)) | |||
{ | |||
if (VisStatus.Length == OxyDataModels.Count && index >= 0 && index < VisStatus.Length) | |||
{ | |||
IsEnable = false; | |||
await Task.Run(() => | |||
{ | |||
sw.Start(); | |||
if (VisStatus[index]) OxyModel.Series.Add(OxyDataModels[index].Line); | |||
else OxyModel.Series.Remove(OxyDataModels[index].Line); | |||
OxyModel.InvalidatePlot(true); //重新加载曲线 | |||
IsEnable = true; | |||
Debug.WriteLine(sw.ElapsedMilliseconds); | |||
sw.Restart(); | |||
}); | |||
} | |||
} | |||
}); | |||
ShowRefrenceWindowCommand = new BPARelayCommand(() => { | |||
ReferenceWindownVisiblity = Visibility.Visible; | |||
}); | |||
HiddenRefrenceWindowCommand = new BPARelayCommand(() => { | |||
ReferenceWindownVisiblity = Visibility.Collapsed; | |||
}); | |||
Task.Factory.StartNew(async () => | |||
_tokenSource = new CancellationTokenSource(); | |||
Task.Factory.StartNew(async (o) => | |||
{ | |||
while (true) | |||
while (!_tokenSource.IsCancellationRequested) | |||
{ | |||
if (ReferenceData != null && ReferenceData.Temperature.Count > 0) | |||
{ | |||
DateTime startTime = DataFeedback.Temperature.Select(x => x.DateTime).Min(); | |||
DateTime endTime = DataFeedback.Temperature.Select(x => x.DateTime).Max().AddSeconds(6); | |||
DateTime startTime = DataFeedback.Temperature.Min(x => x.DateTime); | |||
DateTime endTime = DataFeedback.Temperature.Max(x => x.DateTime).AddSeconds(6); | |||
//PartReferenceData.Temperature.RemoveWhere(x => x.DateTime < startTime); | |||
AxisXMinValue = startTime; | |||
AxisXMaxValue = endTime; | |||
//PartReferenceData.Temperature.RemoveWhere(x => x.DateTime < startTime); | |||
//PartReferenceData.SteamPressure.RemoveWhere(x => x.DateTime < startTime); | |||
//PartReferenceData.SteamPressure.RemoveWhere(x => x.DateTime < startTime); | |||
//PartReferenceData.CondensateWaterTemperature.RemoveWhere(x => x.DateTime < startTime); | |||
//PartReferenceData.CondensateWaterHumidity.RemoveWhere(x => x.DateTime < startTime); | |||
//PartReferenceData.NegativePressureFlowRate.RemoveWhere(x => x.DateTime < startTime); | |||
//PartReferenceData.WeighingWaterTankWeight.RemoveWhere(x => x.DateTime < startTime); | |||
//PartReferenceData.ReactEncoderValue.RemoveWhere(x => x.DateTime < startTime); | |||
//PartReferenceData.ProportionalValveOpening.RemoveWhere(x => x.DateTime < startTime); | |||
//PartReferenceData.BrineTankWeight.RemoveWhere(x => x.DateTime < startTime); | |||
//PartReferenceData.ReactPressure.RemoveWhere(x => x.DateTime < startTime); | |||
PartReferenceData.Temperature.Clear(); | |||
PartReferenceData.SteamPressure.Clear(); | |||
@@ -93,25 +88,34 @@ namespace BPASmartClient.Academy.ViewModel | |||
PartReferenceData.BrineTankWeight.Clear(); | |||
PartReferenceData.ReactPressure.Clear(); | |||
PartReferenceData.Temperature.AddRange(ReferenceData.Temperature.Where(x => x.DateTime >= startTime && x.DateTime <= endTime)); | |||
PartReferenceData.SteamPressure.AddRange(ReferenceData.SteamPressure.Where(x => x.DateTime >= startTime && x.DateTime <= endTime)); | |||
PartReferenceData.SteamPressure.AddRange(ReferenceData.SteamFlowRate.Where(x => x.DateTime >= startTime && x.DateTime <= endTime)); | |||
PartReferenceData.CondensateWaterTemperature.AddRange(ReferenceData.CondensateWaterTemperature.Where(x => x.DateTime >= startTime && x.DateTime <= endTime)); | |||
PartReferenceData.CondensateWaterHumidity.AddRange(ReferenceData.CondensateWaterHumidity.Where(x => x.DateTime >= startTime && x.DateTime <= endTime)); | |||
PartReferenceData.NegativePressureFlowRate.AddRange(ReferenceData.NegativePressureFlowRate.Where(x => x.DateTime >= startTime && x.DateTime <= endTime)); | |||
PartReferenceData.WeighingWaterTankWeight.AddRange(ReferenceData.WeighingWaterTankWeight.Where(x => x.DateTime >= startTime && x.DateTime <= endTime)); | |||
PartReferenceData.ReactEncoderValue.AddRange(ReferenceData.ReactEncoderValue.Where(x => x.DateTime >= startTime && x.DateTime <= endTime)); | |||
PartReferenceData.ProportionalValveOpening.AddRange(ReferenceData.ProportionalValveOpening.Where(x => x.DateTime >= startTime && x.DateTime <= endTime)); | |||
PartReferenceData.BrineTankWeight.AddRange(ReferenceData.BrineTankWeight.Where(x => x.DateTime >= startTime && x.DateTime <= endTime)); | |||
PartReferenceData.ReactPressure.AddRange(ReferenceData.ReactPressure.Where(x => x.DateTime >= startTime && x.DateTime <= endTime)); | |||
if (ReferenceData.Temperature.Max(x => x.DateTime) >= endTime) | |||
{ | |||
PartReferenceData.Temperature.AddRange(ReferenceData.Temperature.Where(x => x.DateTime >= startTime && x.DateTime <= endTime)); | |||
PartReferenceData.SteamPressure.AddRange(ReferenceData.SteamPressure.Where(x => x.DateTime >= startTime && x.DateTime <= endTime)); | |||
PartReferenceData.SteamPressure.AddRange(ReferenceData.SteamFlowRate.Where(x => x.DateTime >= startTime && x.DateTime <= endTime)); | |||
PartReferenceData.CondensateWaterTemperature.AddRange(ReferenceData.CondensateWaterTemperature.Where(x => x.DateTime >= startTime && x.DateTime <= endTime)); | |||
PartReferenceData.CondensateWaterHumidity.AddRange(ReferenceData.CondensateWaterHumidity.Where(x => x.DateTime >= startTime && x.DateTime <= endTime)); | |||
PartReferenceData.NegativePressureFlowRate.AddRange(ReferenceData.NegativePressureFlowRate.Where(x => x.DateTime >= startTime && x.DateTime <= endTime)); | |||
PartReferenceData.WeighingWaterTankWeight.AddRange(ReferenceData.WeighingWaterTankWeight.Where(x => x.DateTime >= startTime && x.DateTime <= endTime)); | |||
PartReferenceData.ReactEncoderValue.AddRange(ReferenceData.ReactEncoderValue.Where(x => x.DateTime >= startTime && x.DateTime <= endTime)); | |||
PartReferenceData.ProportionalValveOpening.AddRange(ReferenceData.ProportionalValveOpening.Where(x => x.DateTime >= startTime && x.DateTime <= endTime)); | |||
PartReferenceData.BrineTankWeight.AddRange(ReferenceData.BrineTankWeight.Where(x => x.DateTime >= startTime && x.DateTime <= endTime)); | |||
PartReferenceData.ReactPressure.AddRange(ReferenceData.ReactPressure.Where(x => x.DateTime >= startTime && x.DateTime <= endTime)); | |||
} | |||
} | |||
await Task.Delay(2000); | |||
//await Task.Delay(2000); | |||
Thread.Sleep(2000); | |||
} | |||
}, TaskCreationOptions.LongRunning); | |||
}, TaskCreationOptions.LongRunning,_tokenSource.Token); | |||
} | |||
~DeviceChart50LViewModel() | |||
{ | |||
_tokenSource.Cancel(false); | |||
} | |||
private CancellationTokenSource _tokenSource; | |||
private DataFeedBack_50 dataFeedback; | |||
public DataFeedBack_50 DataFeedback { get { return dataFeedback; } set { dataFeedback = value; OnPropertyChanged(); } } | |||
@@ -120,7 +124,12 @@ namespace BPASmartClient.Academy.ViewModel | |||
private DataFeedBack_50 _partReferenceData; | |||
public DataFeedBack_50 PartReferenceData { get { return _partReferenceData; } set { _partReferenceData = value; OnPropertyChanged(); } } | |||
public DateTime AxisXMinValue { get { return _axisXMinValue; } set { _axisXMinValue = value; OnPropertyChanged(); } } | |||
private DateTime _axisXMinValue; | |||
public DateTime AxisXMaxValue { get { return _axisXMaxValue; } set { _axisXMaxValue = value; OnPropertyChanged(); } } | |||
private DateTime _axisXMaxValue; | |||
public Func<double, string> DateTimeFormatter { get; set; } = value => value > 0 ? new DateTime((long)value).ToString("HH:mm:ss") : new DateTime((long)DateTime.Now.Ticks).ToString("HH:mm:ss"); | |||
public Func<double, string> doubleFormatter { get; set; } = value => value.ToString("F2"); | |||
@@ -158,20 +167,6 @@ namespace BPASmartClient.Academy.ViewModel | |||
} | |||
private OxyLineSeries CreateLine(string title) | |||
{ | |||
var scb = Application.Current.TryFindResource(title) as SolidColorBrush; | |||
var color = scb.ToOxyColor(); | |||
return new OxyLineSeries() | |||
{ | |||
LineStyle = LineStyle.Solid, | |||
Title = title, | |||
MarkerFill = scb.ToOxyColor(), | |||
MarkerSize = 2, | |||
LineLegendPosition = LineLegendPosition.End, | |||
Color = color, | |||
}; | |||
} | |||
private void LoadNames(List<SaveNameData> data) | |||
{ | |||
@@ -194,8 +189,6 @@ namespace BPASmartClient.Academy.ViewModel | |||
}); | |||
} | |||
public List<OxyDataModel> OxyDataModels { get; set; } = new List<OxyDataModel>(); | |||
public ObservableCollection<RecipeChart> RecipeCharts { get; set; } = new ObservableCollection<RecipeChart>(); | |||
public DateTime SelectTime { get { return _mSelectTime; } set { _mSelectTime = value; OnPropertyChanged(); } } | |||
@@ -204,25 +197,8 @@ namespace BPASmartClient.Academy.ViewModel | |||
public string ProductNum { get { return _mProductNum; } set { _mProductNum = value; OnPropertyChanged(); } } | |||
private string _mProductNum; | |||
public PlotModel OxyModel { get { return _mOxyModel; } set { _mOxyModel = value; OnPropertyChanged(); } } | |||
private PlotModel _mOxyModel = new PlotModel(); | |||
public bool[] VisStatus { get { return _mVisStatus; } set { _mVisStatus = value; OnPropertyChanged(); } } | |||
private bool[] _mVisStatus = new bool[11]; | |||
public bool IsEnable | |||
{ | |||
get { return _mIsEnable; } | |||
set | |||
{ | |||
_mIsEnable = value; | |||
LoadingVis = value ? Visibility.Collapsed : Visibility.Visible; | |||
OnPropertyChanged(); | |||
} | |||
} | |||
private bool _mIsEnable = true; | |||
public Visibility LoadingVis { get { return _mLoadingVis; } set { _mLoadingVis = value; OnPropertyChanged(); } } | |||
private Visibility _mLoadingVis = Visibility.Collapsed; | |||
@@ -233,7 +209,6 @@ namespace BPASmartClient.Academy.ViewModel | |||
public BPARelayCommand<string> InspectDataCommand { get; set; } | |||
public BPARelayCommand<string> CheckedCommand { get; set; } | |||
public BPARelayCommand ShowRefrenceWindowCommand { get;private set; } | |||
public BPARelayCommand HiddenRefrenceWindowCommand { get; private set; } | |||