WAPlots Class: Difference between revisions

From ReliaWiki
Jump to navigation Jump to search
Line 16: Line 16:


== Usage Example ==
== Usage Example ==
  {{APIComment|'Create a new Weibull/ALTA Plot instance. See [[WAPlots.CreatePlot|CreatePlot]].}}  
This example demonstrates how to fit five failure times to a life distribution and then use the fitted distribution to create a plot. Full application examples (in VBA) are available at [[Synthesis_API_Reference#Application_Examples]].
 
{{APIComment|'Initialize a new WeibullDataSet object}}
  Dim ADS As New WeibullDataSet("DataSet1")
 
{{APIComment|'Set life distribution}}
  WDS.AnalysisSettings.Distribution = WeibullSolverDistribution.Weibull
  WDS.AnalysisSettings.Parameters = WeibullSolverNumParameters.MS_2Parameter
 
{{APIComment|'Set applicable analysis settings}}
  WDS.AnalysisSettings.Analysis = WeibullSolverMethod.MLE
  WDS.AnalysisSettings.RankingMethod = WeibullSolverRankMethod.Median
  WDS.AnalysisSettings.UseRSRegression = False
  WDS.AnalysisSettings.ConfBounds = WeibullSolverCBMethod.FisherMatrix
  WDS.AnalysisSettings.SortBeforeCalculations = True
  WDS.AnalysisSettings.UngroupGroupedData = False
 
{{APIComment|'Set Application Setup options}}
  WDS.AnalysisSettings.UseSpecialSort = True
  WDS.GeneralSettings.AllowBiasingNormal = False
  WDS.GeneralSettings.DiscardNegLocation = False
  WDS.GeneralSettings.ResetExpLocation = False
  WDS.GeneralSettings.Use3PTrueMLE = False
  WDS.GeneralSettings.UseExtendedGGamma = False
  WDS.GeneralSettings.UsePlottedYPoints = False
  WDS.GeneralSettings.WarnNegLocation = False
 
{{APIComment|'Add failure times}}
  WDS.AddFailure(16, 1)
  WDS.AddFailure(34, 1)
  WDS.AddFailure(53, 1)
  WDS.AddFailure(75, 1)
  WDS.AddFailure(93, 1)
  WDS.AddFailure(120, 1)
 
{{APIComment|'Add 4 suspensions}}
  WDS.AddFailure(120, 4)
 
{{APIComment|'Fit failure times to the specified distribution}}
  WDS.Calculate()
 
  {{APIComment|'Create and populate a new WAPlotSettings object with customized plot settings. See [[WAPlotSettings Class|WAPlotSettings]].}}
  Dim NewPlotSettings As New WAPlotSettings
  NewPlotSettings.UserName = User Name
  NewPlotSettings.UserCompany = Company
  NewPlotSettings.AutoscaleX = True
  NewPlotSettings.AutoscaleY = True
  NewPlotSettings.ShowTargetReliability = False
  NewPlotSettings.ShowTargetTime = False
  NewPlotSettings.ShowTargetMarker = False
  NewPlotSettings.ShowSuspensionPoints = True
  NewPlotSettings.ShowLeftCensoredPoints = True
  NewPlotSettings.ShowLinesAroundInterval = True
  NewPlotSettings.AdjustMLEPoints = True
  NewPlotSettings.StraightenGammaLine = True
  NewPlotSettings.ShowNumberInGroup = True
  NewPlotSettings.PlotXPrecision = 3
  NewPlotSettings.PlotyPrecision = 3
  NewPlotSettings.PlotXTolerance = 6
  NewPlotSettings.PlotYTolerance = 6
  NewPlotSettings.ConfBounds_TypesSelected = ConfBoundsTypes.None
 
{{APIComment|'Create a WAPlots object.}}
   Dim WeibullALTAPlot As New WAPlots
   Dim WeibullALTAPlot As New WAPlots
    
    
  {{APIComment|'Declare a WeibullDataSet. See [[WeibullDataSet Class|WeibullDataSet]].}}
  {{APIComment|'Add the WeibullDataSet to the WAPlots object.}}
   Dim WDS As New WeibullDataSet
   WeibullALTAPlot.AddDataset(WDS)
    
    
  {{APIComment|'Add values to the raw data. See [[WeibullDataSet.AddFailure|AddFailure]].}}
  {{APIComment|'Define an image object to store the plot picture.}}
   WDS.AddFailure(1, 1)
   Dim PlotPicture as Image
  WDS.AddFailure(2, 1)
  WDS.AddFailure(3, 1)
    
    
  {{APIComment|'Specify that the will be based on the WDS data set.}}
  {{APIComment|'Create an image image of a reliability vs. time plot and save}}
  WeibullALTAPlot.AddDataset(WDS)
  {{APIComment|'it in PlotPicture using the customized plot settings.}}
   PlotPicture = WeibullALTAPlot.CreatePlot(WAPlotType.Reliability, NewPlotSettings)
  {{APIComment|'Create a Probability plot and save it as a bitmap file. See [[WAPlotType Enumeration|WAPlotType]] for plot types.}}
   Dim FinalPlot As Bitmap = WeibullALTAPlot.CreatePlot(WAPlotType.Probability)

Revision as of 17:28, 28 April 2014


Creates a plot based on a fitted model in a WeibullDataSet or ALTADataSet object.

Constructors

  • WAPlots Creates a new WAPlots object.

Methods

Properties

  • ErrorHappened (as boolean) Whether an error happened during the creation of the plot.
  • ErrorMessage (as string) The error that happened during the creation of the plot. Set only if ErrorHappened is true.

Usage Example

This example demonstrates how to fit five failure times to a life distribution and then use the fitted distribution to create a plot. Full application examples (in VBA) are available at Synthesis_API_Reference#Application_Examples.

 'Initialize a new WeibullDataSet object 
 Dim ADS As New WeibullDataSet("DataSet1")
 
 'Set life distribution 
 WDS.AnalysisSettings.Distribution = WeibullSolverDistribution.Weibull
 WDS.AnalysisSettings.Parameters = WeibullSolverNumParameters.MS_2Parameter
 
 'Set applicable analysis settings 
 WDS.AnalysisSettings.Analysis = WeibullSolverMethod.MLE
 WDS.AnalysisSettings.RankingMethod = WeibullSolverRankMethod.Median
 WDS.AnalysisSettings.UseRSRegression = False
 WDS.AnalysisSettings.ConfBounds = WeibullSolverCBMethod.FisherMatrix
 WDS.AnalysisSettings.SortBeforeCalculations = True
 WDS.AnalysisSettings.UngroupGroupedData = False
 
 'Set Application Setup options  
 WDS.AnalysisSettings.UseSpecialSort = True
 WDS.GeneralSettings.AllowBiasingNormal = False
 WDS.GeneralSettings.DiscardNegLocation = False
 WDS.GeneralSettings.ResetExpLocation = False
 WDS.GeneralSettings.Use3PTrueMLE = False
 WDS.GeneralSettings.UseExtendedGGamma = False
 WDS.GeneralSettings.UsePlottedYPoints = False
 WDS.GeneralSettings.WarnNegLocation = False
 
 'Add failure times 
 WDS.AddFailure(16, 1)
 WDS.AddFailure(34, 1)
 WDS.AddFailure(53, 1)
 WDS.AddFailure(75, 1)
 WDS.AddFailure(93, 1)
 WDS.AddFailure(120, 1)
 
 'Add 4 suspensions 
 WDS.AddFailure(120, 4)
 
 'Fit failure times to the specified distribution 
 WDS.Calculate()
 
 'Create and populate a new WAPlotSettings object with customized plot settings. See WAPlotSettings. 
 Dim NewPlotSettings As New WAPlotSettings
 NewPlotSettings.UserName = User Name
 NewPlotSettings.UserCompany = Company
 NewPlotSettings.AutoscaleX = True
 NewPlotSettings.AutoscaleY = True
 NewPlotSettings.ShowTargetReliability = False
 NewPlotSettings.ShowTargetTime = False
 NewPlotSettings.ShowTargetMarker = False
 NewPlotSettings.ShowSuspensionPoints = True
 NewPlotSettings.ShowLeftCensoredPoints = True
 NewPlotSettings.ShowLinesAroundInterval = True
 NewPlotSettings.AdjustMLEPoints = True
 NewPlotSettings.StraightenGammaLine = True
 NewPlotSettings.ShowNumberInGroup = True
 NewPlotSettings.PlotXPrecision = 3
 NewPlotSettings.PlotyPrecision = 3
 NewPlotSettings.PlotXTolerance = 6
 NewPlotSettings.PlotYTolerance = 6
 NewPlotSettings.ConfBounds_TypesSelected = ConfBoundsTypes.None
 
 'Create a WAPlots object. 
 Dim WeibullALTAPlot As New WAPlots
 
 'Add the WeibullDataSet to the WAPlots object. 
 WeibullALTAPlot.AddDataset(WDS)
 
 'Define an image object to store the plot picture. 
 Dim PlotPicture as Image
 
 'Create an image image of a reliability vs. time plot and save 
 'it in PlotPicture using the customized plot settings. 
 PlotPicture = WeibullALTAPlot.CreatePlot(WAPlotType.Reliability, NewPlotSettings)