Example #1
0
 public GraphForm(Replay replay, string statName, List <SelectedStatisticCell> selection, StatisticUnitType unitType)
 {
     if (selection.Count > 0)
     {
         InitializeComponent();
         _replay        = replay;
         _statisticName = statName;
         _statistics    = selection;
         _unitType      = unitType;
         if (selection[0].TackIndex.HasValue)
         {
             _type = StatisticGroupType.Tack;
         }
         else if (selection[0].LegIndex.HasValue)
         {
             _type = StatisticGroupType.Leg;
         }
         else
         {
             _type = StatisticGroupType.Boat;
         }
         WireEvents();
         ConfigureGraph();
         _painter = new Thread(new ThreadStart(this.Run));
         _painter.Start();
     }
     else
     {
         throw new Exception("You must specify at least one statistic");
     }
 }
Example #2
0
 public GraphForm(Replay replay, string statName, List<SelectedStatisticCell> selection, StatisticUnitType unitType)
 {
     if (selection.Count > 0)
     {
         InitializeComponent();
         _replay = replay;
         _statisticName = statName;
         _statistics = selection;
         _unitType = unitType;
         if (selection[0].TackIndex.HasValue)
         {
             _type = StatisticGroupType.Tack;
         }
         else if (selection[0].LegIndex.HasValue)
         {
             _type = StatisticGroupType.Leg;
         }
         else
         {
             _type = StatisticGroupType.Boat;
         }
         WireEvents();
         ConfigureGraph();
         _painter = new Thread(new ThreadStart(this.Run));
         _painter.Start();
     }
     else
     {
         throw new Exception("You must specify at least one statistic");
     }
 }
Example #3
0
 public T GetValue <T>(string name, DateTime now, StatisticUnitType sut)
 {
     if (sut == StatisticUnitType.metric)
     {
         return(((Dictionary <string, TimeLineStatistic <T> >)_stats[typeof(T)])[name].GetValue(now));
     }
     else if (sut == StatisticUnitType.standard)
     {
         return(((Dictionary <string, TimeLineStatistic <T> >)_stats[typeof(T)])[name].Statistic.Calculator.ConvertToStandardUnits(((Dictionary <string, TimeLineStatistic <T> >)_stats[typeof(T)])[name].GetValue(now), ((Dictionary <string, TimeLineStatistic <T> >)_stats[typeof(T)])[name].Statistic.MetricUnit, ((Dictionary <string, TimeLineStatistic <T> >)_stats[typeof(T)])[name].Statistic.StandardUnit));
     }
     else
     {
         throw new Exception("Unkown Statistic Unit Type");
     }
 }
Example #4
0
 public T GetValue(StatisticUnitType sut, DateTime t)
 {
     if (sut == StatisticUnitType.metric)
     {
         return(_time.GetValue(t));
     }
     else if (sut == StatisticUnitType.standard)
     {
         return(_stat.Calculator.ConvertToStandardUnits(_time.GetValue(t), _stat.MetricUnit, _stat.StandardUnit));
     }
     else
     {
         throw new Exception("Unspecified statistic unit type");
     }
 }
Example #5
0
 public object GetValue(Type type, string name, DateTime now, StatisticUnitType sut) //i just picked a type here for the statistic unit type, kinda ugly...
 {
     if (type == typeof(float))
     {
         if (sut == StatisticUnitType.metric)
         {
             return(GetValue <float>(name, now, StatisticUnitType.metric));
         }
         else if (sut == StatisticUnitType.standard)
         {
             return(GetValue <float>(name, now, StatisticUnitType.standard));
         }
         else
         {
             throw new Exception("Unkown Statistic Unit Type");
         }
     }
     else if (type == typeof(int))
     {
         if (sut == StatisticUnitType.metric)
         {
             return(GetValue <int>(name, now, StatisticUnitType.metric));
         }
         else if (sut == StatisticUnitType.standard)
         {
             return(GetValue <int>(name, now, StatisticUnitType.standard));
         }
         else
         {
             throw new Exception("Unkown Statistic Unit Type");
         }
     }
     else if (type == typeof(DateTime))
     {
         return(GetValue <DateTime>(name, now));
     }
     else if (type == typeof(TimeSpan))
     {
         return(GetValue <TimeSpan>(name, now));
     }
     else
     {
         throw new Exception("Unknown Column Type");
     }
 }
