Ejemplo n.º 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;
 }
Ejemplo n.º 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;
 }
Ejemplo n.º 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);
            }
        }
Ejemplo n.º 4
0
        public Physics()
        {
            engine.EngineSpecs es = new engine.EngineSpecs
            {
                //diameter of cylinder
                bore = 0.086f,

                //height of cylinder
                stroke = 0.086f,

                num_of_cylinders             = 4,
                piston_connecting_rod_length = 0.139f,
                //inertia = 10f * 0.08f * 0.08f,
                inertia = 1000f * 0.08f * 0.08f,

                efficiency = 0.33f
            };

            engine = new engine.Engine(es);
        }
Ejemplo n.º 5
0
 public Crankshaft(Engine engine, EngineSpecs es)
 {
     this.engine = engine;
     inertia     = es.inertia;
 }