Beispiel #1
0
        private Polynom GetPerformancePolynom(int rpm)
        {
            if (!IsVarioPump)
            {
                return(null);
            }

            if (DynamicPerformanceCurves.Any(x => x.Rpm == rpm))
            {
                return(DynamicPerformanceCurves.First(x => x.Rpm == rpm).GetPerformancePolynom());
            }

            var upperCurve = DynamicPerformanceCurves.First(x => x.Rpm > rpm);
            var lowerCurve = DynamicPerformanceCurves.Last(x => x.Rpm < rpm);

            var rpmDelta = upperCurve.Rpm - lowerCurve.Rpm;
            var rpmGap   = rpm - lowerCurve.Rpm;

            var result = new Polynom(0, 0, 0, 0);

            for (int i = 0; i < 4; i++)
            {
                var coefficientDelta = upperCurve.GetPerformancePolynom().Coefficients[i] - lowerCurve.GetPerformancePolynom().Coefficients[i];

                result.Coefficients[i] = lowerCurve.GetPerformancePolynom().Coefficients[i] + coefficientDelta * rpmGap / rpmDelta;
            }

            return(result);
        }
Beispiel #2
0
 public int[] GetDefaultRpms()
 {
     if (IsVarioPump)
     {
         return(DynamicPerformanceCurves.Select(x => x.Rpm).ToArray());
     }
     else
     {
         return(null);
     }
 }
Beispiel #3
0
        public double GetInputPower(int rpm)
        {
            var x_n = DynamicPerformanceCurves.Select(x => (double)x.Rpm).ToArray();
            var y_P = DynamicPerformanceCurves.Select(x => x.PowerInput).ToArray();

            if (x_n.Count() != y_P.Count())
            {
                throw new ArgumentException("Angegebene drehzahlabhängige Leistungsdaten unplausibel.");
            }

            var p = Polynom.Polyfit(x_n, y_P, 2);

            return(p.Polyval(rpm));
        }
Beispiel #4
0
        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();
            }
        }