private static ICalcAbleObject MakeCalcHouseholdObject([NotNull] Simulator sim, [NotNull] CalcStartParameterSet csps, [NotNull] ICalcObject hh,
                                                               [NotNull] ILifetimeScope scope,
                                                               [NotNull] CalcVariableDtoFactory cvrdto,
                                                               [NotNull] CalcVariableRepository variableRepository,
                                                               out CalcObjectType cot,
                                                               [NotNull] CalcRepo calcRepo)
        {
            var              cmhdf        = scope.Resolve <CalcModularHouseholdDtoFactory>();
            HouseholdKey     householdKey = new HouseholdKey("HH1");
            CalcHouseholdDto dto          = cmhdf.MakeCalcModularHouseholdDto(sim, (ModularHousehold)hh,
                                                                              csps.TemperatureProfile, householdKey, csps.GeographicLocation,
                                                                              out _, csps.TransportationDeviceSet, csps.TravelRouteSet,
                                                                              csps.EnergyIntensity, csps.ChargingStationSet);
            var cmhf = scope.Resolve <CalcModularHouseholdFactory>();

            /*foreach (var v in dto.CalcVariables)
             *              {
             *                  variableRepository.RegisterVariable(new CalcVariable(v.Name, v.Guid, v.Value, v.LocationName, v.LocationGuid, v.HouseholdKey));
             *              }*/
            foreach (HouseholdKeyEntry entry in dto.GetHouseholdKeyEntries())
            {
                calcRepo.InputDataLogger.Save(Constants.GeneralHouseholdKey, entry);
            }

            calcRepo.InputDataLogger.Save(Constants.GeneralHouseholdKey, dto);
            RegisterAllDtoVariables(cvrdto, variableRepository);
            ICalcAbleObject ch = cmhf.MakeCalcModularHousehold(dto, out _, null, null, calcRepo);

            cot = CalcObjectType.ModularHousehold;
            return(ch);
        }
        private static ICalcAbleObject MakeCalcHouseObject([NotNull] Simulator sim,
                                                           [NotNull] CalcStartParameterSet csps, [NotNull] ICalcObject hh,
                                                           [NotNull] ILifetimeScope scope,
                                                           [NotNull] CalcVariableDtoFactory cvrdto, [NotNull] CalcVariableRepository variableRepository,
                                                           out CalcObjectType cot, [NotNull] CalcRepo calcRepo)
        {
            var house = (House)hh;

            calcRepo.FileFactoryAndTracker.RegisterHousehold(Constants.HouseKey, "House Infrastructure",
                                                             HouseholdKeyType.House, "House Infrastructure", house.Name, house.Description);
            var housedtoFac = scope.Resolve <CalcHouseDtoFactory>();
            var housedto    = housedtoFac.MakeHouseDto(sim, house, csps.TemperatureProfile,
                                                       csps.GeographicLocation, csps.EnergyIntensity);

            foreach (HouseholdKeyEntry entry in housedto.GetHouseholdKeyEntries())
            {
                calcRepo.InputDataLogger.Save(Constants.GeneralHouseholdKey, entry);
            }

            var convertedAutoDevList = housedto.AutoDevs.ConvertAll(x => (IHouseholdKey)x).ToList();

            if (calcRepo.CalcParameters.Options.Contains(CalcOption.HouseholdContents))
            {
                calcRepo.InputDataLogger.SaveList(convertedAutoDevList);
                calcRepo.InputDataLogger.Save(Constants.GeneralHouseholdKey, housedto);
            }

            var chf = scope.Resolve <CalcHouseFactory>();

            RegisterAllDtoVariables(cvrdto, variableRepository);
            ICalcAbleObject ch = chf.MakeCalcHouse(housedto, calcRepo);

            cot = CalcObjectType.House;
            return(ch);
        }
