User:Kate Racaza/test page: Difference between revisions

From ReliaWiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 28: Line 28:
    
    
  {{APIPrefix|End Sub}}
  {{APIPrefix|End Sub}}
==Perform Life Data Analysis on External Data Source==
'''VBA'''
{{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.}}
    {{APIPrefix|Call}} WDS.AddFailure(16, 1)
    {{APIPrefix|Call}} WDS.AddFailure(34, 1)
    {{APIPrefix|Call}} WDS.AddFailure(53, 1) 
    {{APIPrefix|Call}} WDS.AddFailure(75, 1)
    {{APIPrefix|Call}} WDS.AddFailure(93, 1)
 
  {{APIComment|'Add the suspensions to the data set.}}
    {{APIPrefix|Call}} 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.}}
    {{APIPrefix|Call}} 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}}
==Perform Accelerated Life Testing Data Analysis on External Data Source==
'''VBA'''
{{APIPrefix|Sub}} Main()
  {{APIComment|'Declare a new ALTADataSet object.}}
    {{APIPrefix|Dim}} ADS {{APIPrefix|As New}} ALTADataSet
  {{APIComment|'Define a stress type with use stress level = 300.}}
    {{APIPrefix|Call}} ADS.AddStressDefinition({{APIString|"Stress1"}},,300)
  {{APIComment|'Add the failure times to the data set.}}
    {{APIPrefix|Call}} ADS.AddFailure_2(245, 1, 353)
    {{APIPrefix|Call}} ADS.AddFailure_2(110, 1, 373)
    {{APIPrefix|Call}} ADS.AddFailure_2(180, 1, 373) 
    {{APIPrefix|Call}} ADS.AddFailure_2(200, 1, 373)
    {{APIPrefix|Call}} ADS.AddFailure_2(50, 1, 393)
    {{APIPrefix|Call}} ADS.AddFailure_2(70, 1, 393)
    {{APIPrefix|Call}} ADS.AddFailure_2(88, 1, 393)
    {{APIPrefix|Call}} ADS.AddFailure_2(112, 1, 393)
    {{APIPrefix|Call}} ADS.AddFailure_2(140, 1, 393)
    {{APIPrefix|Call}} ADS.AddFailure_2(160, 1, 393)
   
  {{APIComment|'Add the suspensions to the data set.}}
    {{APIPrefix|Call}} ADS.AddSuspension_2(250, 5, 353) 
    {{APIPrefix|Call}} ADS.AddSuspension_2(250, 3, 373)
 
  {{APIComment|'Use the Arrhenius-Weibull model. Keep all other analysis settings at default.}}
    ADS.AnalysisSettings.ModelType = ALTASolverModel_Arrhenius
    ADS.AnalysisSettings.Distribution = ALTASolverDistribution_Weibull
 
  {{APIComment|'Analyze the data set.}}
    {{APIPrefix|Call}} ADS.Calculate()
  {{APIComment|'Calculate the B10 life and display the result.}}
    {{APIPrefix|Dim}} r {{APIPrefix|As}} Double
    r = ADS.FittedModel.Time(.90)
    MsgBox({{APIString|"B10 Life: "}} & r)
{{APIPrefix|End Sub}}
==Perform Accelerated Life Testing Data Analysis with Stress Profiles==
'''VBA'''
{{APIPrefix|Sub}} Main()
 
  {{APIComment|'Declare a new stress profile and define its segments.}}
    {{APIPrefix|Dim}} sp {{APIPrefix|As New}} ALTAStressProfile
    {{APIPrefix|Call}} sp.AddSegment(200, 125)
    {{APIPrefix|Call}} sp.AddSegment(300, 175)
    {{APIPrefix|Call}} sp.AddSegment(350, 200)
    {{APIPrefix|Call}} sp.AddSegment(375, 250)
    sp.RepeatCycle = False
  {{APIComment|'Declare a new ALTADataSet object.}}
    {{APIPrefix|Dim}} ADS {{APIPrefix|As New}} ALTADataSet
  {{APIComment|'Assign the stress profile to the data set.}}
    {{APIPrefix|Call}} ADS.AddStressProfile(sp)
  {{APIComment|'The stress profile uses the logarithmic (power LSR) stress transformation}}
  {{APIComment|'and has a use stress level = 100.}}
    {{APIPrefix|Call}} ADS.AddStressDefinition({{APIString|"Stress1"}}, ALTASolverLSR_Power, 100)
 
  {{APIComment|'Add the failure times to the data set.}}
    {{APIPrefix|Call}} ADS.AddFailure_2(252, 1, sp)
    {{APIPrefix|Call}} ADS.AddFailure_2(280, 1, sp)
    {{APIPrefix|Call}} ADS.AddFailure_2(320, 1, sp)
    {{APIPrefix|Call}} ADS.AddFailure_2(335, 1, sp)
    {{APIPrefix|Call}} ADS.AddFailure_2(354, 1, sp)
    {{APIPrefix|Call}} ADS.AddFailure_2(361, 1, sp)
    {{APIPrefix|Call}} ADS.AddFailure_2(362, 1, sp)
    {{APIPrefix|Call}} ADS.AddFailure_2(368, 1, sp)
   
  {{APIComment|'Add the suspensions to the data set.}}
    {{APIPrefix|Call}} ADS.AddSuspension_2(328, 1, sp) 
    {{APIPrefix|Call}} ADS.AddSuspension_2(375, 3, sp)
 
  {{APIComment|'Use the cumulative damage - Weibull model to analyze the data set.}}
  {{APIComment|'Keep all other analysis settings at default.}}
    ADS.AnalysisSettings.ModelType = ALTASolverModel_CumDamage
    ADS.AnalysisSettings.Distribution = ALTASolverDistribution_Weibull
 
  {{APIComment|'Analyze the data set.}}
    {{APIPrefix|Call}} ADS.Calculate()
  {{APIComment|'Calculate the B1 life and display the result.}}
    {{APIPrefix|Dim}} r {{APIPrefix|As}} Double
    r = ADS.FittedModel.Time(.99)
    MsgBox({{APIString|"B1 Life: "}} & r)
{{APIPrefix|End Sub}}
==

Revision as of 21:43, 23 June 2016

DRAFT

VBA versions of the new tutorials.


Upload XML File to XFRACAS

VBA

Sub Main()

  'Connect to the Synthesis enterprise repository. 
   Dim MyRepository As New Repository
   Call MyRepository.ConnectToSQLRepository("ServerName", "DatabaseName") 'Replace with values for test repository. 

  'Get a list of all available XFRACAS entities. 
   Dim ListOfEntities() As NameIdPair
   ListOfEntities = MyRepository.XFRACAS.GetAllXfracasEntities

  'Select an XFRACAS entity. This example gets the first available entity in the array. 
   Dim EntityID As Integer
   EntityID = ListOfEntities(0).ID

  'Upload the XML file to the import queue of the XFRACAS entity. This code assumes that an XML file  
  'called XMLData.xml contains XFRACAS incidents and is saved in the C drive. 
   Dim j As Integer
   j = MyRepository.XFRACAS.ImportXfracasXmlFile(EntityID, XFRACASImportType_Incident, "C:\XMLData.xml", "My new data")
 
End Sub


Perform Life Data Analysis on External Data Source

VBA

Sub Main()

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


Perform Accelerated Life Testing Data Analysis on External Data Source

VBA

Sub Main()

  'Declare a new ALTADataSet object.  
   Dim ADS As New ALTADataSet

  'Define a stress type with use stress level = 300.  
   Call ADS.AddStressDefinition("Stress1",,300)

  'Add the failure times to the data set. 
   Call ADS.AddFailure_2(245, 1, 353)
   Call ADS.AddFailure_2(110, 1, 373)
   Call ADS.AddFailure_2(180, 1, 373)  
   Call ADS.AddFailure_2(200, 1, 373)
   Call ADS.AddFailure_2(50, 1, 393)
   Call ADS.AddFailure_2(70, 1, 393)
   Call ADS.AddFailure_2(88, 1, 393)
   Call ADS.AddFailure_2(112, 1, 393)
   Call ADS.AddFailure_2(140, 1, 393)
   Call ADS.AddFailure_2(160, 1, 393)
   
  'Add the suspensions to the data set. 
   Call ADS.AddSuspension_2(250, 5, 353)   
   Call ADS.AddSuspension_2(250, 3, 373) 
 
  'Use the Arrhenius-Weibull model. Keep all other analysis settings at default. 
   ADS.AnalysisSettings.ModelType = ALTASolverModel_Arrhenius
   ADS.AnalysisSettings.Distribution = ALTASolverDistribution_Weibull
 
  'Analyze the data set. 
   Call ADS.Calculate()

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

End Sub


Perform Accelerated Life Testing Data Analysis with Stress Profiles

VBA

Sub Main()
 
  'Declare a new stress profile and define its segments.  
   Dim sp As New ALTAStressProfile
   Call sp.AddSegment(200, 125) 
   Call sp.AddSegment(300, 175)
   Call sp.AddSegment(350, 200)
   Call sp.AddSegment(375, 250)
   sp.RepeatCycle = False

  'Declare a new ALTADataSet object.  
   Dim ADS As New ALTADataSet

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

  '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, sp)
   Call ADS.AddFailure_2(280, 1, sp)
   Call ADS.AddFailure_2(320, 1, sp)
   Call ADS.AddFailure_2(335, 1, sp)
   Call ADS.AddFailure_2(354, 1, sp)
   Call ADS.AddFailure_2(361, 1, sp)
   Call ADS.AddFailure_2(362, 1, sp)
   Call ADS.AddFailure_2(368, 1, sp)
   
  'Add the suspensions to the data set. 
   Call ADS.AddSuspension_2(328, 1, sp)   
   Call ADS.AddSuspension_2(375, 3, sp) 
 
  '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

==