Example #1
0
        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);
        }
Example #2
0
        public static BHR.SimulationResult FromTAS(this TSD.ZoneData tsdData, BHR.ProfileResultUnit unitType, BHR.ProfileResultType resultType, int hour, int day)
        {
            TSD.tsdZoneArray?zoneType = resultType.ToTASSpaceType();
            if (zoneType == null)
            {
                BH.Engine.Base.Compute.RecordError("That Result Type is not valid for Space results - please choose a different result type");
                return(null);
            }

            List <double> results = new List <double>();

            switch (unitType)
            {
            case BHR.ProfileResultUnit.Yearly:
                object yearRes = tsdData.GetAnnualZoneResult((int)zoneType.Value);
                results = ToDoubleList(yearRes);
                break;

            case BHR.ProfileResultUnit.Daily:
                if (day < 1 || day > 365)
                {
                    BH.Engine.Base.Compute.RecordError("Please set a day between 1 and 365 inclusive");
                    return(null);
                }
                object dayRes = tsdData.GetDailyZoneResult(day, (int)zoneType.Value);
                results = ToDoubleList(dayRes);
                break;

            case BHR.ProfileResultUnit.Hourly:
                if (hour < 1 || hour > 24)
                {
                    BH.Engine.Base.Compute.RecordError("Please set an hour between 1 and 24 inclusive");
                    return(null);
                }
                results.Add(tsdData.GetHourlyZoneResult(hour, (int)zoneType.Value));
                break;

            default:
                BH.Engine.Base.Compute.RecordError("That unit type is not valid for pulling results from TAS TSD. Please select a different result unit type");
                return(null);
            }

            BHR.SimulationResult result = new BHR.SimulationResult();
            result.SimulationResultType = BHR.SimulationResultType.SpaceResult;
            result.SimulationResults.Add(new BHR.ProfileResult {
                Name = tsdData.name, Type = resultType, Unit = unitType, Results = results
            });

            return(result);
        }
Example #3
0
        public static List <ZoneData> GetZonesData(ZoneDataGroup ZoneDataGroup)
        {
            List <ZoneData> aZoneDataGroupList = new List <ZoneData>();

            int aIndex = 1;

            TSD.ZoneData aZoneData = ZoneDataGroup.pZoneDataGroup.GetZoneData(aIndex);
            while (aZoneData != null)
            {
                aZoneDataGroupList.Add(new ZoneData(aZoneData));
                aIndex++;
                aZoneData = ZoneDataGroup.pZoneDataGroup.GetZoneData(aIndex);
            }
            return(aZoneDataGroupList);
        }
        /// <summary>
        /// Gets Zone Data
        /// </summary>
        /// <param name="CoolingDesignData">TSD Cooling Design Data</param>
        /// <returns name="ZoneData">Zone Data</returns>
        /// <search>
        /// TAS, TBDDocument, TBDDocument, CoolingDesignData, Get Cooling Design Data ZoneData, tas, tsddocument, CoolingDesignData, coolingdesigndata, ZoneData, zonedata, Zone Data, zone data
        /// </search>
        public static List <ZoneData> ZoneData(CoolingDesignData CoolingDesignData)
        {
            List <ZoneData> aZoneDataList = new List <ZoneData>();

            int aIndex = 0;

            TSD.ZoneData aZone = CoolingDesignData.pCoolingDesignData.GetZoneData(aIndex);
            while (aZone != null)
            {
                aZoneDataList.Add(new ZoneData(aZone));
                aIndex++;
                aZone = CoolingDesignData.pCoolingDesignData.GetZoneData(aIndex);
            }
            return(aZoneDataList);
        }
Example #5
0
        /// <summary>
        /// Gets Zones Data
        /// </summary>
        /// <param name="BuildingData">TSD Building Design Data</param>
        /// <returns name="ZonesData">Zones Data</returns>
        /// <search>
        /// TAS, TSDDocument, TSDDocument, BuildingData, Get Building Data ZoneData, tas, tsddocument, buildingdata, ZonesData, zonesdata, Zones Data, zones data
        /// </search>
        public static List <ZoneData> ZonesData(BuildingData BuildingData)
        {
            List <ZoneData> aResult = new List <ZoneData>();

            int aIndex = 1;

            TSD.ZoneData aZoneData = BuildingData.pBuildingData.GetZoneData(aIndex);
            while (aZoneData != null)
            {
                aResult.Add(new ZoneData(aZoneData));
                aIndex++;
                aZoneData = BuildingData.pBuildingData.GetZoneData(aIndex);
            }

            return(aResult);
        }
        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);
        }