Exemple #3
0
        public void CalcPersonDesiresTest()
        {
            CalcParameters calcParameters = CalcParametersFactory.MakeGoodDefaults();
            var            r = new Random(1);

            using (CalcRepo calcRepo = new CalcRepo(calcParameters: calcParameters, rnd: r))
            {
                var cpd = new CalcPersonDesires(calcRepo);
                var cd1 = new CalcDesire("blub0", 1, 0.5m, 0.1m, 1, 1, 1, -1, null, "", "");
                cpd.AddDesires(cd1);
                var cd2 = new CalcDesire("blub1", 2, 0.5m, 0.1m, 1, 1, 1, -1, null, "", "");
                cpd.AddDesires(cd2);
                Logger.Info("CalcPersonDesiresTest:" + cd1.Value + " ; " + cd2.Value);
                // satisfaction
                var satis1 = new CalcDesire("blub", 1, 0.5m, 12, 1, 1, 60, -1, null, "", "")
                {
                    Value = 1
                };
                var satisfactionValues = new List <CalcDesire>
                {
                    satis1
                };
                Logger.Info(cd1.Value + " ; " + cd2.Value);
                for (var i = 0; i < 20; i++)
                {
                    TimeStep ts = new TimeStep(i, 0, false);
                    cpd.ApplyDecay(ts);
                    cpd.ApplyAffordanceEffect(satisfactionValues, true, "blub");
                    Logger.Info(cd1.Value + " ; " + cd2.Value);
                }
            }
        }
 public CalcHouse([NotNull] string name, [NotNull] HouseholdKey houseKey,
                  CalcRepo calcRepo)
 {
     _calcRepo    = calcRepo;
     Name         = name;
     HouseholdKey = houseKey;
 }
        private static CalcRepo PrepareCalculation([NotNull] Simulator sim, [NotNull] CalcStartParameterSet csps,
                                                   [NotNull] ILifetimeScope scope,
                                                   [NotNull] out CalcLoadTypeDtoDictionary dtoltdict,
                                                   [NotNull] out DayLightStatus dls,
                                                   [NotNull] out CalcVariableRepository variableRepository
                                                   )
        {
            CalcRepo calcRepo        = scope.Resolve <CalcRepo>();
            var      inputDataLogger = scope.Resolve <IInputDataLogger>();

            inputDataLogger.Save(Constants.GeneralHouseholdKey, calcRepo.CalcParameters);
            inputDataLogger.Save(Constants.GeneralHouseholdKey, csps.TemperatureProfile);

            dtoltdict = scope.Resolve <CalcLoadTypeDtoDictionary>();

            var affordanceTaggingSetFactory = scope.Resolve <AffordanceTaggingSetFactory>();
            var affordanceTaggingSets       = affordanceTaggingSetFactory.GetAffordanceTaggingSets(sim);

            if (calcRepo.CalcParameters.Options.Contains(CalcOption.AffordanceTaggingSets))
            {
                inputDataLogger.Save(affordanceTaggingSets);
            }

            calcRepo.FileFactoryAndTracker.RegisterGeneralHouse();
            dls = scope.Resolve <DayLightStatus>();
            if (calcRepo.CalcParameters.Options.Contains(CalcOption.DaylightTimesList))
            {
                inputDataLogger.Save(Constants.GeneralHouseholdKey, dls);
            }
            variableRepository = scope.Resolve <CalcVariableRepository>();
            return(calcRepo);
        }
        public void CalcAffordanceVariableTestSet()
        {
            var deviceCategoryGuid = Guid.NewGuid().ToStrGuid();
            //var r = new Random(0);
            //var nr = new NormalRandom(0, 0.1, r);
            const int stepcount = 150;

            Config.IsInUnitTesting = true;
            DateTime startdate = new DateTime(2018, 1, 1);
            DateTime enddate   = startdate.AddMinutes(stepcount);
            //_calcParameters.InitializeTimeSteps(startdate, enddate, new TimeSpan(0, 1, 0), 3, false);
            CalcParameters calcParameters =
                CalcParametersFactory.MakeGoodDefaults().SetStartDate(startdate).SetEndDate(enddate);
            var timeStep = new TimeSpan(0, 1, 0);
            var cp       = new CalcProfile("profile", Guid.NewGuid().ToStrGuid(), timeStep, ProfileType.Absolute, "blub");

            cp.AddNewTimepoint(new TimeSpan(0), 100);
            cp.AddNewTimepoint(new TimeSpan(0, 10, 0), 0);
            cp.ConvertToTimesteps();
            var variables    = new List <CalcAffordanceVariableOp>();
            var variableReqs = new List <VariableRequirement>();
            var loc          = new CalcLocation("loc", Guid.NewGuid().ToStrGuid());
            CalcVariableRepository calcVariableRepository = new CalcVariableRepository();
            var          variableGuid = Guid.NewGuid().ToStrGuid();
            HouseholdKey key          = new HouseholdKey("hh1");
            CalcVariable cv           = new CalcVariable("varname", variableGuid, 0, loc.Name, loc.Guid, key);

            calcVariableRepository.RegisterVariable(cv);
            variables.Add(new CalcAffordanceVariableOp(cv.Name, 1, loc, VariableAction.SetTo,
                                                       VariableExecutionTime.Beginning, variableGuid));
            BitArray     isBusy = new BitArray(100, false);
            Random       rnd    = new Random();
            NormalRandom nr     = new NormalRandom(0, 1, rnd);

            using CalcRepo calcRepo = new CalcRepo(calcParameters: calcParameters, odap: new Mock <IOnlineDeviceActivationProcessor>().Object, normalRandom: nr, rnd: rnd);
            var aff = new CalcAffordance("bla", cp, loc, false, new List <CalcDesire>(), 0, 99,
                                         PermittedGender.All, false, 0.1, new ColorRGB(0, 0, 0), "bla", false, false, variables, variableReqs,
                                         ActionAfterInterruption.GoBackToOld, "bla", 100, false, "", Guid.NewGuid().ToStrGuid(),
                                         calcVariableRepository,
                                         new List <CalcAffordance.DeviceEnergyProfileTuple>(), isBusy, BodilyActivityLevel.Low, calcRepo);
            var lt       = new CalcLoadType("load", "unit1", "unit2", 1, true, Guid.NewGuid().ToStrGuid());
            var cdl      = new CalcDeviceLoad("cdl", 1, lt, 1, 0.1);
            var devloads = new List <CalcDeviceLoad> {
                cdl
            };
            CalcDeviceDto cdd = new CalcDeviceDto("device", deviceCategoryGuid, key,
                                                  OefcDeviceType.Device, "category", string.Empty,
                                                  Guid.NewGuid().ToStrGuid(), loc.Guid, loc.Name);
            var cd = new CalcDevice(devloads, loc,
                                    cdd, calcRepo);

            //loc.Variables.Add("Variable1", 0);
            aff.AddDeviceTuple(cd, cp, lt, 0, timeStep, 10, 1);
            TimeStep ts = new TimeStep(0, 0, false);

            aff.IsBusy(ts, loc, "name");
            //var variableOperator = new VariableOperator();
            aff.Activate(ts, "blub", loc, out var _);
            calcVariableRepository.GetValueByGuid(variableGuid).Should().Be(1);
        }
        public void PickRandomAffordanceFromEquallyAttractiveOnesTest()
        {
            using (var wd = new WorkingDir(Utili.GetCurrentMethodAndClass())) {
                CalcParameters calcParameters = CalcParametersFactory.MakeGoodDefaults();
                calcParameters.AffordanceRepetitionCount = 0;
                wd.InputDataLogger.AddSaver(new HouseholdKeyLogger(wd.SqlResultLoggingService));
                wd.InputDataLogger.AddSaver(new ResultFileEntryLogger(wd.SqlResultLoggingService));
                using (var fft = new FileFactoryAndTracker(wd.WorkingDirectory, "blub", wd.InputDataLogger)) {
                    fft.RegisterHousehold(Constants.GeneralHouseholdKey, "general", HouseholdKeyType.General, "desc", null, null);
                    //SqlResultLoggingService srls = new SqlResultLoggingService(wd.WorkingDirectory);
                    //DateStampCreator dsc = new DateStampCreator(calcParameters);
                    Random rnd = new Random();
                    //OnlineLoggingData old = new OnlineLoggingData(dsc, wd.InputDataLogger, calcParameters);
                    using (var lf = new LogFile(calcParameters, fft)) {
                        CalcProfile            cp  = new CalcProfile("cp1", Guid.NewGuid().ToStrGuid(), TimeSpan.FromMinutes(1), ProfileType.Absolute, "bla");
                        CalcVariableRepository crv = new CalcVariableRepository();
                        BitArray isBusy            = new BitArray(calcParameters.InternalTimesteps, false);
                        using CalcRepo calcRepo = new CalcRepo(lf: lf, calcParameters: calcParameters, rnd: rnd);
                        CalcAffordance aff1 = new CalcAffordance("aff1", cp, null, false, new List <CalcDesire>(), 10, 20, PermittedGender.All, true,
                                                                 1, LPGColors.AliceBlue, null, false, false, null, null, ActionAfterInterruption.GoBackToOld, "", 900, false, "",
                                                                 Guid.NewGuid().ToStrGuid(), crv, new List <CalcAffordance.DeviceEnergyProfileTuple>(), isBusy, BodilyActivityLevel.Low,
                                                                 calcRepo);
                        CalcAffordance aff2 = new CalcAffordance("aff2", cp, null, false, new List <CalcDesire>(), 10, 20, PermittedGender.All, true,
                                                                 1, LPGColors.AliceBlue, null, false, false, null, null, ActionAfterInterruption.GoBackToOld, "", 100, false, "",
                                                                 Guid.NewGuid().ToStrGuid(), crv, new List <CalcAffordance.DeviceEnergyProfileTuple>(), isBusy, BodilyActivityLevel.Low,
                                                                 calcRepo);

                        List <ICalcAffordanceBase> affs = new List <ICalcAffordanceBase> {
                            aff1,
                            aff2
                        };
                        int           aff1C        = 0;
                        int           aff2C        = 0;
                        BitArray      isSick       = new BitArray(calcParameters.InternalTimesteps);
                        BitArray      isOnVacation = new BitArray(calcParameters.InternalTimesteps);
                        CalcPersonDto calcPerson   = CalcPersonDto.MakeExamplePerson();
                        CalcPerson    cperson      = new CalcPerson(calcPerson, null, isSick, isOnVacation, calcRepo);
                        TimeStep      ts           = new TimeStep(1, 0, true);
                        for (int i = 0; i < 1000; i++)
                        {
                            ICalcAffordanceBase cab = cperson.PickRandomAffordanceFromEquallyAttractiveOnes(affs, ts, null, new HouseholdKey("bla"));
                            if (cab == aff1)
                            {
                                aff1C++;
                            }

                            if (cab == aff2)
                            {
                                aff2C++;
                            }
                        }

                        aff1C.Should().BeApproximatelyWithinPercent(900, 0.1);
                        Logger.Info("Number of selections for 90%:" + aff1C + ", 10%:" + aff2C);
                    }
                }
                wd.CleanUp();
            }
        }
 public CalcDeviceFactory([NotNull] CalcLoadTypeDictionary loadTypeDictionary,
                          [NotNull] AvailabilityDtoRepository availabilityDtoRepository,
                          [NotNull] CalcVariableRepository calcVariableRepository, CalcRepo calcRepo)
 {
     _loadTypeDictionary        = loadTypeDictionary;
     _availabilityDtoRepository = availabilityDtoRepository;
     _calcVariableRepository    = calcVariableRepository;
     _calcRepo = calcRepo;
 }
