/// <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); }
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); }
public static List <Guid> UpdateApertureControl(this SAMTBDDocument sAMTBDDocument, IEnumerable <ApertureConstruction> apertureConstructions) { if (sAMTBDDocument == null) { return(null); } return(UpdateApertureControl(sAMTBDDocument.TBDDocument, apertureConstructions)); }
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)); }
public static AnalyticalModel ToSAM(this SAMTBDDocument sAMTBDDocument) { if (sAMTBDDocument == null) { return(null); } return(ToSAM(sAMTBDDocument.TBDDocument)); }
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)); }
public static AnalyticalModel UpdateDesignLoads(this SAMTBDDocument sAMTBDDocument, AnalyticalModel analyticalModel) { if (sAMTBDDocument == null) { return(null); } return(UpdateDesignLoads(sAMTBDDocument.TBDDocument, analyticalModel)); }
public static List <SAMType> UpdateConstructions(this SAMTBDDocument sAMTBDDocument, AnalyticalModel analyticalModel) { if (sAMTBDDocument == null) { return(null); } return(UpdateConstructions(sAMTBDDocument.TBDDocument, analyticalModel)); }
public static bool UpdateBuildingElements(this SAMTBDDocument sAMTBDDocument, AnalyticalModel analyticalModel) { if (sAMTBDDocument == null) { return(false); } return(UpdateBuildingElements(sAMTBDDocument.TBDDocument, analyticalModel)); }
public static bool UpdateWeatherData(this SAMTBDDocument sAMTBDDocument, WeatherData weatherData) { if (sAMTBDDocument == null || weatherData == null) { return(false); } return(UpdateWeatherData(sAMTBDDocument.TBDDocument, weatherData)); }
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)); }
public static WeatherData ToSAM_WeatherData(this SAMTBDDocument sAMTBDDocument) { if (sAMTBDDocument == null) { return(null); } return(ToSAM_WeatherData(sAMTBDDocument.TBDDocument)); }
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)); }
public static List <string> UpdateIZAMs(this SAMTBDDocument sAMTBDDocument, IEnumerable <Space> spaces) { if (sAMTBDDocument == null) { return(null); } return(UpdateIZAMs(sAMTBDDocument.TBDDocument, spaces)); }
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)); }
public static List <Guid> SetBlinds(this SAMTBDDocument sAMTBDDocument, IEnumerable <ApertureConstruction> apertureConstructions) { if (sAMTBDDocument == null) { return(null); } return(SetBlinds(sAMTBDDocument.TBDDocument, apertureConstructions)); }
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); }
/// <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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }