示例#1
0
        public SingleAxisShearStationSummary(
            ISessionColumnCollection collection,
            DataView data,
            double wdbin,
            double wdrosebin,
            double wsbin,
            ShearCalculationGridCollection gridcollection
            )
        {
            _ef            = new ExcelFile();
            _ef.LimitNear += new LimitEventHandler(_ef_LimitNear);
            //original data
            SessionColumnType sheartype = SessionColumnType.WSAvgSingleAxisShear;

            _hourShearWksht   = new HourShearWorkSheet(gridcollection, _ef);
            _monthHourWorksht = new WindSpeedFrequencyMonthHourWorkSheet(collection, data.Table, _ef, sheartype);
            _wSWDworkSht      = new WindSpeedFrequencyWDWSWorkSheet(collection, data, wdbin, wsbin, _ef, sheartype);
            _wroseWksht       = new WindRoseWorkSheet(collection, data, wdrosebin, _ef, sheartype);
            //datarecovery worksheet

            //built in order they will appear in work book
            _hourShearWksht.BuildWorkSheet();
            _monthHourWorksht.BuildWorkSheet();
            _wSWDworkSht.BuildWorkSheet();
            _wroseWksht.BuildWorkSheet();
        }
示例#2
0
        public XbyYShearStationSummary(
            ISessionColumnCollection collection,
            DataView data,
            double wdbin,
            double wdrosebin,
            double wsbin,
            ShearCalculationGridCollection gridcollection,
            List <StationSummarySheetType> whatToRun
            )
        {
            _collection     = collection;
            _data           = data;
            _wdbin          = wdbin;
            _wdrosebin      = wdrosebin;
            _wsbin          = wsbin;
            _gridcollection = gridcollection;

            _ef            = new ExcelFile();
            _ef.LimitNear += new LimitEventHandler(_ef_LimitNear);

            foreach (StationSummarySheetType s in whatToRun)
            {
                try
                {
                    RunReports[s].Invoke();
                }
                catch
                {
                }
            }
        }
示例#3
0
        public XbyYShearStationSummary(
            ISessionColumnCollection collection,
            DataView data,
            double wdbin,
            double wdrosebin,
            double wsbin,
            ShearCalculationGridCollection gridcollection
            )
        {
            _collection     = collection;
            _data           = data;
            _wdbin          = wdbin;
            _wdrosebin      = wdrosebin;
            _wsbin          = wsbin;
            _gridcollection = gridcollection;

            _ef            = new ExcelFile();
            _ef.LimitNear += new LimitEventHandler(_ef_LimitNear);

            //original data
            _shearWksht        = new MonthbyHourShearWorkSheet(gridcollection, _ef);
            _monthHourWorksht  = new WindSpeedFrequencyMonthHourWorkSheet(collection, data.Table, _ef, SessionColumnType.WSAvgShear);
            _wSWDworkSht       = new WindSpeedFrequencyWDWSWorkSheet(collection, data, wdbin, wsbin, _ef, SessionColumnType.WSAvgShear);
            _wroseWksht        = new WindRoseWorkSheet(collection, data, wdrosebin, _ef, SessionColumnType.WSAvgShear);
            _dataRecoveryWksht = new DataRecoveryWorksheet(_ef, collection, data.Table);

            //built in order they will appear in work book
            _shearWksht.BuildWorkSheet();
            _monthHourWorksht.BuildWorkSheet();
            _wSWDworkSht.BuildWorkSheet();
            _wroseWksht.BuildWorkSheet();
            _dataRecoveryWksht.BuildWorkSheet();
        }
        public HourShearWorkSheet(ShearCalculationGridCollection gridcollection, ExcelFile ef)
        {
            //prepare the grids
            _ef = ef;

            _upperAvgGrid = new Grid(new Create1byYGrid(new HourAxis(), gridcollection.UpperAvg));
            _lowerAvgGrid = new Grid(new Create1byYGrid(new HourAxis(), gridcollection.LowerAvg));
            _alphaGrid    = new Grid(new Create1byYGrid(new HourAxis(), gridcollection.Alpha));
        }