Exemple #9
0
 public CalcAffordanceFactory([NotNull] CalcLoadTypeDictionary loadTypeDictionary,
                              [NotNull] AvailabilityDtoRepository availabilityDtoRepository,
                              CalcRepo calcRepo
                              //[NotNull] CalcVariableDtoFactory variableRepository
                              )
 {
     _loadTypeDictionary        = loadTypeDictionary;
     _availabilityDtoRepository = availabilityDtoRepository;
     _calcRepo = calcRepo;
     //_variableRepository = variableRepository;
 }
 public CalcTravelRouteStep([NotNull] string pName,
                            [NotNull] CalcTransportationDeviceCategory transportationDeviceCategory, int stepNumber, double distanceInM,
                            StrGuid guid, [NotNull][ItemNotNull] List <CalcTransportationDevice> vehiclePool,
                            CalcRepo calcRepo) : base(pName, guid)
 {
     TransportationDeviceCategory = transportationDeviceCategory;
     StepNumber         = stepNumber;
     _distanceOfStepInM = distanceInM;
     _vehiclePool       = vehiclePool;
     _calcRepo          = calcRepo;
 }
Exemple #11
0
 public CalcPersonFactory(CalcRepo calcRepo)
 {
     _calcRepo = calcRepo;
     _internalDateTimeForSteps = new List <DateTime> {
         _calcRepo.CalcParameters.InternalStartTime
     };
     for (var i = 1; i < _calcRepo.CalcParameters.InternalTimesteps; i++)
     {
         _internalDateTimeForSteps.Add(_internalDateTimeForSteps[i - 1] + _calcRepo.CalcParameters.InternalStepsize);
     }
 }
Exemple #12
0
        public void SetTimeprofileTest()
        {
            DateTime       startdate      = new DateTime(2018, 1, 1);
            DateTime       enddate        = startdate.AddMinutes(10);
            CalcParameters calcParameters =
                CalcParametersFactory.MakeGoodDefaults().SetStartDate(startdate).SetEndDate(enddate);

            CalcLoadType          clt  = MakeCalcLoadType();
            CalcLocation          cloc = new CalcLocation("blub", Guid.NewGuid().ToStrGuid());
            CalcDeviceLoad        cdl  = new CalcDeviceLoad("cdl1", 1, clt, 1, 0.1);
            List <CalcDeviceLoad> cdls = new List <CalcDeviceLoad>();

            using (WorkingDir wd = new WorkingDir(Utili.GetCurrentMethodAndClass()))
            {
                wd.InputDataLogger.AddSaver(new ColumnEntryLogger(wd.SqlResultLoggingService));
                wd.InputDataLogger.AddSaver(new ResultFileEntryLogger(wd.SqlResultLoggingService));
                wd.InputDataLogger.AddSaver(new HouseholdKeyLogger(wd.SqlResultLoggingService));
                using (FileFactoryAndTracker fft = new FileFactoryAndTracker(wd.WorkingDirectory, "hh1", wd.InputDataLogger))
                {
                    fft.RegisterHousehold(Constants.GeneralHouseholdKey, "General", HouseholdKeyType.General, "desc", null, null);
                    //SqlResultLoggingService srls = new SqlResultLoggingService(wd.WorkingDirectory);
                    DateStampCreator dsc = new DateStampCreator(calcParameters);

                    using (IOnlineLoggingData old = new OnlineLoggingData(dsc, wd.InputDataLogger, calcParameters))
                    {
                        cdls.Add(cdl);

                        OnlineDeviceActivationProcessor odap =
                            new OnlineDeviceActivationProcessor(old, calcParameters, fft);
                        var           deviceCategoryGuid = Guid.NewGuid().ToStrGuid();
                        CalcDeviceDto cdd = new CalcDeviceDto("bla", deviceCategoryGuid
                                                              , new HouseholdKey("HH-6"), OefcDeviceType.Device, "category",
                                                              string.Empty, Guid.NewGuid().ToStrGuid(), cloc.Guid, cloc.Name);
                        using CalcRepo calcRepo = new CalcRepo(odap: odap, calcParameters: calcParameters, normalRandom: NormalRandom);
                        CalcDevice cd = new CalcDevice(cdls, cloc,
                                                       cdd, calcRepo);
                        CalcProfile cp  = MakeCalcProfile5Min100();
                        TimeStep    ts1 = new TimeStep(1, calcParameters);
                        cd.SetAllLoadTypesToTimeprofile(cp, ts1, "test", "name1", 1);
                        TimeStep ts = new TimeStep(0, calcParameters);
                        cd.IsBusyDuringTimespan(ts, 1, 1, clt).Should().BeFalse();
                        cd.IsBusyDuringTimespan(ts.AddSteps(1), 1, 1, clt).Should().BeTrue();
                        cd.IsBusyDuringTimespan(ts.AddSteps(2), 1, 1, clt).Should().BeTrue();
                        cd.IsBusyDuringTimespan(ts.AddSteps(3), 1, 1, clt).Should().BeTrue();
                        cd.IsBusyDuringTimespan(ts.AddSteps(4), 1, 1, clt).Should().BeTrue();
                        cd.IsBusyDuringTimespan(ts.AddSteps(5), 1, 1, clt).Should().BeTrue();
                        cd.IsBusyDuringTimespan(ts.AddSteps(6), 0, 1, clt).Should().BeFalse();
                    }
                }

                wd.CleanUp();
            }
        }