Example #6
0
 public StatisticUnit GetStatisticUnit(string name, StatisticUnitType unitType)
 {
     foreach (Type type in _statDirectory.Keys)
     {
         if (unitType == StatisticUnitType.metric)
         {
             if (type == typeof(int) && ((Dictionary <string, TimeLineStatistic <int> >)_stats[type]).ContainsKey(name))
             {
                 return(((Dictionary <string, TimeLineStatistic <int> >)_stats[type])[name].Statistic.MetricUnit);
             }
             else if (type == typeof(float) && ((Dictionary <string, TimeLineStatistic <float> >)_stats[type]).ContainsKey(name))
             {
                 return(((Dictionary <string, TimeLineStatistic <float> >)_stats[type])[name].Statistic.MetricUnit);
             }
             else if (type == typeof(DateTime) && ((Dictionary <string, TimeLineStatistic <DateTime> >)_stats[type]).ContainsKey(name))
             {
                 return(((Dictionary <string, TimeLineStatistic <DateTime> >)_stats[type])[name].Statistic.MetricUnit);
             }
             else if (type == typeof(TimeSpan) && ((Dictionary <string, TimeLineStatistic <TimeSpan> >)_stats[type]).ContainsKey(name))
             {
                 return(((Dictionary <string, TimeLineStatistic <TimeSpan> >)_stats[type])[name].Statistic.MetricUnit);
             }
         }
         else if (unitType == StatisticUnitType.standard)
         {
             if (type == typeof(int) && ((Dictionary <string, TimeLineStatistic <int> >)_stats[type]).ContainsKey(name))
             {
                 return(((Dictionary <string, TimeLineStatistic <int> >)_stats[type])[name].Statistic.StandardUnit);
             }
             else if (type == typeof(float) && ((Dictionary <string, TimeLineStatistic <float> >)_stats[type]).ContainsKey(name))
             {
                 return(((Dictionary <string, TimeLineStatistic <float> >)_stats[type])[name].Statistic.StandardUnit);
             }
             else if (type == typeof(DateTime) && ((Dictionary <string, TimeLineStatistic <DateTime> >)_stats[type]).ContainsKey(name))
             {
                 return(((Dictionary <string, TimeLineStatistic <DateTime> >)_stats[type])[name].Statistic.StandardUnit);
             }
             else if (type == typeof(TimeSpan) && ((Dictionary <string, TimeLineStatistic <TimeSpan> >)_stats[type]).ContainsKey(name))
             {
                 return(((Dictionary <string, TimeLineStatistic <TimeSpan> >)_stats[type])[name].Statistic.StandardUnit);
             }
         }
     }
     throw new Exception("Could not find specified statistic");
 }
Example #7
0
 public double GetValue(string name, StatisticUnitType sut, DateTime dt)
 {
     foreach (Type type in _statDirectory.Keys)
     {
         if (type == typeof(int) && ((Dictionary <string, TimeLineStatistic <int> >)_stats[type]).ContainsKey(name))
         {
             return((double)((Dictionary <string, TimeLineStatistic <int> >)_stats[type])[name].GetValue(sut, dt));
         }
         else if (type == typeof(float) && ((Dictionary <string, TimeLineStatistic <float> >)_stats[type]).ContainsKey(name))
         {
             return((double)((Dictionary <string, TimeLineStatistic <float> >)_stats[type])[name].GetValue(sut, dt));
         }
         else if (type == typeof(DateTime) && ((Dictionary <string, TimeLineStatistic <DateTime> >)_stats[type]).ContainsKey(name))
         {
             return((double)((Dictionary <string, TimeLineStatistic <DateTime> >)_stats[type])[name].GetValue(sut, dt).Ticks);
         }
         else if (type == typeof(TimeSpan) && ((Dictionary <string, TimeLineStatistic <TimeSpan> >)_stats[type]).ContainsKey(name))
         {
             return((double)((Dictionary <string, TimeLineStatistic <TimeSpan> >)_stats[type])[name].GetValue(sut, dt).Ticks);
         }
     }
     throw new Exception("Could not find specified statistic");
 }
