public static Space ToSAM(this TSD.ZoneData zoneData, IEnumerable <SpaceDataType> spaceDataTypes = null) { ParameterSet parameterSet = Create.ParameterSet_Space(ActiveSetting.Setting, zoneData); if (spaceDataTypes != null) { foreach (SpaceDataType spaceDataType in spaceDataTypes) { List <double> values = zoneData.AnnualZoneResult <double>(spaceDataType); if (values == null) { continue; } JArray jArray = new JArray(); values.ForEach(x => jArray.Add(x)); parameterSet.Add(spaceDataType.Text(), jArray); } } Space space = new Space(zoneData.name, null); space.Add(parameterSet); return(space); }
public static SpaceSimulationResult ToSAM_SpaceSimulationResult(this TSD.ZoneData zoneData, IEnumerable <SpaceDataType> spaceDataTypes = null) { SpaceSimulationResult result = new SpaceSimulationResult(zoneData.name, Assembly.GetExecutingAssembly().GetName()?.Name, zoneData.zoneGUID); result.SetValue("Zone Number", zoneData.zoneNumber); result.SetValue("Description", zoneData.description); result.SetValue("Convective Weighting Factors Count", zoneData.nConvWeightingFactors); result.SetValue("Radiat Weighting Factors Count", zoneData.nRadWeightingFactors); result.SetValue(Analytical.SpaceSimulationResultParameter.Area, zoneData.floorArea); result.SetValue(Analytical.SpaceSimulationResultParameter.Volume, zoneData.volume); result.SetValue("Convective Common Ratio", zoneData.convectiveCommonRatio); result.SetValue("Radiat Common Ratio", zoneData.radiantCommonRatio); ParameterSet parameterSet = Create.ParameterSet_SpaceSimulationResult(ActiveSetting.Setting, zoneData); if (spaceDataTypes != null) { foreach (SpaceDataType spaceDataType in spaceDataTypes) { List <double> values = zoneData.AnnualZoneResult <double>(spaceDataType); if (values == null) { continue; } JArray jArray = new JArray(); values.ForEach(x => jArray.Add(x)); parameterSet.Add(spaceDataType.Text(), jArray); } } result.Add(parameterSet); result.SetValue(SpaceSimulationResultParameter.ZoneGuid, zoneData.zoneGUID); return(result); }