Exemple #13
0
        public void AddChargingStation([NotNull] CalcLoadType gridchargingLoadType,
                                       [NotNull] CalcTransportationDeviceCategory cat,
                                       double chargingDeviceMaxChargingPower,
                                       [NotNull] CalcLoadType carChargingLoadType,
                                       CalcRepo calcRepo)
        {
            string name = Name + " - Charging station " + (ChargingDevices.Count + 1);

            CalcChargingStation station = new CalcChargingStation(cat,
                                                                  gridchargingLoadType, chargingDeviceMaxChargingPower, name,
                                                                  System.Guid.NewGuid().ToStrGuid(), _householdKey, carChargingLoadType, calcRepo);

            ChargingDevices.Add(station);
        }
 public CalcTravelRoute([NotNull] string pName, [NotNull] CalcSite siteA, [NotNull] CalcSite siteB,
                        [NotNull][ItemNotNull] List <CalcTransportationDevice> vehiclePool,
                        [NotNull][ItemNotNull] List <CalcTransportationDevice> locationUnlimitedDevices,
                        [NotNull] HouseholdKey householdkey, StrGuid guid,
                        CalcRepo calcRepo) : base(pName, guid)
 {
     _householdkey = householdkey;
     _calcRepo     = calcRepo;
     SiteA         = siteA;
     SiteB         = siteB;
     siteA.AddRoute(this);
     _vehiclePool = vehiclePool;
     _locationUnlimitedDevices = locationUnlimitedDevices;
 }
 public CalcHouseFactory([NotNull] CalcLoadTypeDictionary ltDict,
                         [NotNull] CalcModularHouseholdFactory cmhf,
                         [NotNull] AvailabilityDtoRepository availabilityDtoRepository,
                         [NotNull] CalcVariableRepository variableRepository,
                         [NotNull] CalcDeviceTaggingSets calcDeviceTaggingSets,
                         CalcRepo calcRepo)
 {
     _ltDict = ltDict;
     _cmhf   = cmhf;
     _availabilityDtoRepository = availabilityDtoRepository;
     _variableRepository        = variableRepository;
     _calcDeviceTaggingSets     = calcDeviceTaggingSets;
     _calcRepo = calcRepo;
 }
 public CalcChargingStation([NotNull] CalcTransportationDeviceCategory deviceCategory, [NotNull] CalcLoadType gridChargingLoadType,
                            double maxChargingPower,
                            [NotNull] string chargingStationName, StrGuid chargingStationGuid,
                            [NotNull] HouseholdKey householdKey,
                            [NotNull] CalcLoadType carChargingLoadType, CalcRepo calcRepo)
 {
     _householdKey        = householdKey;
     _calcRepo            = calcRepo;
     CarChargingLoadType  = carChargingLoadType;
     DeviceCategory       = deviceCategory;
     GridChargingLoadType = gridChargingLoadType;
     MaxChargingPower     = maxChargingPower;
     ChargingStationName  = chargingStationName;
     ChargingStationGuid  = chargingStationGuid;
     IsAvailable          = true;
 }
        public CalcSpaceHeating(
            [NotNull][ItemNotNull] List <CalcDeviceLoad> powerUsage,
            [NotNull] Dictionary <Tuple <int, int, int>, CalcDegreeDay> calcDegreeDays,
            [NotNull] CalcLocation cloc,
            [NotNull] CalcDeviceDto deviceDto, [NotNull] CalcRepo calcRepo) : base(
                powerUsage,
                cloc,
                deviceDto, calcRepo)
        {
            if (powerUsage.Count != 1)
            {
                throw new LPGException("there should be exactly one loadtype for space heating, not more or less.");
            }

            _calcDegreeDays = calcDegreeDays;
        }
Exemple #18
0
        public CalcAirConditioning(
            [NotNull][ItemNotNull] List <CalcDeviceLoad> powerUsage,
            [NotNull] Dictionary <Tuple <int, int, int, int>, CalcDegreeHour> calcDegreeHours,
            [NotNull] CalcLocation cloc,
            [NotNull] CalcDeviceDto calcDeviceDto, [NotNull] CalcRepo calcRepo)
            : base(
                powerUsage, cloc,
                calcDeviceDto, calcRepo)
        {
            if (powerUsage.Count != 1)
            {
                throw new LPGException("there should be exactly one loadtype for air conditioning, not more or less.");
            }

            _calcDegreeHours = calcDegreeHours;
        }
