feat: 온실가스 요약 데이터 출력 추가

prototype
HyungJune Kim 10 months ago
parent 6354aa82f7
commit 60349a5723

@ -28,6 +28,7 @@ namespace SmartAquaViewer.Model
Status, // 전원/상태 Status, // 전원/상태
Sensor, // 센서 값 Sensor, // 센서 값
Energy, // 에너지 소비량 Energy, // 에너지 소비량
GHG // 온실가스 배출량
} }
public enum PowerStatus public enum PowerStatus

@ -21,8 +21,8 @@
<RowDefinition Height="*"/> <RowDefinition Height="*"/>
</Grid.RowDefinitions> </Grid.RowDefinitions>
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/> <ColumnDefinition Width="*"/>
<ColumnDefinition Width="600"/>
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<Border Grid.ColumnSpan="2" Margin="20" BorderBrush="#3E4C60" BorderThickness="1" CornerRadius="10"> <Border Grid.ColumnSpan="2" Margin="20" BorderBrush="#3E4C60" BorderThickness="1" CornerRadius="10">
@ -87,45 +87,43 @@
</UniformGrid> </UniformGrid>
</Border> </Border>
<ScrollViewer Grid.Row="1" Grid.RowSpan="2" Margin="20 0 20 20" <DataGrid Style="{StaticResource DataGridStyle}" ItemsSource="{Binding WaterQualityList}" Background="Transparent"
HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" RowStyle="{StaticResource DataGridRowStyle}" ColumnHeaderStyle="{StaticResource DataGridColumnHeaderStyle}"
HorizontalAlignment="Center"> Grid.Row="1" Grid.RowSpan="2" Margin="20 0 20 20"
<DataGrid Style="{StaticResource DataGridStyle}" ItemsSource="{Binding WaterQualityList}" Background="Transparent" HorizontalAlignment="Stretch" ColumnWidth="*">
RowStyle="{StaticResource DataGridRowStyle}" ColumnHeaderStyle="{StaticResource DataGridColumnHeaderStyle}"> <DataGrid.Columns>
<DataGrid.Columns> <DataGridTextColumn
<DataGridTextColumn Header="시간"
Header="시간" Binding="{Binding RecordedTime, StringFormat=\{0:HH:mm:ss\}}"
Binding="{Binding RecordedTime, StringFormat=\{0:HH:mm:ss\}}" ElementStyle="{StaticResource DataGridElmenetStyle}"/>
ElementStyle="{StaticResource DataGridElmenetStyle}"/>
<DataGridTextColumn Header="모래여과기" ElementStyle="{StaticResource DataGridElmenetStyle}" <DataGridTextColumn Header="모래여과기" ElementStyle="{StaticResource DataGridElmenetStyle}"
Binding="{Binding Filtering.SandFilterEnergy}"/> Binding="{Binding Filtering.SandFilterEnergy}"/>
<DataGridTextColumn Header="순환펌프" ElementStyle="{StaticResource DataGridElmenetStyle}" <DataGridTextColumn Header="순환펌프" ElementStyle="{StaticResource DataGridElmenetStyle}"
Binding="{Binding Filtering.CirculationPumpEnergy}"/> Binding="{Binding Filtering.CirculationPumpEnergy}"/>
<DataGridTextColumn Header="히트펌프" ElementStyle="{StaticResource DataGridElmenetStyle}" <DataGridTextColumn Header="히트펌프" ElementStyle="{StaticResource DataGridElmenetStyle}"
Binding="{Binding Filtering.HeatPumpEnergy}"/> Binding="{Binding Filtering.HeatPumpEnergy}"/>
<DataGridTextColumn Header="에어브로와" ElementStyle="{StaticResource DataGridElmenetStyle}" <DataGridTextColumn Header="에어브로와" ElementStyle="{StaticResource DataGridElmenetStyle}"
Binding="{Binding Filtering.AirBlowerEnergy}"/> Binding="{Binding Filtering.AirBlowerEnergy}"/>
<DataGridTextColumn Header="오존발생기" ElementStyle="{StaticResource DataGridElmenetStyle}" <DataGridTextColumn Header="오존발생기" ElementStyle="{StaticResource DataGridElmenetStyle}"
Binding="{Binding Sterilizing.OzoneGeneratorEnergy}"/> Binding="{Binding Sterilizing.OzoneGeneratorEnergy}"/>
<DataGridTextColumn ElementStyle="{StaticResource DataGridElmenetStyle}" <DataGridTextColumn ElementStyle="{StaticResource DataGridElmenetStyle}"
Binding="{Binding Sterilizing.UVSterilizerEnergy}"> Binding="{Binding Sterilizing.UVSterilizerEnergy}">
<DataGridTextColumn.Header> <DataGridTextColumn.Header>
<StackPanel> <StackPanel>
<TextBlock Text="자외선"/> <TextBlock Text="자외선"/>
<TextBlock Text="살균기"/> <TextBlock Text="살균기"/>
</StackPanel> </StackPanel>
</DataGridTextColumn.Header> </DataGridTextColumn.Header>
</DataGridTextColumn> </DataGridTextColumn>
<DataGridTextColumn Header="오존용해장치" ElementStyle="{StaticResource DataGridElmenetStyle}" <DataGridTextColumn Header="오존용해장치" ElementStyle="{StaticResource DataGridElmenetStyle}"
Binding="{Binding Sterilizing.OzoneDissolverEnergy}"/> Binding="{Binding Sterilizing.OzoneDissolverEnergy}"/>
<DataGridTextColumn Header="배오존장치" ElementStyle="{StaticResource DataGridElmenetStyle}" <DataGridTextColumn Header="배오존장치" ElementStyle="{StaticResource DataGridElmenetStyle}"
Binding="{Binding Sterilizing.ExcessOzoneDestroyerEnergy}"/> Binding="{Binding Sterilizing.ExcessOzoneDestroyerEnergy}"/>
<DataGridTextColumn Header="총 전력" ElementStyle="{StaticResource DataGridElmenetStyle}" <DataGridTextColumn Header="총 전력" ElementStyle="{StaticResource DataGridElmenetStyle}"
Binding="{Binding TotalEnergy, StringFormat=\{0:F2\}}"/> Binding="{Binding TotalEnergy, StringFormat=\{0:F2\}}"/>
</DataGrid.Columns> </DataGrid.Columns>
</DataGrid> </DataGrid>
</ScrollViewer>
<Border Grid.Row="1" Grid.Column="1" Margin="0 0 20 20" CornerRadius="10" <Border Grid.Row="1" Grid.Column="1" Margin="0 0 20 20" CornerRadius="10"
Background="#384659" BorderBrush="#404F63" BorderThickness="1"> Background="#384659" BorderBrush="#404F63" BorderThickness="1">

