private List <CalcAutoDev> MakeCalcAutoDevsFromHouse([NotNull] CalcHouseDto house,
                                                             [NotNull][ItemNotNull] List <CalcLocation> houseLocations)
        {
            var autodevs = new List <CalcAutoDev>(house.AutoDevs.Count);

            // zur kategorien zuordnung
            foreach (var hhautodev in house.AutoDevs)
            {
                CalcProfile           calcProfile = CalcDeviceFactory.MakeCalcProfile(hhautodev.CalcProfile, _calcRepo.CalcParameters);
                CalcLoadType          clt         = _ltDict.GetLoadtypeByGuid(hhautodev.LoadtypeGuid);
                List <CalcDeviceLoad> loads       = new List <CalcDeviceLoad>();
                foreach (CalcDeviceLoadDto loadDto in hhautodev.Loads)
                {
                    CalcDeviceLoad load = new CalcDeviceLoad(loadDto.Name,
                                                             loadDto.MaxPower,
                                                             _ltDict.GetLoadtypeByGuid(loadDto.LoadTypeGuid),
                                                             loadDto.AverageYearlyConsumption,
                                                             loadDto.PowerStandardDeviation);
                    loads.Add(load);
                }

                List <VariableRequirement> requirements = new List <VariableRequirement>();
                foreach (var reqDto in hhautodev.Requirements)
                {
                    VariableRequirement rq = new VariableRequirement(reqDto.Name,
                                                                     reqDto.Value,
                                                                     reqDto.CalcLocationName,
                                                                     reqDto.LocationGuid,
                                                                     reqDto.VariableCondition,
                                                                     _variableRepository,
                                                                     reqDto.VariableGuid);
                    requirements.Add(rq);
                }

                CalcLocation houseLocation = houseLocations.Single(x => x.Guid == hhautodev.CalcLocationGuid);
                var          cautodev      = new CalcAutoDev(
                    calcProfile,
                    clt,
                    loads,
                    hhautodev.TimeStandardDeviation,
                    hhautodev.Multiplier,
                    houseLocation,
                    requirements, hhautodev, _calcRepo);
                var busyarr = _availabilityDtoRepository.GetByGuid(hhautodev.BusyArr.Guid);
                cautodev.ApplyBitArry(busyarr, _ltDict.GetLoadtypeByGuid(hhautodev.LoadtypeGuid));
                autodevs.Add(cautodev);
            }

            return(autodevs);
        }
        public List <CalcAutoDev> MakeCalcAutoDevs(
            [NotNull][ItemNotNull] List <CalcAutoDevDto> autoDevices,
            [NotNull] DtoCalcLocationDict locationDict)
        {
            var autodevs = new List <CalcAutoDev>(autoDevices.Count);

            foreach (var autoDevDto in autoDevices)
            {
                if (_loadTypeDictionary.SimulateLoadtype(autoDevDto.LoadtypeGuid))
                {
                    var         deviceLoads = MakeCalcDeviceLoads(autoDevDto, _loadTypeDictionary);
                    CalcProfile cp          = MakeCalcProfile(autoDevDto.CalcProfile, _calcRepo.CalcParameters);

                    var          loadtype     = _loadTypeDictionary.GetLoadtypeByGuid(autoDevDto.LoadtypeGuid);
                    CalcLocation calcLocation = locationDict.GetCalcLocationByGuid(autoDevDto.CalcLocationGuid);
                    List <VariableRequirement> requirements = new List <VariableRequirement>();
                    foreach (var req in  autoDevDto.Requirements)
                    {
                        VariableRequirement vreq = new VariableRequirement(req.Name,
                                                                           req.Value, req.CalcLocationName, req.LocationGuid,
                                                                           req.VariableCondition, _calcVariableRepository, req.VariableGuid);
                        requirements.Add(vreq);
                    }

                    autoDevDto.AdditionalName = " (autonomous)";
                    var cautodev = new CalcAutoDev(cp, loadtype,
                                                   deviceLoads, autoDevDto.TimeStandardDeviation,
                                                   1, calcLocation,
                                                   requirements, autoDevDto, _calcRepo);
                    var busyarr = _availabilityDtoRepository.GetByGuid(autoDevDto.BusyArr.Guid);
                    cautodev.ApplyBitArry(busyarr, loadtype);
                    autodevs.Add(cautodev);
                }
            }

            return(autodevs);
        }