private void ImportPerformanceCurve(string gameExecutablePath) { PerformanceCurve = new PerformanceCurve(); using (var executableConnection = new ExecutableConnection(gameExecutablePath)) { PerformanceCurve.ImportData(executableConnection, LanguageResources); } }
public double[] GetPerformanceFlowValues(int?rpm = null) { if (rpm == null) { return(PerformanceCurve.Select(x => x.FlowRate).ToArray()); } else if (DynamicPerformanceCurves.Any(x => x.Rpm == rpm)) { return(DynamicPerformanceCurves.First(x => x.Rpm == rpm).GetPerformanceFlowValues()); } else { var maxPerformanceFlowValues = DynamicPerformanceCurves.First(x => x.Rpm == DynamicPerformanceCurves.Max(y => y.Rpm)).PerformanceCurve.Select(x => x.FlowRate).ToArray(); var p = GetPerformancePolynom((int)rpm); var pLim = UpperPerformanceCurveLimit; var result = new List <double>(); var isLastPoint = true; foreach (var q in maxPerformanceFlowValues) { var h = (p.Polyval(q)); if (h >= pLim.Polyval(q)) { result.Add(q); } else if (isLastPoint) { isLastPoint = false; var crossPoints = p.GetCrossPoints(pLim); if (crossPoints.Length == 1) { result.Add(crossPoints[0]); } } } return(result.ToArray()); //var maxRpmCurve = DynamicPerformanceCurves.First(x => x.Rpm == DynamicPerformanceCurves.Max(y => y.Rpm)).PerformanceCurve; //return maxRpmCurve.Select(x => x.FlowRate).ToArray(); } }
public double[] GetPerformanceFlowValues() { return(PerformanceCurve.Select(x => x.FlowRate).ToArray()); }
public double[] GetPerformanceHeadValues() { return(PerformanceCurve.Select(x => x.TotalDynamicHead).ToArray()); }