Beispiel #1
0
        public void RunSingleHpTest()
        {
            DhwProfileGenerator chp = new DhwProfileGenerator();
            Random       rnd        = new Random();
            var          dhwcp      = DhwCalculationParameters.MakeDefaults();
            const double energyuse  = 20000;
            var          hpr        = chp.Run(dhwcp, energyuse, rnd);
            var          profile    = hpr.GetEnergyDemandProfile();
            const string file       = "dhwProfile_Single.xlsx";
            var          colnames   = new List <string> {
                "turnoff"
            };

            XlsxDumper.DumpProfilesToExcel(file,
                                           2017,
                                           15,
                                           new ProfileWorksheetContent("sheet1", "Last", 240, profile),
                                           new EnumWorksheetContent <DhwTurnOffReason>("turnoffs", colnames, hpr.TurnOffReasons.AsReadOnly()));
            profile.Values.Sum().Should().BeApproximately(energyuse, 100);
        }
Beispiel #2
0
        protected override Prosumer ProvidePrivateProfile([NotNull] ProviderParameterDto ppdto)
        {
            DHWHeaterEntry dhw = (DHWHeaterEntry)ppdto.HouseComponent;

            if (dhw.HouseComponentType != HouseComponentType.Dhw)
            {
                throw new FlaException("Wrong type");
            }

            ppdto.HouseComponentResultObject.DhwSystemType = dhw.DhwHeatingSystemType.ToString();
            if (dhw.DhwHeatingSystemType != DhwHeatingSystem.Electricity && dhw.DhwHeatingSystemType != DhwHeatingSystem.Heatpump)
            {
                ppdto.HouseComponentResultObject.HeatingSystemMessage = "Not electric heating";
                return(null);
            }

            Hausanschluss ha = _dbDto.Hausanschlusse.Single(x => x.Guid == dhw.HausAnschlussGuid);
            var           pa = new Prosumer(dhw.HouseGuid,
                                            dhw.Name,
                                            dhw.HouseComponentType,
                                            dhw.SourceGuid,
                                            dhw.FinalIsn,
                                            dhw.HausAnschlussGuid,
                                            ha.ObjectID,
                                            GenerationOrLoad.Load,
                                            ha.Trafokreis,
                                            Name,
                                            "DHW Profile Generator");
            //todo: randomize this with buckets and/or simulate a central control
            int startTime = 2 * 4 + Services.Rnd.Next(12);
            int stopTime  = startTime + 3 * 4 + Services.Rnd.Next(12);
            //double targetRuntimePerDay = 3*4 + Services.Rnd.NextDouble() * 4;
            double trigger = 1 - 0.05 * Services.Rnd.NextDouble();
            DhwCalculationParameters dhwCalculationParameters = new DhwCalculationParameters(startTime, stopTime, trigger);
            var dhwResult = _dhw.Run(dhwCalculationParameters, dhw.EffectiveEnergyDemand, Services.Rnd);

            pa.Profile = dhwResult.GetEnergyDemandProfile();
            return(pa);
        }