Ejemplo n.º 1
0
        public double t; //Время

        #endregion Fields

        #region Constructors

        public Solar_System(double DT)
        {
            //Задание параметров
            G = 398600E9 / (3375000E27)*age* age;///6.67408E-11;
            CoordinateList = new NewCoordinate[7];
            /*PT = new List<double> { 89*24*60*60, 224 * 24 * 60 * 60, 365 * 24 * 60 * 60, 687 * 24 * 60 * 60, 0, 0 };
            PRadiuses = new List<double> { 2440000.0, 6052000.0, 6371000.0, 3390000.0, 69911000, 60268000 };
            PMasses = new List<double> { 328.5E21, 4.867E24, 5.972E24, 639E21, 1.8986E27, 5.6846E26 };
            */
            PColors = new List<Color> { Color.FromRgb(255, 83, 0), Color.FromRgb(255, 150, 0), Color.FromRgb(0, 77, 255), Color.FromRgb(255, 0, 0), Color.FromRgb(133, 133, 133),Color.FromRgb(36,20,100) };
            /*PStartR = new List<Vector> { new Vector(0, 69817445000), new Vector(-1082E8, 0), new Vector(1496E8, 0), new Vector(0, -2279E8),new Vector(0, 740573600000),new Vector(1.353573E12,0) };
            PStartSpeed = new List<Vector> { new Vector(39E3, 0), new Vector(0, 35E3), new Vector(0, -29.8E3), new Vector(-24E3, 0), new Vector(13E3, 0), new Vector(0, -9.79E3) };
            SMass = 1.9891E30;
            SRadius = 696000000;*/
            ///
            //В а.е. и земных массах:
            SMass = 332982;
            SRadius = 0;
            PT = new List<double> { 89.0/365.0, 224.0/365.0, 1, 687.0/365.0, 0, 0 };
            PRadiuses = new List<double> {0, 0, 0, 0, 0 , 0};
            //PRadiuses = new List<double> { 0.01626/*(6), 0.040346/*(6), 0.042473/*(3), 0.0226, 0.466073/*(3), 0.401786/*(6};
            PMasses = new List<double> { 0.055274, 0.815, 1.0, 0.107, 317.916, 95 };
            PStartR = new List<Vector> { new Vector(0, 0.46670079), new Vector(-0.72823128, 0), new Vector(1, 0), new Vector(0, -1.666), new Vector(0, 5.458104), new Vector(10.116, 0) };
            PStartSpeed = new List<Vector> { new Vector(39E3/ae*age, 0), new Vector(0, 35E3/ae*age), new Vector(0, -29.8E3/ae*age), new Vector(-24E3/ae* age, 0), new Vector(13E3/ae* age, 0), new Vector(0, -9.79E3/ae*age) };

            //--------
            SunColor = Color.FromRgb(255, 255, 0);
            SRadiusVector.X = 0;
            SRadiusVector.Y = 0;
            dt = DT; t = 0;
            //-------------------Инициализация планет---------------------
            Mercury = new Planet(PMasses[0], PRadiuses[0], PColors[0], PStartR[0],PStartSpeed[0], PT[0]);
            Venera = new Planet(PMasses[1], PRadiuses[1], PColors[1], PStartR[1], PStartSpeed[1], PT[1]);
            Earth = new Planet(PMasses[2], PRadiuses[2], PColors[2], PStartR[2], PStartSpeed[2], PT[2]);
            Mars = new Planet(PMasses[3], PRadiuses[3], PColors[3], PStartR[3], PStartSpeed[3], PT[3]);
            Jupiter = new Planet(PMasses[4], PRadiuses[4], PColors[4], PStartR[4], PStartSpeed[4], PT[4]);
            Saturn = new Planet(PMasses[5], PRadiuses[5], PColors[5], PStartR[5], PStartSpeed[5], PT[5]);
            Faeton = new Planet(1, 0, Color.FromRgb(255,255,255), new Vector(0, 558874037960/ae), new Vector(-15E3 / ae * age, 0), 0);
            Faeton2 = new Planet(1, 0, Color.FromRgb(0, 255, 0), new Vector(0, 558874037960 / ae), new Vector(-15E3 / ae * age, 0), 0);
            //------------------------------------------------------------
        }
