Пример #1
0
        public static ProjectInfo ToRevit(this AdjacencyClusterSimulationResult adjacencyClusterSimulationResult, Document document, ConvertSettings convertSettings)
        {
            if (adjacencyClusterSimulationResult == null || document == null)
            {
                return(null);
            }

            ProjectInfo result = convertSettings?.GetObject <ProjectInfo>(adjacencyClusterSimulationResult.Guid);

            if (result != null)
            {
                return(result);
            }

            result = document.ProjectInformation;

            if (convertSettings.ConvertParameters)
            {
                if (result != null)
                {
                    Core.Revit.Modify.SetValues(result, adjacencyClusterSimulationResult);
                    Core.Revit.Modify.SetValues(result, adjacencyClusterSimulationResult, ActiveSetting.Setting);
                    Modify.SetValues(result, adjacencyClusterSimulationResult, ActiveSetting.Setting, adjacencyClusterSimulationResult.LoadType());
                }
            }

            convertSettings?.Add(adjacencyClusterSimulationResult.Guid, result);

            return(result);
        }
Пример #2
0
        public static AdjacencyClusterSimulationResult AdjacencyClusterSimulationResult(this BuildingData buildingData)
        {
            if (buildingData == null)
            {
                return(null);
            }

            AdjacencyClusterSimulationResult result = new AdjacencyClusterSimulationResult(buildingData.name, Assembly.GetExecutingAssembly().GetName()?.Name, buildingData.GUID);

            return(result);
        }
Пример #3
0
        public static List <Core.Result> UnmetHours(string path_TSD, string path_TBD, double margin = 0.5)
        {
            if (string.IsNullOrWhiteSpace(path_TSD) || !File.Exists(path_TSD))
            {
                return(null);
            }

            if (string.IsNullOrWhiteSpace(path_TBD) || !File.Exists(path_TBD))
            {
                return(null);
            }

            Dictionary <TBD.Profiles, Dictionary <string, double[]> > temperatureSetPointDictionary = null;

            using (SAMTBDDocument sAMTBDDocument = new SAMTBDDocument(path_TBD, true))
            {
                temperatureSetPointDictionary = sAMTBDDocument.TBDDocument?.Building?.TemperatureSetPointDictionary(TBD.Profiles.ticLL, TBD.Profiles.ticUL);
                sAMTBDDocument.Close();
            }

            if (temperatureSetPointDictionary == null || temperatureSetPointDictionary.Count == 0)
            {
                return(null);
            }

            Dictionary <tsdZoneArray, Dictionary <string, double[]> > yearlyValues      = null;
            Dictionary <string, SpaceSimulationResult> dictionary_SpaceSimulationResult = null;
            AdjacencyClusterSimulationResult           adjacencyClusterSimulationResult = null;

            using (SAMTSDDocument sAMTSDDocument = new SAMTSDDocument(path_TSD, true))
            {
                BuildingData buildingData = sAMTSDDocument.TSDDocument?.SimulationData?.GetBuildingData();
                if (buildingData != null)
                {
                    adjacencyClusterSimulationResult = Create.AdjacencyClusterSimulationResult(buildingData);
                    yearlyValues = sAMTSDDocument.TSDDocument?.SimulationData?.GetBuildingData()?.YearlyValues(new tsdZoneArray[] { tsdZoneArray.dryBulbTemp, tsdZoneArray.occupantSensibleGain });

                    dictionary_SpaceSimulationResult = new Dictionary <string, SpaceSimulationResult>();
                    foreach (KeyValuePair <string, ZoneData> keyValuePair in buildingData.ZoneDataDictionary())
                    {
                        dictionary_SpaceSimulationResult[keyValuePair.Key] = Create.SpaceSimulationResult(keyValuePair.Value);
                    }
                }
            }

            Dictionary <string, bool[]> dictionary_Heating = null;
            Dictionary <string, bool[]> dictionary_Cooling = null;

            if (yearlyValues != null && yearlyValues.Count != 0)
            {
                dictionary_Heating = Compare(temperatureSetPointDictionary[TBD.Profiles.ticLL], yearlyValues[tsdZoneArray.dryBulbTemp], margin, LoadType.Heating);
                if (dictionary_Heating == null)
                {
                    return(null);
                }

                dictionary_Cooling = Compare(temperatureSetPointDictionary[TBD.Profiles.ticUL], yearlyValues[tsdZoneArray.dryBulbTemp], margin, LoadType.Cooling);
                if (dictionary_Cooling == null)
                {
                    return(null);
                }
            }

            Dictionary <string, bool[]> dictionary_OccupantSensibleGain = new Dictionary <string, bool[]>();

            foreach (KeyValuePair <string, double[]> aKeyValuePair in yearlyValues[tsdZoneArray.occupantSensibleGain])
            {
                dictionary_OccupantSensibleGain.Add(aKeyValuePair.Key, aKeyValuePair.Value.ToList().ConvertAll(x => x > 0).ToArray());
            }

            List <Core.Result> result = new List <Core.Result>();

            foreach (KeyValuePair <string, SpaceSimulationResult> keyValuePair in dictionary_SpaceSimulationResult)
            {
                SpaceSimulationResult spaceSimulationResult = keyValuePair.Value;
                if (spaceSimulationResult == null)
                {
                    continue;
                }

                if (dictionary_OccupantSensibleGain.TryGetValue(keyValuePair.Key, out bool[] occupantSensibleGain))