Esempio n. 1
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);
        }
Esempio n. 2
0
        public void RunTest()
        {
            Profile prof             = Profile.MakeRandomProfile(new Random(), "myprofi", Profile.ProfileResolution.QuarterHour, -20, 40);
            CoolingDegreeProfile hdp = new CoolingDegreeProfile(prof, 25, 23);

            hdp.InitializeDailyAmounts(1000);
            Info("sum degree days: " + hdp.CalculateHeatingDegreeDaySum());
            Info("sum energy: " + hdp.CalculateYearlyConsumptionSum());
            foreach (var day in hdp.CoolingDegreeHours)
            {
                Info(day.ToString());
                if (day.DegreeHours < 0)
                {
                    throw new FlaException("Negative degree hours");
                }
            }

            hdp.CalculateYearlyConsumptionSum().Should().BeApproximately(1000, 1);
        }