Perform Life Data Analysis on External Data Source/VBA: Difference between revisions

From ReliaWiki
Jump to navigation Jump to search
(Created page with '{{Template:API}} ==Tutorial: Life Data Analysis== Below is the VBA version of the tutorial. '''VBA''' {{APIPrefix|Sub…')
 
mNo edit summary
 
Line 1: Line 1:
{{Template:API}}
{{DISPLAYTITLE:Perform Life Data Analysis/VBA}}{{Template:API}}


==Tutorial: Life Data Analysis==
==Tutorial: Life Data Analysis==

Latest revision as of 15:28, 7 September 2016

APIWiki.png



Tutorial: Life Data Analysis

Below is the VBA version of the tutorial.

VBA

Sub Main()

  'Declare a new WeibullDataSet object.  
   Dim WDS As New WeibullDataSet
  
  'Add the failure times to the data set. 
   Call WDS.AddFailure(16, 1)
   Call WDS.AddFailure(34, 1)
   Call WDS.AddFailure(53, 1)  
   Call WDS.AddFailure(75, 1)
   Call WDS.AddFailure(93, 1)
  
  'Add the suspensions to the data set. 
   Call WDS.AddSuspension(120, 5)   

  'Use the 2-parameter Weibull distribution and the rank regression on X (RRX) analysis method. 
  'Keep all other analysis settings at default. 
   WDS.AnalysisSettings.Distribution = WeibullSolverDistribution_Weibull
   WDS.AnalysisSettings.Parameters = WeibullSolverNumParameters_MS_2Parameter
   WDS.AnalysisSettings.Analysis = WeibullSolverMethod_RRX
 
  'Analyze the data set. 
   Call WDS.Calculate()

  'Calculate the probability of failure at 226 hrs and display the result. 
   Dim r As Double
   r = WDS.FittedModel.unreliability(226)
   MsgBox("Prob. Fail: " & r)

End Sub