Exemplo n.º 1
0
        private void ReplaceUserData(ProgramTypeViewData oldObj, ProgramTypeAbridged newObj)
        {
            var newItem = CheckObjName(newObj, oldObj.Name);
            var index   = _userData.IndexOf(oldObj);

            _userData.RemoveAt(index);
            _userData.Insert(index, new ProgramTypeViewData(newItem));
            this._allData = _userData.Concat(_systemData).Distinct(_viewDataComparer).ToList();
        }
Exemplo n.º 2
0
        public void Init()
        {
            var url = @"https://raw.githubusercontent.com/ladybug-tools/honeybee-schema/master/samples/program_type/program_type_abridged_office.json";

            using (WebClient wc = new WebClient())
            {
                var json = wc.DownloadString(url);
                this.instance = ProgramTypeAbridged.FromJson(json);
            }
        }
Exemplo n.º 3
0
        private void AddUserData(ProgramTypeAbridged item)
        {
            var newItem     = CheckObjName(item);
            var newViewData = new ProgramTypeViewData(newItem);

            if (!this._userData.Contains(newViewData))
            {
                // add resources to model EnergyProperties
                var engLib = newViewData.CheckResources(SystemEnergyLib);
                this._modelProperties.Energy.MergeWith(engLib);
            }
            this._userData.Insert(0, newViewData);
            this._allData = _userData.Concat(_systemData).Distinct(_viewDataComparer).ToList();
        }
Exemplo n.º 4
0
        public static InternalCondition ToSAM_InternalCondition(this ProgramTypeAbridged programTypeAbridged, ModelEnergyProperties modelEnergyProperties)
        {
            if (programTypeAbridged == null)
            {
                return(null);
            }

            InternalCondition result = new InternalCondition(programTypeAbridged.Identifier);

            PeopleAbridged peopleAbridged = programTypeAbridged.People;

            if (peopleAbridged != null)
            {
                result.SetValue(Analytical.InternalConditionParameter.OccupancyProfileName, peopleAbridged.OccupancySchedule);
                result.SetValue(Analytical.InternalConditionParameter.AreaPerPerson, 1 / peopleAbridged.PeoplePerArea);

                if (modelEnergyProperties != null)
                {
                    IEnumerable <HoneybeeSchema.Energy.ISchedule> schedules = modelEnergyProperties.ScheduleList;
                    if (schedules != null)
                    {
                        foreach (HoneybeeSchema.Energy.ISchedule schedule in schedules)
                        {
                            if (schedule.Identifier == peopleAbridged.ActivitySchedule)
                            {
                                Profile profile = schedule.ToSAM(ProfileType.Other);
                                if (profile != null)
                                {
                                    result.SetValue(InternalConditionParameter.TotalMetabolicRatePerPerson, profile.MaxValue);
                                }
                            }
                        }
                    }
                }

                result.SetValue(Analytical.InternalConditionParameter.OccupancyRadiantProportion, peopleAbridged.RadiantFraction);
                result.SetValue(Analytical.InternalConditionParameter.OccupancyViewCoefficient, 0.227); //TODDO: Implement proper OccupancyViewCoefficient

                if (peopleAbridged.LatentFraction != null && peopleAbridged.LatentFraction.Obj is double)
                {
                    result.SetValue(InternalConditionParameter.LatentFraction, (double)peopleAbridged.LatentFraction.Obj); //TODO: Recalculate value per space
                }
            }

            LightingAbridged lightingAbridged = programTypeAbridged.Lighting;

            if (lightingAbridged != null)
            {
                result.SetValue(Analytical.InternalConditionParameter.LightingProfileName, lightingAbridged.Schedule);
                result.SetValue(Analytical.InternalConditionParameter.LightingGainPerArea, lightingAbridged.WattsPerArea);

                result.SetValue(Analytical.InternalConditionParameter.LightingRadiantProportion, lightingAbridged.RadiantFraction);
                result.SetValue(Analytical.InternalConditionParameter.LightingViewCoefficient, lightingAbridged.VisibleFraction);
            }

            ElectricEquipmentAbridged electricEquipmentAbridged = programTypeAbridged.ElectricEquipment;

            if (electricEquipmentAbridged != null)
            {
                result.SetValue(Analytical.InternalConditionParameter.EquipmentSensibleProfileName, electricEquipmentAbridged.Schedule);
                result.SetValue(Analytical.InternalConditionParameter.EquipmentSensibleGainPerArea, electricEquipmentAbridged.WattsPerArea);

                result.SetValue(Analytical.InternalConditionParameter.EquipmentRadiantProportion, electricEquipmentAbridged.RadiantFraction);
                result.SetValue(Analytical.InternalConditionParameter.EquipmentViewCoefficient, 0.372); //TODDO: Implement proper EquipmentViewCoefficient
            }

            InfiltrationAbridged infiltrationAbridged = programTypeAbridged.Infiltration;

            if (infiltrationAbridged != null)
            {
                result.SetValue(Analytical.InternalConditionParameter.InfiltrationProfileName, infiltrationAbridged.Schedule);
                result.SetValue(InternalConditionParameter.FlowPerExteriorArea, infiltrationAbridged.FlowPerExteriorArea); //TODO: Recalculate value per space
            }

            SetpointAbridged setPoint = programTypeAbridged.Setpoint;

            if (setPoint != null)
            {
                result.SetValue(Analytical.InternalConditionParameter.CoolingProfileName, setPoint.CoolingSchedule);

                result.SetValue(Analytical.InternalConditionParameter.HeatingProfileName, setPoint.HeatingSchedule);
            }

            VentilationAbridged ventilationAbridged = programTypeAbridged.Ventilation;

            if (ventilationAbridged != null)
            {
                result.SetValue(Analytical.InternalConditionParameter.SupplyAirFlow, ventilationAbridged.FlowPerZone);
                result.SetValue(Analytical.InternalConditionParameter.SupplyAirFlowPerArea, ventilationAbridged.FlowPerArea);
                result.SetValue(Analytical.InternalConditionParameter.SupplyAirFlowPerPerson, ventilationAbridged.FlowPerPerson);

                result.SetValue(Analytical.InternalConditionParameter.ExhaustAirFlow, ventilationAbridged.FlowPerZone);
                result.SetValue(Analytical.InternalConditionParameter.ExhaustAirFlowPerArea, ventilationAbridged.FlowPerArea);
                result.SetValue(Analytical.InternalConditionParameter.ExhaustAirFlowPerPerson, ventilationAbridged.FlowPerPerson);
            }

            return(result);
        }