Exemple #19
0
 //[CanBeNull]
 //private CalcAffordanceBase _MainAffordance;
 public AffordanceBaseTransportDecorator([NotNull] ICalcAffordanceBase sourceAffordance,
                                         [NotNull] CalcSite site, [NotNull] TransportationHandler transportationHandler,
                                         [NotNull] string name, [NotNull] HouseholdKey householdkey,
                                         StrGuid guid, CalcRepo calcRepo)
     : base(name, guid)
 {
     if (!site.Locations.Contains(sourceAffordance.ParentLocation))
     {
         throw new LPGException("Wrong site. Bug. Please report.");
     }
     _householdkey = householdkey;
     _calcRepo     = calcRepo;
     _calcRepo.OnlineLoggingData.AddTransportationStatus(new TransportationStatus(new TimeStep(0, 0, false), householdkey, "Initializing affordance base transport decorator for " + name));
     Site = site;
     _transportationHandler = transportationHandler;
     _sourceAffordance      = sourceAffordance;
 }
        public CalcHouse MakeCalcHouse([NotNull] CalcHouseDto calcHouseDto, CalcRepo calcRepo)
        {
            HouseholdKey        houseKey       = Constants.HouseKey;
            var                 calchouse      = new CalcHouse(calcHouseDto.HouseName, calcHouseDto.HouseKey, calcRepo);
            List <CalcLocation> houseLocations = new List <CalcLocation>();

            foreach (var houseLoc in calcHouseDto.HouseLocations)
            {
                CalcLocation cl = new CalcLocation(houseLoc.Name, houseLoc.Guid);
                houseLocations.Add(cl);
            }

            var calcAbleObjects = new List <ICalcAbleObject>();

            //var globalLocationDict = new Dictionary<CalcLocationDto, CalcLocation>();
            foreach (var householddto in calcHouseDto.Households)
            {
                var hh = _cmhf.MakeCalcModularHousehold(householddto, out var _,
                                                        calcHouseDto.HouseName, calcHouseDto.Description, _calcRepo);
                calcAbleObjects.Add(hh);

                //    foreach (var pair in dtoCalcLocationDict.LocationDtoDict) {
                //      if (!globalLocationDict.ContainsKey(pair.Key)) {
                //        globalLocationDict.Add(pair.Key,  pair.Value);
                //  }
                //}
            }

            calchouse.SetHouseholds(calcAbleObjects);
            MakeHeating(calcHouseDto, calchouse, houseKey, houseLocations); //, taggingSets);

            SetAirConditioningOnHouse(calcHouseDto, calchouse, houseLocations);
            var autodevs2 = MakeCalcAutoDevsFromHouse(calcHouseDto, houseLocations);

            calchouse.SetAutoDevs(autodevs2);
            // energy Storage
            SetEnergyStoragesOnHouse(calcHouseDto.EnergyStorages, houseKey, calchouse,
                                     _variableRepository);                   //, taggingSets);
            // transformation devices
            MakeAllTransformationDevices(calcHouseDto, calchouse, houseKey); //taggingSets,

            // generators
            calchouse.SetGenerators(MakeGenerators(calcHouseDto.Generators, houseKey)); //taggingSets,

            return(calchouse);
        }
Exemple #21
0
 public CalcManager([NotNull] string resultPath,
                    int randomSeed,
                    [NotNull] DayLightStatus lightNeededArray,
                    [NotNull] CalcVariableRepository variableRepository,
                    CalcRepo calcRepo)
 {
     _lightNeededArray = lightNeededArray;
     //_srls = srls;
     _randomSeed = randomSeed;
     //_fileVersion = fileVersion;
     //_calcHouseholdPlans = calcHouseholdPlans;
     //_affordanceTaggingSets = affordanceTaggingSets;
     //_deviceTaggingSets = deviceTaggingSets;
     _resultPath = resultPath;
     //_name = pName;
     _variableRepository = variableRepository;
     CalcRepo            = calcRepo;
 }
        public void FileFactoryAndTrackerTest()
        {
            Config.IsInUnitTesting = true;
            using (var wd = new WorkingDir(Utili.GetCurrentMethodAndClass()))
            {
                wd.InputDataLogger.AddSaver(new HouseholdKeyLogger(wd.SqlResultLoggingService));
                wd.InputDataLogger.AddSaver(new ResultFileEntryLogger(wd.SqlResultLoggingService));
                CalcParameters  calcParameters = CalcParametersFactory.MakeGoodDefaults();
                var             clt            = new CalcLoadType("calcloadtype", "kwh", "kW", 0.001, true, Guid.NewGuid().ToStrGuid());
                BitArray        isSick         = new BitArray(calcParameters.InternalTimesteps);
                BitArray        isOnVacation   = new BitArray(calcParameters.InternalTimesteps);
                var             personDto      = CalcPersonDto.MakeExamplePerson();
                Random          r  = new Random();
                Mock <ILogFile> lf = new Mock <ILogFile>();
                using (CalcRepo calcRepo = new CalcRepo(rnd: r, lf: lf.Object, calcParameters: calcParameters))
                {
                    CalcLocation cloc = new CalcLocation("blub", Guid.NewGuid().ToStrGuid());
                    var          cp   = new CalcPerson(personDto,
                                                       cloc, isSick, isOnVacation, calcRepo);

                    /*"personname", 1, 1, null, 1, PermittedGender.Female, lf: null,
                     * householdKey: "hh1", startingLocation: null, traitTag: "traittag",
                     * householdName: "hhname0",calcParameters:calcParameters,isSick:isSick, guid:Guid.NewGuid().ToStrGuid());
                     */
                    var fft = new FileFactoryAndTracker(wd.WorkingDirectory, "testhh", wd.InputDataLogger);
                    fft.RegisterHousehold(new HouseholdKey("hh1"), "test key", HouseholdKeyType.Household, "desc", null, null);
                    fft.RegisterHousehold(Constants.GeneralHouseholdKey, "general key", HouseholdKeyType.General, "desc", null, null);
                    fft.MakeFile <StreamWriter>("file1", "desc", true, ResultFileID.Actions,
                                                new HouseholdKey("hh1"), TargetDirectory.Charts, TimeSpan.FromMinutes(1),
                                                CalcOption.HouseholdContents,
                                                clt.ConvertToLoadTypeInformation(),
                                                cp.MakePersonInformation());
                    //fft.ResultFileList.WriteResultEntries(wd.WorkingDirectory);
                    ResultFileEntryLogger rfel = new ResultFileEntryLogger(wd.SqlResultLoggingService);
                    var rfes = rfel.Load();
                    rfes.Count.Should().BeGreaterThan(0);
                    //ResultFileList.ReadResultEntries(wd.WorkingDirectory);
                    fft.GetResultFileEntry(ResultFileID.Actions, clt.Name, new HouseholdKey("hh1"), cp.MakePersonInformation(), null);
                    fft.Dispose();
                }
                wd.CleanUp();
            }
        }
 public CalcModularHouseholdDtoFactory([NotNull] CalcLoadTypeDtoDictionary ltDict, [NotNull] Random random,
                                       [NotNull] CalcPersonDtoFactory calcPersonDtoFactory,
                                       [NotNull] CalcDeviceDtoFactory calcDeviceDtoFactory,
                                       [NotNull] CalcLocationDtoFactory calcLocationDtoFactory,
                                       [NotNull] CalcVariableDtoFactory calcVariableRepositoryDtoFactory,
                                       [NotNull] CalcAffordanceDtoFactory calcAffordanceDtoFactory,
                                       [NotNull] CalcTransportationDtoFactory transportationDtoFactory,
                                       CalcRepo calcRepo)
 {
     _ltDict = ltDict;
     _random = random;
     _calcPersonDtoFactory             = calcPersonDtoFactory;
     _calcDeviceDtoFactory             = calcDeviceDtoFactory;
     _calcLocationDtoFactory           = calcLocationDtoFactory;
     _calcVariableRepositoryDtoFactory = calcVariableRepositoryDtoFactory;
     _calcAffordanceDtoFactory         = calcAffordanceDtoFactory;
     _transportationDtoFactory         = transportationDtoFactory;
     _calcRepo = calcRepo;
 }
