Talk:ALTADataSet.AddStressProfile/Notes

From ReliaWiki
Revision as of 19:12, 4 October 2016 by Kate Racaza (talk | contribs) (Created page with '===Parameters=== ''Profile'' :Required. The cProfile object. ==Example== The following example demonstrates how to analyze an ALTA data set with a stress pro…')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Parameters

Profile

Required. The cProfile object.


Example

The following example demonstrates how to analyze an ALTA data set with a stress profile.

VBA

 'Create a new resource profile and define its properties. 
  Dim myResource As New cProfile
  myResource.Name = "SampleProfile"
  myResource.ProfileType = ProfileTypeEnum_Stress
  myResource.IsCyclical = True
 
 'Define two segments for the profile. 
  Dim segment As ProfileSegment
  Dim listOfSegments(1) As ProfileSegment
       
  Set segment = New ProfileSegment
  segment.SegmentEnd = 1
  segment.Value = 10
  Set listOfSegments(0) = segment
       
  Set segment = New ProfileSegment
  segment.SegmentEnd = 2
  segment.Value = 20
  Set listOfSegments(1) = segment
   
 'Add the segments to the profile. 
  myResource.SetSegments listOfSegments

 'Declare an ALTADataSet object.  
  Dim ADS As New ALTADataSet

 'Define a stress type, with use stress = 2. 
  Call ADS.AddStressDefinition("Voltage",,2)
 
 'Add the stress profile to the ALTADataSet object. 
  Call ADS.AddStressProfile(myResource)
  
 'Add failure times to the data set. 
  Call ADS.AddFailure_2(61, 1, myResource)
  Call ADS.AddFailure_2(75, 1, myResource)
  Call ADS.AddFailure_2(90, 1, myResource)
  Call ADS.AddFailure_2(95, 1, myResource)
  Call ADS.AddFailure_2(100, 1, myResource)

 'Use the cumulative damage model with the Weibull distribution. 
  ADS.AnalysisSettings.ModelType = ALTASolverModel_CumDamage
  ADS.AnalysisSettings.Distribution = ALTASolverDistribution_Weibull

 'Calculate results. 
  Call ADS.Calculate()

 'Calculate the reliability at 50 hours and display the result. 
  MsgBox("Reliability: " & ADS.FittedModel.Reliability(50))
VB.NET

 'Create a new resource profile and define its properties. 
  Dim myResource As New SynthesisAPI.cProfile("SampleProfile")
  myResource.ProfileType = SynthesisAPI.ProfileTypeEnum.Stress
  myResource.IsCyclical = True

 'Define two segments for the profile. 
  Dim listOfSegments() As SynthesisAPI.ProfileSegment = _
      {New SynthesisAPI.ProfileSegment With {.SegmentEnd = 1, .Value = 10}, _
       New SynthesisAPI.ProfileSegment With {.SegmentEnd = 2, .Value = 20}}

 'Add the segments to the profile. 
  myResource.SetSegments(listOfSegments)

 'Declare an ALTADataSet object.  
  Dim ADS As New SynthesisAPI.ALTADataSet

 'Define a stress type, with use stress = 2. 
  ADS.AddStressDefinition("Voltage",,2)

 'Add the stress profile to the ALTADataSet object. 
  ADS.AddStressProfile(myResource)
  
 'Add failure times to the data set. 
  ADS.AddFailure(61, 1, myResource)
  ADS.AddFailure(75, 1, myResource)
  ADS.AddFailure(90, 1, myResource)
  ADS.AddFailure(95, 1, myResource)
  ADS.AddFailure(100, 1, myResource)

 'Use the cumulative damage model with the Weibull distribution. 
  ADS.AnalysisSettings.ModelType = SynthesisAPI.ALTASolverModel.CumDamage
  ADS.AnalysisSettings.Distribution = SynthesisAPI.ALTASolverDistribution.Weibull

 'Calculate results. 
  ADS.Calculate()

 'Calculate the reliability at 50 hours and display the result. 
  MsgBox("Reliability: " & ADS.FittedModel.Reliability(50))