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

From ReliaWiki
Jump to navigation Jump to search
(Created page with '{{Template:API}}{{Template:InProgress}}')
 
No edit summary
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{Template:API}}{{Template:InProgress}}
{{DISPLAYTITLE:Perform Life Data Analysis}}{{Template:API}}{{Template:BacktoPrevPage}}
 
With the Synthesis API, you can leverage the Weibull++ analysis engine to perform life data analysis on an external data source. In this tutorial, you will use the API to create and analyze a data set, and then obtain analysis results from the resulting model.
 
Note that this tutorial is for demonstration purposes only; it doesn't take efficiency into account and doesn't include any exception handling.
 
 
==Tutorial: Life Data Analysis==
This example demonstrates how to use the Synthesis API to analyze the following data set and obtain an estimate of the probability of failure. A discussion of the example follows.
 
The VBA version of the code sample is available [[Perform_Life_Data_Analysis_on_External_Data_Source/VBA|here]].
 
{|{{table}}
|Number in State||State||Time to F or S
|-
|1||F||16
|-
|1||F||34
|-
|1||F||53
|-
|1||F||75
|-
|1||F||93
|-
|5||S||120
|}
 
'''VB.NET'''
{{APIPrefix|Imports}} SynthesisAPI
{{APIPrefix|Module}} Module1
    {{APIPrefix|Sub}} Main()
  {{APIComment|'Declare a new WeibullDataSet object.}}
    {{APIPrefix|Dim}} WDS {{APIPrefix|As New}} WeibullDataSet
 
  {{APIComment|'Add the failure times to the data set.}}
    WDS.AddFailure(16, 1)
    WDS.AddFailure(34, 1)
    WDS.AddFailure(53, 1) 
    WDS.AddFailure(75, 1)
    WDS.AddFailure(93, 1)
 
  {{APIComment|'Add the suspensions to the data set.}}
    WDS.AddSuspension(120, 5) 
  {{APIComment|'Use the 2-parameter Weibull distribution and the rank regression on X (RRX) analysis method.}}
  {{APIComment|'Keep all other analysis settings at default.}}
    WDS.AnalysisSettings.Distribution = WeibullSolverDistribution.Weibull
    WDS.AnalysisSettings.Parameters = WeibullSolverNumParameters.MS_2Parameter
    WDS.AnalysisSettings.Analysis = WeibullSolverMethod.RRX
 
  {{APIComment|'Analyze the data set.}}
    WDS.Calculate()
  {{APIComment|'Calculate the probability of failure at 226 hrs and display the result.}}
    {{APIPrefix|Dim}} r {{APIPrefix|As}} Double
    r = WDS.FittedModel.unreliability(226)
    MsgBox({{APIString|"Prob. Fail: "}} & r)
    {{APIPrefix|End Sub}}
{{APIPrefix|End Module}}
 
===Discussion===
 
The [[WeibullDataSet Class|WeibullDataSet]] class represents a Weibull++ data sheet for life data analysis. The class contains all the methods and properties that allow you to define a data set and fit a statistical distribution to the data.
 
  {{APIComment|'Declare a new WeibullDataSet object.}}
    {{APIPrefix|Dim}} WDS {{APIPrefix|As New}} WeibullDataSet
 
The data set can contain failures, suspensions, interval data or free-form data. The following example shows how to use the [[WeibullDataSet.AddFailure|AddFailure]] method to define failures and the [[WeibullDataSet.AddSuspension|AddSuspension]] method to define suspensions.
 
{{APIComment|'Add the failure times to the data set.}}
  WDS.AddFailure(16, 1)
  WDS.AddFailure(34, 1)
  WDS.AddFailure(53, 1) 
  WDS.AddFailure(75, 1)
  WDS.AddFailure(93, 1)
 
{{APIComment|'Add the suspensions to the data set.}}
  WDS.AddSuspension(120, 5)
 
The <code>AnalysisSettings</code> property stores a reference to the [[WeibullAnalysisOptions Class|WeibullAnalysisOptions]] object, which represents the analysis settings of the data set (i.e., settings that you might find in a Weibull++ folio's control panel). In this example, we use the property to change some of the attributes of the object.
 
{{APIComment|'Use the 2-parameter Weibull distribution and the rank regression on X (RRX) analysis method.}}
{{APIComment|'Keep all other analysis settings at default.}}
  WDS.AnalysisSettings.Distribution = WeibullSolverDistribution.Weibull
  WDS.AnalysisSettings.Parameters = WeibullSolverNumParameters.MS_2Parameter
  WDS.AnalysisSettings.Analysis = WeibullSolverMethod.RRX
 
Use the [[WeibullDataSet.Calculate|Calculate]] method to analyze the data set.
 
{{APIComment|'Analyze the data set.}}
  WDS.Calculate()
 
The <code>FittedModel</code> property gets the [[CModel Class|cModel]] object that represents the fitted model of the life data analysis. From the model, you can calculate useful metrics such as reliability, failure rate, mean time, etc. In this example, we use the [[CModel.Unreliability|cModel.Unreliability]] method to calculate for the probability of failure.
 
  {{APIComment|'Calculate the probability of failure at 226 hrs and display the result.}}
    {{APIPrefix|Dim}} r {{APIPrefix|As}} Double
    r = WDS.FittedModel.unreliability(226)
    MsgBox({{APIString|"Prob. Fail: "}} & r)
 
 
==References==
*[[WeibullDataSet Class]]
**[[WeibullDataSet.AddFailure|WeibullDataSet.AddFailure Method]]
**[[WeibullDataSet.AddSuspension| WeibullDataSet.AddSuspension Method]]
**[[WeibullDataSet.Calculate|WeibullDataSet.Calculate Method]]
*[[WeibullAnalysisOptions Class]]
*[[CModel Class|cModel Class]]
**[[CModel.Unreliability|cModel.Unreliability Method]]

Latest revision as of 18:43, 3 April 2017

APIWiki.png


<< Back to Tutorials Main Page

With the Synthesis API, you can leverage the Weibull++ analysis engine to perform life data analysis on an external data source. In this tutorial, you will use the API to create and analyze a data set, and then obtain analysis results from the resulting model.

Note that this tutorial is for demonstration purposes only; it doesn't take efficiency into account and doesn't include any exception handling.


Tutorial: Life Data Analysis

This example demonstrates how to use the Synthesis API to analyze the following data set and obtain an estimate of the probability of failure. A discussion of the example follows.

The VBA version of the code sample is available here.

Number in State State Time to F or S
1 F 16
1 F 34
1 F 53
1 F 75
1 F 93
5 S 120
VB.NET

Imports SynthesisAPI 

Module Module1
   Sub Main()

  'Declare a new WeibullDataSet object.  
   Dim WDS As New WeibullDataSet
  
  'Add the failure times to the data set. 
   WDS.AddFailure(16, 1)
   WDS.AddFailure(34, 1)
   WDS.AddFailure(53, 1)  
   WDS.AddFailure(75, 1)
   WDS.AddFailure(93, 1)
  
  'Add the suspensions to the data set. 
   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. 
   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
End Module

Discussion

The WeibullDataSet class represents a Weibull++ data sheet for life data analysis. The class contains all the methods and properties that allow you to define a data set and fit a statistical distribution to the data.

  'Declare a new WeibullDataSet object.  
   Dim WDS As New WeibullDataSet

The data set can contain failures, suspensions, interval data or free-form data. The following example shows how to use the AddFailure method to define failures and the AddSuspension method to define suspensions.

 'Add the failure times to the data set. 
  WDS.AddFailure(16, 1)
  WDS.AddFailure(34, 1)
  WDS.AddFailure(53, 1)  
  WDS.AddFailure(75, 1)
  WDS.AddFailure(93, 1)
  
 'Add the suspensions to the data set. 
  WDS.AddSuspension(120, 5) 

The AnalysisSettings property stores a reference to the WeibullAnalysisOptions object, which represents the analysis settings of the data set (i.e., settings that you might find in a Weibull++ folio's control panel). In this example, we use the property to change some of the attributes of the object.

 '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

Use the Calculate method to analyze the data set.

 'Analyze the data set. 
  WDS.Calculate()

The FittedModel property gets the cModel object that represents the fitted model of the life data analysis. From the model, you can calculate useful metrics such as reliability, failure rate, mean time, etc. In this example, we use the cModel.Unreliability method to calculate for the probability of failure.

  '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)


References