//[Description("BH.Engine.EnergyPlus.Convert ToOSM => gets Internal gains from BH.oM.Environment.Elements.InternalGain")] //[Input("InternalGain", "BHoM InternalGain")] //[Output("EnergyPlus InternalGain")] public static global::OpenStudio.People ToOSMPeopleGain(this BH.oM.Environment.SpaceCriteria.People peopleGain, global::OpenStudio.Model modelReference, global::OpenStudio.Space space) { // TODO: remove static instance below for input of profile object instead! global::OpenStudio.ScheduleConstant activitySchedule = ToOSMScheduleConstantActivity(modelReference); global::OpenStudio.ScheduleConstant occupancySchedule = ToOSMScheduleConstantsAlwaysOn(modelReference); PeopleDefinition PeopleDefinition = new PeopleDefinition(modelReference); // TODO:Check the method being used to define the number of poeple within the space PeopleDefinition.setPeopleperSpaceFloorArea(peopleGain.Sensible); global::OpenStudio.People osPeopleGain = new global::OpenStudio.People(PeopleDefinition); osPeopleGain.setNumberofPeopleSchedule(occupancySchedule); osPeopleGain.setActivityLevelSchedule(activitySchedule); osPeopleGain.setSpace(space); return(osPeopleGain); }
public static List <BHE.IGain> FromTAS(this TBD.InternalGain tbdInternalGain) { if (tbdInternalGain == null) { return(null); } List <BHE.IGain> gains = new List <BHE.IGain>(); TASInternalGainData tasData = new TASInternalGainData(); tasData.ActivityID = System.Convert.ToInt32(tbdInternalGain.activityID); tasData.DomesticHotWater = System.Convert.ToDouble(tbdInternalGain.domesticHotWater); tasData.TargetIlluminance = System.Convert.ToDouble(tbdInternalGain.targetIlluminance); TASDescription tASDescription = new TASDescription(); tASDescription.Description = tbdInternalGain.description.RemoveBrackets(); //Lighting BHE.Lighting lightGain = new BHE.Lighting(); lightGain.Name = "L " + tbdInternalGain.name; lightGain.RadiantFraction = tbdInternalGain.lightingRadProp; TBD.profile tbdProfile = tbdInternalGain.GetProfile((int)TBD.Profiles.ticLG); BHE.Profile aProfile = tbdProfile.FromTAS(); lightGain.Profile = aProfile; lightGain.Fragments.Add(tasData); lightGain.Fragments.Add(tASDescription); gains.Add(lightGain); //Occupancy BHE.People occupantGain = new BHE.People(); occupantGain.Name = "O " + tbdInternalGain.name; tbdProfile = tbdInternalGain.GetProfile((int)TBD.Profiles.ticOSG); //curent limitation it works if we use hourly or yearl profile apprach with 0-1 values and factor as max occupantGain.Sensible = tbdProfile.factor; //Unit W/m2 sensible gain TBD.profile tbdProfileLat = tbdInternalGain.GetProfile((int)TBD.Profiles.ticOLG); occupantGain.Latent = tbdProfileLat.factor; //Unit W/m2 latent gain double aPeopleDesity = (occupantGain.Sensible + occupantGain.Latent) / tbdInternalGain.personGain; //Unit people/m2 aProfile = tbdProfile.FromTAS(); for (int i = 0; i < aProfile.HourlyValues.Count; i++) { aProfile.HourlyValues[i] = aProfile.HourlyValues[i] * aPeopleDesity; } occupantGain.RadiantFraction = tbdInternalGain.occupantRadProp; occupantGain.Profile = aProfile; occupantGain.Fragments.Add(tasData); occupantGain.Fragments.Add(tASDescription); gains.Add(occupantGain); //Equipment BHE.Equipment equipGain = new BHE.Equipment(); equipGain.Name = "Equipment " + tbdInternalGain.name; equipGain.RadiantFraction = tbdInternalGain.equipmentRadProp; tbdProfile = tbdInternalGain.GetProfile((int)TBD.Profiles.ticESG); aProfile = tbdProfile.FromTAS(); equipGain.Profile = aProfile; equipGain.Fragments.Add(tasData); equipGain.Fragments.Add(tASDescription); gains.Add(equipGain); //Pollutant BHE.Pollutant pollGain = new BHE.Pollutant(); pollGain.Name = "P " + tbdInternalGain.name; tbdProfile = tbdInternalGain.GetProfile((int)TBD.Profiles.ticCOG); aProfile = tbdProfile.FromTAS(); pollGain.Profile = aProfile; pollGain.Fragments.Add(tasData); pollGain.Fragments.Add(tASDescription); gains.Add(pollGain); //Infiltration BHE.Infiltration infGain = new BHE.Infiltration(); infGain.Name = "I " + tbdInternalGain.name; tbdProfile = tbdInternalGain.GetProfile((int)TBD.Profiles.ticI); aProfile = tbdProfile.FromTAS(); infGain.Profile = aProfile; infGain.Fragments.Add(tasData); infGain.Fragments.Add(tASDescription); gains.Add(infGain); //tbdInternalGain.freshAirRate; //ToDo: Figure this one out later... return(gains); }