Ejemplo n.º 2
0
        public void UpdateRKMethod(int i, double t, double x, double y, double vx, double vy, Planet planet)
        {
            double k1x, k1y, k2x, k2y, k3x, k3y, k4x, k4y;

            k1x = Updatef(x, y, vx, vy, planet,Jupiter,Saturn) * dt;
            k1y = Updateg(x, y, vx, vy, planet, Jupiter, Saturn) * dt;
            k2x = Updatef(x + vx * dt / 2.0, y + vy * dt / 2.0, vx + k1x / 2.0, vy + k1y / 2.0, planet, Jupiter, Saturn) * dt;
            k2y = Updateg(x + vx * dt / 2.0, y + vy * dt / 2.0, vx + k1x / 2.0, vy + k1y / 2.0, planet, Jupiter, Saturn) * dt;
            k3x = Updatef(x + vx * dt / 2.0 + k1x / 4.0 * dt, y + vy * dt / 2.0 + k1y / 4.0 * dt, vx + k2x / 2.0, vy + k2y / 2.0, planet, Jupiter, Saturn) * dt;
            k3y = Updateg(x + vx * dt / 2.0 + k1x / 4.0 * dt, y + vy * dt / 2.0 + k1y / 4.0 * dt, vx + k2x / 2.0, vy + k2y / 2.0, planet, Jupiter, Saturn) * dt;
            k4x = Updatef(x + vx * dt + k2x * dt / 2.0, y + vy * dt + k2y * dt / 2.0, vx + k3x, vy + k3y, planet, Jupiter, Saturn) * dt;
            k4y = Updateg(x + vx * dt + k2x * dt / 2.0, y + vy * dt + k2y * dt / 2.0, vx + k3x, vy + k3y, planet, Jupiter, Saturn) * dt;

            double
            xNew = x + vx * dt + ((k1x + k2x + k3x) / 6.0) * dt,
            yNew = y + vy * dt + ((k1y + k2y + k3y) / 6.0) * dt,
            vxNew = vx + (k1x + 2 * k2x + 2 * k3x + k4x) / 6.0,
            vyNew = vy + (k1y + 2 * k2y + 2 * k3y + k4y) / 6.0;

            CoordinateList[i] = new NewCoordinate(xNew, yNew, vxNew, vyNew);
        }
Ejemplo n.º 3
0
 public double Updateg(double x, double y, double vx, double vy, Planet planet,Planet p1, Planet p2)
 {
     return (-G * SMass * planet.PRadiusVector.Y / Math.Pow(planet.PRadiusVector.Length, 3)
        - G * p1.PMass * planet.PRadiusVector.Y / Math.Pow(Math.Sqrt(Math.Pow(planet.PRadiusVector.X - p1.PRadiusVector.X, 2) + Math.Pow(planet.PRadiusVector.Y - p1.PRadiusVector.Y, 2)), 3)
        - G * p2.PMass * planet.PRadiusVector.Y / Math.Pow(Math.Sqrt(Math.Pow(planet.PRadiusVector.X - p2.PRadiusVector.X, 2) + Math.Pow(planet.PRadiusVector.Y - p2.PRadiusVector.Y, 2)), 3)
         );
 }
Ejemplo n.º 4
0
 public void Move(Planet planet,int i)
 {
     planet.PRadiusVector.X = CoordinateList[i].x;
     planet.PRadiusVector.Y = CoordinateList[i].y;
     planet.PSpeedVector.X = CoordinateList[i].vx;
     planet.PSpeedVector.Y = CoordinateList[i].vy;
     planet.t += dt;
 }
Ejemplo n.º 5
0
 public double g(double x, double y, double vx,double vy, Planet planet)
 {
     return (-G * SMass * planet.PRadiusVector.Y / Math.Pow(planet.PRadiusVector.Length, 3));
 }
Ejemplo n.º 6
0
 //Функция подсчета расстояния между афелием и перигелием
 void Research(Planet planet, int i,Label label)
 {
     double r = 0;
     if (planet.T/2.0 < planet.t)
     {
         planet.AfIPer = !planet.AfIPer;
         if (planet.AfIPer)
             planet.Afeliy = planet.PRadiusVector;
         else
             planet.Perigeliy = planet.PRadiusVector;
         r = Math.Sqrt(Math.Pow(planet.Afeliy.X - planet.Perigeliy.X, 2) + Math.Pow(planet.Afeliy.Y - planet.Perigeliy.Y, 2));
         planet.t = 0;
         label.Content = Convert.ToString(Math.Round(r, 5)) + " a.e";
         if (system.t > 2)
             rs[i].Add(Math.Round(r , 5));
     }
 }