コード例 #1
0
        /// <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)
        {
            // INPUT
            // declaration
            List <double> _dryBulbTemperature = new List <double>();
            List <double> _relativeHumidity   = new List <double>();

            DA.GetDataList <double>(0, _dryBulbTemperature);
            DA.GetDataList <double>(1, _relativeHumidity);

            if (_dryBulbTemperature.Count == _relativeHumidity.Count)
            {
                SimpleForcingSettings simpleF = new SimpleForcingSettings(_dryBulbTemperature, _relativeHumidity);
                DA.SetData(0, simpleF);
            }
            else
            {
                this.AddRuntimeMessage(GH_RuntimeMessageLevel.Warning, "Lists must be same length.");
            }
        }
コード例 #2
0
ファイル: Config.cs プロジェクト: 542072859/df_envimet
        /// <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.");
                }
            }
        }