예제 #1
0
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");

            // How to iterate through a directory tree
            RecursiveFileSearch.Run();
            StackBasedIteration.Run(@"C:\SAJ");

            FileSysInfo.Run();
            CreateFileOrFolder.Run();
            SimpleFileCopy.Run();
            SimpleFileMove.Run();
            SimpleFileDelete.Run();
            WriteTextFile.Run();
            ReadFromFile.Run();
            // How to create a key in the registry
            RegistryTest.Run();
        }
예제 #2
0
        void runWithCSV()
        {
            myVariables my = new myVariables();

            my.myParameters();
            FO = new FileOutputs(ws);
            SimpleFileCopy SF   = new SimpleFileCopy();
            int            scen = 1;

            SF.copyScenarioFile(scen);

            string buid = ws.ModelBuild;

            ws.Simulation_Initialize();
            Init();
            //SF.copyScenarioFile(scen);
            my.Initialize(scen, ws);
            // 10.26.17
            List <string> ProcessList = new List <string>();

            ProcessList = ws.ProcessManager.ActiveProcesses;
            //
            //isSetError = SetModelParameters(InputFields, ws, ref SetErrMessage);
            //
            //ws.Colorado_Climate_Adjustment_Percent = 100;
            //ws.SaltVerde_Climate_Adjustment_Percent = 100;
            for (int i = 0; i < ProviderClass.NumberOfProviders; i++)
            {
                OneHundred[i] = 20;
            }
            myout.Values = OneHundred;

            ws.WaterAugmentation.setvalues(myout);

            ws.Simulation_AllYears();
            CO = ws.Colorado_Annual_Deliveries.getvalues();
            int Col = ws.Colorado_Annual_Deliveries.RegionalValue(eProvider.Regional);

            //for (int year = ws.Simulation_Start_Year; year < ws.Simulation_End_Year; ++year)
            //{
            //    ws.Simulation_NextYear();
            //    StartSimulation = false;

            //    int Rain = ws.RainWaterHarvested_MF.RegionalValue(eProvider.Regional) + ws.RainWaterHarvested_SF.RegionalValue(eProvider.Regional)
            //        + ws.RainWaterHarvested_PU.RegionalValue(eProvider.Regional);
            //    int Gray = ws.ResGrayWater.RegionalValue(eProvider.Regional);
            //    double Out = ws.PCT_Outdoor_WaterUseRes.RegionalValue(eProvider.Regional);
            //    double res = ws.PCT_WaterSupply_to_Residential.RegionalValue(eProvider.Regional);
            //    double indoor = ws.ResidentialHighDensityIndoorGPCD.RegionalValue(eProvider.Regional) +
            //        ws.ResidentialLowDensityIndoorGPCD.RegionalValue(eProvider.Regional) +
            //        ws.ResidentialMediumDensityIndoorGPCD.RegionalValue(eProvider.Regional);

            //    int odd = year;
            //    if (odd % 2 == 0)
            //    {
            //        sw.WriteLine(year
            //           + ","
            //           + ws.SaltVerde_Annual_Deliveries_SRP.RegionalValue(eProvider.Regional)
            //           +","
            //           + ws.Colorado_Annual_Deliveries.RegionalValue(eProvider.Regional)
            //           + ","
            //           + ws.Groundwater_Pumped_Municipal.RegionalValue(eProvider.Regional)
            //           + ","
            //           + ws.Groundwater_Bank_Used.RegionalValue(eProvider.Regional)
            //           + ","
            //           + ws.Reclaimed_Water_Used.RegionalValue(eProvider.Regional)
            //           + ","
            //           //+ Rain
            //           //+ ","
            //           //+ Gray
            //           + ws.RainWaterHarvtoTotalOutdoorUse.RegionalValue(eProvider.Regional)
            //           + ","
            //           + ws.GrayWaterToTotalOutdoorUse.RegionalValue(eProvider.Regional)
            //           + ","
            //           + ws.ReclaimedToTotalOutdoorUse.RegionalValue(eProvider.Regional)


            //           //+ ws.ResidentialLowDensityOutdoorGPCD.RegionalValue(eProvider.Regional)
            //           //+ ","
            //           //+ ws.ResidentialLowDensityIndoorGPCD.RegionalValue(eProvider.Regional)
            //           //+ ","
            //           //+ ws.LowDensityDemand.RegionalValue(eProvider.Regional)
            //           //+ ","
            //           //+ ws.MediumDensityDemand.RegionalValue(eProvider.Regional)
            //           //+ ","
            //           //+ ws.HighDensityDemand.RegionalValue(eProvider.Regional)
            //           //+ ","
            //           //+ ws.TurfWaterDemand.RegionalValue(eProvider.Regional)
            //           //+ ","
            //           //+ ws.GreenwayWaterDemand.RegionalValue(eProvider.Regional)
            //           //+ ","
            //           //+ ws.TreeWaterDemand.RegionalValue(eProvider.Regional)
            //           + ","
            //           + ws.Total_Demand.RegionalValue(eProvider.Regional)
            //           //+ ws.ResidentialMediumDensityOutdoorGPCD.RegionalValue(eProvider.Regional)
            //           //+ ","
            //           //+ ws.ResidentialHighDensityOutdoorGPCD.RegionalValue(eProvider.Regional)
            //           //+ ","
            //           //+ ws.Total_Demand.RegionalValue(eProvider.Regional)
            //           //+ ","
            //           //+ ws.LowDensityDemand.RegionalValue(eProvider.Regional)
            //           //+ ","
            //           //+ ws.MediumDensityDemand.RegionalValue(eProvider.Regional)
            //           //+ ","
            //           //+ ws.HighDensityDemand.RegionalValue(eProvider.Regional)
            //           //+ ((Convert.ToDouble(ws.Total_Demand.RegionalValue(eProvider.Regional))/Convert.ToDouble( ws.Population_Used.RegionalValue(eProvider.Regional))) * 325851)/365
            //            //+ Rain
            //            //+ ","
            //            //+ Gray
            //            //+ ","
            //            //+ ws.Total_Demand.RegionalValue(eProvider.Regional) * Out / 100 * res / 100
            //          );
            //    }
            //    else
            //    {
            //          //sw.WriteLine(year
            //          //+ ","
            //          // + ws.Total_Demand.RegionalValue(eProvider.Regional)
            //          //    );

            //    }

            //}
            CloseFiles();
            sw.Flush();
            sw.Close();
        }
