コード例 #1
0
        private static void UpdateYearlyTargetNumberYears(int numberYears, string simulationID)
        {
            List <TargetStore> targets = SelectScenario.GetEditSimulationTargets(simulationID);

            if (numberYears == 0)
            {
                return;
            }
            int startYear = int.Parse(targets[0].Year);

            if (numberYears > targets.Count)
            {
                int currentLastYear = int.Parse(targets[targets.Count - 1].Year) + 1;
                while (currentLastYear < startYear + numberYears)
                {
                    CreateScenario.InsertSimulationOCITargets(simulationID, currentLastYear.ToString());
                    currentLastYear++;
                }
            }
            else if (numberYears < targets.Count)
            {
                for (int i = numberYears; i < targets.Count; i++)
                {
                    if (i >= numberYears)
                    {
                        DeleteScenario.DeleteTarget(targets[i].ID);
                    }
                }
            }
        }
コード例 #2
0
ファイル: PrepareAnalysis.cs プロジェクト: jakedw7/iAM
 /// <summary>
 /// This function for testing purposes.   This should be filled by the interface.
 /// </summary>
 /// <param name="simulation"></param>
 private static void ActivityFeasibilityCostConsequences(SimulationStore simulation)
 {
     if (!IsTreamentsDefined(simulation.SimulationID))
     {
         List <OMSActivityStore> activities = OMS.GetActivities(simulation.Asset);
         if (activities != null)
         {
             foreach (OMSActivityStore activity in activities)
             {
                 CreateScenario.AddActivity(activity, simulation);
             }
         }
     }
 }
コード例 #3
0
        private static void UpdateYearlyTargetStartYear(int startYear, string simulationID)
        {
            List <TargetStore> targets = SelectScenario.GetEditSimulationTargets(simulationID);
            int numberYears            = targets.Count;

            if (numberYears == 0)
            {
                return;
            }
            // If startYear earlier than current, add new years with 0 amounts, delete excess years.
            if (startYear < int.Parse(targets[0].Year))
            {
                for (int i = 0; i < numberYears; i++)
                {
                    int         year   = startYear + i;
                    TargetStore target = targets.Find(delegate(TargetStore ts) { return(ts.Year == year.ToString()); });
                    if (target == null)
                    {
                        CreateScenario.InsertSimulationOCITargets(simulationID, year.ToString());
                    }
                }
                for (int index = 0; index < targets.Count; index++)
                {
                    if (int.Parse(targets[index].Year) > startYear + numberYears)
                    {
                        DeleteScenario.DeleteTarget(targets[index].ID);
                    }
                }
            }
            else if (startYear > int.Parse(targets[0].Year)) // If startYear later than current, delete earlier.  Add later.
            {
                for (int index = 0; index < targets.Count; index++)
                {
                    if (int.Parse(targets[index].Year) < startYear)
                    {
                        DeleteScenario.DeleteTarget(targets[index].ID);
                    }
                }

                for (int i = 0; i < numberYears; i++)
                {
                    int         year   = i + startYear;
                    TargetStore target = targets.Find(delegate(TargetStore ts) { return(ts.Year == year.ToString()); });
                    if (target == null)
                    {
                        CreateScenario.InsertSimulationOCITargets(simulationID, year.ToString());
                    }
                }
            }
        }
コード例 #4
0
ファイル: CreateScenario.cs プロジェクト: jakedw7/iAM
 public static void LoadPerformanceCurvesToDecisionEngine(int simulationID, string asset)
 {
     CreateScenario.LoadPerformanceCurvesToDecisionEngine(simulationID, asset, false);
 }