User:Kate Racaza/test page: Difference between revisions

From ReliaWiki
Jump to navigation Jump to search
No edit summary
(Replaced content with '=DRAFT=')
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
=DRAFT=
=DRAFT=
VBA versions of the new tutorials.
==Upload XML File to XFRACAS==
'''VBA'''
{{APIPrefix|Sub}} Main()
  {{APIComment|'Connect to the Synthesis enterprise repository.}}
    {{APIPrefix|Dim}} MyRepository {{APIPrefix|As New}} Repository
    {{APIPrefix|Call}} MyRepository.ConnectToSQLRepository({{APIString|"ServerName"}}, {{APIString|"DatabaseName"}}){{APIComment|'Replace with values for test repository.}}
  {{APIComment|'Get a list of all available XFRACAS entities.}}
    {{APIPrefix|Dim}} ListOfEntities() {{APIPrefix|As}} NameIdPair
    ListOfEntities = MyRepository.XFRACAS.GetAllXfracasEntities
  {{APIComment|'Select an XFRACAS entity. This example gets the first available entity in the array.}}
    {{APIPrefix|Dim}} EntityID {{APIPrefix|As}} Integer
    EntityID = ListOfEntities(0).ID
  {{APIComment|'Upload the XML file to the import queue of the XFRACAS entity. This code assumes that an XML file}}
  {{APIComment|'called XMLData.xml contains XFRACAS incidents and is saved in the C drive.}}
    {{APIPrefix|Dim}} j {{APIPrefix|As}} Integer
    j = MyRepository.XFRACAS.ImportXfracasXmlFile(EntityID, XFRACASImportType_Incident, {{APIString|"C:\XMLData.xml"}}, {{APIString|"My new data"}})
 
{{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}}
==

Latest revision as of 15:37, 7 September 2016

DRAFT