diff --git a/SmartAquaViewer/Model/Enums.cs b/SmartAquaViewer/Model/Enums.cs
index 7b25e86..4f6b500 100644
--- a/SmartAquaViewer/Model/Enums.cs
+++ b/SmartAquaViewer/Model/Enums.cs
@@ -28,6 +28,7 @@ namespace SmartAquaViewer.Model
Status, // 전원/상태
Sensor, // 센서 값
Energy, // 에너지 소비량
+ GHG // 온실가스 배출량
}
public enum PowerStatus
diff --git a/SmartAquaViewer/View/EnegyView.xaml b/SmartAquaViewer/View/EnegyView.xaml
index bc56c08..534b6e0 100644
--- a/SmartAquaViewer/View/EnegyView.xaml
+++ b/SmartAquaViewer/View/EnegyView.xaml
@@ -21,8 +21,8 @@
-
+
@@ -87,45 +87,43 @@
-
-
-
-
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/SmartAquaViewer/View/GreenHouseView.xaml b/SmartAquaViewer/View/GreenHouseView.xaml
index dd74d07..ac8a3f3 100644
--- a/SmartAquaViewer/View/GreenHouseView.xaml
+++ b/SmartAquaViewer/View/GreenHouseView.xaml
@@ -16,55 +16,116 @@
-
+
+
-
+
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
@@ -259,7 +320,7 @@
-
GraphTypes { get; }
- public List WaterQualityList { get; set; }
+ public ReadOnlyObservableCollection WaterQualityList { get; set; }
private double _totalEnergy;
public double TotalEnergy
@@ -181,7 +182,7 @@ namespace SmartAquaViewer.ViewModel
}
}
- private StepFieldKind _selectedKind = StepFieldKind.Sensor; // 기본값은 센서
+ private StepFieldKind _selectedKind = StepFieldKind.Energy; // 기본값은 센서
public StepFieldKind SelectedKind
{
get => _selectedKind;
@@ -240,7 +241,6 @@ namespace SmartAquaViewer.ViewModel
public EnergyViewModel()
{
- WaterQualityList = Datas.Instance.GetWaterQualityVO().ToList();
GraphTypes = new ObservableCollection
{
GraphType.LINE,
@@ -248,6 +248,8 @@ namespace SmartAquaViewer.ViewModel
GraphType.PIE
};
+ WaterQualityList = Datas.Instance.WaterQualityView;
+
TotalSandFilterEnergy = WaterQualityList.Sum(vo => vo.Filtering.SandFilterEnergy);
TotalCirculationPumpEnergy = WaterQualityList.Sum(vo => vo.Filtering.CirculationPumpEnergy);
TotalHeatPumpEnergy = WaterQualityList.Sum(vo => vo.Filtering.HeatPumpEnergy);
@@ -271,13 +273,13 @@ namespace SmartAquaViewer.ViewModel
switch (SelectedGraphType)
{
case GraphType.LINE:
- GraphControlVM.SetMultiLineGraph(WaterQualityList, SelectedYFields, DataType.Energy, ShowMarkers, ShowLegends);
+ GraphControlVM.SetMultiLineGraph(WaterQualityList.ToList(), SelectedYFields, DataType.Energy, ShowMarkers, ShowLegends);
break;
case GraphType.STACKAREA:
- GraphControlVM.SetStackAreaPlot(WaterQualityList, SelectedYFields, DataType.Energy, ShowMarkers, ShowLegends);
+ GraphControlVM.SetStackAreaPlot(WaterQualityList.ToList(), SelectedYFields, DataType.Energy, ShowMarkers, ShowLegends);
break;
case GraphType.PIE:
- GraphControlVM.SetPieChart(WaterQualityList, SelectedYFields, DataType.Energy, UseAverage, IsDonut);
+ GraphControlVM.SetPieChart(WaterQualityList.ToList(), SelectedYFields, DataType.Energy, UseAverage, IsDonut);
break;
default:
break;
diff --git a/SmartAquaViewer/ViewModel/GreenHouseGasViewModel.cs b/SmartAquaViewer/ViewModel/GreenHouseGasViewModel.cs
index f2a29a4..681205f 100644
--- a/SmartAquaViewer/ViewModel/GreenHouseGasViewModel.cs
+++ b/SmartAquaViewer/ViewModel/GreenHouseGasViewModel.cs
@@ -1,7 +1,9 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
+using System.Collections.Specialized;
using System.ComponentModel;
+using System.Diagnostics;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
@@ -18,7 +20,133 @@ namespace SmartAquaViewer.ViewModel
public GraphControlViewModel GraphControlVM { get; } = new GraphControlViewModel();
public ObservableCollection GraphTypes { get; }
- public List WaterQualityList { get; set; }
+ public ReadOnlyObservableCollection WaterQualityList { get; set; }
+
+ private double _totalGreenhouseGas;
+ public double TotalGreenhouseGas
+ {
+ get => _totalGreenhouseGas;
+ set
+ {
+ if (_totalGreenhouseGas != value)
+ {
+ _totalGreenhouseGas = value;
+ OnPropertyChanged();
+ }
+ }
+ }
+
+ private double _totalSandFilterGreenhouseGas;
+ public double TotalSandFilterGreenhouseGas
+ {
+ get => _totalSandFilterGreenhouseGas;
+ set
+ {
+ if (_totalSandFilterGreenhouseGas != value)
+ {
+ _totalSandFilterGreenhouseGas = value;
+ OnPropertyChanged();
+ }
+ }
+ }
+
+ private double _totalCirculationPumpGreenhouseGas;
+ public double TotalCirculationPumpGreenhouseGas
+ {
+ get => _totalCirculationPumpGreenhouseGas;
+ set
+ {
+ if (_totalCirculationPumpGreenhouseGas != value)
+ {
+ _totalCirculationPumpGreenhouseGas = value;
+ OnPropertyChanged();
+ }
+ }
+ }
+
+ private double _totalHeatPumpGreenhouseGas;
+ public double TotalHeatPumpGreenhouseGas
+ {
+ get => _totalHeatPumpGreenhouseGas;
+ set
+ {
+ if (_totalHeatPumpGreenhouseGas != value)
+ {
+ _totalHeatPumpGreenhouseGas = value;
+ OnPropertyChanged();
+ }
+ }
+ }
+
+ private double _totalAirBlowerGreenhouseGas;
+ public double TotalAirBlowerGreenhouseGas
+ {
+ get => _totalAirBlowerGreenhouseGas;
+ set
+ {
+ if (_totalAirBlowerGreenhouseGas != value)
+ {
+ _totalAirBlowerGreenhouseGas = value;
+ OnPropertyChanged();
+ }
+ }
+ }
+
+ private double _totalOzoneGeneratorGreenhouseGas;
+ public double TotalOzoneGeneratorGreenhouseGas
+ {
+ get => _totalOzoneGeneratorGreenhouseGas;
+ set
+ {
+ if (_totalOzoneGeneratorGreenhouseGas != value)
+ {
+ _totalOzoneGeneratorGreenhouseGas = value;
+ OnPropertyChanged();
+ }
+ }
+ }
+
+ private double _totalUVSterilizerGreenhouseGas;
+ public double TotalUVSterilizerGreenhouseGas
+ {
+ get => _totalUVSterilizerGreenhouseGas;
+ set
+ {
+ if (_totalUVSterilizerGreenhouseGas != value)
+ {
+ _totalUVSterilizerGreenhouseGas = value;
+ OnPropertyChanged();
+ }
+ }
+ }
+
+ private double _totalOzoneDissolverGreenhouseGas;
+ public double TotalOzoneDissolverGreenhouseGas
+ {
+ get => _totalOzoneDissolverGreenhouseGas;
+ set
+ {
+ if (_totalOzoneDissolverGreenhouseGas != value)
+ {
+ _totalOzoneDissolverGreenhouseGas = value;
+ OnPropertyChanged();
+ }
+ }
+ }
+
+ private double _totalExcessOzoneDestroyerGreenhouseGas;
+ public double TotalExcessOzoneDestroyerGreenhouseGas
+ {
+ get => _totalExcessOzoneDestroyerGreenhouseGas;
+ set
+ {
+ if (_totalExcessOzoneDestroyerGreenhouseGas != value)
+ {
+ _totalExcessOzoneDestroyerGreenhouseGas = value;
+ OnPropertyChanged();
+ }
+ }
+ }
private int _selectedGraphIndex = -1;
public int SelectedGraphIndex
@@ -60,6 +188,20 @@ namespace SmartAquaViewer.ViewModel
}
}
+ private StepFieldKind _selectedKind = StepFieldKind.GHG; // 기본값은 센서
+ public StepFieldKind SelectedKind
+ {
+ get => _selectedKind;
+ set
+ {
+ if (_selectedKind != value)
+ {
+ _selectedKind = value;
+ OnPropertyChanged();
+ }
+ }
+ }
+
public bool ShowXSelector => SelectedGraphType == GraphType.SCATTER;
// [필드 후보 목록] 탭/시스템에 따라 달라짐
@@ -104,13 +246,27 @@ namespace SmartAquaViewer.ViewModel
public GreenHouseGasViewModel()
{
- WaterQualityList = Datas.Instance.GetWaterQualityVO().ToList();
GraphTypes = new ObservableCollection
{
GraphType.LINE,
GraphType.STACKAREA,
GraphType.PIE
- };
+ };
+
+ WaterQualityList = Datas.Instance.WaterQualityView;
+
+
+ TotalSandFilterGreenhouseGas = WaterQualityList.Sum(vo => vo.Filtering.SandFilterGreenhouseGas);
+ TotalCirculationPumpGreenhouseGas = WaterQualityList.Sum(vo => vo.Filtering.CirculationPumpGreenhouseGas);
+ TotalHeatPumpGreenhouseGas = WaterQualityList.Sum(vo => vo.Filtering.HeatPumpGreenhouseGas);
+ TotalAirBlowerGreenhouseGas = WaterQualityList.Sum(vo => vo.Filtering.AirBlowerGreenhouseGas);
+ TotalOzoneGeneratorGreenhouseGas = WaterQualityList.Sum(vo => vo.Sterilizing.OzoneGeneratorGreenhouseGas);
+ TotalUVSterilizerGreenhouseGas = WaterQualityList.Sum(vo => vo.Sterilizing.UVSterilizerGreenhouseGas);
+ TotalOzoneDissolverGreenhouseGas = WaterQualityList.Sum(vo => vo.Sterilizing.OzoneDissolverGreenhouseGas);
+ TotalExcessOzoneDestroyerGreenhouseGas = WaterQualityList.Sum(vo => vo.Sterilizing.ExcessOzoneDestroyerGreenhouseGas);
+ TotalGreenhouseGas = WaterQualityList.Sum(vo => vo.TotalGreenhouseGas);
+
+ SelectedKind = StepFieldKind.GHG;
DrawGraphCommand = new RelayCommand(DrawGraph);
@@ -123,13 +279,13 @@ namespace SmartAquaViewer.ViewModel
switch (SelectedGraphType)
{
case GraphType.LINE:
- GraphControlVM.SetMultiLineGraph(WaterQualityList, SelectedYFields, DataType.GreenhouseGas, ShowMarkers, ShowLegends);
+ GraphControlVM.SetMultiLineGraph(WaterQualityList.ToList(), SelectedYFields, DataType.GreenhouseGas, ShowMarkers, ShowLegends);
break;
case GraphType.STACKAREA:
- GraphControlVM.SetStackAreaPlot(WaterQualityList, SelectedYFields, DataType.GreenhouseGas, ShowMarkers, ShowLegends);
+ GraphControlVM.SetStackAreaPlot(WaterQualityList.ToList(), SelectedYFields, DataType.GreenhouseGas, ShowMarkers, ShowLegends);
break;
case GraphType.PIE:
- GraphControlVM.SetPieChart(WaterQualityList, SelectedYFields, DataType.GreenhouseGas, UseAverage, IsDonut);
+ GraphControlVM.SetPieChart(WaterQualityList.ToList(), SelectedYFields, DataType.GreenhouseGas, UseAverage, IsDonut);
break;
default:
break;
@@ -143,15 +299,15 @@ namespace SmartAquaViewer.ViewModel
// 공통 시간
AvailableFields.Add(new FieldItem { Name = "RecordedTime", Display = "시간", DataType = typeof(DateTime) });
- AvailableFields.Add(new FieldItem { Name = "TotalGreenhouseGas", Display = "총 배출량", DataType = typeof(double), Kind = StepFieldKind.Energy });
- AvailableFields.Add(new FieldItem { Name = "Filtering.SandFilterGreenhouseGas", Display = "모래여과기", DataType = typeof(double), Kind = StepFieldKind.Energy });
- AvailableFields.Add(new FieldItem { Name = "Filtering.CirculationPumpGreenhouseGas", Display = "순환펌프", DataType = typeof(double), Kind = StepFieldKind.Energy });
- AvailableFields.Add(new FieldItem { Name = "Filtering.HeatPumpGreenhouseGas", Display = "히트펌프", DataType = typeof(double), Kind = StepFieldKind.Energy });
- AvailableFields.Add(new FieldItem { Name = "Filtering.AirBlowerGreenhouseGas", Display = "에어브로와", DataType = typeof(double), Kind = StepFieldKind.Energy });
- AvailableFields.Add(new FieldItem { Name = "Sterilizing.OzoneGeneratorGreenhouseGas", Display = "오존발생기", DataType = typeof(double), Kind = StepFieldKind.Energy });
- AvailableFields.Add(new FieldItem { Name = "Sterilizing.UVSterilizerGreenhouseGas", Display = "자외선 살균기", DataType = typeof(double), Kind = StepFieldKind.Energy });
- AvailableFields.Add(new FieldItem { Name = "Sterilizing.OzoneDissolverGreenhouseGas", Display = "오존용해장치", DataType = typeof(double), Kind = StepFieldKind.Energy });
- AvailableFields.Add(new FieldItem { Name = "Sterilizing.ExcessOzoneDestroyerGreenhouseGas", Display = "배오존장치", DataType = typeof(double), Kind = StepFieldKind.Energy });
+ AvailableFields.Add(new FieldItem { Name = "TotalGreenhouseGas", Display = "총 배출량", DataType = typeof(double), Kind = StepFieldKind.GHG });
+ AvailableFields.Add(new FieldItem { Name = "Filtering.SandFilterGreenhouseGas", Display = "모래여과기", DataType = typeof(double), Kind = StepFieldKind.GHG });
+ AvailableFields.Add(new FieldItem { Name = "Filtering.CirculationPumpGreenhouseGas", Display = "순환펌프", DataType = typeof(double), Kind = StepFieldKind.GHG });
+ AvailableFields.Add(new FieldItem { Name = "Filtering.HeatPumpGreenhouseGas", Display = "히트펌프", DataType = typeof(double), Kind = StepFieldKind.GHG });
+ AvailableFields.Add(new FieldItem { Name = "Filtering.AirBlowerGreenhouseGas", Display = "에어브로와", DataType = typeof(double), Kind = StepFieldKind.GHG });
+ AvailableFields.Add(new FieldItem { Name = "Sterilizing.OzoneGeneratorGreenhouseGas", Display = "오존발생기", DataType = typeof(double), Kind = StepFieldKind.GHG });
+ AvailableFields.Add(new FieldItem { Name = "Sterilizing.UVSterilizerGreenhouseGas", Display = "자외선 살균기", DataType = typeof(double), Kind = StepFieldKind.GHG });
+ AvailableFields.Add(new FieldItem { Name = "Sterilizing.OzoneDissolverGreenhouseGas", Display = "오존용해장치", DataType = typeof(double), Kind = StepFieldKind.GHG });
+ AvailableFields.Add(new FieldItem { Name = "Sterilizing.ExcessOzoneDestroyerGreenhouseGas", Display = "배오존장치", DataType = typeof(double), Kind = StepFieldKind.GHG });
}
private void RebuildFieldCandidates()
@@ -180,7 +336,7 @@ namespace SmartAquaViewer.ViewModel
// Y축 후보: 수치형
foreach (var f in src)
{
- if (SelectedGraphType is GraphType.STACKAREA or GraphType.PIE && f.Name.Equals("TotalEnergy")) continue;
+ if (SelectedGraphType is GraphType.STACKAREA or GraphType.PIE && f.Name!.Equals("TotalGreenhouseGas")) continue;
YFieldCandidates.Add(f);
}
diff --git a/SmartAquaViewer/ViewModel/MonitoringViewModel.cs b/SmartAquaViewer/ViewModel/MonitoringViewModel.cs
index 2a83112..1d020da 100644
--- a/SmartAquaViewer/ViewModel/MonitoringViewModel.cs
+++ b/SmartAquaViewer/ViewModel/MonitoringViewModel.cs
@@ -262,8 +262,6 @@ namespace SmartAquaViewer.ViewModel
IsOpenMode = true;
BtnVisibilityUp = Visibility.Collapsed;
- //WaterQualityList = WaterQualityVO.GetSampleData(new DateTime(2025, 8, 1), new DateTime(2025, 8, 1), 10);
- //Datas.Instance.SetWaterQualityVO(WaterQualityList);
WaterQualityList = Datas.Instance.WaterQualityView;
((INotifyCollectionChanged)WaterQualityList).CollectionChanged += OnWaterQualityChanged;