@Override public List<AjtColumnInfo<SharedRiskGroup>> getNonBasicUserDefinedColumnsVisibleOrNot() { final NetPlan np = callback.getDesign(); final NetworkLayer layer = this.getTableNetworkLayer(); final List<AjtColumnInfo<SharedRiskGroup>> res = new LinkedList<> (); res.add(new AjtColumnInfo<SharedRiskGroup>(this , Collection.class, null , "Nodes", "The nodes belonging to this SRG", null , d->d.getNodes() , AGTYPE.SUMCOLLECTIONCOUNT , null)); res.add(new AjtColumnInfo<SharedRiskGroup>(this , Collection.class, null , "Links", "The links in this layer belonging to this SRG", null , d->d.getLinks(layer) , AGTYPE.SUMCOLLECTIONCOUNT , null)); res.add(new AjtColumnInfo<SharedRiskGroup>(this , Collection.class, null , "Links all layers", "The links in this layer or other layers belonging to this SRG", null , d->d.getLinksAllLayers() , AGTYPE.SUMCOLLECTIONCOUNT , null)); res.add(new AjtColumnInfo<SharedRiskGroup>(this , Double.class, null , "MTTF (hours)" , "The average Mean-Time-To-Fail value measued in hours (the time since the element is repaired until it fails again)", (d,val)->d.setMeanTimeToFailInHours((Double) val), d->d.getMeanTimeToFailInHours() , AGTYPE.MAXDOUBLE , null)); res.add(new AjtColumnInfo<SharedRiskGroup>(this , Double.class, null , "MTTR (hours)" , "The average Mean-Time-To-Repair value measued in hours (the time betweem the element fails, and is up again since it is repaired)", (d,val)->d.setMeanTimeToRepairInHours((Double) val), d->d.getMeanTimeToRepairInHours() , AGTYPE.MAXDOUBLE , null)); res.add(new AjtColumnInfo<SharedRiskGroup>(this , Double.class, null , "Availability" , "The probability of findig the element not failed (MTTF / (MTTF + MTTR)) ", (d,val)->d.setMeanTimeToRepairInHours((Double) val), d->d.getMeanTimeToRepairInHours() , AGTYPE.MAXDOUBLE , null)); res.add(new AjtColumnInfo<SharedRiskGroup>(this , Boolean.class, null , "Is dynamic SRG?" , "Indicates if the SRG is dnyamic (and then its belonging nodes and links may change)", null , d->d.isDynamicSrg() , AGTYPE.NOAGGREGATION , null)); return res; }
private List<Triple<String,String,String>> getSRGInfoTables (SharedRiskGroup srg) { final DecimalFormat df = new DecimalFormat("###.##"); final NetPlan np = srg.getNetPlan(); final List<Triple<String,String,String>> res = new ArrayList <> (); res.add(Triple.of("SRG index/id" , "SRG " + srg.getIndex() + " (id " + srg.getId() + ")", "srg" + srg.getId())); res.add(Triple.of("Mean Time To Fail (MTTF)" , df.format(srg.getMeanTimeToFailInHours() / 24) + " days", "")); res.add(Triple.of("Mean Time To Repair (MTTR)" , df.format(srg.getMeanTimeToRepairInHours() / 24) + " days", "")); res.add(Triple.of("Availability" , String.format("%.6f" , srg.getAvailability()) + " days", "")); res.add(Triple.of("#Nodes" , "" + srg.getNodes() , "")); for (Node n : srg.getNodes()) res.add(Triple.of(getNodeName(n) , "" , "node" + n.getId())); res.add(Triple.of("#Links" , "" + srg.getNodes() , "")); for (NetworkLayer layer : np.getNetworkLayers()) { final Set<Link> linksThisLayer = srg.getLinks(layer); if (linksThisLayer.isEmpty()) continue; for (Link link : linksThisLayer) res.add(Triple.of("Link " + getNodeName(link.getOriginNode()) + " -> " + getNodeName(link.getDestinationNode()) , "Link " + link.getIndex() +" (id " + link.getId() + ")" , "link" + link.getId())); } return res; } private List<Triple<String,String,String>> getLinkInfoTables (Link e)
thisSrg = this.addSRG(other.getMeanTimeToFailInHours(), other.getMeanTimeToRepairInHours(), null); else if (thisSrg.isDynamicSrg()) continue; // dynamic SRGs are not merged final SortedSet<Node> thisNodes = other.getNodes().stream().map(x->(Node) thatToThisTranslation.get(x)).collect(Collectors.toCollection(TreeSet::new));
scheduleEvent(new SimEvent(simTime + Exponential.staticNextDouble(1 / srg.getMeanTimeToRepairInHours()) , SimEvent.DestinationModule.EVENT_GENERATOR , -1 , new GenerateRepairSRG(srg)));
scheduleEvent(new SimEvent(simTime + Exponential.staticNextDouble(1 / srg.getMeanTimeToRepairInHours()) , SimEvent.DestinationModule.EVENT_GENERATOR , -1 , new GenerateRepairSRG(srg)));
double mtbf_years = 1000.0 / (link.getLengthInKm() * 1.9); double mtbf_hours = 365 * 24 * mtbf_years; double mttf_hours = mtbf_hours - srg.getMeanTimeToRepairInHours(); if (mttf_hours < 0) throw new RuntimeException("Bad"); srg.setMeanTimeToFailInHours(mttf_hours);