Example #7
0
        public static Dictionary <Analytical.SpaceSimulationResultParameter, object> Overheating(TSD.ZoneData zoneData, int index_Start, int index_End)
        {
            if (zoneData == null)
            {
                return(null);
            }

            Dictionary <TSD.tsdZoneArray, float[]> dictionary = new Dictionary <TSD.tsdZoneArray, float[]>();

            dictionary[TSD.tsdZoneArray.occupantSensibleGain] = new float[8760];
            dictionary[TSD.tsdZoneArray.resultantTemp]        = new float[8760];
            dictionary[TSD.tsdZoneArray.dryBulbTemp]          = new float[8760];

            for (int i = index_Start; i <= index_End; i++)
            {
                foreach (TSD.tsdZoneArray tsdZoneArray in dictionary.Keys)
                {
                    float[] yearlyValues = dictionary[tsdZoneArray];
                    float[] dailyValues  = (zoneData.GetDailyZoneResult(i, (short)tsdZoneArray) as IEnumerable).Cast <float>().ToArray();
                    int     startHour    = (i * 24) - 24;
                    int     counter      = 0;
                    for (int n = startHour; n <= startHour + 23; n++)
                    {
                        yearlyValues[n] = dailyValues[counter];
                        counter        += 1;
                    }
                    //dictionary[tsdZoneArray] = yearlyValues;
                }
            }

            float[] occupancySensibleGains = dictionary[TSD.tsdZoneArray.occupantSensibleGain];
            float[] resultantTemperatures  = dictionary[TSD.tsdZoneArray.resultantTemp];
            float[] dryBulbTemperatures    = dictionary[TSD.tsdZoneArray.dryBulbTemp];

            float temperature_Max       = float.MinValue;
            int   temperature_Max_Index = -1;
            float temperature_Min       = float.MaxValue;
            int   temperature_Min_Index = -1;

            //item1 resultantTemp > 25
            //item2 resultantTemp > 28
            int[]   temperatures_Count = new int[] { 0, 0 };
            float[] temperatures       = new float[] { 25, 28 };
            int     occupiedHours      = 0;

            for (int i = 0; i < 8760; i++)
            {
                //Max and Min Temp
                float aTemp = dryBulbTemperatures[i];
                if (aTemp > temperature_Max)
                {
                    temperature_Max       = aTemp;
                    temperature_Max_Index = i;
                }

                if (aTemp < temperature_Min)
                {
                    temperature_Min       = aTemp;
                    temperature_Min_Index = i;
                }

                // does the zone have occupancy
                if (occupancySensibleGains[i] > 0)
                {
                    //We are taking temperature data for to cases: greater than 25 and greated than 28 resultantTemperature
                    for (int n = 0; n < temperatures.Length; n++)
                    {
                        if (resultantTemperatures[i] > temperatures[n])
                        {
                            temperatures_Count[n]++;
                        }
                    }

                    occupiedHours++;
                }
            }

            Dictionary <Analytical.SpaceSimulationResultParameter, object> result = new Dictionary <Analytical.SpaceSimulationResultParameter, object>();

            result[Analytical.SpaceSimulationResultParameter.OccupiedHours]              = occupiedHours;
            result[Analytical.SpaceSimulationResultParameter.OccupiedHours25]            = temperatures_Count[0];
            result[Analytical.SpaceSimulationResultParameter.OccupiedHours28]            = temperatures_Count[1];
            result[Analytical.SpaceSimulationResultParameter.MaxDryBulbTemperatureIndex] = temperature_Max_Index;
            result[Analytical.SpaceSimulationResultParameter.MinDryBulbTemperatureIndex] = temperature_Min_Index;
            result[Analytical.SpaceSimulationResultParameter.MaxDryBulbTemperature]      = temperature_Max;
            result[Analytical.SpaceSimulationResultParameter.MinDryBulbTemperature]      = temperature_Min;

            return(result);
        }
Example #8
0
 internal ZoneData(TSD.ZoneData ZoneData)
 {
     pZoneData = ZoneData;
 }