Skip to content

Commit

Permalink
Merge branch 'release/v2.0.4'
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelduchesne committed May 3, 2020
2 parents 1d2d4ba + c92ab3a commit 3970613
Show file tree
Hide file tree
Showing 48 changed files with 723 additions and 244 deletions.
235 changes: 128 additions & 107 deletions DistrictEnergy/DHRunLPModel.cs

Large diffs are not rendered by default.

18 changes: 12 additions & 6 deletions DistrictEnergy/DHSimulateDistrictEnergy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -435,26 +435,32 @@ private double[] GetHourlyElectricalLoadProfile(List<UmiObject> contextObjects)

private IEnumerable<double> GetHourlyLocationSolarRadiation(UmiContext context)
{
RhinoApp.WriteLine("Calculating Solar Radiation on horizontal surface");
RhinoApp.WriteLine("Calculating Solar Radiation on horizontal surfaces...");
var a = new EPWeatherData();
a.GetRawData(context.WeatherFilePath);
return a.HourlyWeatherDataRawList.Select(b => (double) b.GHorRadiation / 1000.0); // from Wh to kWh
var radiation = a.HourlyWeatherDataRawList.Select(b => (double) b.GHorRadiation / 1000.0);
RhinoApp.WriteLine("Completed Solar Radiation");
return radiation; // from Wh to kWh
}

private IEnumerable<double> GetHourlyLocationWind(UmiContext context)
{
RhinoApp.WriteLine("Calculating wind for location");
RhinoApp.WriteLine("Calculating wind for location...");
var a = new EPWeatherData();
a.GetRawData(context.WeatherFilePath);
return a.HourlyWeatherDataRawList.Select(b => (double) b.WindSpeed); // m/s
var wind = a.HourlyWeatherDataRawList.Select(b => (double) b.WindSpeed);
RhinoApp.WriteLine("Completed wind");
return wind; // m/s
}

private IEnumerable<double> GetHourlyLocationAmbiantTemp(UmiContext context)
{
RhinoApp.WriteLine("Calculating temp for location");
RhinoApp.WriteLine("Calculating temperature for location...");
var a = new EPWeatherData();
a.GetRawData(context.WeatherFilePath);
return a.HourlyWeatherDataRawList.Select(b => (double) b.DB); // C
var temp = a.HourlyWeatherDataRawList.Select(b => (double) b.DB);
RhinoApp.WriteLine("Completed temperature");
return temp; // C
}

