예제 #1
0
        /// <summary>
        /// This is the method that actually does the work.
        /// </summary>
        /// <param name="dataAccess">The DA object is used to retrieve from inputs and store in outputs.</param>
        protected override void SolveInstance(IGH_DataAccess dataAccess)
        {
            dataAccess.SetData(1, false);

            bool run = false;

            if (!dataAccess.GetData(1, ref run))
            {
                AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data");
                return;
            }
            if (!run)
            {
                return;
            }

            string path_TBD = null;

            if (!dataAccess.GetData(0, ref path_TBD) || string.IsNullOrWhiteSpace(path_TBD))
            {
                AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data");
                return;
            }

            AnalyticalModel analyticalModel = null;

            using (SAMTBDDocument sAMTBDDocument = new SAMTBDDocument(path_TBD))
            {
                analyticalModel = Analytical.Tas.Convert.ToSAM(sAMTBDDocument);
            }
            dataAccess.SetData(0, analyticalModel);
            dataAccess.SetData(1, analyticalModel != null);
        }
예제 #2
0
        public static WeatherData ToSAM_WeatherData(string path)
        {
            if (string.IsNullOrWhiteSpace(path))
            {
                return(null);
            }

            WeatherData result = null;

            string extension = System.IO.Path.GetExtension(path).ToLower().Trim();

            if (extension.EndsWith("tbd"))
            {
                using (SAMTBDDocument sAMTBDDocument = new SAMTBDDocument(path))
                {
                    result = ToSAM_WeatherData(sAMTBDDocument);
                }
            }
            else if (extension.EndsWith("tsd"))
            {
                using (SAMTSDDocument sAMTSDDocument = new SAMTSDDocument(path))
                {
                    result = ToSAM_WeatherData(sAMTSDDocument);
                }
            }

            return(result);
        }
예제 #3
0
        public static List <Guid> UpdateApertureControl(this SAMTBDDocument sAMTBDDocument, IEnumerable <ApertureConstruction> apertureConstructions)
        {
            if (sAMTBDDocument == null)
            {
                return(null);
            }

            return(UpdateApertureControl(sAMTBDDocument.TBDDocument, apertureConstructions));
        }
예제 #4
0
        public static List <Guid> AddDesignDays(this SAMTBDDocument sAMTBDDocument, IEnumerable <DesignDay> coolingDesignDays, IEnumerable <DesignDay> heatingDesignDays, int repetitions = 30)
        {
            if (sAMTBDDocument == null)
            {
                return(null);
            }

            return(AddDesignDays(sAMTBDDocument.TBDDocument, coolingDesignDays, heatingDesignDays, repetitions));
        }
예제 #5
0
        public static AnalyticalModel ToSAM(this SAMTBDDocument sAMTBDDocument)
        {
            if (sAMTBDDocument == null)
            {
                return(null);
            }

            return(ToSAM(sAMTBDDocument.TBDDocument));
        }
예제 #6
0
        public static List <Guid> AssignBuildingElementType(this SAMTBDDocument sAMTBDDocument, TBD.BuildingElementType buildingElementType, IEnumerable <string> names, bool caseSensitive = true, bool trim = false)
        {
            if (sAMTBDDocument == null)
            {
                return(null);
            }

            return(AssignBuildingElementType(sAMTBDDocument.TBDDocument, buildingElementType, names, caseSensitive, trim));
        }
예제 #7
0
        public static AnalyticalModel UpdateDesignLoads(this SAMTBDDocument sAMTBDDocument, AnalyticalModel analyticalModel)
        {
            if (sAMTBDDocument == null)
            {
                return(null);
            }

            return(UpdateDesignLoads(sAMTBDDocument.TBDDocument, analyticalModel));
        }
예제 #8
0
        public static List <SAMType> UpdateConstructions(this SAMTBDDocument sAMTBDDocument, AnalyticalModel analyticalModel)
        {
            if (sAMTBDDocument == null)
            {
                return(null);
            }

            return(UpdateConstructions(sAMTBDDocument.TBDDocument, analyticalModel));
        }
예제 #9
0
        public static bool UpdateBuildingElements(this SAMTBDDocument sAMTBDDocument, AnalyticalModel analyticalModel)
        {
            if (sAMTBDDocument == null)
            {
                return(false);
            }

            return(UpdateBuildingElements(sAMTBDDocument.TBDDocument, analyticalModel));
        }
