Skip to content

Commit

Permalink
Merge branch 'release/v2.0.3'
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelduchesne committed May 1, 2020
2 parents 458e82c + b85a4e0 commit 1d2d4ba
Show file tree
Hide file tree
Showing 11 changed files with 230 additions and 136 deletions.
2 changes: 1 addition & 1 deletion DistrictEnergy/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyProduct("DistricEnergyPlugIn")]
[assembly: AssemblyVersion("2.0.2.*")]
[assembly: AssemblyVersion("2.0.3.*")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
Expand Down
41 changes: 36 additions & 5 deletions DistrictEnergy/ViewModels/LoadsViewModel.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Windows;
using Deedle;
using DistrictEnergy.Annotations;
using DistrictEnergy.Helpers;
using DistrictEnergy.Networks.ThermalPlants;
using LiveCharts;
using LiveCharts.Defaults;
using LiveCharts.Dtos;
using LiveCharts.Geared;
using Umi.RhinoServices.Context;
using Umi.RhinoServices.UmiEvents;
Expand All @@ -22,6 +26,8 @@ internal class LoadsViewModel : INotifyPropertyChanged
private double _to;
private Func<double, string> _timeFormatter;
private bool _isStorageVisible;
private double _fixedTo;
private double _fixedFrom;

public LoadsViewModel()
{
Expand Down Expand Up @@ -53,7 +59,31 @@ public LoadsViewModel()
};

From = new DateTime(2018, 01, 01, 0, 0, 0).Ticks;
FixedFrom = From;
To = new DateTime(2018, 01, 01, 0, 0, 0).AddHours(8760).Ticks;
FixedTo = To;
}

public double FixedTo
{
get => _fixedTo;
set
{
if (value.Equals(_fixedTo)) return;
_fixedTo = value;
OnPropertyChanged();
}
}

public double FixedFrom
{
get => _fixedFrom;
set
{
if (value.Equals(_fixedFrom)) return;
_fixedFrom = value;
OnPropertyChanged();
}
}

public bool IsStorageVisible
Expand Down Expand Up @@ -157,7 +187,7 @@ private void UpdateLoadsChart(object sender, EventArgs e)
{
var args = (DHRunLPModel.SimulationCompleted) e;
var Total = new double[args.TimeSteps];
var lineSmoothness = 0.5;
var lineSmoothness = 0.1;
SeriesCollection.Clear();
DemandLineCollection.Clear();

Expand All @@ -180,11 +210,13 @@ private void UpdateLoadsChart(object sender, EventArgs e)
SeriesCollection.Add(series);
DemandLineCollection.Add(new GLineSeries
{
Values = demand.Input.ToDateTimePoint().Split(12)
Values = demand.Input.ToDateTimePoint().Split(plot_duration)
.Select(v => new DateTimePoint(v.First().DateTime, v.Sum())).AsGearedValues(),
Title = demand.Name,
LineSmoothness = lineSmoothness,
Stroke = demand.Fill
Stroke = demand.Fill,
PointGeometry = null,
StrokeThickness = 0.5,
});
}

Expand Down Expand Up @@ -233,7 +265,7 @@ private void UpdateLoadsChart(object sender, EventArgs e)
.Select(v => new DateTimePoint(v.First().DateTime, v.Sum())).AsGearedValues(),
Title = storage.Name,
Fill = storage.Fill,
LineSmoothness = lineSmoothness,
LineSmoothness = 0.5,
AreaLimit = 0,
LabelPoint = KWhLabelPointFormatter,
});
Expand Down Expand Up @@ -262,7 +294,6 @@ private void UpdateLoadsChart(object sender, EventArgs e)
AreaLimit = 0,
LabelPoint = KWhLabelPointFormatter,
});
IsStorageVisible = true;
}
}
}
Expand Down
6 changes: 0 additions & 6 deletions DistrictEnergy/ViewModels/PlantSettingsViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ public class PlantSettingsViewModel : INotifyPropertyChanged
typeof(PhotovoltaicArray),
typeof(SolarThermalCollector),
typeof(WindTurbine),
typeof(PipeNetwork),
typeof(GridElectricity),
typeof(GridGas),
typeof(CustomEnergySupplyModule)
Expand Down Expand Up @@ -99,11 +98,6 @@ private void LoadSettings(UmiContext context)
{
DistrictControl.Instance.ListOfPlantSettings.Add(new GridGas());
}
if (!DistrictControl.Instance.ListOfPlantSettings.OfType<PipeNetwork>().Any())
{
DistrictControl.Instance.ListOfDistrictLoads.Add(new PipeNetwork(LoadTypes.Cooling, "Cooling Losses"));
DistrictControl.Instance.ListOfDistrictLoads.Add(new PipeNetwork(LoadTypes.Heating, "Heating Losses"));
}
}

