private IDictionary <string, object> GetParams(int i) { var dictionary = _valueProvider.GetValues(i); foreach (var kv in _randomValueProvider.GetValues(i)) { dictionary[kv.Key] = kv.Value; // overwrite } return(dictionary); }
public static RowCollection MakeRowCollectionForSingleSheet <T>(int year, int timeStepWidthInMinutes, [NotNull] IValueProvider wsc) { //dump to csv RowCollection rc = new RowCollection(wsc.SheetName, wsc.YAxisName); DateTime dt = new DateTime(year, 1, 1); int columnCount = wsc.GetColumnCount(); List <ReadOnlyCollection <T> > columns = new List <ReadOnlyCollection <T> >(); for (int i = 0; i < columnCount; i++) { columns.Add(wsc.GetValues <T>(i)); } int maxProfileCount = columns.Max(x => x.Count); var names = wsc.GetColumnNames(); if (names.Count != names.Distinct().Count()) { string s = ""; foreach (var name in names) { var count = names.Count(x => x == name); if (count > 1) { s += name + ": " + count + "\n"; } } throw new FlaException("Profile names need to be unique:" + s); } if (wsc.GetColumnCount() == 0) { throw new FlaException("no profiles"); } foreach (var profile in columns) { if (profile.Count == 0) { throw new FlaException("no values in profile"); } } for (int row = 0; row < maxProfileCount; row++) { RowBuilder rb = RowBuilder.Start("Idx", row); rc.Add(rb); rb.Add("Time", dt.ToString("ddd, dd.MM.yyyy") + "\n" + dt.ToString("HH:mm")); if (row > 5) { rb.Add("Time (date only)", dt.ToString("dd.MM.yyyy")); } else { rb.Add("Time (date only)", null); } dt = dt.AddMinutes(timeStepWidthInMinutes); for (int col = 0; col < columnCount; col++) { if (columns[col].Count > row) { rb.Add(names[col], columns[col][row]); } } } return(rc); }