예제 #1
0
        public DataTable GetEstado(double Ax) // devuelve una datatable con los datos del estado actual
        {
            DataTable estado = new DataTable();

            estado.Columns.Add(new DataColumn("x L"));
            estado.Columns.Add(new DataColumn("A A*"));
            estado.Columns.Add(new DataColumn("ρ ρo"));
            estado.Columns.Add(new DataColumn("V ao"));
            estado.Columns.Add(new DataColumn("T To"));
            estado.Columns.Add(new DataColumn("P Po"));
            estado.Columns.Add(new DataColumn("M"));

            int i = 0;

            while (i <= this.numRect)
            {
                Rectangulo rect = this.nozzle[i];

                String position    = (i * Ax).ToString(); // coord x
                String area        = rect.GetArea().ToString("0.0000");
                String density     = rect.GetDensP().ToString("0.0000");
                String velocity    = rect.GetVelP().ToString("0.0000");
                String temperature = rect.GetTempP().ToString("0.0000");
                String pressure    = rect.GetPresP().ToString("0.0000");
                String mach        = (rect.GetVelP() / Math.Sqrt(rect.GetTempP())).ToString("0.0000"); // M = V / a

                estado.Rows.Add(position, area, density, velocity, temperature, pressure, mach);

                i++;
            }

            return(estado);
        }
예제 #2
0
 public Rectangulo(Rectangulo rectC) // constructor copia (estado presente)
 {
     this.tempP  = rectC.GetTempP();
     this.velP   = rectC.GetVelP();
     this.densP  = rectC.GetDensP();
     this.presP  = rectC.GetPresP();
     this.altura = rectC.GetAltura();
     this.area   = rectC.GetArea();
 }
예제 #3
0
        public void GuardarEstadoFichero(string fichero, double Ax, double At, double gamma, int contadort, double C, List <double> listdt, List <double> listdens, List <double> listtemp, List <double> listvel, List <double> listpres) // guarda el estado actual del nozzle en un txt
        {
            //obrim fitxer
            StreamWriter W = new StreamWriter(fichero + ".txt");

            //afegim numero de rectangles
            W.WriteLine(Convert.ToString(this.numRect));

            //guardem les dades de cada rectangle en strings
            int i = 0;

            while (i <= this.numRect + 1)
            {
                Rectangulo rect = this.nozzle[i];

                //recollim dades de cada rectangle, separades per ';'
                string dades = Convert.ToString(rect.GetTempP()) + ";" + Convert.ToString(rect.GetVelP()) + ";" + Convert.ToString(rect.GetDensP()) + ";" + Convert.ToString(rect.GetPresP()) + ";" + Convert.ToString(rect.GetAltura()) + ";" + Convert.ToString(rect.GetArea());

                //escribim una linea x cada rectangle
                W.WriteLine(dades);

                i++;
            }

            //afegim la resta de paràmetres
            W.WriteLine(Convert.ToString(Ax));
            W.WriteLine(Convert.ToString(At));
            W.WriteLine(Convert.ToString(gamma));
            W.WriteLine(Convert.ToString(contadort));
            W.WriteLine(Convert.ToString(C));

            //agegim les List
            int cont = 0;

            while (cont < listdt.Count())
            {
                //recollim les dades de les List, separades per ';'
                // ORDRE: dt, dens, temp, vel, pres
                string data = Convert.ToString(listdt[cont]) + ";" + Convert.ToString(listdens[cont]) + ";" + Convert.ToString(listtemp[cont]) + ";" + Convert.ToString(listvel[cont]) + ";" + Convert.ToString(listpres[cont]);

                //escribim una línea per a cada posició
                W.WriteLine(data);

                cont++;
            }

            //tanquem fitxer
            W.Close();
        }