ALTADataSet.AddStressProfile: Difference between revisions

From ReliaWiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
{{Template:API}}{{Template:APIBreadcrumb|.[[ALTADataSet_Class|ALTADataSet]]}}
{{Template:API}}{{Template:APIBreadcrumb|.[[ALTADataSet_Class|ALTADataSet]]}}<div style="border:1px solid #D0CDE8; background:#EEEDF7; border-radius:10px; width:auto; margin:0 0 1em 1em; padding:1em; float:right;"><span style="font-family:arial;font-size:5;color:#585858">Other Versions: [[ALTADataSet.AddStressProfile 10|Version 10]]</span></div>




Line 9: Line 9:
===Parameters===
===Parameters===
''Profile''
''Profile''
:Required. The [[ALTAStressProfile_Class|ALTAStressProfile]] object.
:Required. The [[CProfile Class|cProfile]] object.




Line 16: Line 16:


  '''VBA'''
  '''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.}}  
  {{APIComment|'Declare an ALTADataSet object.}}  
   {{APIPrefix|Dim}} ADS {{APIPrefix|As New}} ALTADataSet
   {{APIPrefix|Dim}} ADS {{APIPrefix|As New}} ALTADataSet
   
   
  {{APIComment|'Define a stress type, with use stress &#61; 100.}}  
  {{APIComment|'Define a stress type, with use stress &#61; 100.}}
   {{APIPrefix|Call}} ADS.AddStressDefinition({{APIString|"Temperature"}},,100)
   {{APIPrefix|Call}} ADS.AddStressDefinition({{APIString|"Temperature"}},,100)
{{APIComment|'Declare a new stress profile and define its segments.}}
  {{APIPrefix|Dim}} sp {{APIPrefix|As New}} ALTAStressProfile
   
  sp.Name = "Profile1"
  sp.RepeatCycle = True
  {{APIPrefix|Call}} sp.AddSegment(1, 100)
  {{APIPrefix|Call}} sp.AddSegment(2, 120)
  {{APIPrefix|Call}} sp.AddSegment(3, 150)
    
    
  {{APIComment|'Add the stress profile to the ALTADataSet object.}}
  {{APIComment|'Add the stress profile to the ALTADataSet object.}}
   {{APIPrefix|Call}} ADS.AddStressProfile(sp)
   {{APIPrefix|Call}} ADS.AddStressProfile(myResource)
    
    
  {{APIComment|'Add failure times to the data set.}}
  {{APIComment|'Add failure times to the data set.}}
   {{APIPrefix|Call}} ADS.AddFailure_2(61, 1, sp)
   {{APIPrefix|Call}} ADS.AddFailure_2(61, 1, myResource)
   {{APIPrefix|Call}} ADS.AddFailure_2(75, 1, sp)
   {{APIPrefix|Call}} ADS.AddFailure_2(75, 1, myResource)
   {{APIPrefix|Call}} ADS.AddFailure_2(90, 1, sp)
   {{APIPrefix|Call}} ADS.AddFailure_2(90, 1, myResource)
   {{APIPrefix|Call}} ADS.AddFailure_2(95, 1, sp)
   {{APIPrefix|Call}} ADS.AddFailure_2(95, 1, myResource)
   {{APIPrefix|Call}} ADS.AddFailure_2(100, 1, sp)
   {{APIPrefix|Call}} ADS.AddFailure_2(100, 1, myResource)
   
   
  {{APIComment|'Use the cumulative damage model with the Weibull distribution.}}
  {{APIComment|'Use the cumulative damage model with the Weibull distribution.}}
Line 48: Line 67:
  {{APIComment|'Calculate results.}}
  {{APIComment|'Calculate results.}}
   {{APIPrefix|Call}} ADS.Calculate()
   {{APIPrefix|Call}} ADS.Calculate()
{{APIComment|'Calculate the reliability at 50 hours and display the result.}}
  MsgBox({{APIString|"Reliability: "}} & ADS.FittedModel.Reliability(50))


  '''VB.NET'''
  '''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.}}  
  {{APIComment|'Declare an ALTADataSet object.}}  
   {{APIPrefix|Dim}} ADS {{APIPrefix|As New}} ALTADataSet
   {{APIPrefix|Dim}} ADS {{APIPrefix|As New}} SynthesisAPI.ALTADataSet
   
   
  {{APIComment|'Define a stress type, with use stress &#61; 100.}}
  {{APIComment|'Define a stress type, with use stress &#61; 100.}}
   ADS.AddStressDefinition({{APIString|"Temperature"}},,)
   ADS.AddStressDefinition({{APIString|"Temperature"}},,100)
   
   
{{APIComment|'Declare a new stress profile and define its segments.}}
  {{APIPrefix|Dim}} sp {{APIPrefix|As New}} ALTAStressProfile({{APIString|"Temperature_Profile"}})
  sp.RepeatCycle = True
  sp.AddSegment(1, 100)
  sp.AddSegment(2, 120)
  sp.AddSegment(3, 150)
 
  {{APIComment|'Add the stress profile to the ALTADataSet object.}}
  {{APIComment|'Add the stress profile to the ALTADataSet object.}}
   ADS.AddStressProfile(sp)
   ADS.AddStressProfile(myResource)
    
    
  {{APIComment|'Add failure times to the data set.}}
  {{APIComment|'Add failure times to the data set.}}
   ADS.AddFailure(61, 1, sp)
   ADS.AddFailure(61, 1, myResource)
   ADS.AddFailure(75, 1, sp)
   ADS.AddFailure(75, 1, myResource)
   ADS.AddFailure(90, 1, sp)
   ADS.AddFailure(90, 1, myResource)
   ADS.AddFailure(95, 1, sp)
   ADS.AddFailure(95, 1, myResource)
   ADS.AddFailure(100, 1, sp)
   ADS.AddFailure(100, 1, myResource)
   
   
  {{APIComment|'Use the cumulative damage model with the Weibull distribution.}}
  {{APIComment|'Use the cumulative damage model with the Weibull distribution.}}
   ADS.AnalysisSettings.ModelType = ALTASolverModel.CumDamage
   ADS.AnalysisSettings.ModelType = SynthesisAPI.ALTASolverModel.CumDamage
   ADS.AnalysisSettings.Distribution = ALTASolverDistribution.Weibull
   ADS.AnalysisSettings.Distribution = SynthesisAPI.ALTASolverDistribution.Weibull
   
   
  {{APIComment|'Calculate results.}}
  {{APIComment|'Calculate results.}}
   ADS.Calculate()
   ADS.Calculate()
{{APIComment|'Calculate the reliability at 50 hours and display the result.}}
  MsgBox({{APIString|"Reliability: "}} & ADS.FittedModel.Reliability(50))

Revision as of 23:24, 22 March 2017

APIWiki.png


Member of: SynthesisAPI.ALTADataSet

Other Versions: Version 10


Adds an ALTAStressProfile object, which represents a time-dependent stress profile, to the data set. Applies to the cumulative damage (CD) model only.

Syntax

.AddStressProfile(Profile)

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(2) As ProfileSegment
       
  Set segment = New ProfileSegment
  segment.SegmentEnd = 1
  segment.Value = 100
  Set listOfSegments(0) = segment
       
  Set segment = New ProfileSegment
  segment.SegmentEnd = 2
  segment.Value = 120
  Set listOfSegments(1) = segment

  Set segment = New ProfileSegment
  segment.SegmentEnd = 3
  segment.Value = 150
  Set listOfSegments(2) = 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 = 100. 
  Call ADS.AddStressDefinition("Temperature",,100)
 
 '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 = 100}, _
       New SynthesisAPI.ProfileSegment With {.SegmentEnd = 2, .Value = 120}, _
       New SynthesisAPI.ProfileSegment With {.SegmentEnd = 3, .Value = 150}}

 '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 = 100. 
  ADS.AddStressDefinition("Temperature",,100)

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