private static CalcSpaceHeatingDto MakeSpaceHeatingDto([NotNull] HeatingParameter heatingparameter,
                                                               [NotNull] CalcLoadTypeDtoDictionary ltDict,
                                                               [NotNull] HouseholdKey householdKey,
                                                               [CanBeNull] out CalcLocationDto heatingLocation)
        //, List<CalcDeviceTaggingSet> taggingSets)
        {
            if (!ltDict.SimulateLoadtype(heatingparameter.HeatingLoadType))
            {
                heatingLocation = null;
                return(null);
            }

            var degreeDayDict = new List <CalcDegreeDayDto>();

            foreach (var degreeDay in heatingparameter.DegreeDays)
            {
                var cdd = new CalcDegreeDayDto(degreeDay.Date.Year, degreeDay.Date.Month, degreeDay.Date.Day, degreeDay.HeatingAmount);
                degreeDayDict.Add(cdd);
            }

            var lt  = ltDict.GetLoadtypeDtoByLoadType(heatingparameter.HeatingLoadType);
            var cdl = new CalcDeviceLoadDto(heatingparameter.HeatingLoadType.Name,
                                            -1,
                                            lt.Name,
                                            lt.Guid,
                                            heatingparameter.YearlyConsumption,
                                            0,
                                            Guid.NewGuid().ToStrGuid(),
                                            1);
            var cdls = new List <CalcDeviceLoadDto> {
                cdl
            };

            heatingLocation = new CalcLocationDto("Space Heating Location", -102, Guid.NewGuid().ToStrGuid());
            var csh = new CalcSpaceHeatingDto("Space Heating",
                                              -1,
                                              cdls,
                                              degreeDayDict,
                                              householdKey,
                                              heatingLocation.Name,
                                              heatingLocation.Guid,
                                              Guid.NewGuid().ToStrGuid());

            //foreach (var calcDeviceTaggingSet in taggingSets) {
            //calcDeviceTaggingSet.AddTag("Space Heating","House Device");
            //}
            return(csh);
        }
        public static CalcSpaceHeatingDto CreateSpaceHeatingObject([NotNull] House house,
                                                                   [NotNull] TemperatureProfile temperatureProfile,
                                                                   [NotNull] HouseholdKey householdKey,
                                                                   [CanBeNull]
                                                                   out CalcLocationDto heatingLocation, DateTime
                                                                   startTime, DateTime endTime,
                                                                   CalcLoadTypeDtoDictionary ltDict) //, List<CalcDeviceTaggingSet> deviceTaggingSets)
        {
            if (house.HouseType == null)
            {
                throw new LPGException("Housetype was null");
            }

            if (house.HouseType.HeatingLoadType != null && Math.Abs(house.HouseType.HeatingYearlyTotal) > 0.0001 &&
                !double.IsNaN(house.HouseType.HeatingYearlyTotal))
            {
                var degreeDays = MakeDegreeDaysClass.MakeDegreeDays(temperatureProfile,
                                                                    startTime, endTime,
                                                                    house.HouseType.HeatingTemperature,
                                                                    house.HouseType.RoomTemperature,
                                                                    house.HouseType.HeatingYearlyTotal,
                                                                    house.HouseType.AdjustYearlyEnergy,
                                                                    house.HouseType.ReferenceDegreeDays);
                foreach (var degreeHour in degreeDays)
                {
                    if (double.IsNaN(degreeHour.HeatingAmount))
                    {
                        throw new LPGException("Heating Amount was NaN");
                    }
                }

                var heatingParameter = new HeatingParameter(degreeDays, house.HouseType.HeatingLoadType, house.HouseType.HeatingYearlyTotal);
                var spaceheating     = MakeSpaceHeatingDto(heatingParameter, ltDict, householdKey, out heatingLocation);
                return(spaceheating); //,deviceTaggingSets
            }

            heatingLocation = null;
            return(null);
        }