Talk:Create Plots/Notes

=DRAFT=

xxx

Prerequisites
In this tutorial, you'll use a Windows Form application to create a button that, when clicked, analyzes a Weibull++ data set and displays the resulting plot. Before you begin, be sure to create a Windows Form Application project, and add a Button and a PictureBox control to the form. You can rename the button to "Create Plot," if desired.

Need help with creating Windows Forms? See this Microsoft tutorial.

Tutorial: Weibull++/ALTA Plots
The following example demonstrates how to use the Synthesis API to create a Weibull++ probability plot and display it in a Windows application. To run this example, paste the code to the Button Click event handler as shown below. A discussion of the example follows.

VB.NET SynthesisAPI Form1 Button1_Click(sender Object, e  EventArgs)  Button1.Click WDS WeibullDataSet WDS.AddFailure(16, 1) WDS.AddFailure(34, 1) WDS.AddFailure(53, 1) WDS.AddFailure(75, 1) WDS.AddFailure(93, 1) WDS.AddSuspension(120, 5) WDS.AnalysisSettings.Distribution = WeibullSolverDistribution.Weibull WDS.AnalysisSettings.Parameters = WeibullSolverNumParameters.MS_2Parameter WDS.AnalysisSettings.Analysis = WeibullSolverMethod.RRX WDS.Calculate WPlot WAPlots WPlot.AddDataset(WDS) PictureBox1.Image = WPlot.CreatePlot(WAPlotType.Probability) PictureBox1.SizeMode = PictureBoxSizeMode.AutoSize

Discussion
The Synthesis API can create plots only from analyzed data sets. In this example, the first three sections of code demonstrate how to create and analyze a simple Weibull++ data set (for a full discussion, see this tutorial).

WDS WeibullDataSet WDS.AddFailure(16, 1) WDS.AddFailure(34, 1) WDS.AddFailure(53, 1) WDS.AddFailure(75, 1) WDS.AddFailure(93, 1) WDS.AddSuspension(120, 5) WDS.AnalysisSettings.Distribution = WeibullSolverDistribution.Weibull WDS.AnalysisSettings.Parameters = WeibullSolverNumParameters.MS_2Parameter WDS.AnalysisSettings.Analysis = WeibullSolverMethod.RRX WDS.Calculate

The WAPlots object represents a plot based on the fitted model of a Weibull++ or ALTA data set. Use the AddDataset method to assign the data set (in this case, a WeibullDataSet object) to the plot.

WPlot WAPlots WPlot.AddDataset(WDS)

Use the CreatePlot method to create a plot. The type of plot it creates is specified by the WAPlotType enumeration, which includes a variety of plots (e.g., reliability, pdf, contour, failure rate plots, etc.). This example creates a probability plot.

To display the plot, assign it to the  property of the PictureBox. The  property is optional; it resizes the PictureBox to fit the image. PictureBox1.Image = WPlot.CreatePlot(WAPlotType.Probability) PictureBox1.SizeMode = PictureBoxSizeMode.AutoSize