示例#5
0
        public bool CalculateWindSpeed(double shearht, out ShearCalculationGridCollection gridcollection)
        {
            try
            {
                //make sure there are axis vals set
                if (_xaxis == null || _yaxis == null)
                {
                    Console.WriteLine(" shear not calculated because no axes were provided");
                    gridcollection = null;
                    return(false);
                }

                //Console.WriteLine(" x axis " + _xaxis.AxisValues.Length + " y axis " + _yaxis.AxisValues.Length);

                HourAxis          hourAxis  = null;
                MonthAxis         monthAxis = null;
                WindDirectionAxis wdAxis    = null;

                //add axes to a list for easier parsing
                List <IAxis> AssignedAxis = new List <IAxis>();
                AssignedAxis.Add(_xaxis);
                AssignedAxis.Add(_yaxis);
                bool useWD = false;

                foreach (IAxis a in AssignedAxis)
                {
                    switch (a.AxisType)
                    {
                    case AxisType.Hour:
                        hourAxis = (HourAxis)a;
                        break;

                    case AxisType.Month:
                        monthAxis = (MonthAxis)a;
                        break;

                    case AxisType.WD:
                        wdAxis = (WindDirectionAxis)a;
                        useWD  = true;

                        throw new NotImplementedException("shear by WD not yet developed");

                    default:
                        break;
                    }
                }

                // Console.WriteLine("assigned axis types");

                _data.Sort = Settings.Default.TimeStampName;
                DateTime t       = DateTime.Now;
                double   missing = Settings.Default.MissingValue;

                //get a date at the beginning of the dataset provided
                DateTime start = DateTime.Parse(_data[2][_collection.DateIndex].ToString());

                //get a list of the columns for this config sorted ascending by height
                SortedDictionary <double, ISessionColumn> orderedWsCols
                    = _collection.GetColumnsByType(SessionColumnType.WSAvg, start, true);

                if (orderedWsCols.Count == 0)
                {
                    throw new ApplicationException("No WS Composite columns were found in MonthHourShear class. Config boundary dates may have been passed incorrectly");
                }

                //sort columns descending by height
                orderedWsCols.Reverse();

                //put the column indexes into a list for coincident values constructor
                SortedDictionary <double, int> TopCols = new SortedDictionary <double, int>();

                foreach (KeyValuePair <double, ISessionColumn> kv in orderedWsCols)
                {
                    //Console.WriteLine("passed to getrows as ws idx:" + kv.Value.ColName);
                    TopCols.Add(kv.Key, _collection[kv.Value.ColName].ColIndex);
                }
                List <double> SensorHts = TopCols.Keys.ToList();
                SensorHts.Sort();
                //Console.WriteLine("first row after sort " + _data[1][0] + " " + _[SensorHts [1]] + " " + _data[1][SensorHts[0]]);

                //pass the column list and the dataview to get only  coincident rows for the columns passed
                XbyYShearCoincidentRowCollection coincident
                    = new XbyYShearCoincidentRowCollection(_collection.DateIndex, TopCols, _data);

                int wdColIndex = 0;
                List <XbyYCoincidentRow> coincidentValues = new List <XbyYCoincidentRow>();
                if (_collection["WDAvgComposite"] != null)
                {
                    wdColIndex = _collection["WDAvgComposite"].ColIndex;

                    //Console.WriteLine("Shear.CalculateWS:wd comp index=" + wdColIndex );

                    coincidentValues = coincident.GetRows(wdColIndex);


                    //Console.WriteLine("coincident rows count " + coincidentValues.Count);
                }
                else
                {
                    coincidentValues = coincident.GetRows(1);
                }

                //collection to hold averages at each x y point
                gridcollection = new ShearCalculationGridCollection();

                //get number of elements in each axis
                int hour  = 0;
                int month = 0;
                int x     = _xaxis.AxisValues.Length;
                int y     = _yaxis.AxisValues.Length;
                // Console.WriteLine("assigned axis lengths " + x + ", " + y);
                if (AxisLengthsDetermined != null)
                {
                    AxisLengthsDetermined("Assigned Alpha Grid Axis lengths " + x + " by " + y);
                }
                //arrays to hold upper and lower avgs at each x,y point
                double[,] UpperAvgGrid = new double[x, y];
                double[,] LowerAvgGrid = new double[x, y];

                //list to hold avg values for each sensor grid at each x and y bin
                List <double> upperWsVals = new List <double>();
                List <double> lowerWSVals = new List <double>();

                for (int a = 0; a < x; a++)
                {
                    for (int j = 0; j < y; j++)
                    {
                        int TestCount = 0;
                        if (useWD)
                        {
                        }
                        else
                        {
                            if (_xaxis.AxisType == AxisType.Hour)
                            {
                                hour = a;  month = j;
                            }
                            else
                            {
                                hour = j;  month = a;
                            }
                            hour  = (int)hourAxis.AxisValues[hour];
                            month = (int)monthAxis.AxisValues[month];
                            //Console.WriteLine("hour " + hour + ", Month " + month);
                            //find the row collection for this x,y point
                            var r = from s in coincidentValues.AsEnumerable()
                                    where s.Date.Month == month && s.Date.Hour == hour &&
                                    s.WD >= 0
                                    select s;

                            //Console.WriteLine(month + " " + hour + " value: " + r.Count());

                            double useUpperWSVal;
                            double useLowerWSVal;

                            foreach (var row in r)
                            {
                                //if (month == 11)
                                //{
                                //    Console.WriteLine("date " + row.Date + " upper ws " + (double)row.UpperWS);
                                //}
                                if (Double.TryParse(row.UpperWS.ToString(), out useUpperWSVal) &&
                                    Double.TryParse(row.LowerWS.ToString(), out useLowerWSVal))
                                {
                                    upperWsVals.Add(useUpperWSVal);
                                    lowerWSVals.Add(useLowerWSVal);
                                }
                                TestCount++;
                            }
                        }
                        //Console.WriteLine("upper count at " + month + ", " + hour + ": " + TestCount);
                        //add each collection  avg to the avg grids

                        //Console.WriteLine("lower average at " + month + ", " + hour + ": " + lowerWSVals.Average() + "/n");
                        if (upperWsVals.Count > 0 && lowerWSVals.Count > 0)
                        {
                            UpperAvgGrid[a, j] = upperWsVals.Average();
                            // Console.WriteLine( a + " by " + j + "           " + upperWsVals.Count);

                            LowerAvgGrid[a, j] = lowerWSVals.Average();
                        }
                        else
                        {
                            UpperAvgGrid[a, j] = 0;
                            LowerAvgGrid[a, j] = 0;
                        }

                        upperWsVals.Clear();
                        lowerWSVals.Clear();

                        //Console.WriteLine("Upper average at " + a + ", " + hour + " "+ UpperAvgGrid[a, j]);
                        //Console.WriteLine("Lower average at " + month + ", " + hour + " " + LowerAvgGrid[a, j]);
                    }
                }
                gridcollection.LowerAvg = LowerAvgGrid;
                gridcollection.UpperAvg = UpperAvgGrid;


                //calculate each alpha value and assign to  a single grid
                double[,] alphaGrid = new double[x, y];

                //fill alpha table

                for (int a = 0; a < x; a++)
                {
                    for (int j = 0; j < y; j++)
                    {
                        //Console.WriteLine(" x=" + a.ToString() + " y=" + j.ToString());
                        alphaGrid[a, j] = Math.Log(gridcollection.UpperAvg [a, j] / gridcollection.LowerAvg [a, j])
                                          / Math.Log(SensorHts[1] / SensorHts[0]);
                        //Console.WriteLine("Alpha in grid=" + alphaGrid[a, j].ToString() +
                        //    " upper ws =" + gridcollection.UpperAvg[a, j].ToString() +
                        //    " Lower ws =" + gridcollection.LowerAvg[a, j].ToString() +
                        //    " upper ht " + SensorHts[1] + " lower ht " + SensorHts[0] +
                        //    " month=" + monthAxis.AxisValues[a] + " hour=" + hourAxis.AxisValues[j]);
                        if (Double.IsNaN(alphaGrid[a, j]))
                        {
                            alphaGrid[a, j] = 0;
                        }
                    }
                }

                gridcollection.Alpha = alphaGrid;

                //create a single multi-d array from the original dictionary of values
                //values must stay in order
                List <int> CombineCols = TopCols.Values.ToList();

                //height and value of the valid ws comp at each row ordered by datetime
                double[,] result = CombineSensorVals(CombineCols);

                //Console.WriteLine("Rows in full data " + _data.Count + " rows in combined dataset " + result.GetLength (1));
                //array to store sheared ws
                List <double> ShearResult = new List <double>(result.GetLength(1));

                //add colummn to dataset and capture colindex
                string localcolname = shearht.ToString();
                localcolname += Enum.GetName(typeof(SessionColumnType), SessionColumnType.WSAvgShear);
                localcolname += x + "by" + y;
                //Console.WriteLine("X by Y shear column  will be named " + localcolname);

                int shearIndex = AddShearColumnToTable(localcolname, shearht);
                int alphaIndex = AddAlphaColumn("Alpha");

                double   thisAlpha;
                int      xVal;
                int      yVal;
                DateTime thisDate;
                double   thisWD;
                if (AddingShearValues != null)
                {
                    AddingShearValues("Calculating " + shearht + "m Sheared Windspeed");
                }
                //loop combined values
                for (int i = 0; i < result.GetLength(1); i++)
                {
                    thisDate = (DateTime)_data[i][_collection.DateIndex];

                    if (useWD)
                    {
                        thisWD = (double)_data[i][wdColIndex];
                    }
                    else
                    {
                        xVal                 = monthAxis.ReturnAxisValue(thisDate);
                        yVal                 = hourAxis.ReturnAxisValue(thisDate);
                        thisAlpha            = gridcollection.Alpha [xVal, yVal];
                        _data[i][alphaIndex] = thisAlpha;
                        if (result[1, i] >= 0)
                        {
                            _data[i][shearIndex] = (result[1, i] * Math.Pow((shearht / result[0, i]), thisAlpha));
                        }
                        else
                        {
                            _data[i][shearIndex] = missing;
                        }
                    }
                }
                _data.Table.AcceptChanges();

                DateTime t_end = DateTime.Now;
                TimeSpan dur   = t_end - t;
                //Console.WriteLine("Calculating and adding " + x + " by " + y + " shear ws takes  " + dur);
                if (AddedShearValues != null)
                {
                    AddedShearValues("Shear Calculation Complete");
                }

                return(true);
            }
            catch (Exception e)
            {
                throw e;
            }
        }
