예제 #1
0
        protected override Polygon GetPistonView(PositionedCylinder _positionedCylinder, double _crankshaftRotation_deg)
        {
            double _cylinderRelativeCrankThrowRotation_deg = _positionedCylinder.GetCylinderRelativeCrankThrowRotation_deg(_crankshaftRotation_deg);
            double _offset_rad = Conversions.DegToRad(_positionedCylinder.Tilt_deg);
            double _cosOffset  = Math.Cos(_offset_rad);


            double _TDC = (_cosOffset * _positionedCylinder.GetPhysicalHeightAbovePiston_mm(_cylinderRelativeCrankThrowRotation_deg));
            double _BDC = (_cosOffset * _positionedCylinder.GetPhysicalHeightUnderPiston_mm(_cylinderRelativeCrankThrowRotation_deg));

            double _rX = _positionedCylinder.Bore_mm / 2d * EngineDesigner.Media.Properties.Settings.Default.PistonVsCylinderClearance;
            double _rY = (Math.Abs(Math.Sin(_offset_rad) * _rX));

            double _rTilt = _rX * Math.Sin(Conversions.DegToRad(_positionedCylinder.Tilt_deg));


            Polygon _polygon = Polygon.Line(
                -_rX + _positionedCylinder.Offset_mm,
                _BDC,
                -_rX + _positionedCylinder.Offset_mm,
                _TDC);

            _polygon.Add(Polygon.Arc(_positionedCylinder.Offset_mm, _TDC, _rX, _rTilt, 0, 540, EngineDesigner.Media.Properties.Settings.Default.BasicEngineSketchArcPrecision));

            _polygon.Add(Polygon.Line(
                             _rX + _positionedCylinder.Offset_mm,
                             _TDC,
                             _rX + _positionedCylinder.Offset_mm,
                             _BDC));

            _polygon.Add(Polygon.Arc(_positionedCylinder.Offset_mm, _BDC, _rX, _rTilt, 180, 540, EngineDesigner.Media.Properties.Settings.Default.BasicEngineSketchArcPrecision));


            return(_polygon);
        }
        protected override Polygon GetPistonView(PositionedCylinder _positionedCylinder, double _crankshaftRotation_deg)
        {
            double _cylinderRelativeCrankThrowRotation_deg = _positionedCylinder.GetCylinderRelativeCrankThrowRotation_deg(_crankshaftRotation_deg);

            double _physicalHeightAbovePiston_mm = _positionedCylinder.GetPhysicalHeightAbovePiston_mm(_cylinderRelativeCrankThrowRotation_deg);
            double _physicalHeightUnderPiston_mm = _positionedCylinder.GetPhysicalHeightUnderPiston_mm(_cylinderRelativeCrankThrowRotation_deg);

            double _cylinderHalfBore = _positionedCylinder.Bore_mm / 2d * EngineDesigner.Media.Properties.Settings.Default.PistonVsCylinderClearance;

            double _offset_rad = Conversions.DegToRad(_positionedCylinder.Tilt_deg);
            double _sinOffset  = Math.Sin(_offset_rad);
            double _cosOffset  = Math.Cos(_offset_rad);


            //zgornja center točka bata
            double _xTDC = (_sinOffset * _physicalHeightAbovePiston_mm);
            double _yTDC = (_cosOffset * _physicalHeightAbovePiston_mm);

            //spodnja center točka bata
            double _xBDC = (_sinOffset * _physicalHeightUnderPiston_mm);
            double _yBDC = (_cosOffset * _physicalHeightUnderPiston_mm);

            //razlike od center do skrajnih točk
            double _x_ = (_cosOffset * _cylinderHalfBore);
            double _y_ = (_sinOffset * _cylinderHalfBore);

            //zgornje skrajne točke
            double _x1 = _xTDC - _x_;
            double _y1 = _yTDC + _y_;
            double _x2 = _xTDC + _x_;
            double _y2 = _yTDC - _y_;

            //spodnje skrajne točke
            double _x3 = _xBDC - _x_;
            double _y3 = _yBDC + _y_;
            double _x4 = _xBDC + _x_;
            double _y4 = _yBDC - _y_;


            return(Polygon.Rectangle(_x1, _y1, _x2, _y2, _x3, _y3, _x4, _y4));
        }
        protected override Polygon GetConnectingRodView(PositionedCylinder _positionedCylinder, double _crankshaftRotation_deg)
        {
            double _absoluteCrankThrowRotation_deg = _positionedCylinder.GetAbsoluteCrankThrowRotation_deg(_crankshaftRotation_deg);
            double _absoluteCrankThrowRotation_rad = Conversions.DegToRad(_absoluteCrankThrowRotation_deg);

            double _cylinderRelativeCrankThrowRotation_deg = _positionedCylinder.GetCylinderRelativeCrankThrowRotation_deg(_crankshaftRotation_deg);
            double _pistonTravelFromCeter_mm = _positionedCylinder.GetPistonTravelFromCrankCenter_mm(_cylinderRelativeCrankThrowRotation_deg);

            double _offset_rad = Conversions.DegToRad(_positionedCylinder.Tilt_deg);


            //zgornja točka ojnice
            double _xTDC = (Math.Sin(_offset_rad) * _pistonTravelFromCeter_mm);
            double _yTDC = (Math.Cos(_offset_rad) * _pistonTravelFromCeter_mm);

            //spodnja točka ojnice
            double _xBDC = (Math.Sin(_absoluteCrankThrowRotation_rad) * _positionedCylinder.CrankThrow.CrankRotationRadius_mm);
            double _yBDC = (Math.Cos(_absoluteCrankThrowRotation_rad) * _positionedCylinder.CrankThrow.CrankRotationRadius_mm);


            return(Polygon.Line(_xTDC, _yTDC, _xBDC, _yBDC));
        }