Exemple #24
0
        public void MakeCalcLocationsTest()
        {
            var locations = new List <Location>();
            var loc       = new Location("loc", 1, string.Empty, Guid.NewGuid().ToStrGuid());

            locations.Add(loc);
            Random r = new Random(1);
            DeviceCategoryPicker picker = new DeviceCategoryPicker(r, null);
            //var cp = new CalcFactoryParameters(picker);
            //var dict =new Dictionary<CalcLocation, List<IAssignableDevice>>();
            var deviceActions = new ObservableCollection <DeviceAction>();
            //var locdict = new Dictionary<Location, CalcLocation>();
            CalcParameters cp = CalcParametersFactory.MakeGoodDefaults();
            //var mock = new Mock<IOnlineDeviceActivationProcessor>();
            //var iodap = mock.Object;
            var locationDtoDict         = new CalcLoadTypeDtoDictionary(new Dictionary <VLoadType, CalcLoadTypeDto>());
            var ltDict                  = new CalcLoadTypeDictionary(new Dictionary <CalcLoadTypeDto, CalcLoadType>());
            CalcLocationDtoFactory cldt = new CalcLocationDtoFactory(cp, picker, locationDtoDict);
            Dictionary <CalcLocationDto, List <IAssignableDevice> > deviceLocationDict = new Dictionary <CalcLocationDto, List <IAssignableDevice> >();
            LocationDtoDict          calclocdict = new LocationDtoDict();
            List <DeviceCategoryDto> devcat      = new List <DeviceCategoryDto>();

            using CalcRepo calcRepo = new CalcRepo();
            //devcat.Add(new DeviceCategoryDto(dc.FullPath, Guid.NewGuid().ToStrGuid()));
            var locdtos = cldt.MakeCalcLocations(locations,
                                                 new HouseholdKey("hh1"),
                                                 EnergyIntensityType.EnergyIntensive,
                                                 deviceLocationDict,
                                                 deviceActions,
                                                 calclocdict,
                                                 devcat);

            locdtos.Count.Should().Be(1);
            locdtos[0].Name.Should().Be(loc.Name);
            CalcLocationFactory clf = new CalcLocationFactory(ltDict, calcRepo);
            //"HH1", EnergyIntensityType.EnergySaving, dict,deviceActions,
            DtoCalcLocationDict dcl = new DtoCalcLocationDict();
            var calclocs            = clf.MakeCalcLocations(locdtos, dcl, calcRepo);

            calclocs.Count.Should().Be(1);
            calclocs[0].Name.Should().Be(loc.Name);
            calclocs[0].Guid.Should().Be(locdtos[0].Guid);
        }
        //private readonly CalcVariableDtoFactory _variableDtoFactory;

        public CalcModularHouseholdFactory([NotNull] CalcLoadTypeDictionary ltDict,
                                           [NotNull] CalcLocationFactory clf,
                                           [NotNull] CalcPersonFactory cpf,
                                           [NotNull] CalcDeviceFactory cdf,
                                           [NotNull] CalcAffordanceFactory caf,
                                           [NotNull] CalcTransportationFactory ctf,
                                           [NotNull] CalcVariableRepository variableRepository,
                                           CalcRepo calcRepo
                                           )
        {
            _ltDict = ltDict;
            _clf    = clf;
            _cpf    = cpf;
            _cdf    = cdf;
            _caf    = caf;
            _ctf    = ctf;
            _calcVariableRepository = variableRepository;
            _calcRepo = calcRepo;
        }
Exemple #26
0
 public void BasicTest()
 {
     using (WorkingDir wd = new WorkingDir(Utili.GetCurrentMethodAndClass()))
     {
         wd.InputDataLogger.AddSaver(new ResultFileEntryLogger(wd.SqlResultLoggingService));
         wd.InputDataLogger.AddSaver(new HouseholdKeyLogger(wd.SqlResultLoggingService));
         CalcParameters calcParameters = CalcParametersFactory.MakeGoodDefaults().EnableShowSettlingPeriod().SetSettlingDays(5);
         using (FileFactoryAndTracker fft = new FileFactoryAndTracker(wd.WorkingDirectory, "blub", wd.InputDataLogger))
         {
             fft.RegisterGeneralHouse();
             fft.RegisterHousehold(new HouseholdKey("HH1"), "test", HouseholdKeyType.Household, "desc",
                                   null, null);
             ThoughtsLogFile tlf = new ThoughtsLogFile(fft, calcParameters);
             Random          rnd = new Random();
             //NormalRandom nr = new NormalRandom(0, 0.1, rnd);
             // this array is pure nonsense and only to make it stop crashing the unit test
             //_calcParameters.InternalDateTimeForSteps = new List<DateTime>(4);
             //for (int i = 0; i < 4; i++)
             //{
             //  _calcParameters.InternalDateTimeForSteps.Add(DateTime.Now);
             //}
             CalcLocation    cloc         = new CalcLocation("cloc", Guid.NewGuid().ToStrGuid());
             BitArray        isSick       = new BitArray(calcParameters.InternalTimesteps);
             BitArray        isOnVacation = new BitArray(calcParameters.InternalTimesteps);
             CalcPersonDto   dto          = CalcPersonDto.MakeExamplePerson();
             Mock <ILogFile> lf           = new Mock <ILogFile>();
             NormalRandom    nr           = new NormalRandom(0, 0.1, rnd);
             using (CalcRepo calcRepo = new CalcRepo(rnd: rnd, lf: lf.Object, calcParameters: calcParameters, normalRandom: nr))
             {
                 CalcPerson cp = new CalcPerson(dto,
                                                cloc, isSick, isOnVacation, calcRepo);
                 //"personName", 0, 1, rnd, 1, PermittedGender.Male, null, "HH1" ,cloc,"traittag", "hhname0",calcParameters,isSick,Guid.NewGuid().ToStrGuid());
                 TimeStep     ts = new TimeStep(0, 0, false);
                 ThoughtEntry te = new ThoughtEntry(cp, ts, "blua");
                 calcParameters.SetSettlingDays(0);
                 tlf.WriteEntry(te, new HouseholdKey("HH1"));
             }
             tlf.Dispose();
         }
         wd.CleanUp();
     }
 }