示例#6
0
        public bool CalculateWindSpeed(double shearht, out ShearCalculationGridCollection grid)
        {
            //there is nothing here that guarantees that the view does not span multple configs
            //but assumes that it does not
            try
            {
                _data.Sort = Settings.Default.TimeStampName;
                DateTime t       = DateTime.Now;
                double   missing = Settings.Default.MissingValue;

                //get a date at the beginning of the dataset provided
                DateTime start = DateTime.Parse(_data[0][_collection.DateIndex].ToString());

                //get a list of the columns for this config sorted ascending by height
                SortedDictionary <double, ISessionColumn> orderedWsCols
                    = _collection.GetColumnsByType(SessionColumnType.WSAvg, start, true);


                //sort columns descending by height
                orderedWsCols.Reverse();
                List <ISessionColumn> workCols = orderedWsCols.Values.ToList();

                //put the column indexes into a list for coincident values constructor
                List <int> TopCols = new List <int>();
                foreach (KeyValuePair <double, ISessionColumn> kv in orderedWsCols)
                {
                    Console.WriteLine("col name " + kv.Value.ColName);
                    TopCols.Add(kv.Value.ColIndex);
                }
                Console.WriteLine("first row after sort " + _data[0][0] + " " + _data[0][TopCols[0]] + " " + _data[0][TopCols[1]]);

                //pass the column list and the dataview to get the coincident values of the columns
                ICoincidentValues coincident = new CoincidentValues(TopCols, _data);

                //take the average of the each of the lists of values
                //add the average to a dictionary indexed by the column index
                Dictionary <int, List <double> > coincidentValues = coincident.GetValues();

                Dictionary <int, double> avgvals = new Dictionary <int, double>();

                foreach (KeyValuePair <int, List <double> > kv in coincidentValues)
                {
                    avgvals.Add(kv.Key, kv.Value.Average());

                    Console.WriteLine(_collection[kv.Key].ColName + " " + kv.Value.Count);

                    double ht = _collection[kv.Key].getConfigAtDate(start).Height;
                }

                Console.WriteLine("upper avg " + avgvals[TopCols[1]] + " lower avg " + avgvals[TopCols[0]]);
                Console.WriteLine("upper ht " + orderedWsCols.Keys.ToList()[1] + " lower ht " + orderedWsCols.Keys.ToList()[0]);
                //calculate alpha
                Console.WriteLine(" num " + Math.Log(avgvals[TopCols[1]] / avgvals[TopCols[0]]));
                Console.WriteLine(" den " + Math.Log(orderedWsCols.Keys.ToList()[1] / orderedWsCols.Keys.ToList()[0]));

                double alpha = Math.Log(avgvals[TopCols[1]] / avgvals[TopCols[0]])
                               / Math.Log(orderedWsCols.Keys.ToList()[1] / orderedWsCols.Keys.ToList()[0]);

                Console.WriteLine("alpha=" + alpha.ToString());

                //create a single multi-d array from the original dictionary of values
                //values must stay in order
                double[,] result = CombineSensorVals(TopCols);

                List <double> ShearResult = new List <double>(result.GetLength(1));

                //add colummn to dataset
                string localcolname = shearht.ToString();
                localcolname += Enum.GetName(typeof(SessionColumnType), SessionColumnType.WSAvgBulkShear);
                Console.WriteLine("composite col will be named " + localcolname);

                int shearIndex = AddBulkShearToTable(localcolname, shearht);

                //apply bulk shear alpha to create sheared array values
                for (int i = 0; i < result.GetLength(1); i++)
                {
                    if (result[1, i] >= 0)
                    {
                        _data[i][shearIndex] = (result[1, i] * Math.Pow((shearht / result[0, i]), alpha));
                    }
                    else
                    {
                        _data[i][shearIndex] = missing;
                    }
                }
                _data.Table.AcceptChanges();

                DateTime t_end = DateTime.Now;
                TimeSpan dur   = t_end - t;
                Console.WriteLine("Calculating and adding bulk shear ws takes  " + dur);
                grid = null;
                return(true);
            }
            catch (Exception e)
            {
                throw e;
            }
        }
