PSFControl: PSFControl

Description Usage Arguments Public function Examples

Description

This class treats various PSF-related supports

Usage

1

Arguments

aa

data format such as example.csv

Public function

Standard reference class is R6 class
Public function

function contents variable(s)
initialize(aa) initializes the object aa:data format such as example.csv
PSF() Executes reliability analysis for current aa-data and returns PSF list.
lambda_Rt2s_tmm(lambda, Rt) converts (lambda,Rt) to (s,tmm) lambda,Rt
s_tmm2lambda_Rt(s, tmm) converts (s,tmm) to (lambda,Rt) s,tmm
ShellRt(lambda, Rt) returns Pf+PSF list at (lambda,Rt) lambda,Rt
MAWP() calculates MAWP from aa data and returns the value
SetPa(xval) sets xval to the variable Pamu xval: value to be set for Pa
SetDi_tr(Di, tr) sets (Di,tr) to (Dimu,trmu) Di,tr:values to be set
CalcSu(gamma) calculates Su from Sa value for the safety factor gamma and returns the value gamma:safety factor
SetSu() Calculates Su value from aa using CalcSu function and sets it to Sumu
GetSu() gets Sumu value
SetSa(x) sets x to Sa x:value to be set
GetMu() gets current mean value list of objet metal
Shell() calculates shell parameter from aa-data and returns it
Rt() calculates Rt value after inspection time and returns it
Pf() returns Pf value of current object metal
Adjust() sets value of 100 to Sa, calculates Su and sets it to Sumu, calculates MAWP and sets it to Pumu
Out(outfile) write current resuts related to object metal to outfile outfile: name of output file
Contour(nn, clevel) draws contour line on the lambda-Rt figure nn:number of grids for evaluation,clevel:list of contour levels
DrawContour(clevel) draws contour line accordint to current private$x,private$y,private$z clevel:list of contour levels
Target(lambda, Pft) returns Rt value with target Pft value for lambda value lambda,Pft
SetCv_mu_cov(mu, cov) sets (mu,cov) to (Cvmu,Cvcov) mu,cov
PSFEval(indata) returns data.frame of results for the condition written in indata indata:condition for calculation

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#If it is necessary, install package "LimitState" as follows
#install.packages("devtools")
#devtools::install_github("ShinsukeSakai0321/LimitState")
library(LimitState)
library(PSFCalc)
#infile <- system.file("example.csv",package="PSFCalc")
fdata <- read.csv(infile)
####Checking for one case ###
Di <- 500; tr <- 10
Cvmu <- 0.2; Cvcov<- 0.5
######################
#aa <- read.csv(infile)
data(example)
aa<-example
psfcal <- PSFCalc::PSFControl$new(aa)
psfcal$SetDi_tr(Di,tr)
psfcal$Adjust(Sa=100)  #Pa=MAWP and evaluates Su from Sa
psfcal$SetCv_mu_cov(Cvmu,Cvcov)
psfcal$PSF()
#Correct answer
#Pf,PSF1,PSF2,....
#[1] 0.0004616347 3.7410414030 1.0114521033 1.0000000000 1.0000000000 1.0000000000
#[7] 1.0109882772 1.0000000000 1.0011929134
###########################
# Calculation of Shell & Rt
###########################
Di <- 500; tr <- 10
infile <- system.file("example.csv",package="PSFCalc")
fdata <- read.csv(infile)
aa <- read.csv(infile)
psfcal <- PSFCalc::PSFControl$new(aa)
psfcal$SetDi_tr(Di,tr)
gamma <- 4
psfcal$SetSa(100)
cat("MAWP=",psfcal$MAWP(),",Su=",psfcal$CalcSu(gamma))
cat("<ce><bb>=",psfcal$Shell(),",Rt=",psfcal$Rt())
############### Drawing contour on lamgda-Rt figure#######################
Di <- 2400; tr <- 13
Cvmu <- 0.1; Cvcov<- 0.5
######################
infile <- system.file("example.csv",package="PSFCalc")
fdata <- read.csv(infile)
aa <- read.csv(infile)
psfcal <- PSFCalc::PSFControl$new(aa)
psfcal$SetDi_tr(Di,tr)
psfcal$Adjust(Sa=100)  #Pa=MAWP, Calculates Su from Sa
psfcal$SetCv_mu_cov(Cvmu,Cvcov)
clevel <- c(1,1e-4,1e-6)# contour levles for Pf
ndiv <- 10  #division of x and y axis
psfcal$Contour(ndiv,clevel)
psfcal$DrawContour(clevel)
#############Evaluates Rt for specific lambda satisfying target reliability #######
Di <- 2400; tr <- 13
Pft <- 1e-6; Cvmu <- 0.1; Cvcov<- 0.5
#####################################
library(GA)
infile <- system.file("example.csv",package="PSFCalc")
fdata <- read.csv(infile)
aa <- read.csv(infile)
psfcal <- PSFCalc::PSFControl$new(aa)
psfcal$SetDi_tr(Di,tr)
psfcal$Adjust(Sa=100)  #Pa=MAWP, Calculates Su from Sa
psfcal$SetCv_mu_cov(Cvmu,Cvcov)
lambda <- 5;
Rt <- psfcal$Target(lambda,Pft)
c(Di,tr,lambda,Rt,Cvmu,Cvcov,psfcal$ShellRt(lambda,Rt))
############################
###Candidate of answer
# [1] 2.400000e+03 1.300000e+01 5.000000e+00 5.172694e-01 1.000000e-01 5.000000e-01
# [7] 9.979141e-07 5.960800e+00 1.073792e+00 1.000000e+00 1.000000e+00 1.000000e+00
#[13] 1.028481e+00 1.000000e+00 1.002066e+00
###########################
# Example of PSFEval
###########################
infile <- system.file("example.csv",package="PSFCalc")
indata <- read.csv(infile)
psfcal <- PSFControl$new(indata)
rescalc <- psfcal$PSFEval(Di=2400,tr=13,Pft=1e-4,Cvmu=0.1,Cvcov=0.5,Sa=100)
rescalc

ShinsukeSakai0321/PSFCalc documentation built on May 20, 2019, 2:24 p.m.