예제 #1
0
        public static List <DataSeriesViewModel> GetSINGenerationDataSeries(int scenario, SINGenerationType generationType)
        {
            ObservableCollection <ChartDataPoint> dataPoints;
            DataSeriesViewModel        dataSeries;
            List <DataSeriesViewModel> dataSeriesList = new List <DataSeriesViewModel>();
            DataTable dataTable = ResultsReader.ReadSINGeneration(scenario, generationType);

            for (int i = 1; i < dataTable.Columns.Count; i++)
            {
                DataColumn column = dataTable.Columns[i];

                dataPoints = new ObservableCollection <ChartDataPoint>();
                foreach (DataRow row in dataTable.Rows)
                {
                    int    period     = Convert.ToInt32(row[0]);
                    string periodDate = "";
                    if (period <= DHOGDataBaseViewModel.PeriodsDate.GetLength(0))
                    {
                        periodDate = DHOGDataBaseViewModel.PeriodsDate[period - 1];
                    }
                    else
                    {
                        throw new Exception(MessageUtil.FormatMessage("ERROR.ChartDateNotFound", "Generación SIN", period));
                    }
                    dataPoints.Add(new ChartDataPoint(periodDate, Convert.ToDouble(row[column])));
                }

                dataSeries = new DataSeriesViewModel(column.ColumnName, dataPoints);
                dataSeriesList.Add(dataSeries);
            }

            dataTable  = ResultsReader.ReadMarginalCost(scenario);
            dataPoints = new ObservableCollection <ChartDataPoint>();
            foreach (DataRow row in dataTable.Rows)
            {
                int    period     = Convert.ToInt32(row[0]);
                string periodDate = "";
                if (period <= DHOGDataBaseViewModel.PeriodsDate.GetLength(0))
                {
                    periodDate = DHOGDataBaseViewModel.PeriodsDate[period - 1];
                }
                else
                {
                    throw new Exception(MessageUtil.FormatMessage("ERROR.ChartDateNotFound", "Generación SIN", period));
                }

                dataPoints.Add(new ChartDataPoint(periodDate, Convert.ToDouble(row[1])));
            }
            dataSeries = new DataSeriesViewModel(dataTable.Columns[1].ColumnName, dataPoints);
            dataSeriesList.Add(dataSeries);

            return(dataSeriesList);
        }
예제 #2
0
        public static List <DataSeriesViewModel> GetGenerationByCompanyDataSeries(int scenario, string selctedCompany)
        {
            ObservableCollection <ChartDataPoint> dataPoints;
            DataSeriesViewModel        dataSeries;
            List <DataSeriesViewModel> dataSeriesList = new List <DataSeriesViewModel>();

            DataTable dataTable = ResultsReader.ReadGenerationByCompany(scenario, selctedCompany);

            dataPoints = new ObservableCollection <ChartDataPoint>();

            foreach (DataRow row in dataTable.Rows)
            {
                int    period     = Convert.ToInt32(row[2]);
                string periodDate = "";
                if (period <= DHOGDataBaseViewModel.PeriodsDate.GetLength(0))
                {
                    periodDate = DHOGDataBaseViewModel.PeriodsDate[period - 1];
                }
                else
                {
                    throw new Exception(MessageUtil.FormatMessage("ERROR.ChartDateNotFound", "Generación SIN", period));
                }
                //dataPoints.Add(new ChartDataPoint(row[2].ToString(), Convert.ToDouble(row[3])));
                dataPoints.Add(new ChartDataPoint(periodDate, Convert.ToDouble(row[3])));
            }

            dataSeries = new DataSeriesViewModel("Generación", dataPoints);
            dataSeriesList.Add(dataSeries);

            //Generación Objetivo
            dataTable = ResultsReader.ReadObjectiveGenerationByCompany(scenario, selctedCompany);

            dataPoints = new ObservableCollection <ChartDataPoint>();
            foreach (DataRow row in dataTable.Rows)
            {
                int    period     = Convert.ToInt32(row[2]);
                string periodDate = "";
                if (period <= DHOGDataBaseViewModel.PeriodsDate.GetLength(0))
                {
                    periodDate = DHOGDataBaseViewModel.PeriodsDate[period - 1];
                }
                else
                {
                    throw new Exception(MessageUtil.FormatMessage("ERROR.ChartDateNotFound", "Generación SIN", period));
                }
                //dataPoints.Add(new ChartDataPoint(row[2].ToString(), Convert.ToDouble(row[3])));
                dataPoints.Add(new ChartDataPoint(periodDate, Convert.ToDouble(row[3])));
            }
            dataSeries = new DataSeriesViewModel("Generación Objetivo", dataPoints);
            dataSeriesList.Add(dataSeries);

            return(dataSeriesList);
        }