예제 #10
0
        public static bool UpdateWeatherData(this SAMTBDDocument sAMTBDDocument, WeatherData weatherData)
        {
            if (sAMTBDDocument == null || weatherData == null)
            {
                return(false);
            }

            return(UpdateWeatherData(sAMTBDDocument.TBDDocument, weatherData));
        }
예제 #11
0
        public static bool UpdateZones(this AnalyticalModel analyticalModel, SAMTBDDocument sAMTBDDocument, bool includeHDD = false)
        {
            if (analyticalModel == null || sAMTBDDocument == null)
            {
                return(false);
            }

            return(UpdateZones(sAMTBDDocument.TBDDocument?.Building, analyticalModel, includeHDD));
        }
예제 #12
0
        public static WeatherData ToSAM_WeatherData(this SAMTBDDocument sAMTBDDocument)
        {
            if (sAMTBDDocument == null)
            {
                return(null);
            }

            return(ToSAM_WeatherData(sAMTBDDocument.TBDDocument));
        }
예제 #13
0
        public static List <string> RemoveSchedules(this SAMTBDDocument sAMTBDDocument, string sufix, bool caseSensitive = true, bool trim = false)
        {
            if (sAMTBDDocument == null)
            {
                return(null);
            }

            return(RemoveSchedules(sAMTBDDocument.TBDDocument, sufix, caseSensitive, trim));
        }
예제 #14
0
        public static List <string> UpdateIZAMs(this SAMTBDDocument sAMTBDDocument, IEnumerable <Space> spaces)
        {
            if (sAMTBDDocument == null)
            {
                return(null);
            }

            return(UpdateIZAMs(sAMTBDDocument.TBDDocument, spaces));
        }
예제 #15
0
        public static List <Guid> AssignAdiabaticConstruction(this SAMTBDDocument sAMTBDDocument, string constructionName_Adiabatic, IEnumerable <string> constructionNames_Sufixes, bool caseSensitive = true, bool trim = false)
        {
            if (sAMTBDDocument == null)
            {
                return(null);
            }

            return(AssignAdiabaticConstruction(sAMTBDDocument.TBDDocument, constructionName_Adiabatic, constructionNames_Sufixes, caseSensitive, trim));
        }
예제 #16
0
        public static List <Guid> SetBlinds(this SAMTBDDocument sAMTBDDocument, IEnumerable <ApertureConstruction> apertureConstructions)
        {
            if (sAMTBDDocument == null)
            {
                return(null);
            }

            return(SetBlinds(sAMTBDDocument.TBDDocument, apertureConstructions));
        }
예제 #17
0
        private static bool Sizing_PrepareDocument(string path_TBD, bool excludeOutdoorAir = true)
        {
            if (string.IsNullOrWhiteSpace(path_TBD) || !global::System.IO.File.Exists(path_TBD))
            {
                return(false);
            }

            bool result = false;

            using (SAMTBDDocument sAMTBDDocument = new SAMTBDDocument(path_TBD))
            {
                TBDDocument tBDDocument = sAMTBDDocument.TBDDocument;
                Building    building    = tBDDocument?.Building;
                if (building != null)
                {
                    SizingType sizingType = SizingType.tbdSizing;

                    List <zone> zones = building.Zones();
                    foreach (zone zone in zones)
                    {
                        zone.sizeCooling    = (int)sizingType;
                        zone.sizeHeating    = (int)sizingType;
                        zone.maxCoolingLoad = 0;
                        zone.maxHeatingLoad = 0;
                    }

                    List <TBD.InternalCondition> internalConditions = building.InternalConditions();
                    for (int i = internalConditions.Count - 1; i >= 0; i--)
                    {
                        TBD.InternalCondition internalCondition = building.GetIC(i);
                        if (internalCondition.name.EndsWith("HDD"))
                        {
                            if (excludeOutdoorAir)
                            {
                                profile profile = internalCondition.GetInternalGain()?.GetProfile((int)Profiles.ticV);
                                if (profile != null)
                                {
                                    profile.factor = 0;
                                }
                            }

                            //while (internalCondition.GetZone(0) != null)
                            //{
                            //    zone zone = internalCondition.GetZone(0);
                            //    zone.AssignIC(internalCondition, false);
                            //}
                        }
                    }

                    sAMTBDDocument.Save();
                    result = true;
                }
            }

            return(result);
        }
