Пример #1
0
 private static void CalculateEnergyConsumption([NotNull] CoolingResult hpr)
 {
     for (int i = 0; i < hpr.CoolingEnergySupply.Count; i++)
     {
         hpr.CoolingEnergyDemand[i] = hpr.CoolingEnergySupply[i]; // no factor since cooling is just used energy
     }
 }
Пример #2
0
        public CoolingResult Run([NotNull] CoolingCalculationParameters hpPar, double yearlyConsumption, [NotNull] Random rnd)
        {
            var hpr = new CoolingResult();

            _hdp.InitializeDailyAmounts(yearlyConsumption);
            //calculate required power
            if (hpPar.HouseMinimumEnergyTriggerinPercent > 1)
            {
                throw new FlaException("More than 100% trigger is not possible");
            }

            var maxDailyNeed = _hdp.CoolingDegreeHours.Select(x => x.HourlyEnergyConsumption).Max();
            var power        = maxDailyNeed / hpPar.TargetMaximumRuntimePerDay; //only target running for 12h

            power = Math.Max(power, 2);                                         // minimum 2kw
            power = ((int)power / 2) * 2;                                       // round to the neared 2kw
            double             houseEnergy = maxDailyNeed;
            int                idx         = 0;
            double             totalEnergy = 0;
            CoolingStateEngine hpse        = new CoolingStateEngine(power, maxDailyNeed, rnd, hpPar);

            for (int i = 0; i < 8760; i++)
            {
                double daily = _hdp.CoolingDegreeHours[i].HourlyEnergyConsumption;
                double energyLostPerTimestep = daily / 4;
                for (int quarterhourStep = 0; quarterhourStep < 4; quarterhourStep++)
                {
                    hpr.AvgTemperatures15Min[idx] = _hdp.CoolingDegreeHours[i].HourlyAverageTemperature;
                    hpr.HouseEnergyTracker[idx]   = houseEnergy;
                    houseEnergy -= energyLostPerTimestep;
                    double heatPumpSuppliedEnergy = hpse.ProvideEnergyForTimestep(houseEnergy);
                    totalEnergy += heatPumpSuppliedEnergy;
                    houseEnergy += heatPumpSuppliedEnergy;
                    hpr.CoolingEnergySupply[idx] = heatPumpSuppliedEnergy;
                    idx++;
                }
            }

            CalculateEnergyConsumption(hpr);
            _logger.Debug("Calculated air conditioning profile for " + yearlyConsumption + " Energy consumption in profile: " +
                          hpr.CoolingEnergySupply.Sum() + " energy demand: " + hpr.CoolingEnergySupply.Sum() + " Degree days: " +
                          _hdp.CoolingDegreeHours.Sum(x => x.DegreeHours) + " total need in degree days: " +
                          _hdp.CoolingDegreeHours.Sum(x => x.HourlyEnergyConsumption) + " Total energy: " + totalEnergy,
                          Stage.ProfileGeneration,
                          "Profile");
            return(hpr);
        }