Beispiel #1
0
        private void runModelToolStripMenuItem_Click(object sender, EventArgs e)
        {
            MyWSIM.Simulation_Initialize();
            SetEditParameters();

            MyWSIM.Simulation_AllYears();
            MyWSIM.Simulation_Stop();
            sankeyGraphUnit.ResetGraph();
            foreach (WaterSimSankeyForm TF in SankeyForms)
            {
                TF.RedrawSankey();
            }
            int unitIndex = MyWSIM.WaterSimWestModel.GetIndex(MyWSIM.WaterSimWestModel.GetUnitModel(ModelUnitName));

            ResetIndicators(unitIndex);
            LoadParameterDropDown();
            ResetParmChart();
            ResetEditParametersValues();
        }
Beispiel #2
0
        private void button1_Click_1(object sender, EventArgs e)
        {
            MyWSIM.Simulation_Initialize();
            SetEditParameters();

            MyWSIM.seti_SimpleAllRegionsDroughtScenario(3);
            // HACING
            //int ModelCount = MyWSIM.WaterSimWestModel.ModelCount;
            //int[] DDepth = new int[ModelCount];
            //int[] DLength = new int[ModelCount];
            //int[] DStartYear = new int[ModelCount];
            //int[] DActive = new int[ModelCount];

            //for (int i = 0; i < ModelCount; i++)
            //{
            //    DStartYear[i] = 2020;
            //    DLength[i] = 40;
            //    DDepth[i] = 60;
            //    DActive[i] = 1;
            //}

            //MyWSIM.WaterSimWestModel.seti_DroughtStartYear(DStartYear);
            //MyWSIM.WaterSimWestModel.seti_DroughtLength(DLength);
            //MyWSIM.WaterSimWestModel.seti_DroughtDepth(DDepth);
            //MyWSIM.WaterSimWestModel.seti_DroughtActive(DActive);

            MyWSIM.Simulation_AllYears();
            MyWSIM.Simulation_Stop();
            sankeyGraphUnit.ResetGraph();
            foreach (WaterSimSankeyForm TF in SankeyForms)
            {
                TF.RedrawSankey();
            }
            int unitIndex = MyWSIM.WaterSimWestModel.GetIndex(MyWSIM.WaterSimWestModel.GetUnitModel(ModelUnitName));

            ResetIndicators(unitIndex);
            LoadParameterDropDown();
            ResetParmChart();
        }
Beispiel #3
0
        private void runModelToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (TheFileNameForData == "")
            {
                MessageBox.Show("A filename mus be selected or created, use Open File or Create New");
            }
            else
            {
                // Get the scernarioName Index Tag
                int TagIndex = ActiveScenbarioName.IndexOf("_");
                // if not found
                if (TagIndex < 0)
                {
                    ActiveScenbarioName += "_0";
                }
                else
                // Found but nothing after
                if (TagIndex == (ActiveScenbarioName.Length - 1))
                {
                    ActiveScenbarioName += "0";
                }
                else
                {
                    // something there, see if number
                    string Temp = ActiveScenbarioName.Substring(TagIndex + 1);
                    try
                    {
                        int testme = Convert.ToInt32(Temp);
                        // ok, worked
                        // Increment and reattache
                        testme++;
                        ActiveScenbarioName = ActiveScenbarioName.Substring(0, TagIndex) + "_" + testme.ToString();
                    }
                    catch
                    {
                        // OK, not a number, create one
                        ActiveScenbarioName = ActiveScenbarioName.Substring(0, TagIndex) + "_0";
                    }
                }
                // Setup Surface Water External Model
                ProviderIntArray UseSurface = new  ProviderIntArray(1);
                MyWSIM.ParamManager.Model_Parameter(eModelParam.epP_SURFACE_USE_EXT_MODEL).ProviderProperty.setvalues(UseSurface);
                //MyWSIM.Simulation_Initialize("TestFile1.csv", "FirstRun");
                MyWSIM.Simulation_Initialize(TheFileNameForData, ActiveScenbarioName);
                //MyWSIM.Simulation_Initialize();
                SetEditParameters();

                MyWSIM.Simulation_AllYears();
                MyWSIM.Simulation_Stop();
                sankeyGraphUnit.ResetGraph();
                foreach (WaterSimSankeyForm TF in SankeyForms)
                {
                    TF.RedrawSankey();
                }
                int unitIndex = MyWSIM.WaterSimWestModel.GetIndex(MyWSIM.WaterSimWestModel.GetUnitModel(ModelUnitName));
                ResetIndicators(unitIndex);
                LoadParameterDropDown();
                ResetParmChart();
                ResetEditParametersValues();

                // EXAMPLE CODE FOR ACCESSING PROCESS
                // Get the Process Manager
                ProcessManager PM = MyWSIM.ProcessManager;
                // Here is a list of the names of all active processed
                List <string> MyProcessNames = PM.ActiveProcesses;
                // Find one process named GWIndicatorProcess:
                // Loop using the AllProcesses enumerator
                foreach (AnnualFeedbackProcess AFP in PM.AllProcesses())
                {
                    // AFP is now a reference to a process
                    // Get its name
                    string AFPName = AFP.Name;
                    // Is it the one we atre looking for
                    if (AFPName == "GWIndicatorProcess: ")
                    {
                        // Cast it as the process we are looking for, you can check first just to be safe
                        if (AFP is GWIndicatorProcess)
                        {
                            int[] TheSafeYield = (AFP as GWIndicatorProcess).SafeYield;
                            break;
                        }
                    }
                    // Alternately we can just look for the class
                    if (AFP is GWIndicatorProcess)
                    {
                        int[] TheSafeYield = (AFP as GWIndicatorProcess).SafeYield;
                        break;
                    }
                }
                // if you want to save it for future reference
                GWIndicatorProcess MyGwProcess;
                foreach (AnnualFeedbackProcess AFP in PM.AllProcesses())
                {
                    if (AFP is GWIndicatorProcess)
                    {
                        MyGwProcess = (AFP as GWIndicatorProcess);
                    }
                }
            }
        }