示例#7
0
        public bool CalculateWindSpeed(double shearht, out ShearCalculationGridCollection gridcollection)
        {
            //make sure there are axis vals set
            if (_xaxis == null)
            {
                Console.WriteLine(" shear not calculated because no axis was provided");
                gridcollection = null;
                return(false);
            }
            Console.WriteLine(" x axis " + _xaxis.AxisValues.Length);
            HourAxis hourAxis = (HourAxis)_xaxis;

            _data.Sort = Settings.Default.TimeStampName;
            DateTime t       = DateTime.Now;
            double   missing = Settings.Default.MissingValue;

            //get a date at the beginning of the dataset provided
            DateTime start = DateTime.Parse(_data[2][_collection.DateIndex].ToString());

            //get a list of the columns for this config sorted ascending by height
            SortedDictionary <double, ISessionColumn> orderedWsCols
                = _collection.GetColumnsByType(SessionColumnType.WSAvg, start, true);

            //sort columns descending by height
            orderedWsCols.Reverse();

            //put the column indexes into a list for coincident values constructor
            SortedDictionary <double, int> TopCols = new SortedDictionary <double, int>();

            foreach (KeyValuePair <double, ISessionColumn> kv in orderedWsCols)
            {
                TopCols.Add(kv.Key, kv.Value.ColIndex);
            }
            List <double> SensorHts = TopCols.Keys.ToList();

            SensorHts.Sort();

            //pass the column list and the dataview to get only  coincident rows for the columns passed
            XbyYShearCoincidentRowCollection coincident
                = new XbyYShearCoincidentRowCollection(_collection.DateIndex, TopCols, _data);

            int wdColIndex = _collection["WDAvgComposite"].ColIndex;

            Console.WriteLine("wd comp index=" + wdColIndex);

            List <XbyYCoincidentRow> coincidentValues = coincident.GetRows(wdColIndex);

            Console.WriteLine("coincident rows count " + coincidentValues.Count);

            //collection to hold averages at each x y point
            gridcollection = new ShearCalculationGridCollection();

            //get number of elements in each axis
            int hour = 0;

            int x = _xaxis.AxisValues.Length;

            Console.WriteLine("assigned axis length  1 by " + x);
            //arrays to hold upper and lower avgs at each x,y point
            double[,] UpperAvgGrid = new double[1, x];
            double[,] LowerAvgGrid = new double[1, x];

            //list to hold avg values for each sensor grid at each x and y bin
            List <double> upperWsVals = new List <double>();
            List <double> lowerWSVals = new List <double>();

            //only 1 element because this is a 1 by x shear
            for (int a = 0; a < 1; a++)
            {
                for (int j = 0; j < x; j++)
                {
                    int TestCount = 0;
                    //Console.WriteLine(" a " + a + " j " + j);
                    hour = (int)hourAxis.AxisValues[j];

                    //find the row collection for this x,y point
                    var r = from s in coincidentValues.AsEnumerable()
                            where s.Date.Hour == hour &&
                            s.WD >= 0
                            select s;

                    //Console.WriteLine(month + " " + hour + " value: " + r.Count());

                    double useUpperWSVal;
                    double useLowerWSVal;
                    foreach (var row in r)
                    {
                        if (Double.TryParse(row.UpperWS.ToString(), out useUpperWSVal) &&
                            Double.TryParse(row.LowerWS.ToString(), out useLowerWSVal))
                        {
                            upperWsVals.Add(useUpperWSVal);
                            lowerWSVals.Add(useLowerWSVal);
                        }
                        TestCount++;
                    }
                    if (upperWsVals.Count > 0 && lowerWSVals.Count > 0)
                    {
                        UpperAvgGrid[a, j] = upperWsVals.Average();
                        LowerAvgGrid[a, j] = lowerWSVals.Average();
                    }
                    else
                    {
                        UpperAvgGrid[a, j] = 0;
                        LowerAvgGrid[a, j] = 0;
                    }
                    upperWsVals.Clear();
                    lowerWSVals.Clear();
                }
            }
            gridcollection.LowerAvg = LowerAvgGrid;
            gridcollection.UpperAvg = UpperAvgGrid;


            //calculate each alpha value and assign to  a single grid
            double[,] alphaGrid = new double[1, x];

            //fill alpha table

            for (int a = 0; a < 1; a++)
            {
                for (int j = 0; j < x; j++)
                {
                    //Console.WriteLine(" x=" + a.ToString() + " y=" + j.ToString());
                    alphaGrid[a, j] = Math.Log(gridcollection.UpperAvg[a, j] / gridcollection.LowerAvg[a, j])
                                      / Math.Log(SensorHts[1] / SensorHts[0]);
                    //Console.WriteLine("Alpha in grid=" + alphaGrid[a, j].ToString() +
                    //    " upper ws =" + gridcollection.UpperAvg[a, j].ToString() +
                    //    " Lower ws =" + gridcollection.LowerAvg[a, j].ToString() +
                    //    " upper ht " + SensorHts[1] + " lower ht " + SensorHts[0] +
                    //    " month=" + monthAxis.AxisValues[a] + " hour=" + hourAxis.AxisValues[j]);
                }
            }

            gridcollection.Alpha = alphaGrid;

            //create a single multi-d array from the original dictionary of values
            //values must stay in order
            List <int> CombineCols = TopCols.Values.ToList();

            //height and value of the valid ws comp at each row ordered by datetime
            double[,] result = CombineSensorVals(CombineCols);

            Console.WriteLine("Rows in full data " + _data.Count + " rows in combined dataset " + result.GetLength(1));
            //array to store sheared ws
            List <double> ShearResult = new List <double>(result.GetLength(1));

            //add colummn to dataset and capture colindex
            string localcolname = shearht.ToString();

            localcolname += Enum.GetName(typeof(SessionColumnType), SessionColumnType.WSAvgSingleAxisShear);
            localcolname += "1" + "by" + x;
            Console.WriteLine("X by Y shear column will be named " + localcolname);

            int shearIndex = AddShearColumnToTable(localcolname, shearht);

            double   thisAlpha;
            int      yVal;
            DateTime thisDate;

            //loop combined values
            for (int i = 0; i < result.GetLength(1); i++)
            {
                thisDate = (DateTime)_data[i][_collection.DateIndex];

                yVal      = hourAxis.ReturnAxisValue(thisDate);
                thisAlpha = gridcollection.Alpha[0, yVal];

                if (result[0, i] > 0)
                {
                    _data[i][shearIndex] = (result[1, i] * Math.Pow((shearht / result[0, i]), thisAlpha));
                    //Console.WriteLine(_data[i][shearIndex]);
                }
                else
                {
                    _data[i][shearIndex] = missing;
                }
            }
            _data.Table.AcceptChanges();

            DateTime t_end = DateTime.Now;
            TimeSpan dur   = t_end - t;

            Console.WriteLine("Calculating and adding 1 by " + x + " shear ws takes  " + dur);

            return(true);
        }