示例#1
0
        // New API
        // Get the base or static failure rate for the given scope
        // !! IMPORTANT: Only ONE Reliability module may return a Base Failure Rate.  Additional modules can exist only to supply Momentary rates
        // If this Reliability module's purpose is to supply Momentary Fialure Rates, then it MUST return 0 when asked for the Base Failure Rate
        // If it dosn't, then the Base Failure Rate of the part will not be correct.
        //
        public virtual double GetBaseFailureRateForScope(double flightData, String scope)
        {
            if (!TestFlightEnabled)
            {
                return(0);
            }

            ReliabilityBodyConfig body = GetConfigForScope(scope);

            if (body == null)
            {
                return(TestFlightUtil.MIN_FAILURE_RATE);
            }

            FloatCurve curve = body.reliabilityCurve;

            if (curve == null)
            {
                return(TestFlightUtil.MIN_FAILURE_RATE);
            }

            double reliability = curve.Evaluate((float)flightData);

            Log(String.Format("Reporting BFR of {0:F4}", reliability));
            return(reliability);
        }
示例#2
0
        // INTERNAL methods
        private ReliabilityBodyConfig GetConfigForScope(String scope)
        {
            if (reliabilityBodies == null)
            {
                return(null);
            }

            ReliabilityBodyConfig returnBody = reliabilityBodies.Find(s => s.scope == scope);

            if (returnBody == null)
            {
                returnBody = reliabilityBodies.Find(s => s.scope == "default");
            }
            return(returnBody);
        }
示例#3
0
 public override void OnLoad(ConfigNode node)
 {
     if (node.HasNode("RELIABILITY_BODY"))
     {
         if (reliabilityBodies == null)
         {
             reliabilityBodies = new List <ReliabilityBodyConfig>();
         }
         foreach (ConfigNode bodyNode in node.GetNodes("RELIABILITY_BODY"))
         {
             ReliabilityBodyConfig reliabilityBody = new ReliabilityBodyConfig();
             reliabilityBody.Load(bodyNode);
             reliabilityBodies.Add(reliabilityBody);
         }
     }
     base.OnLoad(node);
 }
示例#4
0
        public FloatCurve GetReliabilityCurveForScope(String scope)
        {
            if (!TestFlightEnabled)
            {
                return(null);
            }

            ReliabilityBodyConfig body = GetConfigForScope(scope);

            if (body == null)
            {
                return(null);
            }

            FloatCurve curve = body.reliabilityCurve;

            return(curve);
        }