Esempio n. 1
0
        public bool ProcessFile(Asset asset, bool notify, FileOutputs output)
        {
            AssetFileInfo info = new AssetFileInfo(asset);

            string watermark = GetWatermarkImagePath(asset.BrandId);

            Job job = new Job
            {
                AssetId         = asset.AssetId.GetValueOrDefault(),
                InputPath       = info.FilePath,
                WatermarkPath   = (asset.WatermarkPreview && !String.IsNullOrEmpty(watermark)) ? watermark : string.Empty,
                CreatePreview   = output.IsSet(FileOutputs.Preview),
                CreateThumbnail = output.IsSet(FileOutputs.Thumbnail),
                CallbackUrl     = "~/ProcessingCallback.ashx",
                AdditionalData  = string.Format("<AdditionalData><Notify>{0}</Notify></AdditionalData>", notify)
            };

            long jobId = SubmitJob(job);

            return(jobId > 0);
        }
Esempio n. 2
0
        public void scenarios(WaterSimManager_SIO ws)
        {
            int      ScnCnt   = 1;
            DateTime value    = new DateTime(2016, 8, 10);
            String   Filename = "Sensitivity.txt";

            MySW = new System.IO.StreamWriter(Filename);

            // int Count = 0;
            ScnGenForm();
            myParameters();
            FO = new FileOutputs(ws);
            int Count = 0;
            //
            MyParameterInfo MP = new MyParameterInfo();

            if (get_ValidModelRun == true)
            {
                //
                string[] MyWaterUseFlds  = new string[ws.WaterUseGroup.Count];
                string[] MyEffluentFlds  = new string[ws.EffluentGroup.Count];
                string[] MyReclaimedFlds = new string[ws.ReclaimedGroup.Count];
                //
                foreach (MyParameterInfo MPC in pl.myList)
                {
                    ModelParameterClass TheMP = ws.ParamManager.Model_Parameter(MPC.Fieldname);
                    //
                    if (ws.WaterUseGroup.isMember(TheMP.ModelParam))
                    {
                        //GenericCreateCountList(MPC, MyWaterUseFlds, ws.WaterUseGroup.Count);
                        //if (readyToRun)
                        //{
                        //    RunSpecial(aValuesList, ws.WaterUseGroup.Count, MyWaterUseFlds, ws, MPC);
                        //}
                    }
                    else if (ws.EffluentGroup.isMember(TheMP.ModelParam))
                    {
                        //GenericCreateCountList(MPC, MyEffluentFlds, ws.EffluentGroup.Count);
                        //if (readyToRun)
                        //{
                        //    RunSpecial(aValuesList, ws.EffluentGroup.Count, MyEffluentFlds, ws, MPC);
                        //}
                    }
                    else if (ws.ReclaimedGroup.isMember(TheMP.ModelParam))
                    {
                        //GenericCreateCountList(MPC, MyReclaimedFlds, ws.ReclaimedGroup.Count);
                        //if (readyToRun)
                        //{
                        //    RunSpecial(aValuesList, ws.ReclaimedGroup.Count, MyReclaimedFlds, ws, MPC);
                        //}
                    }
                    else
                    {
                        if (0 < MPC.MinIntValue)
                        {
                            Count = 1;
                        }
                        for (int i = MPC.MinIntValue; i < MPC.MaxIntValue + 1; i += MPC.RangeInterval * Count - i)
                        {
                            // ws.Simulation_Initialize();
                            set_parmIncludeMeteorology = false;
                            if (parameterCheck(MPC, i))
                            {
                                //  runOnly();
                            }

                            Count += 1;
                            // runOutputs(MPC, i, ScnCnt);

                            ScnCnt++;
                        }
                        Count = 0;
                    }
                }
                ;
            }
            MySW.Flush();
            MySW.Close();
        }
Esempio n. 3
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();
        }
Esempio n. 4
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();
        }