public ActionResult Detalles(int id)
        {
            PrimeraExpoContext db = new PrimeraExpoContext();

            var model = new DetallesViewModel();

            model.Persona = db.Personas.SingleOrDefault(persona => persona.PersonaId == id);
            return(View(model));
        }
Ejemplo n.º 2
0
        public ActionResult Detalles([FromQuery] double ambiental, [FromQuery] double superficial,
                                     [FromQuery] double operacion, [FromQuery] double diametro,
                                     [FromQuery] double viento,
                                     [FromQuery] double emisividad, [FromQuery] int aislante)
        {
            var datagri   = new ArrayList();
            var transfMax = 0;
            var tipo      = false;

            for (var i = 0; i < 100; i++)
            {
                var    ta   = ambiental + 274;
                var    tsup = superficial + 274;
                var    top  = operacion + 274;
                var    c    = (diametro <= 0) ? 1.79 : 1.016;
                var    esp  = (6.35 * i) * 0.001;
                double kais = 0;
                var    v    = viento * 0.621371;
                var    emss = emisividad;
                var    Do   = diametro * 0.001;
                var    key  = false;


                double valorA;
                double valorB;
                double valorC;
                double operacion2;

                if (aislante == (int)Aislante.CPCA96)
                {
                    valorA = 0.2187 / 6.935;
                    valorB = 0.0002148 / 6.935;
                    valorC = 0.0000006908 / 6.935;

                    operacion2 = ((top + tsup) / 2) * (1.8) + 32;

                    kais = valorA + valorB * operacion2 + valorC * Math.Pow(operacion2, 2);
                }
                if (aislante == (int)Aislante.CPCA144)
                {
                    valorA = 0.2192 / 6.935;
                    valorB = 0.0001433 / 6.935;
                    valorC = 0.0000006312 / 6.935;

                    operacion2 = ((top + tsup) / 2) * (1.8) + 32;

                    kais = valorA + valorB * operacion2 + valorC * Math.Pow(operacion2, 2);
                }
                if (aislante == (int)Aislante.CPCA192)
                {
                    valorA = 0.2331 / 6.935;
                    valorB = 0.0000679 / 6.935;
                    valorC = 0.0000006385 / 6.935;

                    operacion2 = ((top + tsup) / 2) * (1.8) + 32;

                    kais = valorA + valorB * operacion2 + valorC * Math.Pow(operacion2, 2);
                }
                if (aislante == (int)Aislante.FF32)
                {
                    valorA = 0.212 / 6.935;
                    valorB = 0.0002696 / 6.935;
                    valorC = 0.000001367 / 6.935;

                    operacion2 = ((top + tsup) / 2) * (1.8) + 32;

                    kais = valorA + valorB * operacion2 + valorC * Math.Pow(operacion2, 2);
                }
                if (aislante == (int)Aislante.FF48)
                {
                    valorA = 0.2035 / 6.935;
                    valorB = 0.000373 / 6.935;
                    valorC = 0.0000009124 / 6.935;

                    operacion2 = ((top + tsup) / 2) * (1.8) + 32;

                    kais = valorA + valorB * operacion2 + valorC * Math.Pow(operacion2, 2);
                }
                if (aislante == (int)Aislante.FF64)
                {
                    valorA = 0.2033 / 6.935;
                    valorB = 0.0003868 / 6.935;
                    valorC = 0.0000006548 / 6.935;

                    operacion2 = ((top + tsup) / 2) * (1.8) + 32;

                    kais = valorA + valorB * operacion2 + valorC * Math.Pow(operacion2, 2);
                }
                if (aislante == (int)Aislante.FF96)
                {
                    valorA = 0.2187 / 6.935;
                    valorB = 0.0002148 / 6.935;
                    valorC = 0.0000006908 / 6.935;

                    operacion2 = ((top + tsup) / 2) * (1.8) + 32;

                    kais = valorA + valorB * operacion2 + valorC * Math.Pow(operacion2, 2);
                }
                if (aislante == (int)Aislante.FF128)
                {
                    valorA = 0.2114 / 6.935;
                    valorB = 0.0002836 / 6.935;
                    valorC = 0.0000004948 / 6.935;

                    operacion2 = ((top + tsup) / 2) * (1.8) + 32;

                    kais = valorA + valorB * operacion2 + valorC * Math.Pow(operacion2, 2);
                }

                if (c == 1.79)
                {
                    transfMax = CalculoTransferencia(Do * 1000, top, false);
                    tipo      = true;
                    while (key == false)
                    {
                        var hc = 3.0075 * c * (Math.Pow(1.11 / (tsup + ta - 510.44), 0.181)) *
                                 (Math.Pow(1.8 * (tsup - ta), 0.266)) *
                                 (Math.Pow(1 + 7.9366 * Math.Pow(10, -4) * v, 0.5));
                        var hr = (0.9824 * Math.Pow(10, -8) * emss) * (Math.Pow(ta, 4) - Math.Pow(tsup, 4)) /
                                 (ta - tsup);
                        var hs  = hc + hr;
                        var q   = (top - ta) / ((esp / kais) + (1 / hs));
                        var tsc = ta + q / hs;


                        var tsc2  = Convert.ToInt32(tsc);
                        var tsup2 = Convert.ToInt32(tsup);

                        if (tsc2 == tsup2)
                        {
                            key = true;

                            var esp2 = Convert.ToInt32(esp * 1000);
                            var q2   = Convert.ToString(q);


                            var qint   = Convert.ToInt32(q);
                            var tscint = Convert.ToInt32(tsc - 274);

                            datagri.Add(new Resultado
                            {
                                Espesor   = esp2 + " mm",
                                Flux      = qint + " w/m2",
                                SupMaxima = tscint + " °C"
                            });
                        }
                        else
                        {
                            key  = false;
                            tsup = tsc;
                        }
                    }
                }
                else
                {
                    transfMax = CalculoTransferencia(Do * 1000, top, true);
                    tipo      = false;

                    while (key == false)
                    {
                        var da = Do + 2 * esp;
                        var hc = 2.7241 * c * Math.Pow(da, -0.2) * Math.Pow(1.11 / (tsup + ta - 510.44), 0.181) *
                                 Math.Pow(1.8 * (tsup - ta), 0.266) * Math.Pow(1 + 7.9366 * Math.Pow(10, -4) * v, 0.5);
                        var hr  = 0.9824 * Math.Pow(10, -8) * emss * (Math.Pow(ta, 4) - Math.Pow(tsup, 4)) / (ta - tsup);
                        var hs  = hc + hr;
                        var q   = Math.PI * (top - ta) / (1 / (2 * kais) * Math.Log(da / Do) + 1 / (hs * da));
                        var tsc = top - (q / (2 * Math.PI * kais) * Math.Log(da / Do));


                        var tsc2  = Convert.ToInt32(tsc);
                        var tsup2 = Convert.ToInt32(tsup);
                        if (tsc2 == tsup2)
                        {
                            key  = true;
                            tsc += -274;

                            var esp2 = Convert.ToInt32(esp * 1000);

                            var qint   = Convert.ToInt32(q);
                            var tscint = Convert.ToInt32(tsc);


                            datagri.Add(new Resultado
                            {
                                Espesor   = esp2 + " mm",
                                Flux      = qint + " w/m",
                                SupMaxima = tscint + " °C"
                            });
                        }

                        else
                        {
                            key  = false;
                            tsup = tsc;
                        }
                    }
                }
            }

            var viewModel = new DetallesViewModel
            {
                Lista     = datagri,
                TransfMax = transfMax,
                tuberia   = tipo
            };

            return(new ObjectResult(viewModel));
        }