/// <summary>
Expand Down
5 changes: 4 additions & 1 deletion DistrictEnergy/DistrictControl.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public DistrictControl()
new SolarThermalCollector(),
new WindTurbine(),
new GridElectricity(),
new GridGas()
new GridGas(),
};
ListOfDistrictLoads = new ObservableCollection<AbstractDistrictLoad>()
{
Expand All @@ -46,6 +46,9 @@ public DistrictControl()
new ElectricityLoads(),
new PipeNetwork(LoadTypes.Heating, "Heating Losses"),
new PipeNetwork(LoadTypes.Cooling, "Cooling Losses"),
new ElectricityExport(),
new CoolingExport(),
new HeatingExport()
};
PlanningSettings = new PlanningSettings();
DistrictSettings = new DistrictSettings();
Expand Down
37 changes: 28 additions & 9 deletions DistrictEnergy/DistrictEnergy.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,14 @@
<Reference Include="Dragablz, Version=0.0.3.203, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dragablz.0.0.3.203\lib\net45\Dragablz.dll</HintPath>
</Reference>
<Reference Include="Eto, Version=2.5.0.0, Culture=neutral, PublicKeyToken=552281e97c755530, processorArchitecture=MSIL">
<HintPath>..\packages\RhinoCommon.6.25.20114.5271\lib\net45\Eto.dll</HintPath>
</Reference>
<Reference Include="FSharp.Core, Version=4.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\FSharp.Core.4.5.2\lib\net45\FSharp.Core.dll</HintPath>
</Reference>
<Reference Include="Google.OrTools, Version=7.5.7466.0, Culture=neutral, PublicKeyToken=53dbb1ea090cbef7, processorArchitecture=AMD64">
<HintPath>..\packages\Google.OrTools.7.5.7466\lib\net452\Google.OrTools.dll</HintPath>
<Reference Include="Google.OrTools, Version=7.6.7691.0, Culture=neutral, PublicKeyToken=53dbb1ea090cbef7, processorArchitecture=AMD64">
<HintPath>..\packages\Google.OrTools.7.6.7691\lib\net452\Google.OrTools.dll</HintPath>
</Reference>
<Reference Include="Google.Protobuf, Version=3.11.2.0, Culture=neutral, PublicKeyToken=a7d26565bac4d604, processorArchitecture=MSIL">
<HintPath>..\packages\Google.Protobuf.3.11.2\lib\net45\Google.Protobuf.dll</HintPath>
Expand Down Expand Up @@ -83,9 +86,11 @@
<Reference Include="PresentationFramework">
<Private>True</Private>
</Reference>
<Reference Include="RhinoCommon, Version=6.24.20079.23340, Culture=neutral, PublicKeyToken=552281e97c755530, processorArchitecture=MSIL">
<HintPath>..\packages\RhinoCommon.6.24.20079.23341\lib\net45\RhinoCommon.dll</HintPath>
<Private>False</Private>
<Reference Include="Rhino.UI, Version=6.25.20114.5270, Culture=neutral, PublicKeyToken=552281e97c755530, processorArchitecture=MSIL">
<HintPath>..\packages\RhinoCommon.6.25.20114.5271\lib\net45\Rhino.UI.dll</HintPath>
</Reference>
<Reference Include="RhinoCommon, Version=6.25.20114.5270, Culture=neutral, PublicKeyToken=552281e97c755530, processorArchitecture=MSIL">
<HintPath>..\packages\RhinoCommon.6.25.20114.5271\lib\net45\RhinoCommon.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core">
Expand Down Expand Up @@ -127,10 +132,16 @@
<Compile Include="Networks\Loads\HeatingLoads.cs" />
<Compile Include="Networks\Loads\AbstractDistrictLoad.cs" />
<Compile Include="Networks\Loads\IBaseLoad.cs" />
<Compile Include="Networks\ThermalPlants\BaseLoad.cs" />
<Compile Include="Networks\ThermalPlants\CoolingExport.cs" />
<Compile Include="Networks\ThermalPlants\ElectricityExport.cs" />
<Compile Include="Networks\ThermalPlants\Exportable.cs" />
<Compile Include="Networks\ThermalPlants\GridElectricity.cs" />
<Compile Include="Networks\ThermalPlants\GridGas.cs" />
<Compile Include="Networks\ThermalPlants\Dispatchable.cs" />
<Compile Include="Networks\ThermalPlants\HeatingExport.cs" />
<Compile Include="Networks\ThermalPlants\ISolar.cs" />
<Compile Include="Networks\ThermalPlants\IWind.cs" />
<Compile Include="Networks\ThermalPlants\Storage.cs" />
<Compile Include="ViewModels\AnAdditionalLoadViewModel.cs" />
<Compile Include="ViewModels\Converters\Converter.cs" />
Expand Down Expand Up @@ -181,6 +192,7 @@
<Compile Include="ViewModels\Converters\KWConverterUnit.cs" />
<Compile Include="ViewModels\Converters\KWhConverter.cs" />
<Compile Include="ViewModels\Converters\NormalizedkgCO2ConverterUnit.cs" />
<Compile Include="ViewModels\ExportViewModel.cs" />
<Compile Include="ViewModels\SummaryViewModel.cs" />
<Compile Include="ViewModels\CombinedHeatAndPowerViewModel.cs" />
<Compile Include="ViewModels\ChilledWaterViewModel.cs" />
Expand Down Expand Up @@ -211,6 +223,9 @@
<Compile Include="Views\DistrictSettings\AnAdditionalLoadsView.xaml.cs">
<DependentUpon>AnAdditionalLoadsView.xaml</DependentUpon>
</Compile>
<Compile Include="Views\ExportView.xaml.cs">
<DependentUpon>ExportView.xaml</DependentUpon>
</Compile>
<Compile Include="Views\PlantSettings\ACustomModuleView.xaml.cs">
<DependentUpon>ACustomModuleView.xaml</DependentUpon>
</Compile>
Expand Down Expand Up @@ -260,6 +275,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Views\ExportView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Views\PlantSettings\ACustomModuleView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
Expand Down Expand Up @@ -386,9 +405,9 @@
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\MaterialDesignThemes.3.1.0\build\MaterialDesignThemes.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MaterialDesignThemes.3.1.0\build\MaterialDesignThemes.targets'))" />
<Error Condition="!Exists('..\packages\RhinoCommon.6.24.20079.23341\build\net45\RhinoCommon.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\RhinoCommon.6.24.20079.23341\build\net45\RhinoCommon.targets'))" />
<Error Condition="!Exists('..\packages\Google.OrTools.runtime.win-x64.7.5.7466\build\net45\Google.OrTools.runtime.win-x64.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Google.OrTools.runtime.win-x64.7.5.7466\build\net45\Google.OrTools.runtime.win-x64.targets'))" />
<Error Condition="!Exists('..\packages\Google.OrTools.runtime.win-x64.7.6.7691\build\net45\Google.OrTools.runtime.win-x64.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Google.OrTools.runtime.win-x64.7.6.7691\build\net45\Google.OrTools.runtime.win-x64.targets'))" />
<Error Condition="!Exists('..\packages\RhinoCommon.6.25.20114.5271\build\net45\RhinoCommon.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\RhinoCommon.6.25.20114.5271\build\net45\RhinoCommon.targets'))" />
</Target>
<Import Project="..\packages\RhinoCommon.6.24.20079.23341\build\net45\RhinoCommon.targets" Condition="Exists('..\packages\RhinoCommon.6.24.20079.23341\build\net45\RhinoCommon.targets')" />
<Import Project="..\packages\Google.OrTools.runtime.win-x64.7.5.7466\build\net45\Google.OrTools.runtime.win-x64.targets" Condition="Exists('..\packages\Google.OrTools.runtime.win-x64.7.5.7466\build\net45\Google.OrTools.runtime.win-x64.targets')" />
<Import Project="..\packages\Google.OrTools.runtime.win-x64.7.6.7691\build\net45\Google.OrTools.runtime.win-x64.targets" Condition="Exists('..\packages\Google.OrTools.runtime.win-x64.7.6.7691\build\net45\Google.OrTools.runtime.win-x64.targets')" />
<Import Project="..\packages\RhinoCommon.6.25.20114.5271\build\net45\RhinoCommon.targets" Condition="Exists('..\packages\RhinoCommon.6.25.20114.5271\build\net45\RhinoCommon.targets')" />
</Project>
4 changes: 3 additions & 1 deletion DistrictEnergy/Helpers/LoadTypes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ public enum LoadTypes
GridGas,
SolarRadiation,
Wind,
Custom
Custom,
GridHeat,
GridCool
}
}
2 changes: 1 addition & 1 deletion DistrictEnergy/Networks/Loads/AbstractDistrictLoad.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace DistrictEnergy.Networks.Loads
{
public abstract class AbstractDistrictLoad
{
public Guid Id { get; set; } = Guid.NewGuid();
public abstract Guid Id { get; set; }
public abstract LoadTypes LoadType { get; set; }
public abstract double[] Input { get; set; }
public abstract SolidColorBrush Fill { get; set; }
Expand Down
3 changes: 2 additions & 1 deletion DistrictEnergy/Networks/Loads/AdditionalLoads.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,15 @@

namespace DistrictEnergy.Networks.Loads
{
class AdditionalLoads : AbstractDistrictLoad, IBaseLoad
class AdditionalLoads : BaseLoad
{
public AdditionalLoads(LoadTypes loadType)
{
LoadType = loadType;
}

public override double[] Input { get; set; }
public override Guid Id { get; set; } = Guid.NewGuid();
public override LoadTypes LoadType { get; set; }
public override SolidColorBrush Fill { get; set; }
public override string Name { get; set; }
Expand Down
4 changes: 3 additions & 1 deletion DistrictEnergy/Networks/Loads/CoolingLoads.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,23 @@
using System.Linq;
using System.Windows.Media;
using DistrictEnergy.Helpers;
using DistrictEnergy.Networks.ThermalPlants;
using LiveCharts.Defaults;
using Rhino;
using Umi.Core;
using Umi.RhinoServices.Context;

namespace DistrictEnergy.Networks.Loads
{
class CoolingLoads : AbstractDistrictLoad, IBaseLoad
class CoolingLoads : BaseLoad
{
public CoolingLoads()
{

}

public override double[] Input { get; set; }
public override Guid Id { get; set; } = Guid.NewGuid();
public override LoadTypes LoadType { get; set; } = LoadTypes.Cooling;
public override SolidColorBrush Fill { get; set; } = new SolidColorBrush(Color.FromRgb(0, 140, 218));
public override string Name { get; set; } = "Cooling Load";
Expand Down
7 changes: 5 additions & 2 deletions DistrictEnergy/Networks/Loads/ElectricityLoads.cs
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using System.Windows.Media;
using DistrictEnergy.Helpers;
using DistrictEnergy.Networks.ThermalPlants;
using LiveCharts.Defaults;
using Rhino;
using Umi.Core;

namespace DistrictEnergy.Networks.Loads
{
class ElectricityLoads : AbstractDistrictLoad, IBaseLoad
class ElectricityLoads : BaseLoad
{
public ElectricityLoads()
{

}

public override Guid Id { get; set; } = Guid.NewGuid();
public override LoadTypes LoadType { get; set; } = LoadTypes.Elec;
public override SolidColorBrush Fill { get; set; } = new SolidColorBrush(Color.FromRgb(173, 221, 67));
public override string Name { get; set; } = "Electricity Load";
Expand Down
4 changes: 3 additions & 1 deletion DistrictEnergy/Networks/Loads/HeatingLoads.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,22 @@
using System.Collections.Generic;
using System.Windows.Media;
using DistrictEnergy.Helpers;
using DistrictEnergy.Networks.ThermalPlants;
using LiveCharts.Defaults;
using Rhino;
using Umi.Core;
using Umi.RhinoServices.Context;

namespace DistrictEnergy.Networks.Loads
{
class HeatingLoads : AbstractDistrictLoad, IBaseLoad
class HeatingLoads : BaseLoad
{
public HeatingLoads()
{

}

public override Guid Id { get; set; } = Guid.NewGuid();
public override LoadTypes LoadType { get; set; } = LoadTypes.Heating;
public override SolidColorBrush Fill { get; set; } = new SolidColorBrush(Color.FromRgb(235, 45, 45));
public override string Name { get; set; } = "Heating Load";
Expand Down
4 changes: 3 additions & 1 deletion DistrictEnergy/Networks/Loads/PipeNetwork.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@
using System.Windows.Media;
using Deedle.Vectors;
using DistrictEnergy.Helpers;
using DistrictEnergy.Networks.ThermalPlants;
using LiveCharts.Defaults;
using Umi.Core;

namespace DistrictEnergy.Networks.Loads
{
internal class PipeNetwork : AbstractDistrictLoad
internal class PipeNetwork : BaseLoad
{
public PipeNetwork(LoadTypes loadType, string name)
{
Expand Down Expand Up @@ -66,6 +67,7 @@ private double[] CalcInput()
return final;
}

public override Guid Id { get; set; } = Guid.NewGuid();
public override LoadTypes LoadType { get; set; }
public double RelativeLoss { get; set; }
}
Expand Down
13 changes: 6 additions & 7 deletions DistrictEnergy/Networks/ThermalPlants/AbsorptionChiller.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,6 @@ internal class AbsorptionChiller : Dispatchable
{
public AbsorptionChiller()
{
ConversionMatrix = new Dictionary<LoadTypes, double>()
{
{LoadTypes.Cooling, CCOP_ABS},
{LoadTypes.Heating, -1}

};
}

/// <summary>
Expand Down Expand Up @@ -64,7 +58,12 @@ private double CalcCapacity()
public override LoadTypes OutputType { get; } = LoadTypes.Cooling;
public override LoadTypes InputType => LoadTypes.Heating;
public override double CapacityFactor => OFF_ABS;
public override Dictionary<LoadTypes, double> ConversionMatrix { get; set; }
public override Dictionary<LoadTypes, double> ConversionMatrix => new Dictionary<LoadTypes, double>()
{
{LoadTypes.Cooling, CCOP_ABS},
{LoadTypes.Heating, -1}

};
public override List<DateTimePoint> Input { get; set; }
public override List<DateTimePoint> Output { get; set; }
public override double Efficiency => ConversionMatrix[OutputType];
Expand Down
12 changes: 12 additions & 0 deletions DistrictEnergy/Networks/ThermalPlants/BaseLoad.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using System.Collections.Generic;
using DistrictEnergy.Helpers;
using DistrictEnergy.Networks.Loads;
using LiveCharts.Defaults;

namespace DistrictEnergy.Networks.ThermalPlants
{
public abstract class BaseLoad : AbstractDistrictLoad, IBaseLoad
{

}
}
13 changes: 6 additions & 7 deletions DistrictEnergy/Networks/ThermalPlants/CombinedHeatNPower.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,6 @@ public class CombinedHeatNPower : Dispatchable
{
public CombinedHeatNPower()
{
ConversionMatrix = new Dictionary<LoadTypes, double>()
{
{LoadTypes.Elec, EFF_CHP},
{LoadTypes.Heating, HREC_CHP},
{LoadTypes.Gas, -1}
};
}

/// <summary>
Expand Down Expand Up @@ -89,7 +83,12 @@ private double CalcCapacity()
public override LoadTypes OutputType => TMOD_CHP;
public override LoadTypes InputType => LoadTypes.Gas;
public override double CapacityFactor => OFF_CHP;
public override Dictionary<LoadTypes, double> ConversionMatrix { get; set; }
public override Dictionary<LoadTypes, double> ConversionMatrix => new Dictionary<LoadTypes, double>()
{
{LoadTypes.Elec, EFF_CHP},
{LoadTypes.Heating, HREC_CHP},
{LoadTypes.Gas, -1}
};
public override List<DateTimePoint> Input { get; set; }
public override List<DateTimePoint> Output { get; set; }
public override double Efficiency => ConversionMatrix[OutputType];
Expand Down
33 changes: 33 additions & 0 deletions DistrictEnergy/Networks/ThermalPlants/CoolingExport.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
using System;
using System.Collections.Generic;
using System.Windows.Media;
using DistrictEnergy.Helpers;
using DistrictEnergy.Networks.Loads;
using LiveCharts.Defaults;
using Umi.Core;

namespace DistrictEnergy.Networks.ThermalPlants
{
internal class CoolingExport : Exportable
{
public CoolingExport()
{
}

public override Guid Id { get; set; } = Guid.NewGuid();
public override LoadTypes LoadType { get; set; } = LoadTypes.Cooling;
public override double[] Input { get; set; } = new double[8760];
public override double F { get; set; } = 0;
public override double V { get; set; } = 0.15;

public override SolidColorBrush Fill { get; set; } =
new SolidColorBrush((Color)ColorConverter.ConvertFromString("#FF6161"));

public override string Name { get; set; } = "Cooling Export";

public override void GetUmiLoads(List<UmiObject> contextObjects)
{

}
}
}
Loading

0 comments on commit 3970613

Please sign in to comment.