From 471588823b0b0a3ddd5eb8f3ec5d2e966c28a908 Mon Sep 17 00:00:00 2001 From: Samuel Letellier-Duchesne Date: Thu, 30 Apr 2020 19:44:07 -0400 Subject: [PATCH 1/3] Removes the export in the Upper Capacity Bound --- DistrictEnergy/DHRunLPModel.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/DistrictEnergy/DHRunLPModel.cs b/DistrictEnergy/DHRunLPModel.cs index a1ab783..b5d93cb 100644 --- a/DistrictEnergy/DHRunLPModel.cs +++ b/DistrictEnergy/DHRunLPModel.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; using DistrictEnergy.Helpers; @@ -210,8 +210,7 @@ private void Main() .Select(x => x.Value).ToArray().Sum() - Qout.Where(k => k.Key.Item2.OutputType == loadType && k.Key.Item1 == i) .Select(x => x.Value).ToArray().Sum() + - Load.Where(x => x.Key.Item2 == loadType && x.Key.Item1 == i).Select(o => o.Value).Sum() + - E[(i, loadType)]) + Load.Where(x => x.Key.Item2 == loadType && x.Key.Item1 == i).Select(o => o.Value).Sum()) ); } From 21f73ecb18b03bc89883912779f133f2970b322d Mon Sep 17 00:00:00 2001 From: Samuel Letellier-Duchesne Date: Thu, 30 Apr 2020 19:44:54 -0400 Subject: [PATCH 2/3] Fixes the cost functions and Display (improper period length) --- DistrictEnergy/DHRunLPModel.cs | 4 ++-- DistrictEnergy/Networks/ThermalPlants/Dispatchable.cs | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/DistrictEnergy/DHRunLPModel.cs b/DistrictEnergy/DHRunLPModel.cs index b5d93cb..892d098 100644 --- a/DistrictEnergy/DHRunLPModel.cs +++ b/DistrictEnergy/DHRunLPModel.cs @@ -264,7 +264,7 @@ private void Main() for (int t = dt; t < timeSteps * dt; t += dt) { objective.SetCoefficient(P[(t, supplymodule)], - supplymodule.F * DistrictEnergy.Settings.AnnuityFactor + supplymodule.V * dt); + supplymodule.F * DistrictEnergy.Settings.AnnuityFactor / dt + supplymodule.V); } } @@ -273,7 +273,7 @@ private void Main() for (int t = dt; t < timeSteps * dt; t += dt) { objective.SetCoefficient(S[(t, storage)], - storage.F * DistrictEnergy.Settings.AnnuityFactor + storage.V * dt); + storage.F * DistrictEnergy.Settings.AnnuityFactor / dt + storage.V); } } diff --git a/DistrictEnergy/Networks/ThermalPlants/Dispatchable.cs b/DistrictEnergy/Networks/ThermalPlants/Dispatchable.cs index 49d5d7c..20006df 100644 --- a/DistrictEnergy/Networks/ThermalPlants/Dispatchable.cs +++ b/DistrictEnergy/Networks/ThermalPlants/Dispatchable.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Windows.Media; @@ -42,7 +42,8 @@ public FixedCost(IThermalPlantSettings plant, byte alpha = 255) Fill = new SolidColorBrush(Color.FromArgb(alpha, color.R, color.G, color.B)); Name = plant.Name + " Fixed Cost"; if (plant.Output != null) - Cost = plant.Output.Max() * DistrictControl.PlanningSettings.AnnuityFactor * plant.F; + Cost = plant.Output.Max() * DistrictControl.PlanningSettings.AnnuityFactor * plant.F / + (8760 / DistrictControl.PlanningSettings.TimeSteps); } } From 27dd1514434ad5537cc5e218e36107c825c0a0c0 Mon Sep 17 00:00:00 2001 From: Samuel Letellier-Duchesne Date: Thu, 30 Apr 2020 19:45:29 -0400 Subject: [PATCH 3/3] Sets the Export price to the ElectricityDollars --- DistrictEnergy/DHRunLPModel.cs | 5 +++-- DistrictEnergy/Networks/ThermalPlants/Dispatchable.cs | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/DistrictEnergy/DHRunLPModel.cs b/DistrictEnergy/DHRunLPModel.cs index 892d098..54f2448 100644 --- a/DistrictEnergy/DHRunLPModel.cs +++ b/DistrictEnergy/DHRunLPModel.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; using DistrictEnergy.Helpers; @@ -8,6 +8,7 @@ using Google.OrTools.LinearSolver; using Rhino; using Rhino.Commands; +using Umi.RhinoServices.Context; namespace DistrictEnergy { @@ -279,7 +280,7 @@ private void Main() foreach (var variable in E) { - objective.SetCoefficient(variable.Value, 1000000); + objective.SetCoefficient(variable.Value, UmiContext.Current.ProjectSettings.ElectricityDollars); } objective.SetMinimization(); diff --git a/DistrictEnergy/Networks/ThermalPlants/Dispatchable.cs b/DistrictEnergy/Networks/ThermalPlants/Dispatchable.cs index 20006df..936eeda 100644 --- a/DistrictEnergy/Networks/ThermalPlants/Dispatchable.cs +++ b/DistrictEnergy/Networks/ThermalPlants/Dispatchable.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Windows.Media;