|
@@ -0,0 +1,73 @@
|
|
|
|
+package com.nationrel.modules.fta.util;
|
|
|
|
+
|
|
|
|
+import org.apache.commons.math3.distribution.LogNormalDistribution;
|
|
|
|
+import org.apache.commons.math3.distribution.NormalDistribution;
|
|
|
|
+
|
|
|
|
+public class ReliabilityAlgorithmUtil {
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 指数分布可靠度算法
|
|
|
|
+ *
|
|
|
|
+ * @param lambda
|
|
|
|
+ * @param gamma
|
|
|
|
+ * @param time
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ public static double exponentialReliability(double lambda, double gamma, double time) {
|
|
|
|
+ // TODO 根据实际情况添加判断
|
|
|
|
+ if (lambda <= 0 || time < 0) {
|
|
|
|
+ throw new IllegalArgumentException("lambda and x must be positive");
|
|
|
|
+ }
|
|
|
|
+ return Math.exp(-lambda * (time - gamma));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * WEIBULL分布可靠度算法
|
|
|
|
+ *
|
|
|
|
+ * @param time
|
|
|
|
+ * @param beta
|
|
|
|
+ * @param eta
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ public static double weibullReliability(double beta, double eta, double gamma, double time) {
|
|
|
|
+ // TODO 根据实际情况添加判断
|
|
|
|
+ if (time < 0 || beta <= 0 || eta <= 0) {
|
|
|
|
+ return 0;
|
|
|
|
+ }
|
|
|
|
+ return Math.exp(-Math.pow((time - gamma) / eta, beta));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * normal分布可靠度算法
|
|
|
|
+ *
|
|
|
|
+ * @param time
|
|
|
|
+ * @param mean
|
|
|
|
+ * @param sigma
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ public static double normalReliability(double mean, double sigma, double time) {
|
|
|
|
+ // TODO 根据实际情况添加判断
|
|
|
|
+ if (time < 0 || mean <= 0 || sigma <= 0) {
|
|
|
|
+ return 0;
|
|
|
|
+ }
|
|
|
|
+ NormalDistribution normalDistribution = new NormalDistribution(sigma, sigma);
|
|
|
|
+ return 1 - normalDistribution.cumulativeProbability(time);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * logNormal分布可靠度算法
|
|
|
|
+ *
|
|
|
|
+ * @param time
|
|
|
|
+ * @param logMean
|
|
|
|
+ * @param logSigma
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ public static double logNormalReliability(double logMean, double logSigma, double time) {
|
|
|
|
+ // TODO 根据实际情况添加判断
|
|
|
|
+ if (time < 0 || logMean <= 0 || logSigma <= 0) {
|
|
|
|
+ return 0;
|
|
|
|
+ }
|
|
|
|
+ LogNormalDistribution logNormalDistribution = new LogNormalDistribution(logMean, logSigma);
|
|
|
|
+ return 1 - logNormalDistribution.cumulativeProbability(time);
|
|
|
|
+ }
|
|
|
|
+}
|