public static BHE.Profile FromTAS(this TBD.profile tbdProfile) { BHE.Profile profile = new BHE.Profile(); profile.Name = tbdProfile.name; switch (tbdProfile.type) { case TBD.ProfileTypes.ticValueProfile: profile.HourlyValues.Add(tbdProfile.value); break; case TBD.ProfileTypes.ticHourlyProfile: for (int i = 1; i < 25; i++) { profile.HourlyValues.Add(tbdProfile.hourlyValues[i]); } break; case TBD.ProfileTypes.ticYearlyProfile: profile.HourlyValues = ToDoubleList(tbdProfile.GetYearlyValues()); break; } TASDescription tasData = new TASDescription(); tasData.Description = tbdProfile.description.RemoveBrackets(); profile.Fragments.Add(tasData); return(profile); }
public static TBD.Thermostat ToTAS(this BHE.Thermostat thermostat, TBD.Thermostat tbdThermostat) { if (thermostat == null) { return(tbdThermostat); } tbdThermostat.name = thermostat.Name; tbdThermostat.controlRange = (float)thermostat.ControlRange; tbdThermostat.proportionalControl = (thermostat.ProportionalControl ? 1 : 0); TASDescription tasFragment = thermostat.FindFragment <TASDescription>(typeof(TASDescription)); if (tasFragment != null) { tbdThermostat.description = tasFragment.Description; } TASThermostatData thermostatData = thermostat.FindFragment <TASThermostatData>(typeof(TASThermostatData)); if (thermostatData != null) { tbdThermostat.radiantProportion = (float)thermostatData.RadiantProportion; } return(tbdThermostat); }
public static BHPC.Construction FromTAS(this TBD.Construction tbdConstruction) { if (tbdConstruction == null) { return(null); } BHPC.Construction construction = new BHPC.Construction(); construction.Name = tbdConstruction.name; int mIndex = 1; TBD.material tbdMaterial = null; double thickness = 0; while ((tbdMaterial = tbdConstruction.materials(mIndex)) != null) { construction.Layers.Add(tbdMaterial.FromTAS(tbdConstruction)); (construction.Layers.Last()).Thickness = (tbdConstruction.materialWidth[mIndex] == 0 ? (construction.Layers.Last()).Thickness : tbdConstruction.materialWidth[mIndex]); // temp solution set material thickness as value from construction.material.thickness thickness += construction.Layers.Last().Thickness; mIndex++; } //construction.FFactor = tbdConstruction.FFactor; TASDescription tasData = new TASDescription(); tasData.Description = tbdConstruction.description.RemoveBrackets(); construction.Fragments.Add(tasData); return(construction); }
public static TBD.zone ToTAS(this BHE.Space space, TBD.zone tbdSpace) { //TODO:Assign Internal Conditions to Zones //TODO:Assign Building Elements (Surfaces) to Zones if (space == null) { return(tbdSpace); } tbdSpace.name = space.Name; BHP.LoadFragment loads = space.FindFragment <BHP.LoadFragment>(typeof(BHP.LoadFragment)); if (loads != null) { tbdSpace.maxHeatingLoad = (float)loads.HeatingLoad; tbdSpace.maxCoolingLoad = (float)loads.CoolingLoad; } TASSpaceData tasFragment = space.FindFragment <TASSpaceData>(typeof(TASSpaceData)); if (tasFragment != null) { tbdSpace.colour = tasFragment.Colour; tbdSpace.daylightFactor = (float)tasFragment.DaylightFactor; tbdSpace.exposedPerimeter = (float)tasFragment.ExposedPerimeter; tbdSpace.external = tasFragment.External; tbdSpace.facadeLength = (float)tasFragment.FacadeLength; tbdSpace.fixedConvectionCoefficient = (float)tasFragment.FixedConvectionCoefficient; tbdSpace.floorArea = (float)tasFragment.FloorArea; tbdSpace.GUID = tasFragment.TASID; tbdSpace.length = (float)tasFragment.Length; tbdSpace.sizeCooling = tasFragment.SizeCooling; tbdSpace.sizeHeating = tasFragment.SizeHeating; tbdSpace.volume = (float)tasFragment.Volume; tbdSpace.wallFloorAreaRatio = (float)tasFragment.WallFloorAreaRatio; } TASDescription tasDescription = space.FindFragment <TASDescription>(typeof(TASDescription)); if (tasFragment != null) { tbdSpace.description = tasDescription.Description; } return(tbdSpace); }
public static TBD.profile ToTAS(this BHE.Profile profile, TBD.profile tbdProfile) { if (profile == null) { return(tbdProfile); } tbdProfile.name = profile.Name; TASDescription tasFragment = profile.FindFragment <TASDescription>(typeof(TASDescription)); if (tasFragment != null) { tbdProfile.description = tasFragment.Description; } return(tbdProfile); }
public static BHE.Equipment FromTAS(this TBD.Emitter tbdEmitter) { if (tbdEmitter == null) { return(null); } BHE.Equipment emitter = new BHE.Equipment(); emitter.Name = tbdEmitter.name; emitter.RadiantFraction = tbdEmitter.radiantProportion; TASDescription tasData = new TASDescription(); tasData.Description = tbdEmitter.description.RemoveBrackets(); emitter.Fragments.Add(tasData); return(emitter); }
public static TBD.Emitter ToTAS(this BHE.Equipment emitter, TBD.Emitter tbdEmitter) { //TODO:Gain list (Heating and Cooling factors) are not pushed. The View Coefficient, Radiant Proportion, Temperatures are pushed. Capacity Compensation is not pushed. if (emitter == null) { return(tbdEmitter); } tbdEmitter.name = emitter.Name; tbdEmitter.radiantProportion = (float)emitter.RadiantFraction; TASDescription tasFragment = emitter.FindFragment <TASDescription>(typeof(TASDescription)); if (tasFragment != null) { tbdEmitter.description = tasFragment.Description; } return(tbdEmitter); }
public static BHE.Thermostat FromTAS(this TBD.Thermostat tbdThermostat) { if (tbdThermostat == null) { return(null); } BHE.Thermostat thermostat = new BHE.Thermostat(); thermostat.Name = tbdThermostat.name; thermostat.ControlRange = tbdThermostat.controlRange; thermostat.ProportionalControl = tbdThermostat.proportionalControl != 0; TASThermostatData tasData = new TASThermostatData(); TASDescription tasDescription = new TASDescription(); tasData.RadiantProportion = tbdThermostat.radiantProportion; tasDescription.Description = tbdThermostat.description; thermostat.Fragments.Add(tasData); thermostat.Fragments.Add(tasDescription); thermostat.Profiles = tbdThermostat.Profiles(); return(thermostat); }
public static BHE.Space FromTAS(this TBD.zone tbdSpace, TBD.TBDDocument tbdDocument) { BHE.Space space = new BHE.Space(); space.Name = tbdSpace.name + tbdSpace.number.ToString(); BHP.LoadFragment loads = new BHP.LoadFragment(); loads.CoolingLoad = tbdSpace.maxCoolingLoad; loads.HeatingLoad = tbdSpace.maxHeatingLoad; space.Fragments.Add(loads); //Adding data to Extended Poroperties-------------------------------------------------------------------------------------------------------------- //EnvironmentContextProperties BHP.OriginContextFragment environmentContextProperties = new BHP.OriginContextFragment(); environmentContextProperties.ElementID = tbdSpace.GUID.RemoveBrackets(); environmentContextProperties.Description = tbdSpace.description; environmentContextProperties.TypeName = tbdSpace.name; space.Fragments.Add(environmentContextProperties); //SpaceContextProperties BHP.SpaceContextFragment spaceContextProperties = new BHP.SpaceContextFragment(); spaceContextProperties.Colour = BH.Engine.Adapters.TAS.Query.GetRGB(tbdSpace.colour).ToString(); spaceContextProperties.IsExternal = tbdSpace.external != 0; //spaceContextProperties.ConnectedElements = tbdSpace.external != 0; space.Fragments.Add(spaceContextProperties); //SpaceAnalyticalProperties BHP.SpaceAnalyticalFragment spaceAnalyticalProperties = new BHP.SpaceAnalyticalFragment(); spaceAnalyticalProperties.DaylightFactor = tbdSpace.daylightFactor; spaceAnalyticalProperties.FacadeLength = tbdSpace.facadeLength; spaceAnalyticalProperties.FixedConvectionCoefficient = tbdSpace.fixedConvectionCoefficient; spaceAnalyticalProperties.SizeCoolingMethod = ((TBD.SizingType)tbdSpace.sizeCooling).FromTAS(); spaceAnalyticalProperties.SizeHeatingMethod = ((TBD.SizingType)tbdSpace.sizeCooling).FromTAS(); space.Fragments.Add(spaceAnalyticalProperties); //Extended Properties TASSpaceData tasData = new TASSpaceData(); tasData.Colour = System.Convert.ToUInt32(tbdSpace.colour); tasData.DaylightFactor = tbdSpace.daylightFactor; tasData.ExposedPerimeter = tbdSpace.exposedPerimeter; tasData.External = tbdSpace.external; tasData.FacadeLength = tbdSpace.facadeLength; tasData.FixedConvectionCoefficient = tbdSpace.fixedConvectionCoefficient; tasData.FloorArea = tbdSpace.floorArea; tasData.TASID = tbdSpace.GUID.RemoveBrackets(); tasData.Length = tbdSpace.length; tasData.SizeCooling = tbdSpace.sizeCooling; tasData.SizeHeating = tbdSpace.sizeHeating; tasData.Volume = tbdSpace.volume; tasData.WallFloorAreaRatio = tbdSpace.wallFloorAreaRatio; TASDescription tasDescription = new TASDescription(); tasDescription.Description = tbdSpace.description; //Proces to extract Number of people directly into space if needed //double[] YearlyPeopleSensibleSepcificGain = Query.GetNumberOfPeople(tbdDocument, tbdSpace); //double MaxSpecificSensibleGain = YearlyPeopleSensibleSepcificGain.Max(); //double[] YearlyPeopleLatenteSepcificGain = Query.GetNumberOfPeople(tbdDocument, tbdSpace, TBD.Profiles.ticOLG); //double MaxSpecificLatentGain = YearlyPeopleLatenteSepcificGain.Max(); //double NumberOfPeople = PeopleDesity / tbdSpace.floorArea; space.Fragments.Add(tasData); space.Fragments.Add(tasDescription); return(space); }
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); }
public static TBD.Construction ToTAS(this BHPC.Construction construction, TBD.Construction tbdConstruction) { if (construction == null) { return(tbdConstruction); } if (construction.Layers == null) { return(tbdConstruction); } if (tbdConstruction == null) { return(tbdConstruction); } tbdConstruction.name = construction.Name; //tbdConstruction.additionalHeatTransfer = (float)construction.AdditionalHeatTransfer(); //tbdConstruction.FFactor = (float)construction.FFactor; //ToDo: Fix these from the fragment after fragment implementation if (construction.Layers.Count > 0 && construction.Layers[0].Material != null) { if (construction.Layers[0].Material.IsTransparent()) { tbdConstruction.type = TBD.ConstructionTypes.tcdTransparentConstruction; } else { tbdConstruction.type = TBD.ConstructionTypes.tcdOpaqueConstruction; } } //tbdConstruction.GUID = construction.BHoM_Guid.ToString(); foreach (BH.oM.Physical.Constructions.Layer layer in construction.Layers) { layer.ToTAS(tbdConstruction.AddMaterial()); } ////copy construction thickness to material thickness //if (tbdConstruction.type == TBD.ConstructionTypes.tcdOpaqueConstruction) //{ // int mIndex = 1; // TBD.material m = null; // while ((m = tbdConstruction.materials(mIndex)) != null) // { // tbdConstruction.materials = tbdConstruction.materialWidth[mIndex]; // //tbdConstruction.materialWidth[mIndex] = (float)((construction.Materials.Where(x => x.Name == m.name).FirstOrDefault() as BHM.Material).Thickness); // mIndex++; // } //} //if (tbdConstruction.type == TBD.ConstructionTypes.tcdOpaqueConstruction) //{ int mIndex = 1; TBD.material m = null; while ((m = tbdConstruction.materials(mIndex)) != null) { if (construction.Layers.Where(x => x.Material.Name == m.name).FirstOrDefault() != null) { tbdConstruction.materialWidth[mIndex] = (float)(construction.Layers.Where(x => x.Material.Name == m.name).FirstOrDefault().Thickness); } mIndex++; } TASDescription tasFragment = construction.FindFragment <TASDescription>(typeof(TASDescription)); if (tasFragment != null) { tbdConstruction.description = tasFragment.Description; } return(tbdConstruction); }