예제 #18
0
        /// <summary>
        /// This is the method that actually does the work.
        /// </summary>
        /// <param name="dataAccess">The DA object is used to retrieve from inputs and store in outputs.</param>
        protected override void SolveInstance(IGH_DataAccess dataAccess)
        {
            dataAccess.SetData(1, false);

            bool run = false;

            if (!dataAccess.GetData(2, ref run))
            {
                AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data");
                return;
            }
            if (!run)
            {
                return;
            }

            string path_TBD = null;

            if (!dataAccess.GetData(0, ref path_TBD) || string.IsNullOrWhiteSpace(path_TBD))
            {
                AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data");
                return;
            }

            AnalyticalModel analyticalModel = null;

            if (!dataAccess.GetData(1, ref analyticalModel) || analyticalModel == null)
            {
                AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data");
                return;
            }

            bool result = false;

            using (SAMTBDDocument sAMTBDDocument = new SAMTBDDocument(path_TBD))
            {
                result = Analytical.Tas.Modify.UpdateBuildingElements(sAMTBDDocument, analyticalModel);

                AdjacencyCluster adjacencyCluster = analyticalModel.AdjacencyCluster;
                Analytical.Tas.Modify.UpdateThermalParameters(adjacencyCluster, sAMTBDDocument.TBDDocument?.Building);
                analyticalModel = new AnalyticalModel(analyticalModel, adjacencyCluster);
                if (result)
                {
                    sAMTBDDocument.Save();
                }
            }

            dataAccess.SetData(0, new GooAnalyticalModel(analyticalModel));
            dataAccess.SetData(1, result);
        }
예제 #19
0
        public static bool Simulate(string path_TBD, string path_TSD, int day_First, int day_Last)
        {
            if (string.IsNullOrWhiteSpace(path_TBD) || string.IsNullOrWhiteSpace(path_TSD))
            {
                return(false);
            }

            bool result = false;

            using (SAMTBDDocument sAMTBDDocument = new SAMTBDDocument(path_TBD))
            {
                result = Simulate(sAMTBDDocument, path_TSD, day_First, day_Last);
            }

            return(result);
        }
예제 #20
0
        public static List <DesignDay> DesignDays(this string path_TBD, out List <DesignDay> coolingDesignDays, out List <DesignDay> heatingDesignDays)
        {
            coolingDesignDays = null;
            heatingDesignDays = null;

            if (string.IsNullOrWhiteSpace(path_TBD))
            {
                return(null);
            }

            List <DesignDay> result = null;

            using (SAMTBDDocument sAMTBDDocument = new SAMTBDDocument(path_TBD, true))
            {
                result = DesignDays(sAMTBDDocument, out coolingDesignDays, out heatingDesignDays);
            }

            return(result);
        }
예제 #21
0
        public static List <string> UpdateIZAMs(this string path_TBD, IEnumerable <Space> spaces)
        {
            if (string.IsNullOrWhiteSpace(path_TBD))
            {
                return(null);
            }

            List <string> result = null;

            using (SAMTBDDocument sAMTBDDocument = new SAMTBDDocument(path_TBD))
            {
                result = UpdateIZAMs(sAMTBDDocument, spaces);
                if (result != null)
                {
                    sAMTBDDocument.Save();
                }
            }

            return(result);
        }
예제 #22
0
        public static List <Guid> AssignAdiabaticConstruction(this string path_TBD, string constructionName_Adiabatic, IEnumerable <string> constructionNames_Sufixes, bool caseSensitive = true, bool trim = false)
        {
            if (string.IsNullOrWhiteSpace(path_TBD))
            {
                return(null);
            }

            List <Guid> result = null;

            using (SAMTBDDocument sAMTBDDocument = new SAMTBDDocument(path_TBD))
            {
                result = AssignAdiabaticConstruction(sAMTBDDocument, constructionName_Adiabatic, constructionNames_Sufixes, caseSensitive, trim);
                if (result != null)
                {
                    sAMTBDDocument.Save();
                }
            }

            return(result);
        }
예제 #23
0
        public static List <string> RemoveSchedules(this string path_TBD, string sufix, bool caseSensitive = true, bool trim = false)
        {
            if (string.IsNullOrWhiteSpace(path_TBD))
            {
                return(null);
            }

            List <string> result = null;

            using (SAMTBDDocument sAMTBDDocument = new SAMTBDDocument(path_TBD))
            {
                result = RemoveSchedules(sAMTBDDocument, sufix, caseSensitive, trim);
                if (result != null)
                {
                    sAMTBDDocument.Save();
                }
            }

            return(result);
        }
