/// <summary> /// This is the method that actually does the work. /// </summary> /// <param name="DA">The DA object is used to retrieve from inputs and store in outputs.</param> protected override void SolveInstance(IGH_DataAccess DA) { string _epw = null; string _envimetFolder = null; bool _forceTemperature_ = true; bool _forceWind_ = true; bool _forceRelativeHumidity_ = true; bool _forcePrecipitation_ = false; bool _forceRadiationClouds_ = true; int minFlowSteps_ = 50; double limitWind2500_ = 0; double maxWind2500_ = 20; string envimetInstallationFolder_ = null; DA.GetData(0, ref _epw); DA.GetData(1, ref _envimetFolder); DA.GetData(2, ref _forceTemperature_); DA.GetData(3, ref _forceWind_); DA.GetData(4, ref _forceRelativeHumidity_); DA.GetData(5, ref _forcePrecipitation_); DA.GetData(6, ref _forceRadiationClouds_); DA.GetData(7, ref minFlowSteps_); DA.GetData(8, ref limitWind2500_); DA.GetData(9, ref maxWind2500_); DA.GetData(10, ref envimetInstallationFolder_); Active temperature = (_forceTemperature_) ? Active.YES : Active.NO; Active wind = (_forceWind_) ? Active.YES : Active.NO; Active relativeHumidity = (_forceRelativeHumidity_) ? Active.YES : Active.NO; Active precipitation = (_forcePrecipitation_) ? Active.YES : Active.NO; Active radiation = (_forceRadiationClouds_) ? Active.YES : Active.NO; FullForcing fullforcing = new FullForcing(_epw, _envimetFolder, envimetInstallationFolder_) { LimitWind2500 = 0, MaxWind2500 = 20.0, MinFlowsteps = 50, ForceTemperature = (int)temperature, ForceWind = (int)wind, ForceRelativeHumidity = (int)relativeHumidity, ForcePrecipitation = (int)precipitation, ForceRadClouds = (int)radiation }; DA.SetData(0, fullforcing); }
public Simx(MainSettings mainSettings) { MainSettings = mainSettings; SimpleForcing = null; TThread = null; TimeSteps = null; ModelTiming = null; SoilSettings = null; Sources = null; Turbulence = null; OutputSettings = null; Cloud = null; Background = null; SolarAdjust = null; BuildingSettings = null; IVS = null; SOR = null; InflowAvg = null; Facades = null; PlantSetting = null; LBC = null; FullForcing = null; }
/// <summary> /// This is the method that actually does the work. /// </summary> /// <param name="DA">The DA object is used to retrieve from inputs and store in outputs.</param> protected override void SolveInstance(IGH_DataAccess DA) { MainSettings _mainSettings = null; List <Configuration> otherSettings_ = new List <Configuration> (); bool _runIt = false; DA.GetData(0, ref _mainSettings); DA.GetDataList(1, otherSettings_); DA.GetData(2, ref _runIt); SimpleForcingSettings simpleForcingSettings = null; TThread tThread = null; TimeSteps timeSteps = null; ModelTiming modelTiming = null; SoilConfig soilConfig = null; Sources sources = null; Turbulence turbulence = null; OutputSettings outputSettings = null; Cloud cloud = null; Background background = null; SolarAdjust solarAdjust = null; BuildingSettings buildingSettings = null; IVS ivs = null; ParallelCPU parallelCPU = null; SOR sor = null; InflowAvg inflowAvg = null; Facades facades = null; PlantSetting plantSetting = null; LBC lbc = null; FullForcing fullForcing = null; if (_runIt) { try { foreach (Configuration o in otherSettings_) { Type obj = o.GetType(); if (obj == typeof(SimpleForcingSettings)) { simpleForcingSettings = o as SimpleForcingSettings; } else if (obj == typeof(TThread)) { tThread = o as TThread; } else if (obj == typeof(TimeSteps)) { timeSteps = o as TimeSteps; } else if (obj == typeof(ModelTiming)) { modelTiming = o as ModelTiming; } else if (obj == typeof(SoilConfig)) { soilConfig = o as SoilConfig; } else if (obj == typeof(Sources)) { sources = o as Sources; } else if (obj == typeof(Turbulence)) { turbulence = o as Turbulence; } else if (obj == typeof(OutputSettings)) { outputSettings = o as OutputSettings; } else if (obj == typeof(Cloud)) { cloud = o as Cloud; } else if (obj == typeof(Background)) { background = o as Background; } else if (obj == typeof(SolarAdjust)) { solarAdjust = o as SolarAdjust; } else if (obj == typeof(BuildingSettings)) { buildingSettings = o as BuildingSettings; } else if (obj == typeof(IVS)) { ivs = o as IVS; } else if (obj == typeof(ParallelCPU)) { parallelCPU = o as ParallelCPU; } else if (obj == typeof(SOR)) { sor = o as SOR; } else if (obj == typeof(InflowAvg)) { inflowAvg = o as InflowAvg; } else if (obj == typeof(Facades)) { facades = o as Facades; } else if (obj == typeof(PlantSetting)) { plantSetting = o as PlantSetting; } else if (obj == typeof(LBC)) { lbc = o as LBC; } else if (obj == typeof(FullForcing)) { fullForcing = o as FullForcing; } } Simx simx = new Simx(_mainSettings) { SimpleForcing = simpleForcingSettings, TThread = tThread, TimeSteps = timeSteps, ModelTiming = modelTiming, SoilSettings = soilConfig, Sources = sources, Turbulence = turbulence, OutputSettings = outputSettings, Cloud = cloud, Background = background, SolarAdjust = solarAdjust, BuildingSettings = buildingSettings, IVS = ivs, ParallelCPU = parallelCPU, SOR = sor, InflowAvg = inflowAvg, Facades = facades, PlantSetting = plantSetting, LBC = lbc, FullForcing = fullForcing }; simx.WriteSimx(); DA.SetData(0, Path.Combine(Path.GetDirectoryName(_mainSettings.Inx), _mainSettings.Name + ".simx")); } catch { this.AddRuntimeMessage(GH_RuntimeMessageLevel.Warning, "Please provide a valid mainSettings."); } } }