@ -16,55 +16,116 @@
<Grid Background="#243851"> <Grid Background="#243851">
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="*"/> <RowDefinition Height="160"/>
<RowDefinition Height="350"/>
<RowDefinition Height="*"/> <RowDefinition Height="*"/>
</Grid.RowDefinitions> </Grid.RowDefinitions>
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/> <ColumnDefinition Width="*"/>
<ColumnDefinition Width="600"/>
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<ScrollViewer Grid.RowSpan="2" Margin="20" <Border Grid.ColumnSpan="2" Margin="20" BorderBrush="#3E4C60" BorderThickness="1" CornerRadius="10">
HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" <Border.Background>
HorizontalAlignment="Center"> <ImageBrush ImageSource="/Resources/Images/top_bg.png" Stretch="Fill"/>
<DataGrid Style="{StaticResource DataGridStyle}" Background="Transparent" ItemsSource="{Binding WaterQualityList}" </Border.Background>
RowStyle="{StaticResource DataGridRowStyle}" ColumnHeaderStyle="{StaticResource DataGridColumnHeaderStyle}"> <UniformGrid Columns="9">
<DataGrid.Columns> <StackPanel VerticalAlignment="Center" HorizontalAlignment="Center">
<DataGridTextColumn <TextBlock Text="총 배출량" HorizontalAlignment="Center"
Header="시간" FontSize="22" Foreground="White" FontFamily="{StaticResource SCDream5}"/>
Binding="{Binding RecordedTime, StringFormat=\{0:HH:mm:ss\}}" <TextBlock Text="{Binding TotalGreenhouseGas, StringFormat=\{0:F2\}}" HorizontalAlignment="Center"
ElementStyle="{StaticResource DataGridElmenetStyle}"/> FontSize="26" Foreground="White" FontFamily="{StaticResource SCDream4}"/>
</StackPanel>
<StackPanel VerticalAlignment="Center" HorizontalAlignment="Center">
<TextBlock Text="모래여과기" HorizontalAlignment="Center"
FontSize="22" Foreground="White" FontFamily="{StaticResource SCDream5}"/>
<TextBlock Text="{Binding TotalSandFilterGreenhouseGas, StringFormat=\{0:F2\}}" HorizontalAlignment="Center"
FontSize="26" Foreground="White" FontFamily="{StaticResource SCDream4}"/>
</StackPanel>
<StackPanel VerticalAlignment="Center" HorizontalAlignment="Center">
<TextBlock Text="순환펌프" HorizontalAlignment="Center"
FontSize="22" Foreground="White" FontFamily="{StaticResource SCDream5}"/>
<TextBlock Text="{Binding TotalCirculationPumpGreenhouseGas, StringFormat=\{0:F2\}}" HorizontalAlignment="Center"
FontSize="26" Foreground="White" FontFamily="{StaticResource SCDream4}"/>
</StackPanel>
<StackPanel VerticalAlignment="Center" HorizontalAlignment="Center">
<TextBlock Text="히트펌프" HorizontalAlignment="Center"
FontSize="22" Foreground="White" FontFamily="{StaticResource SCDream5}"/>
<TextBlock Text="{Binding TotalHeatPumpGreenhouseGas, StringFormat=\{0:F2\}}" HorizontalAlignment="Center"
FontSize="26" Foreground="White" FontFamily="{StaticResource SCDream4}"/>
</StackPanel>
<StackPanel VerticalAlignment="Center" HorizontalAlignment="Center">
<TextBlock Text="에어브로와" HorizontalAlignment="Center"
FontSize="22" Foreground="White" FontFamily="{StaticResource SCDream5}"/>
<TextBlock Text="{Binding TotalAirBlowerGreenhouseGas, StringFormat=\{0:F2\}}" HorizontalAlignment="Center"
FontSize="26" Foreground="White" FontFamily="{StaticResource SCDream4}"/>
</StackPanel>
<StackPanel VerticalAlignment="Center" HorizontalAlignment="Center">
<TextBlock Text="오존발생기" HorizontalAlignment="Center"
FontSize="22" Foreground="White" FontFamily="{StaticResource SCDream5}"/>
<TextBlock Text="{Binding TotalOzoneGeneratorGreenhouseGas, StringFormat=\{0:F2\}}" HorizontalAlignment="Center"
FontSize="26" Foreground="White" FontFamily="{StaticResource SCDream4}"/>
</StackPanel>
<StackPanel VerticalAlignment="Center" HorizontalAlignment="Center">
<TextBlock Text="자외선 살균기" HorizontalAlignment="Center"
FontSize="22" Foreground="White" FontFamily="{StaticResource SCDream5}"/>
<TextBlock Text="{Binding TotalUVSterilizerGreenhouseGas, StringFormat=\{0:F2\}}" HorizontalAlignment="Center"
FontSize="26" Foreground="White" FontFamily="{StaticResource SCDream4}"/>
</StackPanel>
<StackPanel VerticalAlignment="Center" HorizontalAlignment="Center">
<TextBlock Text="오존용해장치" HorizontalAlignment="Center"
FontSize="22" Foreground="White" FontFamily="{StaticResource SCDream5}"/>
<TextBlock Text="{Binding TotalOzoneDissolverGreenhouseGas, StringFormat=\{0:F2\}}" HorizontalAlignment="Center"
FontSize="26" Foreground="White" FontFamily="{StaticResource SCDream4}"/>
</StackPanel>
<StackPanel VerticalAlignment="Center" HorizontalAlignment="Center">
<TextBlock Text="배오존장치" HorizontalAlignment="Center"
FontSize="22" Foreground="White" FontFamily="{StaticResource SCDream5}"/>
<TextBlock Text="{Binding TotalExcessOzoneDestroyerGreenhouseGas, StringFormat=\{0:F2\}}" HorizontalAlignment="Center"
FontSize="26" Foreground="White" FontFamily="{StaticResource SCDream4}"/>
</StackPanel>
</UniformGrid>
</Border>
<DataGridTextColumn Header="모래여과기" ElementStyle="{StaticResource DataGridElmenetStyle}" <DataGrid Style="{StaticResource DataGridStyle}" Background="Transparent" ItemsSource="{Binding WaterQualityList}"
Binding="{Binding Filtering.SandFilterGreenhouseGas, StringFormat=\{0:F3\}}"/> RowStyle="{StaticResource DataGridRowStyle}" ColumnHeaderStyle="{StaticResource DataGridColumnHeaderStyle}"
<DataGridTextColumn Header="순환펌프" ElementStyle="{StaticResource DataGridElmenetStyle}" ColumnWidth="*" HorizontalAlignment="Stretch"
Binding="{Binding Filtering.CirculationPumpGreenhouseGas, StringFormat=\{0:F3\}}"/> Grid.Row="1" Grid.RowSpan="2" Margin="20 0 20 20">
<DataGridTextColumn Header="히트펌프" ElementStyle="{StaticResource DataGridElmenetStyle}" <DataGrid.Columns>
Binding="{Binding Filtering.HeatPumpGreenhouseGas, StringFormat=\{0:F3\}}"/> <DataGridTextColumn
<DataGridTextColumn Header="에어브로와" ElementStyle="{StaticResource DataGridElmenetStyle}" Header="시간"
Binding="{Binding Filtering.AirBlowerGreenhouseGas, StringFormat=\{0:F3\}}"/> Binding="{Binding RecordedTime, StringFormat=\{0:HH:mm:ss\}}"
<DataGridTextColumn Header="오존발생기" ElementStyle="{StaticResource DataGridElmenetStyle}" ElementStyle="{StaticResource DataGridElmenetStyle}"/>
Binding="{Binding Sterilizing.OzoneGeneratorGreenhouseGas, StringFormat=\{0:F3\}}"/>
<DataGridTextColumn ElementStyle="{StaticResource DataGridElmenetStyle}" <DataGridTextColumn Header="모래여과기" ElementStyle="{StaticResource DataGridElmenetStyle}"
Binding="{Binding Sterilizing.UVSterilizerGreenhouseGas, StringFormat=\{0:F3\}}"> Binding="{Binding Filtering.SandFilterGreenhouseGas, StringFormat=\{0:F3\}}"/>
<DataGridTextColumn.Header> <DataGridTextColumn Header="순환펌프" ElementStyle="{StaticResource DataGridElmenetStyle}"
<StackPanel> Binding="{Binding Filtering.CirculationPumpGreenhouseGas, StringFormat=\{0:F3\}}"/>
<TextBlock Text="자외선"/> <DataGridTextColumn Header="히트펌프" ElementStyle="{StaticResource DataGridElmenetStyle}"
<TextBlock Text="살균기"/> Binding="{Binding Filtering.HeatPumpGreenhouseGas, StringFormat=\{0:F3\}}"/>
</StackPanel> <DataGridTextColumn Header="에어브로와" ElementStyle="{StaticResource DataGridElmenetStyle}"
</DataGridTextColumn.Header> Binding="{Binding Filtering.AirBlowerGreenhouseGas, StringFormat=\{0:F3\}}"/>
</DataGridTextColumn> <DataGridTextColumn Header="오존발생기" ElementStyle="{StaticResource DataGridElmenetStyle}"
<DataGridTextColumn Header="오존용해장치" ElementStyle="{StaticResource DataGridElmenetStyle}" Binding="{Binding Sterilizing.OzoneGeneratorGreenhouseGas, StringFormat=\{0:F3\}}"/>
Binding="{Binding Sterilizing.OzoneDissolverGreenhouseGas, StringFormat=\{0:F3\}}"/> <DataGridTextColumn ElementStyle="{StaticResource DataGridElmenetStyle}"
<DataGridTextColumn Header="배오존장치" ElementStyle="{StaticResource DataGridElmenetStyle}" Binding="{Binding Sterilizing.UVSterilizerGreenhouseGas, StringFormat=\{0:F3\}}">
Binding="{Binding Sterilizing.ExcessOzoneDestroyerGreenhouseGas, StringFormat=\{0:F3\}}"/> <DataGridTextColumn.Header>
<DataGridTextColumn Header="총 배출량" ElementStyle="{StaticResource DataGridElmenetStyle}" <StackPanel>
Binding="{Binding TotalGreenhouseGas, StringFormat=\{0:F3\}}"/> <TextBlock Text="자외선"/>
</DataGrid.Columns> <TextBlock Text="살균기"/>
</DataGrid> </StackPanel>
</ScrollViewer> </DataGridTextColumn.Header>
</DataGridTextColumn>
<DataGridTextColumn Header="오존용해장치" ElementStyle="{StaticResource DataGridElmenetStyle}"
Binding="{Binding Sterilizing.OzoneDissolverGreenhouseGas, StringFormat=\{0:F3\}}"/>
<DataGridTextColumn Header="배오존장치" ElementStyle="{StaticResource DataGridElmenetStyle}"
Binding="{Binding Sterilizing.ExcessOzoneDestroyerGreenhouseGas, StringFormat=\{0:F3\}}"/>
<DataGridTextColumn Header="총 배출량" ElementStyle="{StaticResource DataGridElmenetStyle}"
Binding="{Binding TotalGreenhouseGas, StringFormat=\{0:F3\}}"/>
</DataGrid.Columns>
</DataGrid>
<Border Grid.Row="0" Grid.Column="1" Margin="0 20 20 20" CornerRadius="10" <Border Grid.Row="1" Grid.Column="1" Margin="0 0 20 20" CornerRadius="10"
Background="#384659" BorderBrush="#404F63" BorderThickness="1"> Background="#384659" BorderBrush="#404F63" BorderThickness="1">
<Grid> <Grid>
<Grid.RowDefinitions> <Grid.RowDefinitions>
@ -259,7 +320,7 @@
</Grid> </Grid>
</Border> </Border>
<Border Grid.Row="1" Grid.Column="1" Margin="0 0 20 20" CornerRadius="10" <Border Grid.Row="2" Grid.Column="1" Margin="0 0 20 20" CornerRadius="10"
Background="#384659" BorderBrush="#404F63" BorderThickness="1"> Background="#384659" BorderBrush="#404F63" BorderThickness="1">
<control:GraphControl x:Name="graphControl" <control:GraphControl x:Name="graphControl"
Margin="10" DataContext="{Binding GraphControlVM}" Margin="10" DataContext="{Binding GraphControlVM}"