Exemplo n.º 5
0
        public static List <Profile> ToSAM_Profiles(this ProgramTypeAbridged programTypeAbridged, IEnumerable <ISchedule> schedules = null)
        {
            if (programTypeAbridged == null)
            {
                return(null);
            }

            List <ScheduleRulesetAbridged> scheduleRulesetAbridgeds = HoneybeeSchema.Helper.EnergyLibrary.DefaultScheduleRuleset?.ToList();

            List <Profile> result = new List <Profile>();

            PeopleAbridged peopleAbridged = programTypeAbridged.People;

            if (peopleAbridged != null)
            {
                ISchedule schedule = null;

                if (schedules != null)
                {
                    schedule = schedules?.First(x => x.Identifier == peopleAbridged.OccupancySchedule);
                }

                if (schedule == null && scheduleRulesetAbridgeds != null)
                {
                    schedule = scheduleRulesetAbridgeds.Find(x => x.Identifier == peopleAbridged.OccupancySchedule);
                }

                if (schedule != null)
                {
                    Profile profile = schedule.ToSAM(ProfileType.Occupancy);
                    result.Add(profile);
                }
            }

            LightingAbridged lightingAbridged = programTypeAbridged.Lighting;

            if (lightingAbridged != null)
            {
                ISchedule schedule = null;

                if (schedules != null)
                {
                    schedule = schedules?.First(x => x.Identifier == lightingAbridged.Schedule);
                }

                if (schedule == null && scheduleRulesetAbridgeds != null)
                {
                    schedule = scheduleRulesetAbridgeds.Find(x => x.Identifier == lightingAbridged.Schedule);
                }

                if (schedule != null)
                {
                    Profile profile = schedule.ToSAM(ProfileType.Lighting);
                    result.Add(profile);
                }
            }

            ElectricEquipmentAbridged electricEquipmentAbridged = programTypeAbridged.ElectricEquipment;

            if (electricEquipmentAbridged != null)
            {
                ISchedule schedule = null;

                if (schedules != null)
                {
                    schedule = schedules?.First(x => x.Identifier == electricEquipmentAbridged.Schedule);
                }

                if (schedule == null && scheduleRulesetAbridgeds != null)
                {
                    schedule = scheduleRulesetAbridgeds.Find(x => x.Identifier == electricEquipmentAbridged.Schedule);
                }

                if (schedule != null)
                {
                    Profile profile = schedule.ToSAM(ProfileType.EquipmentSensible);
                    result.Add(profile);
                }
            }

            InfiltrationAbridged infiltrationAbridged = programTypeAbridged.Infiltration;

            if (infiltrationAbridged != null)
            {
                ISchedule schedule = null;

                if (schedules != null)
                {
                    schedule = schedules?.First(x => x.Identifier == infiltrationAbridged.Schedule);
                }

                if (schedule == null && scheduleRulesetAbridgeds != null)
                {
                    schedule = scheduleRulesetAbridgeds.Find(x => x.Identifier == infiltrationAbridged.Schedule);
                }

                if (schedule != null)
                {
                    Profile profile = schedule.ToSAM(ProfileType.Infiltration);//= new Profile(infiltrationAbridged.Schedule, ProfileType.EquipmentSensible);
                    result.Add(profile);
                }
            }

            SetpointAbridged setPointAbridged = programTypeAbridged.Setpoint;

            if (setPointAbridged != null)
            {
                ISchedule schedule = null;

                if (schedules != null)
                {
                    schedule = schedules?.First(x => x.Identifier == setPointAbridged.CoolingSchedule);
                }

                if (schedule == null && scheduleRulesetAbridgeds != null)
                {
                    schedule = scheduleRulesetAbridgeds.Find(x => x.Identifier == setPointAbridged.CoolingSchedule);
                }

                if (schedule != null)
                {
                    Profile profile_Cooling = schedule.ToSAM(ProfileType.Cooling);//= new Profile(setPointAbridged.CoolingSchedule, ProfileType.Cooling);
                    result.Add(profile_Cooling);
                }

                schedule = null;

                if (schedules != null)
                {
                    schedule = schedules?.First(x => x.Identifier == setPointAbridged.HeatingSchedule);
                }

                if (schedule == null && scheduleRulesetAbridgeds != null)
                {
                    schedule = scheduleRulesetAbridgeds.Find(x => x.Identifier == setPointAbridged.HeatingSchedule);
                }

                if (schedule != null)
                {
                    Profile profile_Heating = schedule.ToSAM(ProfileType.Heating);//= new Profile(setPointAbridged.HeatingSchedule, ProfileType.Heating);
                    result.Add(profile_Heating);
                }
            }

            return(result);
        }