User:Kate Racaza/test page
Jump to navigation
Jump to search
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
==