예제 #1
0
		public void Drawing()
		{
			var options = new GraphOptions(null, null, 0.01, new GraphSize(0, 720, -40, _sizeY / 2), new SvgFileSize((int)(_sizeY * 3.4 * 2.2 * 4), (int)(_sizeY * 3.4 * 4 / 2)), AppDomain.CurrentDomain.BaseDirectory + @"\Graph\Temp\gr4.tmp", "");
			options.PosX = App.CurrentEngineType == EngineType.Petrol ? 3000 : 4000;
			options.PosY = 4000;
			Graph = new Graph(InitPlot(options), options);
			Graph.DrawLine(new DataPoint(180, _sizeY), new DataPoint(180, -30), LineStyle.Dash);
			Graph.DrawLine(new DataPoint(360, _sizeY), new DataPoint(360, -30), LineStyle.Dash);
			Graph.DrawLine(new DataPoint(540, _sizeY), new DataPoint(540, -30), LineStyle.Dash);
			Graph.DrawLine(new DataPoint(720, _sizeY), new DataPoint(720, -30), LineStyle.Dash);
			Graph.DrawCurve(MainCurve());
		}
		public void Drawing()
		{
			var options = new GraphOptions(null, null, 0.01, new GraphSize(0, 720, -40, _sizeY), new SvgFileSize((int)(_sizeY * 3.4 * 2.2 * 4), (int)(_sizeY * 3.4 * 4)), AppDomain.CurrentDomain.BaseDirectory + @"\Graph\Temp\gr2.tmp", "");
			options.PosX = App.CurrentEngineType == EngineType.Petrol ? 3000 : 4000;
			options.PosY = 400;
			Graph = new Graph(InitPlot(options), options);
			Graph.DrawLine(new DataPoint(180, _sizeY), new DataPoint(180, -30), LineStyle.Dash);
			Graph.DrawLine(new DataPoint(360, _sizeY), new DataPoint(360, -30), LineStyle.Dash);
			Graph.DrawLine(new DataPoint(540, _sizeY), new DataPoint(540, -30), LineStyle.Dash);
			Graph.DrawLine(new DataPoint(720, _sizeY), new DataPoint(720, -30), LineStyle.Dash);
			//Inlet
			var mainLine1Start = new DataPoint(0, -_p0);
			var mainLine1End = new DataPoint(180, -_p0);
			Graph.DrawLine(mainLine1Start, mainLine1End);
			//Outlet
			var mainLine2Start = new DataPoint(540, _p0);
			var mainLine2End = new DataPoint(720, _p0);
			Graph.DrawLine(mainLine2Start, mainLine2End);
			//Compression and Working stroke lines
			var pointsCompression = CompressionCurve();
			_pointsCompression = pointsCompression;
			Graph.DrawCurve(pointsCompression);
			var pointsWorkingStroke = WorkingStrokeCurve();
			_pointsWorkingStroke = pointsWorkingStroke;
			Graph.DrawCurve(pointsWorkingStroke);
			//Connection line between compression and working stroke lines
			var connectionLineStart = new DataPoint(360, pointsCompression[pointsCompression.Count - 1].Y);
			var connectionLineEnd = new DataPoint(360, pointsWorkingStroke[0].Y);
			Graph.DrawLine(connectionLineStart, connectionLineEnd);

			Graph.DrawLine(new DataPoint(0, _sizeY - _sizeY * 0.05), new DataPoint(720, _sizeY - _sizeY * 0.05));
			//Pj line
			PjCurve();
			//Ro line
			if (App.CurrentEngineType == EngineType.Diesel)
				Graph.DrawLine(new DataPoint(360, pointsWorkingStroke[0].Y),
					new DataPoint(360 + _data["Ro"].Val, pointsWorkingStroke[0].Y));
		}
		public void Drawing()
		{
			var delta = _data["CorrectionOfBrix"].Val;
			var radius = _data["RadiusOfCrank"].Val;
			var points = new List<PointInfo>
			{
				new PointInfo(new DataPoint(0, 0), "O"),
				new PointInfo(new DataPoint(delta, 0), "O͵")
			};
			var scaleX = _data["PistonStroke"].Val > 80 ? 1 : 0.5;
			radius /= scaleX;
			DrawAnglesVal(radius, ref points);
			var sizeX = (int)((_data["PistonStroke"].Val + _data["PistonStroke2"].Val) / scaleX);
			sizeX += (int)(sizeX * 0.2);
			var zoyebalo = sizeX - _data["PistonStroke"].Val/scaleX - _data["PistonStroke2"].Val/scaleX;

			var options = new GraphOptions(null, points, 0.01, new GraphSize((int)(_diapason.FromX - _sc - _radius), (int)(_radius + zoyebalo), -(int)(_radius + zoyebalo), 10), new SvgFileSize((int)((sizeX) * 5 * 4 - 35 /*Shit*/), (int)(_radius * 5 * 4 - 35)), AppDomain.CurrentDomain.BaseDirectory + @"\Graph\Temp\gr3.tmp", "");
			options.PosX = 423; //Shit
			options.PosY = 3500;
			Graph = new Graph(InitPlot(options), options);
			//Main line
			Graph.DrawLine(new DataPoint(-_radius, 0), new DataPoint(_radius, 0));
			//Helper lines
			Graph.DrawLine(new DataPoint(-_radius, 0), new DataPoint(-_radius, 10));
			Graph.DrawLine(new DataPoint(_radius, 0), new DataPoint(_radius, 10));
			//Main lines (half of chardas)
			for (var i = 30; i <= 150; i += 30)
			{
				Graph.DrawLine(new DataPoint(delta, 0), 360 - i, CalculateChordaLen(i, delta, radius));
			}
			DrawSemicircle(radius);
			//Save to svg
			Graph.DrawPoints();
			//Exemption of memory
			GC.Collect();
		}
