public OverrideEntry([NotNull] string complexName, HeatingSystemType heatingSystemType, EnergyDemandSource source, double amount) { ComplexName = complexName; HeatingSystemType = heatingSystemType; Source = source; Amount = amount; }
public ActionResult DeleteConfirmed(int id) { HeatingSystemType heatingSystemType = db.HeatingSystemTypes.Find(id); db.HeatingSystemTypes.Remove(heatingSystemType); db.SaveChanges(); return RedirectToAction("Index"); }
//CONSTRUCTORS public RV(string inputName, string inputRegNumber, int inputYear, LicenceType inputLicence, FuelType inputFuel, decimal inputMinPrice, HeatingSystemType inputHS) : base(inputName, inputRegNumber, inputYear, inputLicence, inputFuel, inputMinPrice) { HeatingSystem = inputHS; }
public ActionResult Edit([Bind(Include = "HeatingSystemTypeID,Type")] HeatingSystemType heatingSystemType) { if (ModelState.IsValid) { db.Entry(heatingSystemType).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } return View(heatingSystemType); }
public ActionResult Create([Bind(Include = "HeatingSystemTypeID,Type")] HeatingSystemType heatingSystemType) { if (ModelState.IsValid) { db.HeatingSystemTypes.Add(heatingSystemType); db.SaveChanges(); return RedirectToAction("Index"); } return View(heatingSystemType); }
// GET: HeatingSystemTypes/Edit/5 public ActionResult Edit(int? id) { if (id == null) { return new HttpStatusCodeResult(HttpStatusCode.BadRequest); } HeatingSystemType heatingSystemType = db.HeatingSystemTypes.Find(id); if (heatingSystemType == null) { return HttpNotFound(); } return View(heatingSystemType); }
public List <OverrideEntry> ReadEntries() { string path = @"V:\Dropbox\BurgdorfStatistics\Corrections\Corrections.xlsx"; var p = new ExcelPackage(new FileInfo(path)); var ws = p.Workbook.Worksheets[1]; int row = 2; List <OverrideEntry> ores = new List <OverrideEntry>(); while (ws.Cells[row, 1].Value != null) { string name = (string)ws.Cells[row, 1].Value; string heatingSystemTypeStr = (string)ws.Cells[row, 2].Value; HeatingSystemType hst = (HeatingSystemType)Enum.Parse(typeof(HeatingSystemType), heatingSystemTypeStr); string energyDemandSourceStr = (string)ws.Cells[row, 3].Value; EnergyDemandSource eds = (EnergyDemandSource)Enum.Parse(typeof(EnergyDemandSource), energyDemandSourceStr); double amount = (double)ws.Cells[row, 4].Value; OverrideEntry ore = new OverrideEntry(name, hst, eds, amount); ores.Add(ore); row = row + 1; } p.Dispose(); return(ores); }
public List <OverrideEntry> ReadEntries([NotNull] ServiceRepository services) { string path = Path.Combine(services.RunningConfig.Directories.BaseUserSettingsDirectory, "HeatingSystemOverrides.xlsx"); var p = new ExcelPackage(new FileInfo(path)); var ws = p.Workbook.Worksheets[1]; int row = 2; List <OverrideEntry> ores = new List <OverrideEntry>(); while (ws.Cells[row, 1].Value != null) { string name = (string)ws.Cells[row, 1].Value; string heatingSystemTypeStr = (string)ws.Cells[row, 2].Value; HeatingSystemType hst = (HeatingSystemType)Enum.Parse(typeof(HeatingSystemType), heatingSystemTypeStr); string energyDemandSourceStr = (string)ws.Cells[row, 3].Value; EnergyDemandSource eds = (EnergyDemandSource)Enum.Parse(typeof(EnergyDemandSource), energyDemandSourceStr); double amount = (double)ws.Cells[row, 4].Value; OverrideEntry ore = new OverrideEntry(name, hst, eds, amount); ores.Add(ore); row += 1; } p.Dispose(); return(ores); }
private static void GetKantonHeatingSystem(HeatingSystemType kantonHeatingMethod, [NotNull] HeatingSystemEntry hse, [NotNull] HouseHeating houseHeatingData, ref double totalHeatDemand) { switch (kantonHeatingMethod) { case HeatingSystemType.Electricity: hse.OriginalHeatingSystemType = HeatingSystemType.Electricity; hse.SynthesizedHeatingSystemType = HeatingSystemType.Electricity; // change this to consider the canton values and leave some electricty rest totalHeatDemand = houseHeatingData.KantonTotalEnergyDemand; break; case HeatingSystemType.Heatpump: hse.OriginalHeatingSystemType = HeatingSystemType.Heatpump; hse.SynthesizedHeatingSystemType = HeatingSystemType.Heatpump; // change this to consider the canton values and leave some electricty rest totalHeatDemand = houseHeatingData.KantonTotalEnergyDemand; break; case HeatingSystemType.SolarThermal: hse.OriginalHeatingSystemType = HeatingSystemType.SolarThermal; hse.SynthesizedHeatingSystemType = HeatingSystemType.Other; totalHeatDemand = houseHeatingData.KantonTotalEnergyDemand; break; case HeatingSystemType.Gas: //can't be gas, since localnet says it is not gas hse.OriginalHeatingSystemType = HeatingSystemType.Gas; hse.SynthesizedHeatingSystemType = HeatingSystemType.Öl; totalHeatDemand = houseHeatingData.KantonTotalEnergyDemand; break; case HeatingSystemType.Fernwärme: hse.OriginalHeatingSystemType = HeatingSystemType.Fernwärme; hse.SynthesizedHeatingSystemType = HeatingSystemType.Öl; totalHeatDemand = houseHeatingData.KantonTotalEnergyDemand; break; case HeatingSystemType.Öl: hse.OriginalHeatingSystemType = HeatingSystemType.Öl; hse.SynthesizedHeatingSystemType = HeatingSystemType.Öl; //: change this to consider the canton values and leave some electricty rest totalHeatDemand = houseHeatingData.KantonTotalEnergyDemand; break; case HeatingSystemType.Kohle: hse.OriginalHeatingSystemType = HeatingSystemType.Kohle; hse.SynthesizedHeatingSystemType = HeatingSystemType.Other; totalHeatDemand = houseHeatingData.KantonTotalEnergyDemand; break; case HeatingSystemType.None: hse.OriginalHeatingSystemType = HeatingSystemType.None; hse.SynthesizedHeatingSystemType = HeatingSystemType.None; if (houseHeatingData.KantonTotalEnergyDemand > 1) { throw new Exception("No heating method but energy demand"); } break; case HeatingSystemType.Other: hse.OriginalHeatingSystemType = HeatingSystemType.Other; hse.SynthesizedHeatingSystemType = HeatingSystemType.Other; totalHeatDemand = houseHeatingData.KantonTotalEnergyDemand; break; case HeatingSystemType.Holz: hse.OriginalHeatingSystemType = HeatingSystemType.Holz; hse.SynthesizedHeatingSystemType = HeatingSystemType.Other; totalHeatDemand = houseHeatingData.KantonTotalEnergyDemand; break; case HeatingSystemType.Unbekannt: break; case HeatingSystemType.GasheatingLocalnet: hse.OriginalHeatingSystemType = HeatingSystemType.GasheatingLocalnet; hse.SynthesizedHeatingSystemType = HeatingSystemType.Gas; totalHeatDemand = houseHeatingData.LocalnetGasEnergyUse; break; case HeatingSystemType.FernwärmeLocalnet: hse.OriginalHeatingSystemType = HeatingSystemType.FernwärmeLocalnet; hse.SynthesizedHeatingSystemType = HeatingSystemType.Fernwärme; totalHeatDemand = houseHeatingData.LocalnetFernwärmeEnergyUse; break; case HeatingSystemType.FeuerungsstättenOil: totalHeatDemand = houseHeatingData.KantonTotalEnergyDemand; hse.OriginalHeatingSystemType = HeatingSystemType.FeuerungsstättenOil; hse.SynthesizedHeatingSystemType = HeatingSystemType.Öl; break; case HeatingSystemType.FeuerungsstättenGas: totalHeatDemand = houseHeatingData.KantonTotalEnergyDemand; hse.OriginalHeatingSystemType = HeatingSystemType.FeuerungsstättenGas; hse.SynthesizedHeatingSystemType = HeatingSystemType.Öl; break; default: throw new Exception("Unknown heating method: " + kantonHeatingMethod); } }
private void ChangeHeatingSystemsForOneType([NotNull] ScenarioSliceParameters slice, [NotNull][ItemNotNull] List <HeatingSystemEntry> allPotentialSystemsToChange, HeatingSystemType heatingSystemType, double sumToSwitch, [NotNull] RowCollection rc, [NotNull] Dictionary <string, House> housesByGuid) { if (Math.Abs(sumToSwitch) < 0.1) { return; } var rb = RowBuilder.Start("Type to Change", heatingSystemType.ToString()); rc.Add(rb); var matchingPotentialSystemsToChange = allPotentialSystemsToChange.Where(x => x.SynthesizedHeatingSystemType == heatingSystemType).ToList(); rb.Add("Planned Sum", sumToSwitch); rb.Add("Energy Demand before across all systems", matchingPotentialSystemsToChange.Select(x => x.OriginalHeatDemand2017).Sum()); WeightedRandomAllocator <HeatingSystemEntry> wra = new WeightedRandomAllocator <HeatingSystemEntry>(Services.Rnd, MyLogger); var pickedHeatingSystems = wra.PickObjectUntilLimit(matchingPotentialSystemsToChange, WeighingFunctionForSwitchingToHeatpump, x => x.OriginalHeatDemand2017, sumToSwitch, false); double changedEnergy = 0; foreach (var pickedHeatingSystem in pickedHeatingSystems) { pickedHeatingSystem.Age = 0; pickedHeatingSystem.SynthesizedHeatingSystemType = HeatingSystemType.Heatpump; pickedHeatingSystem.ProvideProfile = true; changedEnergy += pickedHeatingSystem.OriginalHeatDemand2017; House house = housesByGuid[pickedHeatingSystem.HouseGuid]; var rb1 = RowBuilder.Start("House", house.ComplexName); rb1.Add("Changed Energy", pickedHeatingSystem.EffectiveEnergyDemand); rb1.Add("Heating System", heatingSystemType); rc.Add(rb1); } rb.Add("Changed Sum", changedEnergy); Info("Changed " + pickedHeatingSystems.Count + " from " + heatingSystemType + " to heatpump for a total of " + changedEnergy / 1_000_000 + " gwh"); double overSubscribed = sumToSwitch - changedEnergy; rb.Add("Oversubscribed", overSubscribed); if (slice.DstYear != 2050) { if (overSubscribed > 0) { throw new FlaException("Problem: tried to allocate " + sumToSwitch / Constants.GWhFactor + "gwh to heat pumps, but could only switch " + changedEnergy / Constants.GWhFactor + " gwh in the year " + slice.DstYear + " and scenario " + slice.DstScenario + " from type " + heatingSystemType); } //im letzten jahr ist oversubscribe ok. //overSubscribed.Should().BeLessOrEqualTo(0); } var leftoveroldSystems = matchingPotentialSystemsToChange.Where(x => x.SynthesizedHeatingSystemType == heatingSystemType).ToList(); rb.Add("Energy Demand after across all systems", leftoveroldSystems.Select(x => x.EffectiveEnergyDemand).Sum()); }