@ -1,4 +1,5 @@
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.ComponentModel; using System.ComponentModel;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
using System.Windows.Input; using System.Windows.Input;
@ -13,7 +14,7 @@ namespace SmartAquaViewer.ViewModel
public GraphControlViewModel GraphControlVM { get; } = new GraphControlViewModel(); public GraphControlViewModel GraphControlVM { get; } = new GraphControlViewModel();
public ObservableCollection<GraphType> GraphTypes { get; } public ObservableCollection<GraphType> GraphTypes { get; }
public List<WaterQualityVO> WaterQualityList { get; set; } public ReadOnlyObservableCollection<WaterQualityVO> WaterQualityList { get; set; }
private double _totalEnergy; private double _totalEnergy;
public 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 public StepFieldKind SelectedKind
{ {
get => _selectedKind; get => _selectedKind;
@ -240,7 +241,6 @@ namespace SmartAquaViewer.ViewModel
public EnergyViewModel() public EnergyViewModel()
{ {
WaterQualityList = Datas.Instance.GetWaterQualityVO().ToList();
GraphTypes = new ObservableCollection<GraphType> GraphTypes = new ObservableCollection<GraphType>
{ {
GraphType.LINE, GraphType.LINE,
@ -248,6 +248,8 @@ namespace SmartAquaViewer.ViewModel
GraphType.PIE GraphType.PIE
}; };
WaterQualityList = Datas.Instance.WaterQualityView;
TotalSandFilterEnergy = WaterQualityList.Sum(vo => vo.Filtering.SandFilterEnergy); TotalSandFilterEnergy = WaterQualityList.Sum(vo => vo.Filtering.SandFilterEnergy);
TotalCirculationPumpEnergy = WaterQualityList.Sum(vo => vo.Filtering.CirculationPumpEnergy); TotalCirculationPumpEnergy = WaterQualityList.Sum(vo => vo.Filtering.CirculationPumpEnergy);
TotalHeatPumpEnergy = WaterQualityList.Sum(vo => vo.Filtering.HeatPumpEnergy); TotalHeatPumpEnergy = WaterQualityList.Sum(vo => vo.Filtering.HeatPumpEnergy);
@ -271,13 +273,13 @@ namespace SmartAquaViewer.ViewModel
switch (SelectedGraphType) switch (SelectedGraphType)
{ {
case GraphType.LINE: case GraphType.LINE:
GraphControlVM.SetMultiLineGraph(WaterQualityList, SelectedYFields, DataType.Energy, ShowMarkers, ShowLegends); GraphControlVM.SetMultiLineGraph(WaterQualityList.ToList(), SelectedYFields, DataType.Energy, ShowMarkers, ShowLegends);
break; break;
case GraphType.STACKAREA: case GraphType.STACKAREA:
GraphControlVM.SetStackAreaPlot(WaterQualityList, SelectedYFields, DataType.Energy, ShowMarkers, ShowLegends); GraphControlVM.SetStackAreaPlot(WaterQualityList.ToList(), SelectedYFields, DataType.Energy, ShowMarkers, ShowLegends);
break; break;
case GraphType.PIE: case GraphType.PIE:
GraphControlVM.SetPieChart(WaterQualityList, SelectedYFields, DataType.Energy, UseAverage, IsDonut); GraphControlVM.SetPieChart(WaterQualityList.ToList(), SelectedYFields, DataType.Energy, UseAverage, IsDonut);
break; break;
default: default:
break; break;

@ -1,7 +1,9 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.ComponentModel; using System.ComponentModel;
using System.Diagnostics;
using System.Linq; using System.Linq;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
using System.Text; using System.Text;
@ -18,7 +20,133 @@ namespace SmartAquaViewer.ViewModel
public GraphControlViewModel GraphControlVM { get; } = new GraphControlViewModel(); public GraphControlViewModel GraphControlVM { get; } = new GraphControlViewModel();
public ObservableCollection<GraphType> GraphTypes { get; } public ObservableCollection<GraphType> GraphTypes { get; }
public List<WaterQualityVO> WaterQualityList { get; set; } public ReadOnlyObservableCollection<WaterQualityVO> 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; private int _selectedGraphIndex = -1;
public int SelectedGraphIndex 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; public bool ShowXSelector => SelectedGraphType == GraphType.SCATTER;
// [필드 후보 목록] 탭/시스템에 따라 달라짐 // [필드 후보 목록] 탭/시스템에 따라 달라짐
@ -104,7 +246,6 @@ namespace SmartAquaViewer.ViewModel
public GreenHouseGasViewModel() public GreenHouseGasViewModel()
{ {
WaterQualityList = Datas.Instance.GetWaterQualityVO().ToList();
GraphTypes = new ObservableCollection<GraphType> GraphTypes = new ObservableCollection<GraphType>
{ {
GraphType.LINE, GraphType.LINE,
@ -112,6 +253,21 @@ namespace SmartAquaViewer.ViewModel
GraphType.PIE 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); DrawGraphCommand = new RelayCommand(DrawGraph);
RebuildAvailableFields(); RebuildAvailableFields();
@ -123,13 +279,13 @@ namespace SmartAquaViewer.ViewModel
switch (SelectedGraphType) switch (SelectedGraphType)
{ {
case GraphType.LINE: case GraphType.LINE:
GraphControlVM.SetMultiLineGraph(WaterQualityList, SelectedYFields, DataType.GreenhouseGas, ShowMarkers, ShowLegends); GraphControlVM.SetMultiLineGraph(WaterQualityList.ToList(), SelectedYFields, DataType.GreenhouseGas, ShowMarkers, ShowLegends);
break; break;
case GraphType.STACKAREA: case GraphType.STACKAREA:
GraphControlVM.SetStackAreaPlot(WaterQualityList, SelectedYFields, DataType.GreenhouseGas, ShowMarkers, ShowLegends); GraphControlVM.SetStackAreaPlot(WaterQualityList.ToList(), SelectedYFields, DataType.GreenhouseGas, ShowMarkers, ShowLegends);
break; break;
case GraphType.PIE: case GraphType.PIE:
GraphControlVM.SetPieChart(WaterQualityList, SelectedYFields, DataType.GreenhouseGas, UseAverage, IsDonut); GraphControlVM.SetPieChart(WaterQualityList.ToList(), SelectedYFields, DataType.GreenhouseGas, UseAverage, IsDonut);
break; break;
default: default:
break; break;
@ -143,15 +299,15 @@ namespace SmartAquaViewer.ViewModel
// 공통 시간 // 공통 시간
AvailableFields.Add(new FieldItem { Name = "RecordedTime", Display = "시간", DataType = typeof(DateTime) }); 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 = "TotalGreenhouseGas", Display = "총 배출량", DataType = typeof(double), Kind = StepFieldKind.GHG });
AvailableFields.Add(new FieldItem { Name = "Filtering.SandFilterGreenhouseGas", Display = "모래여과기", DataType = typeof(double), Kind = StepFieldKind.Energy }); 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.Energy }); 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.Energy }); 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.Energy }); 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.Energy }); 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.Energy }); 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.Energy }); 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.Energy }); AvailableFields.Add(new FieldItem { Name = "Sterilizing.ExcessOzoneDestroyerGreenhouseGas", Display = "배오존장치", DataType = typeof(double), Kind = StepFieldKind.GHG });
} }
private void RebuildFieldCandidates() private void RebuildFieldCandidates()
@ -180,7 +336,7 @@ namespace SmartAquaViewer.ViewModel
// Y축 후보: 수치형 // Y축 후보: 수치형
foreach (var f in src) 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); YFieldCandidates.Add(f);
} }

@ -262,8 +262,6 @@ namespace SmartAquaViewer.ViewModel
IsOpenMode = true; IsOpenMode = true;
BtnVisibilityUp = Visibility.Collapsed; 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; WaterQualityList = Datas.Instance.WaterQualityView;
((INotifyCollectionChanged)WaterQualityList).CollectionChanged += OnWaterQualityChanged; ((INotifyCollectionChanged)WaterQualityList).CollectionChanged += OnWaterQualityChanged;

Loading…
Cancel
Save