예제 #4
0
		public void Drawing()
		{
			//Calculating scale and size of axes
			var scaleX = _data["PistonStroke"].Val > 80 ? 1 : 0.5;
			var sizeX = (int)((_data["PistonStroke"].Val + _data["PistonStroke2"].Val) / scaleX);
			sizeX += (int)(sizeX * 0.2);

			var scaleY = _data["MaxPressure"].Val < 5 ? 0.025 :
				_data["MaxPressure"].Val > 8 ? 0.05 : 0.04;
			var sizeY = (int)(_data["MaxPressure"].Val / scaleY);
			sizeY += (int)(sizeY * 0.1);

			if(App.CurrentEngineType == EngineType.Petrol)
				_sizeX = (int)(_data["PistonStroke"].Val / scaleX);
			else
				_sizeX = (int) ((_data["PistonStroke"].Val - _data["Sigma"].Val) / scaleX);
			_sizeY = sizeY;
			_sc = (_data["PistonStroke2"].Val/scaleX);
			_radius = _data["RadiusOfCrank"].Val / scaleX;

			//Main points
			var pointZ = _data["MaxPressure"].Val/scaleY;
			var pointc = _data["PressureCompression"].Val / scaleY;

			var pistonStroke2Val = _data["PistonStroke2"].Val/scaleX;
			var points = new List<PointInfo>
			{
				new PointInfo(new DataPoint(pistonStroke2Val, pointZ), "z"),
				new PointInfo(new DataPoint(pistonStroke2Val, pointc), "с"),
				new PointInfo(new DataPoint((_data["PistonStroke"].Val + _data["PistonStroke2"].Val) / scaleX, _data["PressureInlet"].Val / scaleY), "a"),
				new PointInfo(new DataPoint((_data["PistonStroke"].Val + _data["PistonStroke2"].Val) / scaleX, _data["PressureExtension"].Val / scaleY), "b")
			};
			//Main curves
			var curves = new List<CurveInfo>
			{
				new CurveInfo(n => pistonStroke2Val, LineStyle.Solid, "", true),
			};
			//
			var options = new GraphOptions(curves, points, 0.01, new GraphSize(-80, sizeX, -40, sizeY),
				new SvgFileSize((int) (sizeX*5*4), (int) (sizeY*3.4*4)), AppDomain.CurrentDomain.BaseDirectory + @"\Graph\Temp\gr1.tmp", "");
			options.PosX = 400;
			options.PosY = 400;
			Graph = new Graph(InitPlot(options), options);
			Graph.DrawLine(new DataPoint((_data["PistonStroke"].Val + _data["PistonStroke2"].Val) / scaleX, _data["PressureExtension"].Val / scaleY), new DataPoint((_data["PistonStroke"].Val + _data["PistonStroke2"].Val) / scaleX, -40));
			//Drawing pa horizontal line
			Graph.DrawLine(new DataPoint(0, _data["PressureInlet"].Val / scaleY), 0, sizeX);
			//Drawing β-lines and "ChristmasTree" by recursive method DrawChristmasTreeVertical(angle, startPoint)
			var forMainCurveY1 = new List<double>();
			var forMainCurveY2 = new List<double>();
			DrawChristmasTreeVertical(_data["TgB2"].Val, new DataPoint(0, _data["MaxPressure"].Val / scaleY), ref forMainCurveY1);
			DrawChristmasTreeVertical(_data["TgB1"].Val, new DataPoint(0, _data["PressureCompression"].Val / scaleY), ref forMainCurveY2);
			Graph.DrawLine(new DataPoint(0, 0), 90 + _data["TgB1"].Val, sizeY / Math.Cos(Graph.DegreeToRadian(_data["TgB1"].Val)) - sizeY * 0.1);
			Graph.DrawLine(new DataPoint(0, 0), 90 + _data["TgB2"].Val, sizeY / Math.Cos(Graph.DegreeToRadian(_data["TgB2"].Val)) - sizeY * 0.1);
			//Ro line
			if (App.CurrentEngineType == EngineType.Diesel)
				Graph.DrawLine(new DataPoint(_data["PistonStroke2"].Val / scaleX, _data["MaxPressure"].Val / scaleY), new DataPoint((_data["PistonStroke2"].Val + _data["Sigma"].Val) / scaleX, _data["MaxPressure"].Val / scaleY));
			//Drawing 20 deg line and horizontal "ChristmasTree"
			Graph.DrawLine(new DataPoint(0, 0), 360 - 20, sizeX);
			var forMainCurveX = new List<double>();
			var forMainCurveXDiesel = new List<double>();
			DrawChristmasTreeHorizontal(20, new DataPoint(_data["PistonStroke2"].Val / scaleX, 0), ref forMainCurveX);
			if (App.CurrentEngineType == EngineType.Diesel)
			{
				DrawChristmasTreeHorizontalDiesel(20, new DataPoint((_data["PistonStroke2"].Val + _data["Sigma"].Val) / scaleX, 0), ref forMainCurveXDiesel);
			}
			//Drawing curves and dots
			Graph.DrawCurves();
			Graph.DrawPoints();

			#region Draw main curves
			var x1 = new List<double>();
			var x2 = new List<double>();
			var y1 = new List<double>();
			var y2 = new List<double>();
			
			int smallerList1;
			if (App.CurrentEngineType == EngineType.Petrol)
				smallerList1 = forMainCurveX.Count < forMainCurveY1.Count ? forMainCurveX.Count : forMainCurveY1.Count;
			else
				smallerList1 = forMainCurveXDiesel.Count < forMainCurveY1.Count ? forMainCurveXDiesel.Count : forMainCurveY1.Count;
			var smallerList2 = forMainCurveX.Count < forMainCurveY2.Count ? forMainCurveX.Count : forMainCurveY2.Count;
			
			for (var i = 0; i < smallerList1; i++)
			{
				if (App.CurrentEngineType == EngineType.Petrol)
					x1.Add(forMainCurveX[forMainCurveX.Count - i - 1]);
				else
					x1.Add(forMainCurveXDiesel[forMainCurveXDiesel.Count - i - 1]);
				y1.Add(forMainCurveY1[forMainCurveY1.Count - i - 1]);
			}
			for (var i = 0; i < smallerList2; i++)
			{
				x2.Add(forMainCurveX[forMainCurveX.Count - i - 1]);
				y2.Add(forMainCurveY2[forMainCurveY2.Count - i - 1]);
			}
			//Just must be for alignment last point!
			x1[x1.Count - 1] = (_data["PistonStroke"].Val + _data["PistonStroke2"].Val) / scaleX;
			y1[y1.Count - 1] = _data["PressureExtension"].Val / scaleY;
			x2[x2.Count - 1] = (_data["PistonStroke"].Val + _data["PistonStroke2"].Val) / scaleX;
			y2[y2.Count - 1] = _data["PressureInlet"].Val / scaleY;
			_mainCurve1X = new List<double>(x1);
			_mainCurve2X = new List<double>(x2);
			_mainCurve1Y = new List<double>(y1);
			_mainCurve2Y = new List<double>(y2);
			_p0 = _data["PressureInlet"].Val/scaleY;
			Graph.DrawCurve(x1, y1);
			Graph.DrawCurve(x2, y2);
			#endregion
		}