Преглед изворни кода

[task-1766] 性能验证模块 开发 (二期) / 【后端】验证报告的接口开发

Li Yuan пре 2 година
родитељ
комит
d79377d089

+ 72 - 0
ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/components/verification/model/EP15CalcVO.java

@@ -0,0 +1,72 @@
+package com.lc.ibps.components.verification.model;
+
+import com.lc.ibps.components.verification.funcs.xAverage;
+import com.lc.ibps.components.verification.funcs.xFuncStdevVar;
+import com.lc.ibps.components.verification.funcs.xValue;
+
+import java.util.Arrays;
+import java.util.stream.Collectors;
+
+public class EP15CalcVO {
+
+    private SpecimensCalcVO[] data;
+
+/*
+
+    Number of replicates 	3
+    Number of days				5
+    A       B       C       D       E           F       G
+            Rep 1	Rep 2	Rep 3	Run mean	Run SD	Variance
+5   Day 1	3.3	    3.23	3.43	3.320	    0.101	0.010
+6   Day 2	3.21	3.45	3.42	3.360	    0.131	0.017
+7   Day 3	3.21	3.24	3.45	3.300	    0.131	0.017
+8   Day 4	3.5	    3.45	3.51	3.487	    0.032	0.001
+9   Day 5	3.33	3.45	3.32	3.367	    0.072	0.005
+
+11  Over all mean [ Average E5:E9]	        3.367
+12  Within run variance Vr [ average G5:G9]	0.010
+13 Within run SD [SQRT(B12)]	            0.101       批内标准差
+14  Between run SD [SD(E5:E9)]	            0.073
+15  Between run variance Vb [B14*B14]	    0.005       批间方差
+16  Ratio Vr/Vb  [+B12/B15]	                1.928
+17  Total variance [((B2-1)/B2)*B12+B15]	0.012
+18  Laboratory SD [SQRT B17]	            0.110       室内标准差
+19  Laboratory CV[ (B18/B11)*100]	        3.259
+*/
+
+    private xValue withinSD;
+    private xValue vb;
+    private xValue labSD;
+    private int days;
+
+    public EP15CalcVO(SpecimensCalcVO[] data, int days) {
+        this.data = data;
+        this.days = days;
+        getLabSD();
+    }
+
+    public xValue getWithinSD() {
+        if (withinSD == null) {
+            xValue[] vrs = Arrays.stream(data).map(SpecimensCalcVO::getVariance).toArray(xValue[]::new);
+            xValue withinVr = xAverage.eval(vrs);
+            withinSD = new xValue(Math.sqrt(withinVr.getDoub()));
+        }
+        return withinSD;
+    }
+
+    public xValue getVb() {
+        if (vb == null) {
+            xValue[] vrs = Arrays.stream(data).map(SpecimensCalcVO::getMean).toArray(xValue[]::new);
+            xValue x = xFuncStdevVar.evalArgs(vrs, xFuncStdevVar.iSTDEV);
+            vb = new xValue(Math.pow(x.getDoub(), 2));
+        }
+        return vb;
+    }
+
+    public xValue getLabSD() {
+        if (labSD == null) {
+            labSD = new xValue(Math.sqrt((days - 1 / days) * Math.pow(getWithinSD().getDoub(), 2) + getVb().getDoub()));
+        }
+        return labSD;
+    }
+}