Talk:ALTADataSet.AddStressProfile/Notes: Difference between revisions

From ReliaWiki
Jump to navigation Jump to search
No edit summary
(Replaced content with '==DRAFT==')
 
Line 1: Line 1:
===Parameters===
==DRAFT==
''Profile''
:Required. The [[CProfile_Class|cProfile]] object.
 
 
==Example==
The following example demonstrates how to analyze an ALTA data set with a stress profile.
 
'''VBA'''
{{APIComment|'Create a new resource profile and define its properties.}}
  {{APIPrefix|Dim}} myResource {{APIPrefix|As New}} cProfile
  myResource.Name = {{APIString|"SampleProfile"}}
  myResource.ProfileType = ProfileTypeEnum_Stress
  myResource.IsCyclical = True
 
{{APIComment|'Define two segments for the profile.}}
  {{APIPrefix|Dim}} segment {{APIPrefix|As}} ProfileSegment
  {{APIPrefix|Dim}} listOfSegments(2) {{APIPrefix|As}} ProfileSegment
       
  {{APIPrefix|Set}} segment = {{APIPrefix|New}} ProfileSegment
  segment.SegmentEnd = 1
  segment.Value = 100
  {{APIPrefix|Set}} listOfSegments(0) = segment
       
  {{APIPrefix|Set}} segment = {{APIPrefix|New}} ProfileSegment
  segment.SegmentEnd = 2
  segment.Value = 120
  {{APIPrefix|Set}} listOfSegments(1) = segment
  {{APIPrefix|Set}} segment = {{APIPrefix|New}} ProfileSegment
  segment.SegmentEnd = 3
  segment.Value = 150
  {{APIPrefix|Set}} listOfSegments(2) = segment
   
{{APIComment|'Add the segments to the profile.}}
  myResource.SetSegments listOfSegments
{{APIComment|'Declare an ALTADataSet object.}}
  {{APIPrefix|Dim}} ADS {{APIPrefix|As New}} ALTADataSet
{{APIComment|'Define a stress type, with use stress = 100.}}
  {{APIPrefix|Call}} ADS.AddStressDefinition({{APIString|"Temperature"}},,100)
 
{{APIComment|'Add the stress profile to the ALTADataSet object.}}
  {{APIPrefix|Call}} ADS.AddStressProfile(myResource)
 
{{APIComment|'Add failure times to the data set.}}
  {{APIPrefix|Call}} ADS.AddFailure_2(61, 1, myResource)
  {{APIPrefix|Call}} ADS.AddFailure_2(75, 1, myResource)
  {{APIPrefix|Call}} ADS.AddFailure_2(90, 1, myResource)
  {{APIPrefix|Call}} ADS.AddFailure_2(95, 1, myResource)
  {{APIPrefix|Call}} ADS.AddFailure_2(100, 1, myResource)
{{APIComment|'Use the cumulative damage model with the Weibull distribution.}}
  ADS.AnalysisSettings.ModelType = ALTASolverModel_CumDamage
  ADS.AnalysisSettings.Distribution = ALTASolverDistribution_Weibull
{{APIComment|'Calculate results.}}
  {{APIPrefix|Call}} ADS.Calculate()
{{APIComment|'Calculate the reliability at 50 hours and display the result.}}
  MsgBox({{APIString|"Reliability: "}} & ADS.FittedModel.Reliability(50))
 
'''VB.NET'''
{{APIComment|'Create a new resource profile and define its properties.}}
  {{APIPrefix|Dim}} myResource {{APIPrefix|As New}} SynthesisAPI.cProfile({{APIString|"SampleProfile"}})
  myResource.ProfileType = SynthesisAPI.ProfileTypeEnum.Stress
  myResource.IsCyclical = True
{{APIComment|'Define two segments for the profile.}}
  {{APIPrefix|Dim}} listOfSegments() {{APIPrefix|As}} SynthesisAPI.ProfileSegment = _
      {{{APIPrefix|New}} SynthesisAPI.ProfileSegment {{APIPrefix|With}} {.SegmentEnd = 1, .Value = 100}, _
        {{APIPrefix|New}} SynthesisAPI.ProfileSegment {{APIPrefix|With}} {.SegmentEnd = 2, .Value = 120}, _
        {{APIPrefix|New}} SynthesisAPI.ProfileSegment {{APIPrefix|With}} {.SegmentEnd = 3, .Value = 150}}
{{APIComment|'Add the segments to the profile.}}
  myResource.SetSegments(listOfSegments)
{{APIComment|'Declare an ALTADataSet object.}}
  {{APIPrefix|Dim}} ADS {{APIPrefix|As New}} SynthesisAPI.ALTADataSet
{{APIComment|'Define a stress type, with use stress = 100.}}
  ADS.AddStressDefinition({{APIString|"Temperature"}},,100)
{{APIComment|'Add the stress profile to the ALTADataSet object.}}
  ADS.AddStressProfile(myResource)
 
{{APIComment|'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)
{{APIComment|'Use the cumulative damage model with the Weibull distribution.}}
  ADS.AnalysisSettings.ModelType = SynthesisAPI.ALTASolverModel.CumDamage
  ADS.AnalysisSettings.Distribution = SynthesisAPI.ALTASolverDistribution.Weibull
{{APIComment|'Calculate results.}}
  ADS.Calculate()
{{APIComment|'Calculate the reliability at 50 hours and display the result.}}
  MsgBox({{APIString|"Reliability: "}} & ADS.FittedModel.Reliability(50))

Latest revision as of 21:26, 30 March 2017

DRAFT