Ejemplo n.º 3
0
 public UserDetails(User selectedItem)
 {
     BindingContext = new  DetallesViewModel(this, selectedItem);
     InitializeComponent();
 }
Ejemplo n.º 4
0
        public ActionResult Detalles(Calculo calculo)
        {
            // Calculo calculo = _context.Calculos.Where(c => c.Id == Id).SingleOrDefault(); //_context.Set<Calculo>().SingleOrDefault(c => c.Id == Id);


            ArrayList datagri   = new ArrayList();
            int       transfMax = 0;
            bool      tipo      = false;

            for (int i = 0; i < 100; i++)
            {
                var    ta   = calculo.Ambiental + 274;
                var    tsup = calculo.Superficial + 274;
                var    top  = calculo.Operacion + 274;
                double C    = (calculo.Diametro <= 0) ? 1.79 : 1.016;
                double esp  = (6.35 * i) * 0.001;
                double kais = 0;
                double V    = calculo.Viento * 0.621371;
                double Emss = calculo.Emisividad;
                double Do   = calculo.Diametro * 0.001;
                bool   key  = false;


                double ValorA      = 0;
                double ValorB      = 0;
                double ValorC      = 0;
                double TOperacion2 = 0;

                if (calculo.Aislante == ProductosList.CPCA96)
                {
                    ValorA = 0.2187 / 6.935;
                    ValorB = 0.0002148 / 6.935;
                    ValorC = 0.0000006908 / 6.935;

                    TOperacion2 = ((top + tsup) / 2) * (1.8) + 32;

                    kais = ValorA + ValorB * TOperacion2 + ValorC * Math.Pow(TOperacion2, 2);
                }
                if (calculo.Aislante == ProductosList.CPCA144)
                {
                    ValorA = 0.2192 / 6.935;
                    ValorB = 0.0001433 / 6.935;
                    ValorC = 0.0000006312 / 6.935;

                    TOperacion2 = ((top + tsup) / 2) * (1.8) + 32;

                    kais = ValorA + ValorB * TOperacion2 + ValorC * Math.Pow(TOperacion2, 2);
                }
                if (calculo.Aislante == ProductosList.CPCA192)
                {
                    ValorA = 0.2331 / 6.935;
                    ValorB = 0.0000679 / 6.935;
                    ValorC = 0.0000006385 / 6.935;

                    TOperacion2 = ((top + tsup) / 2) * (1.8) + 32;

                    kais = ValorA + ValorB * TOperacion2 + ValorC * Math.Pow(TOperacion2, 2);
                }
                if (calculo.Aislante == ProductosList.TERMOAISLANTE)
                {
                    ValorA = 0.1977 / 6.935;
                    ValorB = 0.0004 / 6.935;
                    ValorC = 0.0000002262 / 6.935;

                    TOperacion2 = ((top + tsup) / 2) * (1.8) + 32;

                    kais = ValorA + ValorB * TOperacion2 + ValorC * Math.Pow(TOperacion2, 2);
                }
                if (calculo.Aislante == ProductosList.FF32)
                {
                    ValorA = 0.212 / 6.935;
                    ValorB = 0.0002696 / 6.935;
                    ValorC = 0.000001367 / 6.935;

                    TOperacion2 = ((top + tsup) / 2) * (1.8) + 32;

                    kais = ValorA + ValorB * TOperacion2 + ValorC * Math.Pow(TOperacion2, 2);
                }
                if (calculo.Aislante == ProductosList.FF48)
                {
                    ValorA = 0.2035 / 6.935;
                    ValorB = 0.000373 / 6.935;
                    ValorC = 0.0000009124 / 6.935;

                    TOperacion2 = ((top + tsup) / 2) * (1.8) + 32;

                    kais = ValorA + ValorB * TOperacion2 + ValorC * Math.Pow(TOperacion2, 2);
                }
                if (calculo.Aislante == ProductosList.FF64)
                {
                    ValorA = 0.2033 / 6.935;
                    ValorB = 0.0003868 / 6.935;
                    ValorC = 0.0000006548 / 6.935;

                    TOperacion2 = ((top + tsup) / 2) * (1.8) + 32;

                    kais = ValorA + ValorB * TOperacion2 + ValorC * Math.Pow(TOperacion2, 2);
                }
                if (calculo.Aislante == ProductosList.FF96)
                {
                    ValorA = 0.2187 / 6.935;
                    ValorB = 0.0002148 / 6.935;
                    ValorC = 0.0000006908 / 6.935;

                    TOperacion2 = ((top + tsup) / 2) * (1.8) + 32;

                    kais = ValorA + ValorB * TOperacion2 + ValorC * Math.Pow(TOperacion2, 2);
                }
                if (calculo.Aislante == ProductosList.FF128)
                {
                    ValorA = 0.2114 / 6.935;
                    ValorB = 0.0002836 / 6.935;
                    ValorC = 0.0000004948 / 6.935;

                    TOperacion2 = ((top + tsup) / 2) * (1.8) + 32;

                    kais = ValorA + ValorB * TOperacion2 + ValorC * Math.Pow(TOperacion2, 2);
                }

                if (C == 1.79)
                {
                    transfMax = CalculoTransferencia(Do * 1000, top, false);
                    tipo      = true;
                    while (key == false)
                    {
                        double hc  = 3.0075 * C * (Math.Pow(1.11 / (tsup + ta - 510.44), 0.181)) * (Math.Pow(1.8 * (tsup - ta), 0.266)) * (Math.Pow(1 + 7.9366 * Math.Pow(10, -4) * V, 0.5));
                        double hr  = (0.9824 * Math.Pow(10, -8) * Emss) * (Math.Pow(ta, 4) - Math.Pow(tsup, 4)) / (ta - tsup);
                        double hs  = hc + hr;
                        double q   = (top - ta) / ((esp / kais) + (1 / hs));
                        double tsc = ta + q / hs;


                        int tsc2  = Convert.ToInt32(tsc);
                        int tsup2 = Convert.ToInt32(tsup);

                        if (tsc2 == tsup2)
                        {
                            key = true;

                            int    esp2 = Convert.ToInt32(esp * 1000);
                            string q2   = Convert.ToString(q);


                            int qint   = Convert.ToInt32(q);
                            int tscint = Convert.ToInt32(tsc - 274);

                            datagri.Add(new Resultado {
                                Espesor = esp2 + " mm", Flux = qint + " w/m2", SupMaxima = tscint + " °C"
                            });
                        }
                        else
                        {
                            key  = false;
                            tsup = tsc;
                        }
                    }
                }
                else
                {
                    transfMax = CalculoTransferencia(Do * 1000, top, true);
                    tipo      = false;

                    while (key == false)
                    {
                        double da  = Do + 2 * esp;
                        double hc  = 2.7241 * C * Math.Pow(da, -0.2) * Math.Pow(1.11 / (tsup + ta - 510.44), 0.181) * Math.Pow(1.8 * (tsup - ta), 0.266) * Math.Pow(1 + 7.9366 * Math.Pow(10, -4) * V, 0.5);
                        double hr  = 0.9824 * Math.Pow(10, -8) * Emss * (Math.Pow(ta, 4) - Math.Pow(tsup, 4)) / (ta - tsup);
                        double hs  = hc + hr;
                        double q   = Math.PI * (top - ta) / (1 / (2 * kais) * Math.Log(da / Do) + 1 / (hs * da));
                        double tsc = top - (q / (2 * Math.PI * kais) * Math.Log(da / Do));


                        int tsc2  = Convert.ToInt32(tsc);
                        int tsup2 = Convert.ToInt32(tsup);
                        if (tsc2 == tsup2)
                        {
                            key  = true;
                            tsc += -274;

                            int esp2 = Convert.ToInt32(esp * 1000);

                            int qint   = Convert.ToInt32(q);
                            int tscint = Convert.ToInt32(tsc);


                            datagri.Add(new Resultado {
                                Espesor = esp2 + " mm", Flux = qint + " w/m", SupMaxima = tscint + " °C"
                            });
                        }

                        else
                        {
                            key  = false;
                            tsup = tsc;
                        }
                    }
                }
            }

            var ViewModel = new DetallesViewModel
            {
                Lista     = datagri,
                TransfMax = transfMax,
                tuberia   = tipo
            };

            ViewData["MyCalculo"] = ViewModel;



            return(View(ViewModel));
        }