예제 #4
0
        protected override Polygon GetConnectingRodView(PositionedCylinder _positionedCylinder, double _crankshaftRotation_deg)
        {
            double _cylinderRelativeCrankThrowRotation_deg = _positionedCylinder.GetCylinderRelativeCrankThrowRotation_deg(_crankshaftRotation_deg);

            double _offset_rad = Conversions.DegToRad(_positionedCylinder.Tilt_deg);
            double _cosOffset  = Math.Cos(_offset_rad);

            double _pistonTravelFromCeter_mm       = _positionedCylinder.GetPistonTravelFromCrankCenter_mm(_cylinderRelativeCrankThrowRotation_deg);
            double _absoluteCrankThrowRotation_deg = _positionedCylinder.GetAbsoluteCrankThrowRotation_deg(_crankshaftRotation_deg);
            double _absoluteCrankThrowRotation_rad = Conversions.DegToRad(_absoluteCrankThrowRotation_deg);


            double _TDC = (_cosOffset * _pistonTravelFromCeter_mm);
            double _BDC = (Math.Cos(_absoluteCrankThrowRotation_rad) * _positionedCylinder.CrankThrow.CrankRotationRadius_mm);


            return(Polygon.Line(
                       _positionedCylinder.Offset_mm,
                       _TDC,
                       _positionedCylinder.Offset_mm,
                       _BDC));
        }
예제 #5
0
        private void DrawInertia(double _from, double _to, Color _color, double _rpm, PositionedCylinder _positionedCylinder)
        {
            List <XY> _points = new List <XY>();

            for (double _a = _from; _a < _to; _a++)
            {
                double _alteredA = _positionedCylinder.GetCylinderRelativeCrankThrowRotation_deg(_a);

                double _x = _positionedCylinder.GetInertiaForceReciprocating_N(_a, _rpm);
                double _y = _positionedCylinder.GetInertiaForceRotating_N(_a, _rpm);

                _points.Add(new XY(_x, _y));

                Console.WriteLine(string.Format(
                                      "X ({0});  Y ({1})",
                                      _x.ToString(),
                                      _y.ToString()));
            }

            Function _chart = Function.FromPoints(_points);

            this.functionChart1.DrawFunction(_chart, null, _color);
        }