Example #8
0
 public SortedList <DateTime, double> GetStatisticTimeline(int boatIndex, int?legIndex, int?tackIndex, string statistic, StatisticUnitType unit)
 {
     if (tackIndex.HasValue)
     {
         int realTackIndex = 0;
         while (_boats[boatIndex].Tacks[realTackIndex].LegIndex != legIndex.Value && _boats[boatIndex].Tacks[realTackIndex].IndexOnLeg != tackIndex.Value && realTackIndex < _boats[boatIndex].Tacks.Count)
         {
             realTackIndex++;
         }
         if (_boats[boatIndex].Tacks[realTackIndex].LegIndex == legIndex.Value && _boats[boatIndex].Tacks[realTackIndex].IndexOnLeg == tackIndex.Value && realTackIndex < _boats[boatIndex].Tacks.Count)
         {
             return(_boats[boatIndex].TackStatistics[realTackIndex].GetGraphableTimeline(statistic, unit));
         }
         else
         {
             throw new Exception("Could not find the specified statistic timeline");
         }
     }
     else if (legIndex.HasValue)
     {
         return(_boats[boatIndex].LegStatistics[legIndex.Value].GetGraphableTimeline(statistic, unit));
     }
     else
     {
         return(_boats[boatIndex].TotalStatistics.GetGraphableTimeline(statistic, unit));
     }
 }
Example #9
0
        public DataSet GetFullStatistics(StatisticUnitType unittype)
        {
            //get
            //{
            DataSet ds = new DataSet("Statistics");

            lock (_boats)
            {
                DataTable boats = new DataTable("Boats");
                boats.Columns.Add(new DataColumn("id", typeof(int)));
                boats.Columns.Add(new DataColumn("name", typeof(string)));
                boats.Columns.Add(new DataColumn("number", typeof(string)));
                boats.Columns.Add(new DataColumn("color", typeof(System.Drawing.Color)));

                foreach (ReplayBoat b in _boats)
                {
                    object[] row = new object[4];
                    row[0] = b.Id;
                    row[1] = b.Name;
                    row[2] = b.Number;
                    row[3] = b.Color;
                    boats.Rows.Add(row);
                }
                ds.Tables.Add(boats);

                DataTable  legs = new DataTable("Legs");
                DataColumn dc   = legs.Columns.Add("index", typeof(int));
                legs.Columns.Add("description", typeof(string));

                for (int i = 0; i <= _race.Course.Route.Count; i++)
                {
                    string description = "";
                    if (i == 0)
                    {
                        description = "Pre-Start";
                    }
                    else if (i > 0 && i < _race.Course.Route.Count)
                    {
                        description = i + " " + _race.Course.Route[i - 1].Name + " to " + _race.Course.Route[i].Name;
                    }
                    else if (i == _race.Course.Route.Count)
                    {
                        description = "Post-Finish";
                    }
                    else
                    {
                        throw new Exception("Invalid Course Leg Reached");
                    }
                    object[] row = { i, description };
                    legs.Rows.Add(row);
                }

                object[] row2 = { DBNull.Value, "Overall" };
                legs.Rows.Add(row2);

                ds.Tables.Add(legs);

                DataTable  tacks     = new DataTable("Tacks");
                DataColumn boatId    = tacks.Columns.Add("boat_id", typeof(int));
                DataColumn legIndex  = tacks.Columns.Add("leg_index", typeof(int));
                DataColumn tackIndex = tacks.Columns.Add("tack_index", typeof(int));
                DataColumn tackname  = tacks.Columns.Add("name", typeof(string));



                DataTable stats = new DataTable("Statistics");
                stats.Columns.Add("boat_id", typeof(int));
                DataColumn dc2 = stats.Columns.Add("leg_index", typeof(int));
                dc2.AllowDBNull = true;
                DataColumn dc3 = stats.Columns.Add("tack_index", typeof(int));
                dc3.AllowDBNull = true;

                DataTable statinfo = new DataTable("StatisticInfo");
                statinfo.Columns.Add("name", typeof(string));
                statinfo.Columns.Add("type", typeof(string));
                statinfo.Columns.Add("unit", typeof(string));
                statinfo.Columns.Add("description", typeof(string));

                TimeLineStatisticCollection example = _boats[0].TotalStatistics;
                foreach (Type statType in example.StatisticDirectory.Keys)
                {
                    foreach (string name in example.StatisticDirectory[statType])
                    {
                        if (!stats.Columns.Contains(name))
                        {
                            stats.Columns.Add(name, statType /*example[name].GetValue(unittype, _simTime).GetType()*/);

                            object[] info = null;

                            if (unittype == StatisticUnitType.metric)
                            {
                                object[] t = { name, statType.ToString(), example.GetStatisticMetricUnit(statType, name).ToString(), "" };
                                info = t;
                            }
                            else if (unittype == StatisticUnitType.standard)
                            {
                                object[] t = { name, statType.ToString(), example.GetStatisticStandardUnit(statType, name).ToString(), "" };
                                info = t;
                            }

                            statinfo.Rows.Add(info);
                        }
                    }
                }
                ds.Tables.Add(statinfo);

                foreach (ReplayBoat b in _boats)
                {
                    DataRow dr = stats.NewRow();
                    dr["boat_id"]    = b.Id;
                    dr["leg_index"]  = System.DBNull.Value;
                    dr["tack_index"] = System.DBNull.Value;
                    TimeLineStatisticCollection fullstats = b.TotalStatistics;
                    foreach (Type t in fullstats.StatisticDirectory.Keys)
                    {
                        foreach (string s in fullstats.StatisticDirectory[t])
                        {
                            dr[s] = fullstats.GetValue(t, s, _simTime, unittype);
                        }
                    }
                    stats.Rows.Add(dr);

                    List <TimeLineStatisticCollection> legstats = b.LegStatistics;
                    for (int i = 0; i < legstats.Count && i <= b.GetCurrentLeg(_simTime); i++)
                    {
                        DataRow d = stats.NewRow();
                        d["boat_id"]    = b.Id;
                        d["leg_index"]  = i;
                        d["tack_index"] = DBNull.Value;
                        foreach (Type t in legstats[i].StatisticDirectory.Keys)
                        {
                            foreach (string s in legstats[i].StatisticDirectory[t])
                            {
                                d[s] = legstats[i].GetValue(t, s, _simTime, unittype);
                            }
                        }
                        stats.Rows.Add(d);
                    }

                    lock (b.Tacks)
                    {
                        for (int i = 0; i < b.Tacks.Count && i <= b.GetCurrentTack(_simTime); i++)
                        {
                            DataRow d = tacks.NewRow();
                            d["boat_id"]    = b.Id;
                            d["leg_index"]  = b.Tacks[i].LegIndex;
                            d["tack_index"] = b.Tacks[i].Index;
                            d["name"]       = (b.Tacks[i].IndexOnLeg + 1) + " " + b.Tacks[i].Direction.ToString();
                            tacks.Rows.Add(d);

                            TimeLineStatisticCollection tackstats = b.TackStatistics[b.Tacks[i].Index];

                            DataRow td = stats.NewRow();
                            td["boat_id"]    = b.Id;
                            td["leg_index"]  = b.Tacks[i].LegIndex;
                            td["tack_index"] = b.Tacks[i].Index;
                            foreach (Type tt in tackstats.StatisticDirectory.Keys)
                            {
                                foreach (string s in tackstats.StatisticDirectory[tt])
                                {
                                    td[s] = tackstats.GetValue(tt, s, _simTime, unittype);
                                }
                            }
                            stats.Rows.Add(td);
                        }
                    }
                }
                ds.Tables.Add(stats);
                ds.Tables.Add(tacks);
            }
            return(ds);
            //}
        }
