public void ElectricEquipmentWithDefaultTest()
        {
            // use 0 for watts per area as same as double type's default value
            var elecEqp = new ElectricEquipmentAbridged("new_elec_eqp", 0, "some_schedule");
            var dup     = elecEqp.DuplicateElectricEquipmentAbridged();

            Assert.IsTrue(elecEqp.Equals(dup));
        }
Ejemplo n.º 2
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);
        }
Ejemplo n.º 3
0
 public void Init()
 {
     this.instance = ElectricEquipmentAbridged.FromJson(json);
     //this.instance = new ElectricEquipmentAbridged("newID", 12.5, "Schedule-Equipment");
     //this.instance.DisplayName = "Electrical Equipment Definition";
 }
Ejemplo n.º 4
0
 public void Init()
 {
     this.instance = ElectricEquipmentAbridged.FromJson(json);
 }
Ejemplo 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);
        }