Skip to content

Commit

Permalink
Merge pull request #42 from MITSustainableDesignLab/feature/Cost
Browse files Browse the repository at this point in the history
Fixes costs accounting & display in views
  • Loading branch information
samuelduchesne authored Apr 30, 2020
2 parents 01149de + 27dd151 commit 1621ec4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
10 changes: 5 additions & 5 deletions DistrictEnergy/DHRunLPModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using Google.OrTools.LinearSolver;
using Rhino;
using Rhino.Commands;
using Umi.RhinoServices.Context;

namespace DistrictEnergy
{
Expand Down Expand Up @@ -210,8 +211,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())
);
}

Expand Down Expand Up @@ -265,7 +265,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);
}
}

Expand All @@ -274,13 +274,13 @@ 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);
}
}

foreach (var variable in E)
{
objective.SetCoefficient(variable.Value, 1000000);
objective.SetCoefficient(variable.Value, UmiContext.Current.ProjectSettings.ElectricityDollars);
}

objective.SetMinimization();
Expand Down
3 changes: 2 additions & 1 deletion DistrictEnergy/Networks/ThermalPlants/Dispatchable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down

0 comments on commit 1621ec4

Please sign in to comment.