Example #10
0
        public SortedList <DateTime, double> GetGraphableTimeline(string name, StatisticUnitType sut)
        {
            SortedList <DateTime, double> line = new SortedList <DateTime, double>();

            Type statType = null;

            foreach (Type t in _statDirectory.Keys)
            {
                if (_statDirectory[t].Contains(name))
                {
                    statType = t;
                }
            }

            IList <DateTime> times;

            if (statType != null)
            {
                if (statType == typeof(float))
                {
                    times = ((Dictionary <string, TimeLineStatistic <float> >)_stats[statType])[name].Times;
                    foreach (DateTime dt in times)
                    {
                        line.Add(dt, (double)(((Dictionary <string, TimeLineStatistic <float> >)_stats[statType])[name].GetValue(sut, dt)));
                    }
                }
                else if (statType == typeof(int))
                {
                    times = ((Dictionary <string, TimeLineStatistic <int> >)_stats[statType])[name].Times;
                    foreach (DateTime dt in times)
                    {
                        line.Add(dt, (double)(((Dictionary <string, TimeLineStatistic <int> >)_stats[statType])[name].GetValue(sut, dt)));
                    }
                }
                else if (statType == typeof(DateTime))
                {
                    times = ((Dictionary <string, TimeLineStatistic <DateTime> >)_stats[statType])[name].Times;
                    foreach (DateTime dt in times)
                    {
                        line.Add(dt, (double)(((Dictionary <string, TimeLineStatistic <DateTime> >)_stats[statType])[name].GetValue(sut, dt).Ticks));
                    }
                }
                else if (statType == typeof(TimeSpan))
                {
                    times = ((Dictionary <string, TimeLineStatistic <TimeSpan> >)_stats[statType])[name].Times;
                    foreach (DateTime dt in times)
                    {
                        line.Add(dt, (double)(((Dictionary <string, TimeLineStatistic <TimeSpan> >)_stats[statType])[name].GetValue(sut, dt).Ticks));
                    }
                }
                else
                {
                    throw new Exception("Unknown Column Type");
                }
            }
            else
            {
                throw new Exception("Could not find statistic with specified name");
            }
            return(line);
        }
