| | |
| | | import com.zt.life.modules.mainPart.TestScheme.model.TestScheme; |
| | | import org.apache.commons.math3.distribution.ChiSquaredDistribution; |
| | | import org.springframework.stereotype.Service; |
| | | import com.zt.common.db.query.QueryFilter; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.util.ArrayList; |
| | | import java.util.Formatter; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | import java.util.stream.Stream; |
| | | |
| | | |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Service |
| | | public class TestSchemeService extends BaseService<TestSchemeDao, TestScheme> { |
| | | |
| | | /** |
| | | * 分页查询 |
| | | * |
| | | * @param queryFilter |
| | | * @return |
| | | */ |
| | | /* public List<TestScheme> page(QueryFilter queryFilter) { |
| | | return baseDao.getList(queryFilter.getQueryParams()); |
| | | } |
| | | */ |
| | | |
| | | /** |
| | | * 删除 |
| | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.*; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | |
| | | /** |
| | |
| | | Map<String, Object> errMap = new HashMap<>(); |
| | | Map<String, Integer> reliabType = new HashMap<>(); |
| | | reliabType.put("指数分布", 1); |
| | | reliabType.put("二项分布", 3); |
| | | reliabType.put("威布尔分布", 2); |
| | | reliabType.put("二项分布", 3); |
| | | Map<String, Integer> repairType = new HashMap<>(); |
| | | repairType.put("指数分布", 1); |
| | | repairType.put("威布尔分布", 2); |
| | |
| | | private Double Mttr; |
| | | private Double Mtbf; |
| | | private Double Msr; |
| | | private Double mttfMle; |
| | | private Double mttrMle; |
| | | private Long productId; |
| | | private CurveParam curveParam; |
| | | private String name; |
| | |
| | | @Data |
| | | public class FailureModel { |
| | | public static final String TYPE_EXP = "exponential"; |
| | | public static final String TYPE_BIN = "binomial"; |
| | | public static final String TYPE_BIN = "sof"; |
| | | public static final String TYPE_WBL = "weibull"; |
| | | public static final String TYPE_FIX = "fixed"; |
| | | |
| | |
| | | Map<Integer, String> templetsStrMap2 = new HashMap<>(); |
| | | |
| | | private JSONObject xmlJSONObj; |
| | | |
| | | /** |
| | | * 分页查询 |
| | | * |
| | | * @param queryFilter |
| | | * @return |
| | | */ |
| | | /* public List<SimulatAssess> page(QueryFilter queryFilter) { |
| | | return baseDao.getList(queryFilter.getQueryParams()); |
| | | }*/ |
| | | |
| | | |
| | | /** |
| | | * 删除 |
| | |
| | | ele.addAttribute("value", String.valueOf(failureModel.getParam1())); |
| | | break; |
| | | case FailureModel.TYPE_BIN: |
| | | ele = failureModelTag.addElement("reliability"); |
| | | ele = failureModelTag.addElement("p"); |
| | | ele.addAttribute("value", String.valueOf(failureModel.getParam1())); |
| | | ele = failureModelTag.addElement("n"); |
| | | ele.addAttribute("value", String.valueOf(failureModel.getParam2())); |
| | | ele = failureModelTag.addElement("k"); |
| | | ele = failureModelTag.addElement("m"); |
| | | ele.addAttribute("value", String.valueOf(failureModel.getParam3())); |
| | | break; |
| | | case FailureModel.TYPE_WBL: |
| | |
| | | if (StringUtils.isNotBlank(nameValue)) { |
| | | productId1 = Convert.toLong(nameValue.split("-")[0]); |
| | | |
| | | Double mtbf = (Double) jsonArray.getJSONObject(i).get("mttf"); |
| | | Double mttr = (Double) jsonArray.getJSONObject(i).get("mttr"); |
| | | Double msr = (Double) jsonArray.getJSONObject(i).get("msr"); |
| | | Double mtbf = null; |
| | | Double mttr = null; |
| | | Double msr = null; |
| | | if (!jsonArray.getJSONObject(i).get("mttf").equals("inf")){ |
| | | mtbf = (Double)jsonArray.getJSONObject(i).get("mttf"); |
| | | }else{ |
| | | mtbf = 0.0; |
| | | } |
| | | if (!jsonArray.getJSONObject(i).get("mttr").equals("inf")){ |
| | | mttr = (Double)jsonArray.getJSONObject(i).get("mttr"); |
| | | }else{ |
| | | mttr = 0.0; |
| | | } |
| | | if (!jsonArray.getJSONObject(i).get("msr").equals("inf")){ |
| | | msr = (Double)jsonArray.getJSONObject(i).get("msr"); |
| | | }else{ |
| | | msr = 0.0; |
| | | } |
| | | |
| | | WeakDto weakDto = new WeakDto(); |
| | | weakDto.setId(productId1); |
| | | weakDto.setMtbf(mtbf); |
| | |
| | | |
| | | param.setXData(xList); |
| | | param.setYData(doubleArray); |
| | | Double mtbf = (Double) jsonArray.getJSONObject(i).get("mttf"); |
| | | Double mttr = (Double) jsonArray.getJSONObject(i).get("mttr"); |
| | | Double msr = (Double) jsonArray.getJSONObject(i).get("msr"); |
| | | |
| | | Double mttfMle = null; |
| | | Double mttrMle = null; |
| | | Double mtbf = null; |
| | | Double mttr = null; |
| | | Double msr = null; |
| | | if (!jsonArray.getJSONObject(i).get("mttf").equals("inf")){ |
| | | mtbf = (Double)jsonArray.getJSONObject(i).get("mttf"); |
| | | }else{ |
| | | mtbf = 0.0; |
| | | } |
| | | if (!jsonArray.getJSONObject(i).get("mttr").equals("inf")){ |
| | | mttr = (Double)jsonArray.getJSONObject(i).get("mttr"); |
| | | }else{ |
| | | mttr = 0.0; |
| | | } |
| | | if (!jsonArray.getJSONObject(i).get("msr").equals("inf")){ |
| | | msr = (Double)jsonArray.getJSONObject(i).get("msr"); |
| | | }else{ |
| | | msr = 0.0; |
| | | } |
| | | |
| | | if (!jsonArray.getJSONObject(i).get("mttr_MLE").equals("inf")){ |
| | | mttrMle = (Double)jsonArray.getJSONObject(i).get("mttr_MLE"); |
| | | }else{ |
| | | mttrMle = 0.0; |
| | | } |
| | | if(!jsonArray.getJSONObject(i).get("mttf_MLE").equals("inf")){ |
| | | mttfMle = (Double) jsonArray.getJSONObject(i).get("mttf_MLE"); |
| | | }else{ |
| | | mttfMle = 0.0; |
| | | } |
| | | data.setMtbf(mtbf); |
| | | data.setMttr(mttr); |
| | | data.setMsr(msr); |
| | | data.setMttfMle(mttfMle); |
| | | data.setMttrMle(mttrMle); |
| | | } |
| | | data.setCurveParam(param); |
| | | } |
| | |
| | | ObjectMapper mapper = new ObjectMapper(); |
| | | String jsonStr = null; |
| | | try { |
| | | // 使用 ObjectMapper 的 readValue 方法,将文件中的 JSON 数据转换为一个 Java 对象 |
| | | // 这里使用 Object 类作为泛型参数,表示任意类型的对象 |
| | | Object obj = mapper.readValue(new File(filePath), Object.class); |
| | | // 使用 ObjectMapper 的 writeValueAsString 方法,将 Java 对象转换为 JSON 字符串 |
| | | jsonStr = mapper.writeValueAsString(obj); |
| | | |
| | | } catch (IOException e) { |
| | | // 处理异常 |
| | | e.printStackTrace(); |
| | |
| | | <span>{{ keepNumberBy4(scope.row.msr) }}</span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column |
| | | prop="mttfMle" |
| | | label="节点寿命" |
| | | width="100px" |
| | | align="right"> |
| | | <template slot-scope="scope"> |
| | | <span>{{ keepNumberBy4(scope.row.mttfMle) }}</span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column |
| | | prop="mttrMle" |
| | | label="平均维修时间" |
| | | width="100px" |
| | | align="right"> |
| | | <template slot-scope="scope"> |
| | | <span>{{ keepNumberBy4(scope.row.mttrMle) }}</span> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | </div> |
| | | </div> |
| | |
| | | <template> |
| | | <div class="mod-taskReliability-taskPhase"> |
| | | <div class="echart" id="myChart" :style="myChartStyle"></div> |
| | | <div id="myChart" :style="myChartStyle"></div> |
| | | </div> |
| | | </template> |
| | | |
| | |
| | | mttr: '', |
| | | mtbf: '', |
| | | msr: '', |
| | | mttfMle: '', |
| | | mttrMle: '', |
| | | myChart: {}, |
| | | myChartStyle: {float: "left", width: "100%", height: "680px"}, //图表样式 |
| | | myChartStyle: {width: "100%", height: "750px"}, //图表样式 |
| | | option: {} |
| | | } |
| | | }, |
| | |
| | | this.mttr = res.data.mttr.toFixed(4) |
| | | this.mtbf = res.data.mtbf.toFixed(4) |
| | | this.msr = res.data.msr.toFixed(4) |
| | | this.mttfMle = res.data.mttfMle.toFixed(4) |
| | | this.mttrMle = res.data.mttrMle.toFixed(4) |
| | | } |
| | | this.option = { |
| | | title: { |
| | | text: "mttf:" + this.mtbf + " mttr:" + this.mttr + " msr:" + this.msr, |
| | | text: "mttf:" + this.mtbf + " mttr:" + this.mttr + " msr:" + this.msr + " 节点寿命:" + this.mttfMle + " 平均维修时间:" + this.mttrMle, |
| | | textStyle: { // 主标题文本样式{"fontSize": 18,"fontWeight": "bolder","color": "#333"} |
| | | fontFamily: 'Arial', |
| | | fontSize: 30, |
| | | fontSize: 27, |
| | | fontStyle: 'normal', |
| | | fontWeight: 'normal', |
| | | }, |
| | | textAlign: 'auto',//整体(包括 text 和 subtext)的水平对齐 |
| | | textVerticalAlign: 'auto',//整体(包括 text 和 subtext)的垂直对齐 |
| | | padding: 0,//[5,10] | [ 5,6, 7, 8] ,标题内边距 |
| | | left: 'center',//'5' | '5%',title 组件离容器左侧的距离 |
| | | right: 'auto',//'title 组件离容器右侧的距离 |
| | | top: '20',//title 组件离容器上侧的距离 |
| | | bottom: 'auto',//title 组件离容器下侧的距离 |
| | | top: '20px' |
| | | }, |
| | | grid:{ |
| | | top:'15%' |
| | | }, |
| | | xAxis: { |
| | | data: this.xDataList, |
| | | name: '仿真总时长', |
| | | type: 'category', |
| | | axisLabel: { |
| | | formatter: function(value) { |
| | | formatter: function (value) { |
| | | // 将 X 轴刻度值格式化为保留两位小数的字符串 |
| | | return parseFloat(value).toFixed(2); |
| | | } |
| | | } |
| | | }, |
| | | yAxis: { |
| | | type:"value", |
| | | type: "value", |
| | | name: '可靠度', |
| | | }, |
| | | series: [ |
| | |
| | | this.mttr = res.data.mttr.toFixed(4) |
| | | this.mtbf = res.data.mtbf.toFixed(4) |
| | | this.msr = res.data.msr.toFixed(4) |
| | | this.mttfMle = res.data.mttfMle.toFixed(4) |
| | | this.mttrMle = res.data.mttrMle.toFixed(4) |
| | | } |
| | | this.option = { |
| | | title: { |
| | | text: "mttf:" + this.mtbf + " mttr:" + this.mttr + " msr:" + this.msr, |
| | | text: "mttf:" + this.mtbf + " mttr:" + this.mttr + " msr:" + this.msr + " 节点寿命:" + this.mttfMle + " 平均维修时间:" + this.mttrMle, |
| | | textStyle: { // 主标题文本样式{"fontSize": 18,"fontWeight": "bolder","color": "#333"} |
| | | fontFamily: 'Arial', |
| | | fontSize: 30, |
| | | fontSize: 27, |
| | | fontStyle: 'normal', |
| | | fontWeight: 'normal', |
| | | }, |
| | | textAlign: 'auto',//整体(包括 text 和 subtext)的水平对齐 |
| | | textVerticalAlign: 'auto',//整体(包括 text 和 subtext)的垂直对齐 |
| | | padding: 0,//[5,10] | [ 5,6, 7, 8] ,标题内边距 |
| | | left: 'center',//'5' | '5%',title 组件离容器左侧的距离 |
| | | right: 'auto',//'title 组件离容器右侧的距离 |
| | | top: 'auto',//title 组件离容器上侧的距离 |
| | | bottom: 'auto',//title 组件离容器下侧的距离 |
| | | top: '20px' |
| | | }, |
| | | grid:{ |
| | | top:'15%' |
| | | }, |
| | | xAxis: { |
| | | data: this.xDataList, |
| | |
| | | splitNumber: 10 |
| | | }, |
| | | yAxis: { |
| | | |
| | | name: '', |
| | | name: '可靠度', |
| | | }, |
| | | series: [ |
| | | { |
| | |
| | | </div> |
| | | </el-col> |
| | | <el-col :span="20"> |
| | | <div class="fa-card-a" style="height: calc(100vh - 230px)"> |
| | | <div class="fa-card-a"> |
| | | <SimulatCurve ref="SimulatCurve"></SimulatCurve> |
| | | </div> |
| | | </el-col> |