Exemple #27
0
        public void TestBasics()
        {
            // needs major redesign of calcperson class
            using (WorkingDir wd = new WorkingDir(Utili.GetCurrentMethodAndClass()))
            {// StreamFactory sf = new StreamFactory();
                DateTime       startdate      = new DateTime(2018, 1, 1);
                DateTime       enddate        = startdate.AddMinutes(100);
                CalcParameters calcParameters = CalcParametersFactory.MakeGoodDefaults().SetStartDate(startdate).SetEndDate(enddate).EnableShowSettlingPeriod().SetSettlingDays(0);
                wd.InputDataLogger.AddSaver(new HouseholdKeyLogger(wd.SqlResultLoggingService));
                wd.InputDataLogger.AddSaver(new ResultFileEntryLogger(wd.SqlResultLoggingService));
                using (var fft = new FileFactoryAndTracker(wd.WorkingDirectory, "test1", wd.InputDataLogger))
                {
                    fft.RegisterHousehold(Constants.GeneralHouseholdKey, "general", HouseholdKeyType.General, "desc", null, null);
                    //SqlResultLoggingService srls = new SqlResultLoggingService(wd.WorkingDirectory);
                    CalculationProfiler profiler = new CalculationProfiler();
                    CalcRepo            calcRepo = CalcRepo.Make(calcParameters, wd.InputDataLogger, wd.WorkingDirectory, "name", profiler);
                    DesiresLogFile      dlf      = new DesiresLogFile(fft, calcParameters);
                    CalcDesire          cd1      = new CalcDesire("desire1", 1, 0.5m, 12, 1, 1, 60, -1, null, "", "");

                    //NormalRandom nr = new NormalRandom(0, 0.1, r);
                    CalcLocation  cloc         = new CalcLocation("cloc", Guid.NewGuid().ToStrGuid());
                    BitArray      isSick       = new BitArray(calcParameters.InternalTimesteps);
                    BitArray      isOnVacation = new BitArray(calcParameters.InternalTimesteps);
                    CalcPersonDto calcPerson   = CalcPersonDto.MakeExamplePerson();
                    CalcPerson    cp           = new CalcPerson(calcPerson, cloc,
                                                                isSick, isOnVacation, calcRepo);
                    //"bla", 1, 5, r, 48, PermittedGender.Male, lf, "HH1", cloc, "traittag", "hhname0",calcParameters,isSick,Guid.NewGuid().ToStrGuid());
                    cp.PersonDesires.AddDesires(cd1);
                    dlf.RegisterDesires(cp.PersonDesires.Desires.Values);
                    TimeStep    ts = new TimeStep(0, 0, true);
                    DesireEntry de = new DesireEntry(cp, ts, cp.PersonDesires, dlf, calcParameters);
                    fft.RegisterHousehold(new HouseholdKey("hh1"), "bla", HouseholdKeyType.Household, "desc", null, null);
                    dlf.WriteEntry(de, new HouseholdKey("hh1"));
                    dlf.Dispose();
                }
                wd.CleanUp();
            }
        }
        public CalcTravelRoute GetTravelRouteFromSrcLoc([NotNull] CalcLocation srcLocation,
                                                        [NotNull] CalcSite dstSite, [NotNull] TimeStep startTimeStep,
                                                        [NotNull] string personName, CalcRepo calcRepo)
        {
            CalcSite srcSite = LocationSiteLookup[srcLocation];

            if (srcSite == dstSite)
            {
                return(SameSiteRoutes[srcSite]);
            }
            //first get the routes, no matter if busy
            var devicesAtSrc   = AllMoveableDevices.Where(x => x.Currentsite == srcSite).ToList();
            var possibleRoutes = srcSite.GetAllRoutesTo(dstSite, devicesAtSrc);

            if (possibleRoutes.Count == 0)
            {
                return(null);
            }

            //check if the route is busy by calculating the duration. If busy, duration will be null
            int?            dur = null;
            CalcTravelRoute ctr = null;

            while (dur == null && possibleRoutes.Count > 0)
            {
                ctr = possibleRoutes[calcRepo.Rnd.Next(possibleRoutes.Count)];
                possibleRoutes.Remove(ctr);
                dur = ctr.GetDuration(startTimeStep, personName, AllMoveableDevices);
            }

            if (dur == null)
            {
                ctr = null;
            }

            return(ctr);
        }
