コード例 #1
0
        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);
        }
コード例 #2
0
        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);
        }