コード例 #1
0
 public Cylinder(EngineSpecs es, Crankshaft crankshaft, double initial_crank_angle, StrokeCycle initial_stroke)
 {
     this.es             = es;
     piston              = new Piston(es, crankshaft, initial_crank_angle);
     bore                = es.bore;
     stroke              = es.stroke;
     this.current_stroke = initial_stroke;
 }
コード例 #2
0
 public Piston(EngineSpecs es, Crankshaft crankshaft, double initial_crank_angle)
 {
     this.es                      = es;
     this.crankshaft              = crankshaft;
     this.crank_angle             = initial_crank_angle;
     this.angle_of_current_stroke = 0;
     crank_radius                 = es.stroke / 2.0;
     connecting_rod_length        = es.piston_connecting_rod_length;
 }
コード例 #3
0
        public Engine(EngineSpecs es)
        {
            this.es = es;

            cylinders = new Cylinder[es.num_of_cylinders];

            crankshaft = new Crankshaft(this, es);

            num_of_cylinders = es.num_of_cylinders;
            efficiency       = es.efficiency;

            for (int i = 0; i < es.num_of_cylinders; i++)
            {
                double      initial_piston_angle = 0;
                StrokeCycle initial_stroke       = StrokeCycle.Intake;


                switch (i)
                {
                case 0:
                {
                    initial_piston_angle = 0;
                    initial_stroke       = StrokeCycle.Intake;
                    break;
                }

                case 1:
                {
                    initial_piston_angle = 180;
                    initial_stroke       = StrokeCycle.Compression;
                    break;
                }

                case 2:
                {
                    initial_piston_angle = 180;
                    initial_stroke       = StrokeCycle.Exhaust;
                    break;
                }

                case 3:
                {
                    initial_piston_angle = 0;
                    initial_stroke       = StrokeCycle.Combustion;
                    break;
                }
                }

                cylinders[i] = new Cylinder(es, crankshaft, initial_piston_angle, initial_stroke);
            }
        }