Exemple #29
0
        public CalcTransportationDevice(
            [NotNull] CalcTransportationDeviceCategory category,
            double averageSpeedInMPerS, [NotNull][ItemNotNull] List <CalcDeviceLoad> loads,
            double fullRangeInMeters,
            double energyToDistanceFactor,
            double maxChargingPower,
            [CanBeNull] CalcLoadType chargingCalcLoadType,
            [NotNull][ItemNotNull] List <CalcSite> allCalcSites,
            [NotNull] CalcDeviceDto calcDeviceDto, [NotNull] CalcRepo calcRepo)
            : base(calcDeviceDto.Name, calcDeviceDto.Guid)
        {
            _dsc                    = new DateStampCreator(calcRepo.CalcParameters);
            _loads                  = loads;
            _fullRangeInMeters      = fullRangeInMeters;
            _energyToDistanceFactor = energyToDistanceFactor;
            _maxChargingPower       = maxChargingPower;
            _chargingCalcLoadType1  = chargingCalcLoadType;
            _availableRangeInMeters = fullRangeInMeters;
            Category                = category;
            AverageSpeedInMPerS     = averageSpeedInMPerS;
            _calcDeviceDto          = calcDeviceDto;
            _calcRepo               = calcRepo;
            if (_calcRepo.CalcParameters.InternalTimesteps == 0)
            {
                throw new LPGException("Time steps were not initialized.");
            }

            _isBusyArray = new BitArray(_calcRepo.CalcParameters.InternalTimesteps);
            //not all devices need to have load types. busses for example have no load
            //if (loads.Count == 0) {
            //throw new DataIntegrityException("The transportation device " + pName +
            //" seems to have no load types. That is not very useful. Please fix.");
            //}
            var vehiclePoolGuid = "8C426E95-B269-402E-9806-C3785D6C8433".ToStrGuid();

            _calcDeviceDto.LocationGuid = vehiclePoolGuid;
            _calcDeviceDto.LocationName = "Vehicle Pool";
            if (calcDeviceDto.LocationGuid == null)
            {
                throw new LPGException("Trying to initalize with empty location guid");
            }
            foreach (CalcDeviceLoad deviceLoad in loads)
            {
                //TODO: check if -1 is a good location guid
                //OefcKey key = new OefcKey(_calcDeviceDto.HouseholdKey, OefcDeviceType.Transportation, Guid, "-1", deviceLoad.LoadType.Guid, "Transportation");
                var key = _calcRepo.Odap.RegisterDevice(deviceLoad.LoadType.ConvertToDto(), calcDeviceDto);
                _keysByLocGuidAndLoadtype.Add(calcDeviceDto.LocationGuid, new Dictionary <CalcLoadType, OefcKey>());
                _keysByLocGuidAndLoadtype[calcDeviceDto.LocationGuid].Add(deviceLoad.LoadType, key);
            }

            if (chargingCalcLoadType != null)
            {
                var key2 = _calcRepo.Odap.RegisterDevice(chargingCalcLoadType.ConvertToDto(), calcDeviceDto);
                if (!_keysByLocGuidAndLoadtype.ContainsKey(calcDeviceDto.LocationGuid))
                {
                    _keysByLocGuidAndLoadtype.Add(calcDeviceDto.LocationGuid, new Dictionary <CalcLoadType, OefcKey>());
                }
                var dict = _keysByLocGuidAndLoadtype[calcDeviceDto.LocationGuid];
                if (!dict.ContainsKey(chargingCalcLoadType))
                {
                    dict.Add(chargingCalcLoadType, key2);
                }
            }

            RegisterForAllCalcSites(allCalcSites);
        }
Exemple #30
0
        public void MatchAutonomousDevicesWithNormalDevicesTest()
        {
            // make different devices at different locations
            // only a single one should be matched.
            var startdate      = new DateTime(2018, 1, 1);
            var enddate        = startdate.AddMinutes(100);
            var calcParameters = CalcParametersFactory.MakeGoodDefaults().SetStartDate(startdate).SetEndDate(enddate);

            //_calcParameters.InitializeTimeSteps(startdate, enddate, new TimeSpan(0, 1, 0), 3, false);

            Config.IsInUnitTesting = true;
            var cloc1    = new CalcLocation("loc1", Guid.NewGuid().ToStrGuid());
            var cloc2    = new CalcLocation("loc1", Guid.NewGuid().ToStrGuid());
            var cdevload = new List <CalcDeviceLoad>();
            var clt      = new CalcLoadType("calcloadtype", "power", "sum", 1, true, Guid.NewGuid().ToStrGuid());

            cdevload.Add(new CalcDeviceLoad("load", 100, clt, 0, 0));
            var devCategoryGuid = Guid.NewGuid().ToStrGuid();
            IMock <IOnlineDeviceActivationProcessor> iodap = new Mock <IOnlineDeviceActivationProcessor>();

            using (var calcRepo = new CalcRepo(iodap.Object, calcParameters: calcParameters)) {
                var cdd1 = new CalcDeviceDto("cdevice1", devCategoryGuid, new HouseholdKey("HH1"), OefcDeviceType.Device, "category", "",
                                             Guid.NewGuid().ToStrGuid(), cloc1.Guid, cloc1.Name);

                var cdLoc1 = new CalcDevice(new List <CalcDeviceLoad>(), cloc1, cdd1, calcRepo);
                var cdd2   = new CalcDeviceDto("cdevice1", devCategoryGuid, new HouseholdKey("HH1"), OefcDeviceType.Device, "category", "",
                                               Guid.NewGuid().ToStrGuid(), cloc1.Guid, cloc1.Name);
                var cdLoc1B = new CalcDevice(new List <CalcDeviceLoad>(), cloc1, cdd2, calcRepo);
                var cdd3    = new CalcDeviceDto("cdevice1", devCategoryGuid, new HouseholdKey("HH1"), OefcDeviceType.Device, "category", "",
                                                Guid.NewGuid().ToStrGuid(), cloc2.Guid, cloc2.Name);
                var cdLoc2 = new CalcDevice(new List <CalcDeviceLoad>(), cloc2, cdd3, calcRepo);
                var cp     = new CalcProfile("cp1", Guid.NewGuid().ToStrGuid(), TimeSpan.FromMilliseconds(1), ProfileType.Absolute, "blub");
                //CalcVariableRepository crv = new CalcVariableRepository();
                //VariableRequirement vr = new VariableRequirement("");
                var requirements = new List <VariableRequirement>();
                var cdd4         = new CalcDeviceDto("cdevice1", devCategoryGuid, new HouseholdKey("HH1"), OefcDeviceType.Device, "category", "",
                                                     Guid.NewGuid().ToStrGuid(), cloc1.Guid, cloc1.Name);
                var cadLoc1  = new CalcAutoDev(cp, clt, cdevload, 0, 1, cloc1, requirements, cdd4, calcRepo);
                var autodevs = new List <CalcAutoDev> {
                    cadLoc1
                };
                var normalDevices = new List <CalcDevice> {
                    cdLoc1,
                    cdLoc1B,
                    cdLoc2
                };
                CalcHousehold.MatchAutonomousDevicesWithNormalDevices(autodevs, normalDevices);
                //var totalmatchcount = 0;
                foreach (var device in normalDevices)
                {
                    Logger.Info(device.Name);
                    foreach (var matchingAutoDev in device.MatchingAutoDevs)
                    {
                        //      totalmatchcount++;
                        Logger.Info("\t" + matchingAutoDev.Name);
                    }
                }

                cdLoc1.MatchingAutoDevs.Count.Should().Be(1);
            }

            //(totalmatchcount).Should().Be(1);
        }