Package com.ordobill.webapp.beans

Examples of com.ordobill.webapp.beans.Sampleform


  @SuppressWarnings("unused")
  public Sampleform engineCore(Project project,ArrayList<SampleBean> figList,HashMap<String, SimulationFields[]> simulationArr) throws Exception {
   
    long start = System.currentTimeMillis();
    SampleBean samplebean = new SampleBean();
    Sampleform sampleform = new Sampleform();
    EconomicAnalysis _EconomicAnalysis = new EconomicAnalysis();
    Modeling modeling = new Modeling();
    sampleform.setLifeTime(project.getProLifeTime());
    sampleform.setIteration(project.getProIterNum());
    sampleform.setTd((float)project.getProTd());
    sampleform.setLifeTime(project.getProLifeTime());
   
    float[][] resultArr = null;
    float[] totavaArr = null;
    ArrayList<int[][]> breakList = new ArrayList<int[][]>();
   
    float[] iterationArr = new float [sampleform.getIteration()];
    String[][] stepAve = new String [2][figList.size()];
    String[] stepFigName = new String [figList.size()];
    sampleform.setIterationArr(new float [sampleform.getIteration()]);
    sampleform.setYeartotRoof((int)sampleform.getTd()*24);
    sampleform.setTotRoof((int)(sampleform.getYeartotRoof())*sampleform.getLifeTime());
    boolean saTest = false;
    saList = new ArrayList<SampleBean>();
   
    sampleform.setFailState("flaring");
    for (int k=0;k<sampleform.getIteration();k++) {
      sumF = 0;
      int[][] brakeArr = new int[3][figList.size()];
      for (int i=0;i<brakeArr[0].length;i++) {
        brakeArr[1][i] = figList.get(i).getFigUid();
      }
      resultArr = new float[figList.size()+1][(int)sampleform.getTotRoof()];
      totavaArr = new float[sampleform.getLifeTime()];
      sampleform.setYearAvailability(0f);
      sampleform.setRepearState(true);
      for (int i=0;i<figList.size();i++) {
        saControl = 1;
        sampleform.setStep(0f);
        sampleform.setPresent(0f);
        sampleform.setMaxMttf(figList.get(i).getFigMaxMttf()*8760f);
        sampleform.setMinMttf(figList.get(i).getFigMinMttf()*8760f);
        sampleform.setMostMttf(figList.get(i).getFigMostMttf()*8760f);
        for (int s=0;s<sampleform.getTotRoof();s++){
          //System.out.println(sampleform.getPresent());
          if (sampleform.getPresent() <= s) {
            this.computeHazardRate(sampleform,figList.get(i));
            //System.out.println(sampleform.isGeneralState());
           
            if (sampleform.isGeneralState()) { //정상
              sampleform.setRepearState(true);
              sampleform.setPresent(sampleform.getPresent()+24);
            } else {//고장
              brakeArr[0][i] = brakeArr[0][i] + 1;
              if (figList.get(i).getFigMoType().equals("se")) {
                //System.out.println(figList.get(i).getFigMoName());
                sampleform.setRepearState(false);
                //System.out.println("b:"+sampleform.getPresent());
                sampleform.setPresent(sampleform.getPresent()+figList.get(i).getFigMttr());
                //System.out.println("a:"+sampleform.getPresent());
              } else if (sampleform.getFailState() == "flaring" && figList.get(i).getFigFlaring().floatValue() > 1) {
                sampleform.setRepearState(true);
                sampleform.setPresent(s+figList.get(i).getFigFlaring().floatValue());
                sampleform.setFailState("mttr");
              } else if (sampleform.getFailState() == "mttr" && figList.get(i).getFigFlaring().floatValue() > 1) {
                sampleform.setRepearState(false);
                sampleform.setImpRepair(figList.get(i).getFigMttr());
                sampleform.setImpFailure(figList.get(i).getFigDelivery().floatValue());
                sampleform.setPresent(sampleform.getPresent()+sampleform.getImpFailure()+sampleform.getImpRepair());
                sampleform.setImpRepair(s+sampleform.getImpRepair());
                sampleform.setFailState("flaring");
              } else {
                if (Integer.parseInt(figList.get(i).getFigFailureState()) == 1) { // 직렬일경우
                  sampleform.setRepearState(false);
                  sampleform.setImpRepair(figList.get(i).getFigMttr());
                  sampleform.setImpFailure(figList.get(i).getFigDelivery().floatValue());
                  sampleform.setPresent(sampleform.getPresent()+sampleform.getImpFailure()+sampleform.getImpRepair());
                  sampleform.setImpRepair(s+sampleform.getImpRepair());
                } else if (Integer.parseInt(figList.get(i).getFigFailureState())> 1){ // 병렬일 경우
                  sampleform.setRepearState(true);
                }
              }
              sampleform.setBreakpoint(sampleform.getPresent()); // 고장에서 정상으로 돌아올시점 기록
             
              sumF = 0;
            }
          }
          ///////////////////////////////////////////////
          if (sampleform.isRepearState()) {
            sampleform.setAvailability(100f);
          } else {
            if (sampleform.getImpRepair()>s) { //delivery
              sampleform.setAvailability(100f - (figList.get(i).getFigImpFailure().floatValue()*100f));
            } else { //mttr
              sampleform.setAvailability(100f - (figList.get(i).getFigImpRepair().floatValue()*100f));
            }
          }
          resultArr[i][s] = sampleform.getAvailability();
          sampleform.setStep(sampleform.getAvailability()+sampleform.getStep());
          //log.debug(sampleform.getAvailability());
        }
       
        //stepFigName[i] = figList.get(i).getFigMoName();
        stepAve[0][i] = figList.get(i).getFigMoName();
        float val = (1-((sampleform.getTotRoof()-sampleform.getStep())/sampleform.getTotRoof()));
        if (k == 0) {
          stepAve[1][i] = Float.toString(val);
        } else if(k == sampleform.getIteration()-1) {
          stepAve[1][i] = Float.toString((val+Float.valueOf(stepAve[1][i]).floatValue())/sampleform.getIteration());
        } else {
          stepAve[1][i] = Float.toString(val+Float.valueOf(stepAve[1][i]).floatValue());
        }
       
        sampleform.setBreakpoint(0);
      }
      breakList.add(brakeArr);//장비별 고장횟수
     
      //현재 다중 부품이 들어갈경우 하나라도 망가지면 시스템이 정지한다는 가정하에 가용성 계산(직렬)
      for (int s=0;s<sampleform.getTotRoof();s++) {
        for (int i=0;i<figList.size();i++) {
         
           if (sampleform.getAvailability() > resultArr[i][s] || i == 0) {
            sampleform.setAvailability(resultArr[i][s]);
          }
        }
        resultArr[figList.size()][s] = sampleform.getAvailability();
        sampleform.setYearAvailability(sampleform.getYearAvailability() + sampleform.getAvailability());
        if (((s+1)%sampleform.getYeartotRoof()) == 0) {
          int arrNum = (int) ((s+1)/sampleform.getYeartotRoof())-1;
          sampleform.setYearAvailability(sampleform.getYearAvailability()/100f);
          totavaArr[arrNum] = sampleform.getYearAvailability();
          sampleform.setYearAvailability(0f);;
        }
        sampleform.setAvailability(0f);
      }
      //전체 가용율 계산
      for (int i=0;i<totavaArr.length;i++) {
        sampleform.setAvailability(sampleform.getAvailability() + totavaArr[i]);
      }
      float stdAva = (1-((sampleform.getTotRoof()-sampleform.getAvailability())/sampleform.getTotRoof()));
      iterationArr[k] = stdAva;
      sampleform.setAvailabilityAll(sampleform.getAvailabilityAll() + stdAva);
    }
    //sampleform.setStepFigName(stepFigName);
   
    //장비별 망가진 횟수
    /*for (int i=0;i<breakList.size();i++) {
      //_EconomicAnalysis.
      System.out.println(breakList.size());
      for (int s=0;s<breakList.get(i)[0].length;s++) {
        System.out.println(breakList.get(i)[0][s]);
      }
    }*/
   
    sampleform.setStepAve(stepAve);
    sampleform.setStepFigName(stepFigName);
    sampleform.setBrakeArr(breakList);
    sampleform.setResultArr(resultArr);//시간당 수치 or 마지막번지에는 eq 가용율
    sampleform.setIterationArr(iterationArr);//iteration roof 당 가용율
    sampleform.setYeartotRoof(sampleform.getYeartotRoof());//1년기준 총 루프 횟수
    sampleform.setTotRoof((int)sampleform.getTotRoof());//Iteration 기준 총 루프 횟수
    sampleform.setTotAvailability((sampleform.getAvailabilityAll()/sampleform.getIteration())*100);//총 총가용율
    sampleform.setFmcont(figList.size()+1);
   
   
    long end = System.currentTimeMillis();
    log.debug( " testNum : " + testNum + "" );
    log.debug( "실행 시간 : " + ( end - start )/1000.0 + "초" );
    log.debug(sampleform.getTotRoof());
    log.debug("총 총가용율:"+sampleform.getTotAvailability()+"%");
   
    //request.setAttribute("resultparamater", sampleform.getTotavaArr());
    //log.debug();
    //log.debug();
    return sampleform;
View Full Code Here


       
        ArrayList<Figures> figList = (ArrayList<Figures>) sqlMap.queryForList("Figures.figures", new Figures(projectForm));
        samplebean.setFigProjectUid(projectForm.getProUid());
        //sampleBean = (ArrayList<SampleBean>) sqlMap.queryForList("Sample.figures",samplebean);
        //System.out.println("sampleBean.size() : " + sampleBean.size());
        Sampleform sampleform = sampleEngine.engineCore(projectForm,sampleBean,simulationArr);
       
      //시작 경제성 계산
        /*
        EconomicAnalysis _EconomicAnalysis = new EconomicAnalysis();
        int economicResulut = 0;
        int tempResult = 0;
        for (int i=0;i<economicList.size();i++) {
          economicList.get(i).setLifeTime(sampleform.getLifeTime());
         
          economicList.get(i).setCP(_EconomicAnalysis.compute(economicList.get(i)));
          System.out.println(economicList.get(i).getCP());
          economicResulut = (int) (economicResulut + economicList.get(i).getCP());
        }
       
      int breakEconomicResulut = 0;
        System.out.println("economicResulut-->"+economicResulut);
        for (int i=0;i<sampleform.getBrakeArr().size();i++) {
          int temp1 = 0;
          for (int s=0;s<sampleform.getBrakeArr().get(i)[0].length;s++) {
            sampleform.getBrakeArr().get(i)[2][s] = (int) (economicList.get(s).getRepairCost()*sampleform.getBrakeArr().get(i)[0][s]);
            temp1 = temp1 + sampleform.getBrakeArr().get(i)[2][s];
          }
          System.out.println(temp1);
          breakEconomicResulut = breakEconomicResulut + temp1;
        }
        System.out.println(breakEconomicResulut);
        breakEconomicResulut = breakEconomicResulut/economicList.size();
       
        System.out.println("총계산 결과:"+breakEconomicResulut+"+"+economicResulut);*/
        //끝 경제성 계산
        // report 데이터 처리
        Report _Report = computeReport(sampleform,projectForm);
        int reportUid = (Integer) sqlMap.insert("Report.Insert", _Report);
        ArrayList<FigInform> figInformList;
        for (int i=0;i<figList.size();i++) {
            figInformList = new ArrayList<FigInform>();
            for (int s=0;s<sampleform.getIteration();s++) {
              FigInform inFig = new FigInform();
              inFig.setFigUid(figList.get(i).getFigUid());
              inFig.setHazardRate(0.1f);
              inFig.setRandomNum(0.01f);
              figInformList.add(inFig);
            }
            figList.get(i).setFigInform(figInformList);
        }
       
        SimulationFields[] simFieldsArr = new SimulationFields[sampleform.getIterationArr().length];       
        Float[] timeofsim = new Float[1];
        timeofsim[0] = (float)sampleform.getLifeTime();
       
        float temp = 0;
        for (int i=0;i<simFieldsArr.length;i++) {
            SimulationFields simfields = new SimulationFields();
            simfields.setAvailabilityValue(sampleform.getIterationArr()[i]*100);
            simfields.setTimeOfSimulation(timeofsim);
            simfields.setIterationStep(i);
            simfields.setRepairTime(0);
            simFieldsArr[i] = simfields;
            temp += sampleform.getIterationArr()[i];
           
           
        }
        simulationArr.put((String)session.getAttribute(Constants.SESSION_GETID), simFieldsArr);
        System.out.println("-------------------------------------------------> " + temp);
View Full Code Here

       
        ArrayList<Figures> figList = (ArrayList<Figures>) sqlMap.queryForList("Figures.figures", new Figures(projectForm));
        samplebean.setFigProjectUid(projectForm.getProUid());
        //sampleBean = (ArrayList<SampleBean>) sqlMap.queryForList("Sample.figures",samplebean);
        //System.out.println("sampleBean.size() : " + sampleBean.size());
        Sampleform sampleform = sampleEngine.engineCore(projectForm,sampleBean,simulationArr);
       
        SimulationFields[] simFieldsArr = new SimulationFields[sampleform.getIterationArr().length];
       
        float AveAvailability = 0;
        for (int i=0;i<simFieldsArr.length;i++) {
          AveAvailability += sampleform.getIterationArr()[i];
        }
       
        request.setAttribute("AveAvailability", AveAvailability);
        request.setAttribute("ProjectName", ProjectName);
      return mapping.findForward("LinkerSucess");
View Full Code Here

TOP

Related Classes of com.ordobill.webapp.beans.Sampleform

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.