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 bool UpdateInternalCondition_HDD(this TBD.InternalCondition internalCondition_TBD, InternalCondition internalCondition, ProfileLibrary profileLibrary) { if (internalCondition_TBD == null || internalCondition == null) { return(false); } internalCondition_TBD.description = internalCondition.Name + " - HDD"; internalCondition_TBD.includeSolarInMRT = 0; TBD.Emitter emitter = null; double value = double.NaN; emitter = internalCondition_TBD.GetHeatingEmitter(); if (emitter != null) { if (internalCondition.TryGetValue(InternalConditionParameter.HeatingEmitterRadiantProportion, out value)) { emitter.radiantProportion = System.Convert.ToSingle(value); } if (internalCondition.TryGetValue(InternalConditionParameter.HeatingEmitterCoefficient, out value)) { emitter.viewCoefficient = System.Convert.ToSingle(value); } } emitter = internalCondition_TBD.GetCoolingEmitter(); if (emitter != null) { if (internalCondition.TryGetValue(InternalConditionParameter.CoolingEmitterRadiantProportion, out value)) { emitter.radiantProportion = System.Convert.ToSingle(value); } if (internalCondition.TryGetValue(InternalConditionParameter.CoolingEmitterCoefficient, out value)) { emitter.viewCoefficient = System.Convert.ToSingle(value); } } TBD.InternalGain internalGain = internalCondition_TBD.GetInternalGain(); internalGain.name = internalCondition.Name + " - HDD"; Profile profile = null; profile = internalCondition.GetProfile(ProfileType.Infiltration, profileLibrary); if (profile != null) { if (internalCondition.TryGetValue(InternalConditionParameter.InfiltrationAirChangesPerHour, out value)) { TBD.profile profile_TBD = internalGain.GetProfile((int)TBD.Profiles.ticI); if (profile_TBD != null) { profile_TBD.name = profile.Name; profile_TBD.type = TBD.ProfileTypes.ticValueProfile; profile_TBD.factor = 1; profile_TBD.value = System.Convert.ToSingle(value); } } } TBD.Thermostat thermostat = internalCondition_TBD.GetThermostat(); if (thermostat != null) { thermostat.controlRange = 0; thermostat.proportionalControl = 0; profile = internalCondition.GetProfile(ProfileType.Heating, profileLibrary); if (profile != null) { thermostat.name = profile.Name; TBD.profile profile_TBD = thermostat.GetProfile((int)TBD.Profiles.ticLL); if (profile_TBD != null) { value = profile.MaxValue; if (!double.IsNaN(value)) { profile_TBD.name = profile.Name; profile_TBD.type = TBD.ProfileTypes.ticValueProfile; profile_TBD.factor = 1; profile_TBD.value = System.Convert.ToSingle(value); } } } } return(true); }
public static bool UpdateInternalCondition(this TBD.InternalCondition internalCondition_TBD, Space space, ProfileLibrary profileLibrary) { if (space == null || internalCondition_TBD == null) { return(false); } InternalCondition internalCondition = space.InternalCondition; if (internalCondition == null) { return(false); } internalCondition_TBD.name = space.Name; internalCondition_TBD.description = internalCondition.Name; internalCondition_TBD.includeSolarInMRT = 1; TBD.Emitter emitter = null; double value = double.NaN; emitter = internalCondition_TBD.GetHeatingEmitter(); if (emitter != null) { emitter.name = internalCondition.GetSystemTypeName <HeatingSystemType>(); if (internalCondition.TryGetValue(InternalConditionParameter.HeatingEmitterRadiantProportion, out value)) { emitter.radiantProportion = System.Convert.ToSingle(value); } if (internalCondition.TryGetValue(InternalConditionParameter.HeatingEmitterCoefficient, out value)) { emitter.viewCoefficient = System.Convert.ToSingle(value); } } emitter = internalCondition_TBD.GetCoolingEmitter(); if (emitter != null) { emitter.name = internalCondition.GetSystemTypeName <CoolingSystemType>(); if (internalCondition.TryGetValue(InternalConditionParameter.CoolingEmitterRadiantProportion, out value)) { emitter.radiantProportion = System.Convert.ToSingle(value); } if (internalCondition.TryGetValue(InternalConditionParameter.CoolingEmitterCoefficient, out value)) { emitter.viewCoefficient = System.Convert.ToSingle(value); } } TBD.InternalGain internalGain = internalCondition_TBD.GetInternalGain(); if (internalCondition.TryGetValue(InternalConditionParameter.LightingRadiantProportion, out value)) { internalGain.lightingRadProp = System.Convert.ToSingle(value); } if (internalCondition.TryGetValue(InternalConditionParameter.OccupancyRadiantProportion, out value)) { internalGain.occupantRadProp = System.Convert.ToSingle(value); } if (internalCondition.TryGetValue(InternalConditionParameter.EquipmentRadiantProportion, out value)) { internalGain.equipmentRadProp = System.Convert.ToSingle(value); } if (internalCondition.TryGetValue(InternalConditionParameter.LightingViewCoefficient, out value)) { internalGain.lightingViewCoefficient = System.Convert.ToSingle(value); } if (internalCondition.TryGetValue(InternalConditionParameter.OccupancyViewCoefficient, out value)) { internalGain.occupantViewCoefficient = System.Convert.ToSingle(value); } if (internalCondition.TryGetValue(InternalConditionParameter.EquipmentViewCoefficient, out value)) { internalGain.equipmentViewCoefficient = System.Convert.ToSingle(value); } internalGain.domesticHotWater = (float)0.197; internalGain.name = internalCondition.Name; internalGain.description = internalCondition.GetSystemTypeName <VentilationSystemType>(); if (internalCondition.TryGetValue(InternalConditionParameter.LightingLevel, out value)) { internalGain.targetIlluminance = System.Convert.ToSingle(value); } internalGain.personGain = 0; double occupancyGainPerPerson = Analytical.Query.OccupancyGainPerPerson(space); if (!double.IsNaN(occupancyGainPerPerson)) { internalGain.personGain = System.Convert.ToSingle(occupancyGainPerPerson); } Profile profile = null; profile = internalCondition.GetProfile(ProfileType.Infiltration, profileLibrary); if (profile != null) { if (internalCondition.TryGetValue(InternalConditionParameter.InfiltrationAirChangesPerHour, out value)) { TBD.profile profile_TBD = internalGain.GetProfile((int)TBD.Profiles.ticI); if (profile_TBD != null) { Update(profile_TBD, profile, value); } } } double area = double.NaN; if (!space.TryGetValue(SpaceParameter.Area, out area)) { area = double.NaN; } profile = internalCondition.GetProfile(ProfileType.Lighting, profileLibrary); if (profile != null) { TBD.profile profile_TBD = internalGain.GetProfile((int)TBD.Profiles.ticLG); if (profile_TBD != null) { double gain = Analytical.Query.CalculatedLightingGain(space); if (double.IsNaN(area) || area == 0 || double.IsNaN(gain)) { gain = 0; } else { gain = gain / area; } Update(profile_TBD, profile, gain); } } profile = internalCondition.GetProfile(ProfileType.Occupancy, profileLibrary); if (profile != null) { TBD.profile profile_TBD = null; profile_TBD = internalGain.GetProfile((int)TBD.Profiles.ticOLG); if (profile_TBD != null) { double gain = Analytical.Query.OccupancyLatentGain(space); if (double.IsNaN(area) || area == 0 || double.IsNaN(gain)) { gain = 0; } else { gain = gain / area; } Update(profile_TBD, profile, gain); } profile_TBD = internalGain.GetProfile((int)TBD.Profiles.ticOSG); if (profile_TBD != null) { double gain = Analytical.Query.OccupancySensibleGain(space); if (double.IsNaN(area) || area == 0 || double.IsNaN(gain)) { gain = 0; } else { gain = gain / area; } Update(profile_TBD, profile, gain); } } profile = internalCondition.GetProfile(ProfileType.EquipmentSensible, profileLibrary); if (profile != null) { TBD.profile profile_TBD = internalGain.GetProfile((int)TBD.Profiles.ticESG); if (profile_TBD != null) { double gain = Analytical.Query.CalculatedEquipmentSensibleGain(space); if (double.IsNaN(area) || area == 0 || double.IsNaN(gain)) { gain = 0; } else { gain = gain / area; } Update(profile_TBD, profile, gain); } } profile = internalCondition.GetProfile(ProfileType.EquipmentLatent, profileLibrary); if (profile != null) { TBD.profile profile_TBD = internalGain.GetProfile((int)TBD.Profiles.ticELG); if (profile_TBD != null) { double gain = Analytical.Query.CalculatedEquipmentLatentGain(space); if (double.IsNaN(area) || area == 0 || double.IsNaN(gain)) { gain = 0; } else { gain = gain / area; } Update(profile_TBD, profile, gain); } } profile = internalCondition.GetProfile(ProfileType.Pollutant, profileLibrary); if (profile != null) { TBD.profile profile_TBD = internalGain.GetProfile((int)TBD.Profiles.ticCOG); if (profile_TBD != null) { double generation = Analytical.Query.CalculatedPollutantGeneration(space); if (double.IsNaN(area) || area == 0 || double.IsNaN(generation)) { generation = 0; } else { generation = generation / area; } Update(profile_TBD, profile, generation); } } TBD.Thermostat thermostat = internalCondition_TBD.GetThermostat(); if (thermostat != null) { List <string> names = new List <string>(); thermostat.controlRange = 0; thermostat.proportionalControl = 0; profile = internalCondition.GetProfile(ProfileType.Cooling, profileLibrary); if (profile != null) { names.Add(profile.Name); TBD.profile profile_TBD = thermostat.GetProfile((int)TBD.Profiles.ticUL); if (profile_TBD != null) { Update(profile_TBD, profile, 1); } } profile = internalCondition.GetProfile(ProfileType.Heating, profileLibrary); if (profile != null) { names.Add(profile.Name); TBD.profile profile_TBD = thermostat.GetProfile((int)TBD.Profiles.ticLL); if (profile_TBD != null) { Update(profile_TBD, profile, 1); } } profile = internalCondition.GetProfile(ProfileType.Humidification, profileLibrary); if (profile != null) { names.Add(profile.Name); TBD.profile profile_TBD = thermostat.GetProfile((int)TBD.Profiles.ticHLL); if (profile_TBD != null) { Update(profile_TBD, profile, 1); } } profile = internalCondition.GetProfile(ProfileType.Dehumidification, profileLibrary); if (profile != null) { names.Add(profile.Name); TBD.profile profile_TBD = thermostat.GetProfile((int)TBD.Profiles.ticHUL); if (profile_TBD != null) { Update(profile_TBD, profile, 1); } } names.RemoveAll(x => string.IsNullOrWhiteSpace(x)); if (names.Count != 0) { thermostat.name = string.Join(" & ", names); } } return(true); }
public static InternalCondition ToSAM(this TBD.InternalCondition internalCondition, double area = double.NaN) { if (internalCondition == null) { return(null); } InternalCondition result = new InternalCondition(internalCondition.name); TBD.Emitter emitter = null; emitter = internalCondition.GetHeatingEmitter(); if (emitter != null) { result.SetValue(InternalConditionParameter.HeatingEmitterRadiantProportion, emitter.radiantProportion); result.SetValue(InternalConditionParameter.HeatingEmitterCoefficient, emitter.viewCoefficient); } emitter = internalCondition.GetCoolingEmitter(); if (emitter != null) { result.SetValue(InternalConditionParameter.CoolingEmitterRadiantProportion, emitter.radiantProportion); result.SetValue(InternalConditionParameter.CoolingEmitterCoefficient, emitter.viewCoefficient); } TBD.InternalGain internalGain = internalCondition.GetInternalGain(); if (internalGain != null) { result.SetValue(InternalConditionParameter.LightingRadiantProportion, internalGain.lightingRadProp); result.SetValue(InternalConditionParameter.OccupancyRadiantProportion, internalGain.occupantRadProp); result.SetValue(InternalConditionParameter.EquipmentRadiantProportion, internalGain.equipmentRadProp); result.SetValue(InternalConditionParameter.LightingViewCoefficient, internalGain.lightingViewCoefficient); result.SetValue(InternalConditionParameter.OccupancyViewCoefficient, internalGain.occupantViewCoefficient); result.SetValue(InternalConditionParameter.EquipmentViewCoefficient, internalGain.equipmentViewCoefficient); TBD.profile profile_TBD = null; profile_TBD = internalGain.GetProfile((int)TBD.Profiles.ticI); if (profile_TBD != null) { result.SetValue(InternalConditionParameter.InfiltrationProfileName, string.Format("{0} [{1}]", internalCondition.name, profile_TBD.name)); result.SetValue(InternalConditionParameter.InfiltrationAirChangesPerHour, profile_TBD.GetExtremeValue(true)); } profile_TBD = internalGain.GetProfile((int)TBD.Profiles.ticLG); if (profile_TBD != null) { result.SetValue(InternalConditionParameter.LightingProfileName, string.Format("{0} [{1}]", internalCondition.name, profile_TBD.name)); result.SetValue(InternalConditionParameter.LightingGainPerArea, profile_TBD.GetExtremeValue(true)); result.SetValue(InternalConditionParameter.LightingLevel, internalGain.targetIlluminance); } double personGain = internalGain.personGain; double gain = 0; profile_TBD = internalGain.GetProfile((int)TBD.Profiles.ticOSG); if (profile_TBD != null) { double value = profile_TBD.GetExtremeValue(true); result.SetValue(InternalConditionParameter.OccupancySensibleGainPerPerson, value); gain += value; } profile_TBD = internalGain.GetProfile((int)TBD.Profiles.ticOLG); if (profile_TBD != null) { double value = profile_TBD.GetExtremeValue(true); result.SetValue(InternalConditionParameter.OccupancyProfileName, string.Format("{0} [{1}]", internalCondition.name, profile_TBD.name)); result.SetValue(InternalConditionParameter.OccupancyLatentGainPerPerson, value); gain += value; } if (!double.IsNaN(area) && !double.IsNaN(gain)) { double occupancy = (gain * area) / personGain; result.SetValue(InternalConditionParameter.AreaPerPerson, area / occupancy); } profile_TBD = internalGain.GetProfile((int)TBD.Profiles.ticESG); if (profile_TBD != null) { result.SetValue(InternalConditionParameter.EquipmentSensibleProfileName, string.Format("{0} [{1}]", internalCondition.name, profile_TBD.name)); result.SetValue(InternalConditionParameter.EquipmentSensibleGainPerArea, profile_TBD.GetExtremeValue(true)); } profile_TBD = internalGain.GetProfile((int)TBD.Profiles.ticELG); if (profile_TBD != null) { result.SetValue(InternalConditionParameter.EquipmentLatentProfileName, string.Format("{0} [{1}]", internalCondition.name, profile_TBD.name)); result.SetValue(InternalConditionParameter.EquipmentLatentGainPerArea, profile_TBD.GetExtremeValue(true)); } profile_TBD = internalGain.GetProfile((int)TBD.Profiles.ticCOG); if (profile_TBD != null) { result.SetValue(InternalConditionParameter.PollutantProfileName, string.Format("{0} [{1}]", internalCondition.name, profile_TBD.name)); result.SetValue(InternalConditionParameter.PollutantGenerationPerArea, profile_TBD.GetExtremeValue(true)); } } TBD.Thermostat thermostat = internalCondition.GetThermostat(); if (internalGain != null) { TBD.profile profile_TBD = null; profile_TBD = thermostat.GetProfile((int)TBD.Profiles.ticUL); if (profile_TBD != null) { result.SetValue(InternalConditionParameter.CoolingProfileName, string.Format("{0} [{1}]", internalCondition.name, profile_TBD.name)); } profile_TBD = thermostat.GetProfile((int)TBD.Profiles.ticLL); if (profile_TBD != null) { result.SetValue(InternalConditionParameter.HeatingProfileName, string.Format("{0} [{1}]", internalCondition.name, profile_TBD.name)); } profile_TBD = thermostat.GetProfile((int)TBD.Profiles.ticHLL); if (profile_TBD != null) { result.SetValue(InternalConditionParameter.HumidificationProfileName, string.Format("{0} [{1}]", internalCondition.name, profile_TBD.name)); } profile_TBD = thermostat.GetProfile((int)TBD.Profiles.ticHUL); if (profile_TBD != null) { result.SetValue(InternalConditionParameter.DehumidificationProfileName, string.Format("{0} [{1}]", internalCondition.name, profile_TBD.name)); } } return(result); }
internal Emitter(TBD.Emitter Emitter) { pEmitter = Emitter; }