Beispiel #1
0
        private void btnAbrirDB_Click(object sender, EventArgs e)
        {
            try
            {
                if (ComboMedidores.Text != "")
                {
                    pnlAlertaVerde.Visible = false;
                    pnlAlertaRojo.Visible  = false;
                    Conector_DataBase conector = new Conector_DataBase();
                    List <DatosPilot> Regitros = new List <DatosPilot>();
                    //OpenFileDialog openFileDialog1 = new OpenFileDialog();
                    //openFileDialog1.RestoreDirectory = true;
                    //openFileDialog1.CheckFileExists = true;
                    //openFileDialog1.CheckPathExists = true;
                    //openFileDialog1.Title = "Buscar medición en formato csv";
                    //openFileDialog1.DefaultExt = ".csv";
                    //openFileDialog1.Filter = "archivos csv (*.csv)|*.csv";

                    string ScvMedidor = txtNumeroMedidor.Text + ".csv";
                    string url        = "C:\\Data Origen Report One\\DBPILOT\\" + ScvMedidor;

                    if (File.Exists(url).ToString() != "")
                    {
                        if (File.Exists(url))
                        {
                            string line = "";
                            //string linea = "";
                            int counter = 0;
                            // Read the file and display it line by line.
                            System.IO.StreamReader file = new System.IO.StreamReader(@"" + url);
                            //se crear un clon de la lectura del archivon para saber la cantidad de lineas
                            System.IO.StreamReader fileCantidad = new System.IO.StreamReader(@"" + url);
                            PilotDB filaData = new PilotDB();
                            filaData.Nombre            = txtNombreMedidor.Text;
                            filaData.NombrePropietadio = txtNombreCliente.Text;
                            filaData.Marca             = txtMarcaMedidor.Text;
                            filaData.NumeroMedidor     = txtNumeroMedidor.Text;
                            //Bloque
                            decimal Blo_KwhDel_a       = 0;
                            decimal Blo_KwhRec_a       = 0;
                            decimal Blo_kVARhDel_a     = 0;
                            decimal Blo_Blo_kVARhRec_a = 0;
                            while ((line = file.ReadLine()) != null)
                            {
                                counter++;
                                int      cantidadColumnas = line.Split(',').Count();
                                string[] columnasCsv      = new string[cantidadColumnas];
                                int[]    columnasUsar     = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 15, 17, 18, 19, 20, 21 };
                                columnasCsv = line.Split(',');
                                DatosPilot Dato = new DatosPilot();


                                if (counter > 1)
                                {
                                    // this.gridDatos.Rows.Add(1);
                                    Random rnd = new Random();
                                    for (var i = 0; i < cantidadColumnas; i++)
                                    {
                                        var texto = SacarTexto(line, i + 1);
                                        switch (i)
                                        {
                                        case 1:
                                            Dato.Time = Convert.ToDateTime(texto);
                                            break;

                                        case 2:
                                            Dato.Va = Convert.ToDecimal(texto);
                                            break;

                                        case 3:
                                            Dato.Vb = Convert.ToDecimal(texto);
                                            break;

                                        case 4:
                                            Dato.Vc = Convert.ToDecimal(texto);
                                            break;

                                        case 5:
                                            Dato.Ia = Convert.ToDecimal(texto);
                                            break;

                                        case 6:
                                            Dato.Ib = Convert.ToDecimal(texto);
                                            break;

                                        case 7:
                                            Dato.Ic = Convert.ToDecimal(texto);
                                            break;

                                        case 8:
                                            Dato.Frequency = Convert.ToDecimal(texto);
                                            break;

                                        case 9:
                                            Dato.Pa = Convert.ToDecimal(texto);
                                            break;

                                        case 10:
                                            Dato.Pb = Convert.ToDecimal(texto);
                                            break;

                                        case 11:
                                            Dato.Pc = Convert.ToDecimal(texto);
                                            break;

                                        case 15:
                                            Dato.TotalkW = Convert.ToDecimal(texto);
                                            break;

                                        case 18:
                                            Dato.Pftot = Convert.ToDecimal(texto);
                                            break;

                                        //Datos generados en bloque
                                        case 19:
                                            Dato.KwhRec = Convert.ToDecimal(texto);
                                            if (counter >= 3)
                                            {
                                                if (Dato.KwhRec < Blo_KwhRec_a)
                                                {
                                                    Dato.Blo_KwhRec = Blo_KwhRec_a - Convert.ToDecimal(texto);
                                                }
                                                else
                                                {
                                                    Dato.Blo_KwhRec = 0;
                                                }

                                                Blo_KwhRec_a = Dato.KwhRec;
                                            }
                                            else
                                            {
                                                Blo_KwhRec_a = Dato.KwhRec;
                                            }

                                            break;

                                        case 20:
                                            Dato.KwhDel = Convert.ToDecimal(texto);

                                            if (counter >= 3)
                                            {
                                                Dato.Blo_KwhDel = Blo_KwhDel_a - Convert.ToDecimal(texto);
                                                Blo_KwhDel_a    = Dato.KwhDel;
                                            }
                                            else
                                            {
                                                Blo_KwhDel_a = Dato.KwhDel;
                                            }

                                            break;

                                        case 21:
                                            Dato.kVARhDel = Convert.ToDecimal(texto);
                                            if (counter >= 3)
                                            {
                                                if (Dato.kVARhDel < Blo_kVARhDel_a)
                                                {
                                                    Dato.Blo_kVARhDel = 0;
                                                }
                                                else
                                                {
                                                    Dato.Blo_kVARhDel = Blo_kVARhDel_a - Convert.ToDecimal(texto);
                                                }

                                                Blo_kVARhDel_a = Dato.kVARhDel;
                                            }
                                            else
                                            {
                                                Blo_kVARhDel_a = Dato.kVARhDel;
                                            }
                                            break;

                                        case 22:
                                            Dato.kVARhRec = Convert.ToDecimal(texto);
                                            if (counter >= 3)
                                            {
                                                Dato.Blo_kVARhRec  = Blo_Blo_kVARhRec_a - Convert.ToDecimal(texto);
                                                Blo_Blo_kVARhRec_a = Dato.kVARhRec;
                                            }
                                            else
                                            {
                                                Blo_Blo_kVARhRec_a = Dato.kVARhRec;
                                            }
                                            break;

                                        case 23:
                                            Dato.TotalkWh_del_Rec     = Dato.KwhRec - Dato.KwhDel;
                                            Dato.Blo_TotalkWh_del_Rec = Dato.Blo_KwhRec - Dato.Blo_KwhDel;
                                            Dato.TotalkVARh           = Dato.kVARhRec - Dato.kVARhDel;
                                            Dato.Blo_TotalkVARh       = Dato.Blo_kVARhRec - Dato.Blo_kVARhDel;
                                            ////datos Calculado a partir de lo registros
                                            Dato.Rec_kW = (Dato.KwhRec * 4);
                                            Dato.Del_kW = (Dato.KwhDel * 4);
                                            double a = Convert.ToDouble(Dato.TotalkVARh);
                                            Dato.kVAh_rms = Convert.ToDecimal(a * 0.8);
                                            double b = Convert.ToDouble(Dato.KwhRec);
                                            Dato.Rec_kVAh = Convert.ToDecimal(b * 0.8);
                                            double c = Convert.ToDouble(Dato.KwhDel);
                                            Dato.Del_kVAh = Convert.ToDecimal(c * 0.8);
                                            break;
                                        }
                                    }
                                    Regitros.Add(Dato);
                                }
                            }
                            //Pasar Los Datos Leidos Ala Base de datos
                            conector.insertarDatosPilot(Regitros, filaData);
                            pnlAlertaVerde.Visible = true;
                            lblverde.Text          = "Registros Agregados";
                        }
                        else
                        {
                            pnlAlertaRojo.Visible = true;
                            lblR.Text             = "El archivo scv  no se encuentra";
                        }
                    }
                    else
                    {
                        pnlAlertaRojo.Visible = true;
                        lblR.Text             = "El archivo scv esta Vacio ";
                    }
                }
                else
                {
                    pnlAlertaRojo.Visible = true;
                    lblR.Text             = "Seleccione Un Medidor";
                }
            }
            catch (Exception ex)
            {
                pnlAlertaRojo.Visible = true;
                lblR.Text             = "Erro AL Guardar Los Registro : " + ex.ToString();
            }
        }
        public void btnAnlizarRangoFecha_Click(object sender, EventArgs e)
        {
            //Llano
            txtKwhLlano.Text            = "";
            txtKvahrLlano.Text          = "";
            txtKwdLlano.Text            = "";
            txtFactorPotenciaLlano.Text = "";
            //punta
            txtKwhPunta.Text            = "";
            txtKvahrPunta.Text          = "";
            txtKwdPunta.Text            = "";
            txtFactorPotenciaPunta.Text = "";
            //valle
            txtKwhValle.Text            = "";
            txtKvahrValle.Text          = "";
            txtKwdValle.Text            = "";
            txtFactorPotenciaValle.Text = "";
            //Voltaje
            txtMaxL1.Text      = "";
            txtFechaMaxL1.Text = "";

            //Valores de Fecha para la consulta
            //Fecha Inicial
            DateTime fechaInicial         = dtFechaInicalRegistro.Value.Date;
            DateTime horaInicial          = Convert.ToDateTime(CbHoraInicialRegistro.Text + ":" + CbMinutoInicialRegistro.Text + ":" + "00");
            DateTime FechaInicialRegistro = fechaInicial.AddHours(horaInicial.Hour).AddMinutes(horaInicial.Minute).AddSeconds(horaInicial.Second);
            //Fecha Final
            DateTime fechaFinal         = dtFechaFinalRegistro.Value.Date;
            DateTime horaFinal          = Convert.ToDateTime(CbHoraFinalRegistro.Text + ":" + CbMinutoFinalRegistro.Text + ":" + "00");
            DateTime FechaFinalRegistro = fechaFinal.AddHours(horaFinal.Hour).AddMinutes(horaFinal.Minute).AddSeconds(horaFinal.Second);

            CantidadDias = 0;
            for (DateTime i = FechaInicialRegistro; i <= FechaFinalRegistro; i = i.AddDays(1))
            {
                CantidadDias++;
            }
            txtCantidadDias.Text = "" + CantidadDias;


            Conector_DataBase conector = new Conector_DataBase();

            var DocumentoRegistro = MongoConexion.DataBase.GetCollection <DatosPilot>("pilot");


            ////Linq
            var resutado = (from d in DocumentoRegistro.FindAll()
                            where (d.NumeroMedidor == txtNumeroMedidor.Text) &&
                            (d.Time >= FechaInicialRegistro && d.Time <= FechaFinalRegistro)
                            orderby d.Time ascending
                            select d).ToList();

            //var PRUEBA = (from d in DocumentoRegistro.FindAll()
            //                  where (d.NumeroMedidor == txtNumeroMedidor.Text)
            //                orderby d.Time ascending
            //                select d).ToList();



            // PilotDB pilot = new PilotDB();
            DatosPilot dpilot      = new DatosPilot();
            DatosPilot dpilotValle = new DatosPilot();
            DatosPilot dpilotPunta = new DatosPilot();
            //deliveri
            DatosPilot dpilotDelivey      = new DatosPilot();
            DatosPilot dpilotValleDelivey = new DatosPilot();
            DatosPilot dpilotPuntaDelivey = new DatosPilot();
            //recibido
            DatosPilot dpilotRecibido      = new DatosPilot();
            DatosPilot dpilotValleRecibido = new DatosPilot();

            DatosRegistro DatosNeto  = new DatosRegistro();
            DatosRegistro DatosValle = new DatosRegistro();
            DatosRegistro DatosPunta = new DatosRegistro();

            if (resutado == null || resutado.Count() < 1)
            {
                //HACER ALGO POR QUE NO HAY DATA
                pnlAlertaRojo.Visible = true;
                lblR.Text             = "Rango de fecha invalido";
            }
            else
            {
                //FUMADAS CON DATA
                foreach (var Datos in resutado)
                {
                    //neto => Total de la sumatoria en valle y punta de los registros
                    DatosNeto.Kwh   = DatosNeto.Kwh + Datos.Blo_TotalkWh_del_Rec;
                    DatosNeto.Kvarh = DatosNeto.Kvarh + Datos.Blo_TotalkVARh;
                    DatosNeto.Kwd   = DatosNeto.Kwd + Datos.TotalkW;
                    // Total de los delivery
                    DatosNeto.D_Kwh   = DatosNeto.D_Kwh + Datos.Blo_kVARhDel;
                    DatosNeto.D_Kvarh = DatosNeto.D_Kvarh + Datos.Blo_kVARhDel;
                    // total de los dados recibidos
                    DatosNeto.R_Kwh   = DatosNeto.R_Kwh + Datos.Blo_KwhRec;
                    DatosNeto.R_Kvarh = DatosNeto.R_Kvarh + Datos.Blo_kVARhRec;

                    if (Datos.Time.Hour > 18 && Datos.Time.Hour < 20)
                    {
                        //punta
                        //neto
                        dpilotPunta.TotalkWh_del_Rec = dpilotPunta.TotalkWh_del_Rec + Datos.TotalkWh_del_Rec;
                        dpilotPunta.TotalkVARh       = dpilotPunta.TotalkVARh + Datos.TotalkVARh;
                        dpilotPunta.TotalkW          = dpilotPunta.TotalkW + Datos.TotalkW;


                        //delivey
                        dpilotPuntaDelivey.KwhDel   = dpilotPuntaDelivey.KwhDel + Datos.KwhDel;
                        dpilotPuntaDelivey.kVARhDel = dpilotPuntaDelivey.kVARhDel + Datos.kVARhDel;
                        dpilotPuntaDelivey.Del_kW   = dpilotPuntaDelivey.Del_kW + Datos.Del_kW;

                        //Resibido
                    }
                    else
                    {
                        //Valle
                        //Neto
                        dpilotValle.TotalkWh_del_Rec = dpilotValle.TotalkWh_del_Rec + Datos.TotalkWh_del_Rec;
                        dpilotValle.TotalkVARh       = dpilotValle.TotalkVARh + Datos.TotalkVARh;
                        dpilotValle.TotalkW          = dpilotValle.TotalkW + Datos.TotalkW;
                        //delivey
                        dpilotValleDelivey.KwhDel   = dpilotValleDelivey.KwhDel + Datos.KwhDel;
                        dpilotValleDelivey.kVARhDel = dpilotValleDelivey.kVARhDel + Datos.kVARhDel;
                        dpilotValleDelivey.Del_kW   = dpilotValleDelivey.Del_kW + Datos.Del_kW;
                        //Recibido
                        dpilotValleRecibido.KwhRec   = dpilotValleRecibido.KwhRec + Datos.KwhRec;
                        dpilotValleRecibido.kVARhRec = dpilotValleRecibido.kVARhRec + Datos.kVARhRec;
                        dpilotValleRecibido.kVARhRec = dpilotValleRecibido.kVARhRec + Datos.kVARhRec;
                    }
                    //Enviado
                    //dpilot.

                    if (DatosNeto.L1Max < Convert.ToSingle(Datos.Va))
                    {
                        DatosNeto.L1Max     = Convert.ToSingle(Datos.Va);
                        DatosNeto.L1MAxdate = Datos.Time;
                    }
                    if (DatosNeto.L2Max < Convert.ToSingle(Datos.Vb))
                    {
                        DatosNeto.L2Max     = Convert.ToSingle(Datos.Vb);
                        DatosNeto.L2Maxdate = Datos.Time;
                    }
                    if (DatosNeto.L3Max < Convert.ToSingle(Datos.Vc))
                    {
                        DatosNeto.L3Max     = Convert.ToSingle(Datos.Vc);
                        DatosNeto.L3Maxdate = Datos.Time;
                    }
                }
                DatosNeto.PF = (DatosNeto.Kwh == 0) ? 0 : Convert.ToDecimal(Math.Cos(Math.Atan(Convert.ToSingle(DatosNeto.Kvarh / DatosNeto.Kwh))));


                //Agregar los datos de la consulta a una tabla

                var bindingList = new BindingList <DatosPilot>(resutado);
                var source      = new BindingSource(bindingList, null);
                gridDatosConsulta.Rows.Clear();
                gridDatosConsulta.DataSource = source;
                gridDatosConsulta.Refresh();

                ////Llano////////////////////////

                //dpilot.Pftot =
                //txtKwhLlano.Text = dpilot.TotalkWh_del_Rec.ToString();
                //txtKvahrLlano.Text = dpilot.TotalkVARh.ToString();
                //txtKwdLlano.Text = dpilot.TotalkW.ToString();
                //txtFactorPotenciaLlano.Text = dpilot.Pftot.ToString();
                ////Lano delivery
                //dpilotDelivey.Pftot = (dpilotDelivey.KwhDel == 0) ? 0 : Convert.ToDecimal(Math.Cos(Math.Atan(Convert.ToSingle(dpilotDelivey.kVARhDel / dpilotDelivey.KwhDel))));
                //txtKwhLlanoD.Text = dpilotDelivey.KwhDel.ToString();
                //txtKvarhLlanoD.Text = dpilotDelivey.kVARhDel.ToString();
                //txtKwdLlanoD.Text = dpilotDelivey.Del_kW.ToString();
                //txtPfLlanoD.Text = dpilotDelivey.Pftot.ToString();
                ////Llano Recibido
                //dpilotRecibido.Pftot = (dpilotRecibido.KwhRec == 0) ? 0 : Convert.ToDecimal(Math.Cos(Math.Atan(Convert.ToSingle(dpilotRecibido.kVARhRec / dpilotRecibido.KwhRec))));
                //txtKwhLlanoR.Text = dpilotRecibido.KwhRec.ToString();
                //txtKvarhLlanoR.Text = dpilotRecibido.kVARhRec.ToString();
                //txtKwdLlanoR.Text = dpilotRecibido.Rec_kW.ToString();
                //txtPfLlanoR.Text = dpilotRecibido.Pftot.ToString();

                ////punta/////////////////


                //dpilotPunta.Pftot = (dpilotPunta.TotalkWh_del_Rec == 0) ? 0 : Convert.ToDecimal(Math.Cos(Math.Atan(Convert.ToSingle(dpilotPunta.TotalkVARh / dpilotPunta.TotalkWh_del_Rec))));
                //txtKwhPunta.Text = dpilotPunta.TotalkWh_del_Rec.ToString();
                //txtKvahrPunta.Text = dpilotPunta.TotalkVARh.ToString();
                //txtKwdPunta.Text = dpilotPunta.TotalkW.ToString();
                //txtFactorPotenciaPunta.Text = dpilotPunta.Pftot.ToString();
                ////Delivery
                //dpilotPuntaDelivey.Pftot = (dpilotPuntaDelivey.KwhDel == 0) ? 0 : Convert.ToDecimal(Math.Cos(Math.Atan(Convert.ToSingle(dpilotPuntaDelivey.kVARhDel / dpilotPuntaDelivey.KwhDel))));
                //txtKwhPuntaD.Text = dpilotPuntaDelivey.KwhDel.ToString();
                //txtKvarhPuntaD.Text = dpilotPuntaDelivey.kVARhDel.ToString();
                //txtKwdPuntaD.Text = dpilotPuntaDelivey.Del_kW.ToString();
                //txtPfPuntaD.Text = dpilotPuntaDelivey.Pftot.ToString();

                ////valle////////////

                ////netos///////
                //dpilotValle.Pftot = (dpilotValle.TotalkWh_del_Rec == 0) ? 0 : Convert.ToDecimal(Math.Cos(Math.Atan(Convert.ToSingle(dpilotValle.TotalkVARh / dpilotValle.TotalkWh_del_Rec))));
                //txtKwhValle.Text = dpilotValle.TotalkWh_del_Rec.ToString();
                //txtKvahrValle.Text = dpilotValle.TotalkVARh.ToString();
                //txtKwdValle.Text = dpilotValle.TotalkW.ToString();
                //txtFactorPotenciaValle.Text = dpilotValle.Pftot.ToString();
                ////Delivery
                //dpilotValleDelivey.Pftot = (dpilotValleDelivey.KwhDel == 0) ? 0 : Convert.ToDecimal(Math.Cos(Math.Atan(Convert.ToSingle(dpilotValleDelivey.kVARhDel / dpilotValleDelivey.KwhDel))));
                //txtKwhValleD.Text = dpilotValleDelivey.KwhDel.ToString();
                //txtKvarhValleD.Text = dpilotValleDelivey.kVARhDel.ToString();
                //txtKwdValleD.Text = dpilotValleDelivey.Del_kW.ToString();
                //txtPfValleD.Text = dpilotValleDelivey.Pftot.ToString();
                ////Recibido
                //txtKwhValleR.Text = dpilotValleRecibido.KwhRec.ToString();

                ////Voltaje
                //txtMaxL1.Text = L1Max.ToString();
                //txtFechaMaxL1.Text = L1MAxdate.ToString();
                //txtMaxL2.Text = L2Max.ToString();
                //txtFechaMaxL2.Text = L2Maxdate.ToString();
                //txtMaxL3.Text = L3Max.ToString();
                //txtFechaMaxL3.Text = L3Maxdate.ToString();
            }
        }