예제 #3
0
        public void Run()
        {
            ScnGenForm();
            myVariables my = new myVariables();

            my.myParameters();
            FO = new FileOutputs(ws);
            SimpleFileCopy SF = new SimpleFileCopy();
            //
            String Filename = "ScenarioProject.txt";
            int    ScnCnt   = 1;
            double Count    = 1;
            double traces   = FCORTraceN * FSVRTraceN * FGrowthN * FRainN * FEffiency;
            double total    = traces;// *FScenario;

            sw = new System.IO.StreamWriter(Filename);
            String File = "ByPass.txt";

            swAdd = new System.IO.StreamWriter(File);
            ProviderIntArray New    = new ProviderIntArray();
            ProviderIntArray Values = new ProviderIntArray();

            for (int i = 0; i < New.Length; i++)
            {
                New[i] = 0;
            }
            for (int i = 0; i < New.Length; i++)
            {
                Values[i] = 50;
            }

            if (get_ValidModelRun == true)
            {
                // One at a time ------
                int scen = 7;
                SF.copyScenarioFile(scen);
                //
                foreach (int st in SVtrace)
                {
                    foreach (int co in COtrace)
                    {
                        foreach (int rain in RainFall)
                        {
                            foreach (int growth in Growth)
                            {
                                foreach (int eff in Efficiency)
                                {
                                    string ScnName = "Base";
                                    RunningGrowth = growth;
                                    RunningEff    = eff;
                                    //if(scen >1) sScenario[scen - 1];
                                    string ver  = ws.Model_Version;
                                    string buid = ws.ModelBuild;
                                    ws.Simulation_Initialize();
                                    Init();
                                    InitSpecial(New, Values);
                                    my.Initialize(scen, ws);
                                    if (SetParms(st, co, rain, growth, eff))
                                    {
                                        string Cstring = DateTime.Now.ToString("h:mm:ss tt") + " In step: " + "--" + Count + " Of: " + total + " > " + (Count / total) * 100 + " %";
                                        Console.WriteLine(Cstring);
                                        Console.WriteLine("");
                                        Console.WriteLine("Simulating " + scen + " " + ScnName);

                                        simpleRun();
                                    }


                                    Count += 1;
                                    runOutputs(scen, ScnCnt, my, sw);
                                    ws.Simulation_Stop();
                                }
                            }
                        }
                    }
                }
            }
            CloseFiles();
            sw.Flush();
            sw.Close();
            swAdd.Flush();
            swAdd.Close();
        }