コード例 #1
0
        //private void LogRunEnd(DateTime startOfRun)
        //{
        //    Type t = typeof (RunTracker);
        //    MethodInfo method = t.GetMethod("RunCompleted", BindingFlags.Public | BindingFlags.Static);

        //    try
        //    {
        //        method.Invoke(null, new object[] {Scenario.Project, Scenario, startOfRun});
        //    }
        //    catch(Exception)
        //    {
        //        method.Invoke(null, new object[] { Scenario.Project, startOfRun });
        //    }
        //}

        private void ApplyRunParameters(RunParameters parameters)
        {
            HashSet <string> skipKeys = new HashSet <string>(new [] { RUN_NAME_KEY });

            RunningConfiguration configuration = Scenario.CurrentConfiguration;
            Type configType = configuration.GetType();

            foreach (var entry in parameters.Params.Where(kvp => !skipKeys.Contains(kvp.Key)))
            {
                var ri  = ReflectedItem.NewItem(entry.Key, configuration);
                var val = entry.Value;

                if (ri.itemType == typeof(DateTime))
                {
                    val = DateTime.ParseExact(entry.Value.ToString(), "dd/MM/yyyy", CultureInfo.InvariantCulture);
                }
                else if (ri.itemType == typeof(InputSet))
                {
                    val = Scenario.Network.InputSets.FirstOrDefault(ipSet => ipSet.Name == (string)entry.Value);
                }
                else if (ri.itemType == typeof(TimeStep))
                {
                    val = TimeStep.FromName((string)entry.Value);
                }

                ri.itemValue = val;
            }
        }
コード例 #2
0
ファイル: TimeSeriesHelper.cs プロジェクト: jmp75/RtoTIME
 public static TimeSeries CreateTimeSeries(double[] values, DateTime startDate, string timeStep)
 {
     return(new TimeSeries(startDate, TimeStep.FromName(timeStep), values));
 }