Perform Accelerated Life Testing Data Analysis with Stress Profiles/VBA

From ReliaWiki
Jump to navigation Jump to search
APIWiki.png



Tutorial: Accelerated Life Testing Data Analysis - Stress Profiles

Below is the VBA version of the tutorial.

VBA

Sub Main()
 
  'Declare a new stress profile and define its properties.  
   Dim myProfile As New cProfile
   myProfile.Name = "StressProfile"
   myProfile.ProfileType = ProfileTypeEnum_Stress
   myProfile.IsCyclical = False

  'Define four segments for the stress profile. 
   Dim segment As ProfileSegment
   Dim listofsegments(3) As ProfileSegment
  
   Set segment = New ProfileSegment
   segment.SegmentEnd = 200
   segment.Value = 124
   Set listofsegments(0) = segment
  
   Set segment = New ProfileSegment
   segment.SegmentEnd = 300
   segment.Value = 175
   Set listofsegments(1) = segment
  
   Set segment = New ProfileSegment
   segment.SegmentEnd = 350
   segment.Value = 200
   Set listofsegments(2) = segment
  
   Set segment = New ProfileSegment
   segment.SegmentEnd = 375
   segment.Value = 250
   Set listofsegments(3) = segment

  'Add the segments to the stress profile. 
   myProfile.SetSegments listofsegments
 
  'Declare a new ALTADataSet object.  
   Dim ADS As New ALTADataSet

  'Assign the stress profile to the data set.  
   Call ADS.AddStressProfile(myProfile)

  'The stress profile uses the logarithmic (power LSR) stress transformation 
  'and has a use stress level = 100.  
   Call ADS.AddStressDefinition("Stress1", ALTASolverLSR_Power, 100)
 
  'Add the failure times to the data set. 
   Call ADS.AddFailure_2(252, 1, myProfile)
   Call ADS.AddFailure_2(280, 1, myProfile)
   Call ADS.AddFailure_2(320, 1, myProfile)
   Call ADS.AddFailure_2(335, 1, myProfile)
   Call ADS.AddFailure_2(354, 1, myProfile)
   Call ADS.AddFailure_2(361, 1, myProfile)
   Call ADS.AddFailure_2(362, 1, myProfile)
   Call ADS.AddFailure_2(368, 1, myProfile)
   
  'Add the suspensions to the data set. 
   Call ADS.AddSuspension_2(328, 1, myProfile)   
   Call ADS.AddSuspension_2(375, 3, myProfile) 
 
  'Use the cumulative damage - Weibull model to analyze the data set. 
  'Keep all other analysis settings at default. 
   ADS.AnalysisSettings.ModelType = ALTASolverModel_CumDamage
   ADS.AnalysisSettings.Distribution = ALTASolverDistribution_Weibull
 
  'Analyze the data set. 
   Call ADS.Calculate()

  'Calculate the B1 life and display the result. 
   Dim r As Double
   r = ADS.FittedModel.Time(.99)
   MsgBox("B1 Life: " & r)

End Sub