private void AddPeakSolarIntervalToSchedule() { var ti = _consumptionCalculator .ReadOnlySiteSettings .PeakSolarInterval; int peakStartHr = ti.Start.Hours, peakStartMin = ti.Start.Minutes; int peakEndHr = ti.End.Hours, peakEndMin = ti.End.Minutes; ApplianceUsageSchedule.AddUsageInterval( peakStartHr, peakStartMin, peakEndHr, peakEndMin, UsageKind.UsingSolar); }
/// <summary> /// Makes an ApplianceUsage line. /// </summary> /// <remarks> /// We're passing in an IConsumptionCalculator so that we can get /// the Consumption/Site info like NumSolarHours and tell the /// Consumption it should Recalculate(), but without having to /// pass in the entire Consumption object, and thus avoiding any /// unintended consequences through, say, some weird list-manipulation. /// </remarks> public ApplianceUsage(IConsumptionCalculator consumptionCalculator, Appliance appliance, int quantity, decimal powerConsumption, bool enabled) { _consumptionCalculator = consumptionCalculator; ApplianceUsageSchedule = new ApplianceUsageSchedule( consumptionCalculator.ReadOnlySiteSettings); this.AddPeakSolarIntervalToSchedule(); this.SetAppliance(appliance); this.SetQuantity(quantity); this.SetPowerConsumption(powerConsumption); this.SetEnabled(enabled); // Recalculate this.Recalculate(); }
protected override void _HandleSolarIntervalUpdated() { ApplianceUsageSchedule.HandlePeakSolarIntervalUpdated(); }