OnPropertyChanged(string.Empty);
Expand Down
4 changes: 2 additions & 2 deletions DistrictEnergy/Views/PlantSettings/ChilledWaterView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<ResourceDictionary
Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Defaults.xaml" />
<ResourceDictionary
Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Primary/MaterialDesignColor.DeepPurple.xaml" />
Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Primary/materialdesigncolor.blue.xaml" />
<ResourceDictionary
Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Accent/MaterialDesignColor.Lime.xaml" />
</ResourceDictionary.MergedDictionaries>
Expand All @@ -43,7 +43,7 @@
<ColumnDefinition />
</Grid.ColumnDefinitions>
<materialDesign:PackIcon Grid.Column="0"
Kind="InfoOutline"
Kind="Snowflake"
Height="32"
Width="32"
VerticalAlignment="Center" />
Expand Down
27 changes: 2 additions & 25 deletions DistrictEnergy/Views/PlantSettings/ElectricGenerationView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,34 +24,11 @@
<ResourceDictionary
Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Defaults.xaml" />
<ResourceDictionary
Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Primary/MaterialDesignColor.DeepPurple.xaml" />
Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Primary/materialdesigncolor.yellow.xaml" />
<ResourceDictionary
Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Accent/MaterialDesignColor.Lime.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
<!--<Style x:Key="PlantComponentHeader" TargetType="{x:Type TextBlock}">
<Setter Property="TextWrapping" Value="NoWrap" />
<Setter Property="TextTrimming" Value="None" />
<Setter Property="Margin" Value="5, 5" />
<Setter Property="FontSize" Value="14" />
<Setter Property="Foreground" Value="#404040" />
</Style>
<Style x:Key="StackPanelStyle" TargetType="StackPanel">
<Setter Property="HorizontalAlignment" Value="Stretch" />
<Setter Property="VerticalAlignment" Value="Top" />
<Setter Property="Width" Value="Auto" />
<Setter Property="Margin" Value="5,0,5,5" />
<Setter Property="Background" Value="White" />
</Style>
<Style x:Key="TextBoxInError" TargetType="{x:Type TextBox}">
<Style.Triggers>
<Trigger Property="Validation.HasError" Value="true">
<Setter Property="ToolTip"
Value="{Binding RelativeSource={x:Static RelativeSource.Self},
Path=(Validation.Errors)[0].ErrorContent}" />
</Trigger>
</Style.Triggers>
</Style>-->
</UserControl.Resources>
<Grid x:Name="ElectricGenGroup">
<GroupBox Margin="4" Style="{DynamicResource MaterialDesignCardGroupBox}"
Expand All @@ -64,7 +41,7 @@
<ColumnDefinition />
</Grid.ColumnDefinitions>
<materialDesign:PackIcon Grid.Column="0"
Kind="InfoOutline"
Kind="Flash"
Height="32"
Width="32"
VerticalAlignment="Center" />
Expand Down
18 changes: 2 additions & 16 deletions DistrictEnergy/Views/PlantSettings/HotWaterView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,25 +25,11 @@
<ResourceDictionary
Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Defaults.xaml" />
<ResourceDictionary
Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Primary/MaterialDesignColor.DeepPurple.xaml" />
Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Primary/materialdesigncolor.red.xaml" />
<ResourceDictionary
Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Accent/MaterialDesignColor.Lime.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
<!--<Style x:Key="PlantComponentHeader" TargetType="{x:Type TextBlock}">
<Setter Property="TextWrapping" Value="NoWrap" />
<Setter Property="TextTrimming" Value="None" />
<Setter Property="Margin" Value="5, 5" />
<Setter Property="FontSize" Value="14" />
<Setter Property="Foreground" Value="#404040" />
</Style>
<Style x:Key="StackPanelStyle" TargetType="StackPanel">
<Setter Property="HorizontalAlignment" Value="Stretch" />
<Setter Property="VerticalAlignment" Value="Top" />
<Setter Property="Width" Value="Auto" />
<Setter Property="Margin" Value="5,0,5,5" />
<Setter Property="Background" Value="White" />
</Style>-->
</UserControl.Resources>
<Grid x:Name="HotWaterGroup">
<GroupBox Margin="4" Style="{DynamicResource MaterialDesignCardGroupBox}"
Expand All @@ -56,7 +42,7 @@
<ColumnDefinition />
</Grid.ColumnDefinitions>
<materialDesign:PackIcon Grid.Column="0"
Kind="InfoOutline"
Kind="Fire"
Height="32"
Width="32"
VerticalAlignment="Center" />
Expand Down
Loading

0 comments on commit 1d2d4ba

Please sign in to comment.