コード例 #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)
        {
            int _surfaceStep_   = 30;
            int _flowStep_      = 900;
            int _radiationStep_ = 600;
            int _plantStep_     = 600;
            int _sourceStep_    = 600;

            DA.GetData(0, ref _surfaceStep_);
            DA.GetData(1, ref _flowStep_);
            DA.GetData(2, ref _radiationStep_);
            DA.GetData(3, ref _plantStep_);
            DA.GetData(4, ref _sourceStep_);

            var modelTiming = new ModelTiming()
            {
                SurfaceSteps   = _surfaceStep_,
                FlowSteps      = _flowStep_,
                RadiationSteps = _radiationStep_,
                PlantSteps     = _plantStep_,
                SourcesSteps   = _sourceStep_
            };

            DA.SetData(0, modelTiming);
        }
コード例 #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.");
                }
            }
        }