Nothing
# addActive.R
# copyright 2015-2016, openreliability.org
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
addActive<-function(DF, at, mttf=NULL, mttr=NULL, name="",description="") {
if(length(names(DF))!=19) stop("first argument must be a fault tree")
ftree_test<-NULL
FT_FIELDS<-getFT_FIELDS()
for(nm in 1:19) {ftree_test<-c(ftree_test,names(DF)[nm]==FT_FIELDS[nm])}
if(!all(ftree_test)) stop("first argument must be a fault tree")
tp<-1
parent<-which(DF$ID== at)
if(length(parent)==0) {stop("connection reference not valid")}
thisID<-max(DF$ID)+1
if(DF$Type[parent]<10) {stop("non-gate connection requested")}
## ***Caution Child positions in DF may change ***
availableconn<-which(DF[parent,8:12]<1)
if(length(availableconn)>3) {
DF[parent,(7+availableconn[1])]<-thisID
}else{
if((DF$Type[parent]==10||DF$Type[parent]==11)&&length(availableconn)>0) {
DF[parent,(7+availableconn[1])]<-thisID
}else{
stop("connection slot not available")
}
}
if(is.null(mttf)) {stop("active component must have mttf")}
if(is.null(mttr)) {stop("active component must have mttr")}
Dfrow<-data.frame(
ID= thisID ,
Name= name ,
Parent= at ,
Type= tp ,
CFR= 1/mttf ,
PBF= mttr/(mttf+mttr) ,
CRT= mttr ,
Child1= -1 ,
Child2= -1 ,
Child3= -1 ,
Child4= -1 ,
Child5= -1 ,
Level= DF$Level[parent]+1 ,
Independent= TRUE ,
PHF= -1 ,
Repairable= TRUE ,
inspectionInterval= -1 ,
InspectIonObject= "" ,
Description= description
)
DF<-rbind(DF, Dfrow)
DF
}
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.