Example #11
0
 public SortedList<DateTime,double> GetStatisticTimeline(int boatIndex,int? legIndex,int? tackIndex,string statistic,StatisticUnitType unit)
 {
     if (tackIndex.HasValue)
     {
         int realTackIndex = 0;
         while (_boats[boatIndex].Tacks[realTackIndex].LegIndex != legIndex.Value && _boats[boatIndex].Tacks[realTackIndex].IndexOnLeg != tackIndex.Value && realTackIndex < _boats[boatIndex].Tacks.Count)
         {
             realTackIndex++;
         }
         if (_boats[boatIndex].Tacks[realTackIndex].LegIndex == legIndex.Value && _boats[boatIndex].Tacks[realTackIndex].IndexOnLeg == tackIndex.Value && realTackIndex < _boats[boatIndex].Tacks.Count)
         {
             return _boats[boatIndex].TackStatistics[realTackIndex].GetGraphableTimeline(statistic, unit);
         }
         else
         {
             throw new Exception("Could not find the specified statistic timeline");
         }
     }
     else if (legIndex.HasValue)
     {
         return _boats[boatIndex].LegStatistics[legIndex.Value].GetGraphableTimeline(statistic, unit);
     }
     else
     {
         return _boats[boatIndex].TotalStatistics.GetGraphableTimeline(statistic, unit);
     }
 }