Beispiel #3
0
        private void btnLeer_Click(object sender, EventArgs e)
        {
            OpenFileDialog openFileDialog1 = new OpenFileDialog();

            openFileDialog1.RestoreDirectory = true;
            openFileDialog1.CheckFileExists  = true;
            openFileDialog1.CheckPathExists  = true;
            openFileDialog1.Title            = "Buscar medición en formato csv";
            openFileDialog1.DefaultExt       = ".csv";
            openFileDialog1.Filter           = "archivos csv (*.csv)|*.csv";
            //openFileDialog1.ShowDialog();

            if (openFileDialog1.ShowDialog() == DialogResult.OK && openFileDialog1.ToString() != "")
            {
                if (File.Exists("" + openFileDialog1.FileName))
                {
                    string line;
                    int    counter = 0;

                    // Read the file and display it line by line.
                    System.IO.StreamReader file =
                        new System.IO.StreamReader(@"" + openFileDialog1.FileName);

                    List <DatosPilot> listaData = new List <DatosPilot>();


                    while ((line = file.ReadLine()) != null)
                    {
                        counter++;
                        int      cantidadColumnas = line.Split(',').Count();
                        string[] columnasCsv      = new string[cantidadColumnas];
                        int[]    columnasUsar     = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 15, 17, 18, 19, 20, 21 };
                        columnasCsv = line.Split(',');

                        DatosPilot filaData = new DatosPilot();

                        if (counter > 1 && counter <= 41)
                        {
                            // this.gridDatos.Rows.Add(1);
                            Random rnd = new Random();

                            for (var i = 0; i < cantidadColumnas; i++)
                            {
                                var texto = SacarTexto(line, i + 1);

                                switch (i)
                                {
                                case 1:
                                    filaData.Time = Convert.ToDateTime(texto);
                                    break;

                                case 2:
                                    filaData.Va = Convert.ToDecimal(texto);
                                    break;

                                case 3:
                                    filaData.Vb = Convert.ToDecimal(texto);
                                    break;

                                case 4:
                                    filaData.Vc = Convert.ToDecimal(texto);
                                    break;

                                case 5:
                                    filaData.Ia = Convert.ToDecimal(texto);
                                    break;

                                case 6:
                                    filaData.Ib = Convert.ToDecimal(texto);
                                    break;

                                case 7:
                                    filaData.Ic = Convert.ToDecimal(texto);
                                    break;

                                case 8:
                                    filaData.Frequency = Convert.ToDecimal(texto);
                                    break;

                                case 9:
                                    filaData.Pa = Convert.ToDecimal(texto);
                                    break;

                                case 10:
                                    filaData.Pb = Convert.ToDecimal(texto);
                                    break;

                                case 11:
                                    filaData.Pc = Convert.ToDecimal(texto);
                                    break;

                                case 15:
                                    filaData.TotalkW = Convert.ToDecimal(texto);
                                    break;

                                case 18:
                                    filaData.Pftot = Convert.ToDecimal(texto);
                                    break;

                                case 19:
                                    filaData.KwhRec = Convert.ToDecimal(texto);
                                    break;

                                case 20:
                                    filaData.KwhDel = Convert.ToDecimal(texto);
                                    break;

                                case 21:
                                    filaData.kVARhDel = Convert.ToDecimal(texto);
                                    break;

                                case 22:
                                    filaData.kVARhRec = Convert.ToDecimal(texto);
                                    break;

                                case 23:
                                    filaData.TotalkWh_del_Rec = (filaData.KwhRec - filaData.KwhDel);
                                    filaData.TotalkVARh       = (filaData.kVARhDel - filaData.kVARhRec);
                                    ////
                                    filaData.Rec_kW = (filaData.KwhRec * 4);
                                    filaData.Del_kW = (filaData.KwhDel * 4);
                                    double a = Convert.ToDouble(filaData.TotalkVARh);
                                    filaData.kVAh_rms = Convert.ToDecimal(a * 0.8);
                                    double b = Convert.ToDouble(filaData.KwhRec);
                                    filaData.Rec_kVAh = Convert.ToDecimal(b * 0.8);
                                    double c = Convert.ToDouble(filaData.KwhDel);
                                    filaData.Rec_kVAh = Convert.ToDecimal(c * 0.8);
                                    break;
                                }
                            }
                            listaData.Add(filaData);
                        }
                    }
                    var bindingList = new BindingList <DatosPilot>(listaData);
                    var source      = new BindingSource(bindingList, null);
                    gridDatos.DataSource = source;
                }
            }
        }