예제 #24
0
        public static List <Guid> UpdateApertureControl(this string path_TBD, IEnumerable <ApertureConstruction> apertureConstructions)
        {
            if (string.IsNullOrWhiteSpace(path_TBD))
            {
                return(null);
            }

            List <Guid> result = null;

            using (SAMTBDDocument sAMTBDDocument = new SAMTBDDocument(path_TBD))
            {
                result = UpdateApertureControl(sAMTBDDocument, apertureConstructions);
                if (result != null)
                {
                    sAMTBDDocument.Save();
                }
            }

            return(result);
        }
예제 #25
0
        public static bool UpdateZones(this AnalyticalModel analyticalModel, string path_TBD, bool includeHDD = false)
        {
            if (analyticalModel == null || string.IsNullOrWhiteSpace(path_TBD))
            {
                return(false);
            }

            bool result = false;

            using (SAMTBDDocument sAMTBDDocument = new SAMTBDDocument(path_TBD))
            {
                result = UpdateZones(analyticalModel, sAMTBDDocument, includeHDD);
                if (result)
                {
                    sAMTBDDocument.Save();
                }
            }

            return(result);
        }
예제 #26
0
        public static List <Space> UpdateDesignLoads(this BuildingModel buildingModel, string path_TBD)
        {
            if (string.IsNullOrWhiteSpace(path_TBD))
            {
                return(null);
            }

            List <Space> result = null;

            using (SAMTBDDocument sAMTBDDocument = new SAMTBDDocument(path_TBD))
            {
                result = UpdateDesignLoads(buildingModel, sAMTBDDocument);
                if (result != null)
                {
                    sAMTBDDocument.Save();
                }
            }

            return(result);
        }
예제 #27
0
        public static bool UpdateShading(string path_TBD, AnalyticalModel analyticalModel, double tolerance = Core.Tolerance.Distance)
        {
            if (analyticalModel == null || string.IsNullOrWhiteSpace(path_TBD))
            {
                return(false);
            }

            bool result = false;

            using (SAMTBDDocument sAMTBDDocument = new SAMTBDDocument(path_TBD))
            {
                result = UpdateShading(sAMTBDDocument?.TBDDocument, analyticalModel, tolerance);
                if (result)
                {
                    sAMTBDDocument.Save();
                }
            }

            return(result);
        }
예제 #28
0
        public static List <SAMType> UpdateConstructions(this string path_TBD, AnalyticalModel analyticalModel)
        {
            if (string.IsNullOrWhiteSpace(path_TBD))
            {
                return(null);
            }

            List <SAMType> result = null;

            using (SAMTBDDocument sAMTBDDocument = new SAMTBDDocument(path_TBD))
            {
                result = UpdateConstructions(sAMTBDDocument, analyticalModel);
                if (result != null)
                {
                    sAMTBDDocument.Save();
                }
            }

            return(result);
        }
예제 #29
0
        public static bool UpdateBuildingElements(this string path_TBD, AnalyticalModel analyticalModel)
        {
            if (string.IsNullOrWhiteSpace(path_TBD))
            {
                return(false);
            }

            bool result = false;

            using (SAMTBDDocument sAMTBDDocument = new SAMTBDDocument(path_TBD))
            {
                result = UpdateBuildingElements(sAMTBDDocument, analyticalModel);
                if (result)
                {
                    sAMTBDDocument.Save();
                }
            }

            return(result);
        }
예제 #30
0
        public static List <Guid> AssignBuildingElementType(this string path_TBD, TBD.BuildingElementType buildingElementType, IEnumerable <string> names, bool caseSensitive = true, bool trim = false)
        {
            if (string.IsNullOrWhiteSpace(path_TBD))
            {
                return(null);
            }

            List <Guid> result = null;

            using (SAMTBDDocument sAMTBDDocument = new SAMTBDDocument(path_TBD))
            {
                result = AssignBuildingElementType(sAMTBDDocument, buildingElementType, names, caseSensitive, trim);
                if (result != null)
                {
                    sAMTBDDocument.Save();
                }
            }

            return(result);
        }