Example #12
0
        public DataSet GetFullStatistics(StatisticUnitType unittype)
        {
            //get
            //{
                DataSet ds = new DataSet("Statistics");
                lock (_boats)
                {
                    DataTable boats = new DataTable("Boats");
                    boats.Columns.Add(new DataColumn("id", typeof(int)));
                    boats.Columns.Add(new DataColumn("name", typeof(string)));
                    boats.Columns.Add(new DataColumn("number", typeof(string)));
                    boats.Columns.Add(new DataColumn("color", typeof(System.Drawing.Color)));

                    foreach (ReplayBoat b in _boats)
                    {
                        object[] row = new object[4];
                        row[0] = b.Id;
                        row[1] = b.Name;
                        row[2] = b.Number;
                        row[3] = b.Color;
                        boats.Rows.Add(row);
                    }
                    ds.Tables.Add(boats);

                    DataTable legs = new DataTable("Legs");
                    DataColumn dc = legs.Columns.Add("index", typeof(int));
                    legs.Columns.Add("description", typeof(string));

                    for (int i = 0; i <= _race.Course.Route.Count; i++)
                    {
                        string description = "";
                        if (i == 0)
                        {
                            description = "Pre-Start";
                        }
                        else if (i > 0 && i < _race.Course.Route.Count)
                        {
                            description = i + " " + _race.Course.Route[i - 1].Name + " to " + _race.Course.Route[i].Name;
                        }
                        else if (i == _race.Course.Route.Count)
                        {
                            description = "Post-Finish";
                        }
                        else
                        {
                            throw new Exception("Invalid Course Leg Reached");
                        }
                        object[] row = { i, description };
                        legs.Rows.Add(row);
                    }

                    object[] row2 = { DBNull.Value, "Overall" };
                    legs.Rows.Add(row2);

                    ds.Tables.Add(legs);

                    DataTable tacks = new DataTable("Tacks");
                    DataColumn boatId = tacks.Columns.Add("boat_id", typeof(int));
                    DataColumn legIndex = tacks.Columns.Add("leg_index", typeof(int));
                    DataColumn tackIndex = tacks.Columns.Add("tack_index", typeof(int));
                    DataColumn tackname = tacks.Columns.Add("name", typeof(string));



                    DataTable stats = new DataTable("Statistics");
                    stats.Columns.Add("boat_id", typeof(int));
                    DataColumn dc2 = stats.Columns.Add("leg_index", typeof(int));
                    dc2.AllowDBNull = true;
                    DataColumn dc3 = stats.Columns.Add("tack_index", typeof(int));
                    dc3.AllowDBNull = true;

                    DataTable statinfo = new DataTable("StatisticInfo");
                    statinfo.Columns.Add("name", typeof(string));
                    statinfo.Columns.Add("type", typeof(string));
                    statinfo.Columns.Add("unit", typeof(string));
                    statinfo.Columns.Add("description", typeof(string));

                    TimeLineStatisticCollection example = _boats[0].TotalStatistics;
                    foreach (Type statType in example.StatisticDirectory.Keys)
                    {
                        foreach (string name in example.StatisticDirectory[statType])
                        {
                            if (!stats.Columns.Contains(name))
                            {
                                stats.Columns.Add(name, statType/*example[name].GetValue(unittype, _simTime).GetType()*/);

                                object[] info = null;

                                if (unittype == StatisticUnitType.metric)
                                {
                                    object[] t = { name, statType.ToString(), example.GetStatisticMetricUnit(statType,name).ToString(), "" };
                                    info = t;
                                }
                                else if (unittype == StatisticUnitType.standard)
                                {
                                    object[] t = { name, statType.ToString(), example.GetStatisticStandardUnit(statType, name).ToString(), "" };
                                    info = t;
                                }

                                statinfo.Rows.Add(info);
                            }
                        }
                    }
                    ds.Tables.Add(statinfo);

                    foreach (ReplayBoat b in _boats)
                    {
                        DataRow dr = stats.NewRow();
                        dr["boat_id"] = b.Id;
                        dr["leg_index"] = System.DBNull.Value;
                        dr["tack_index"] = System.DBNull.Value;
                        TimeLineStatisticCollection fullstats = b.TotalStatistics;
                        foreach (Type t in fullstats.StatisticDirectory.Keys)
                        {
                            foreach (string s in fullstats.StatisticDirectory[t])
                            {
                                dr[s] = fullstats.GetValue(t, s, _simTime, unittype);
                            }
                        }
                        stats.Rows.Add(dr);

                        List<TimeLineStatisticCollection> legstats = b.LegStatistics;
                        for (int i = 0; i < legstats.Count && i<=b.GetCurrentLeg(_simTime); i++)
                        {
                            DataRow d = stats.NewRow();
                            d["boat_id"] = b.Id;
                            d["leg_index"] = i;
                            d["tack_index"] = DBNull.Value;
                            foreach (Type t in legstats[i].StatisticDirectory.Keys)
                            {
                                foreach (string s in legstats[i].StatisticDirectory[t])
                                {
                                    d[s] = legstats[i].GetValue(t, s, _simTime, unittype);
                                }
                            }
                            stats.Rows.Add(d);
                        }

                        lock (b.Tacks)
                        {
                            for(int i=0;i<b.Tacks.Count && i<=b.GetCurrentTack(_simTime);i++)
                            {
                                DataRow d = tacks.NewRow();
                                d["boat_id"] = b.Id;
                                d["leg_index"] = b.Tacks[i].LegIndex;
                                d["tack_index"] = b.Tacks[i].Index;
                                d["name"] = (b.Tacks[i].IndexOnLeg + 1) + " " + b.Tacks[i].Direction.ToString();
                                tacks.Rows.Add(d);

                                TimeLineStatisticCollection tackstats = b.TackStatistics[b.Tacks[i].Index];

                                DataRow td = stats.NewRow();
                                td["boat_id"] = b.Id;
                                td["leg_index"] = b.Tacks[i].LegIndex;
                                td["tack_index"] = b.Tacks[i].Index;
                                foreach (Type tt in tackstats.StatisticDirectory.Keys)
                                {
                                    foreach (string s in tackstats.StatisticDirectory[tt])
                                    {
                                        td[s] = tackstats.GetValue(tt, s, _simTime, unittype);
                                    }
                                }
                                stats.Rows.Add(td);
                            }
                        }
                    }
                    ds.Tables.Add(stats);
                    ds.Tables.Add(tacks);
                }
                return ds;
            //}
        }