|
|
(2 intermediate revisions by one other user not shown) |
Line 1: |
Line 1: |
| == Formatted Usage Examples ==
| | #REDIRECT [[API Tutorials]] |
| {{APIComment|These formatted examples begin with an XML file, import it into the synthesis repository, add data, perform calculations, perform an analysis, and show results. Finally, they create a plot and display a message.}}
| |
| | |
| | |
| First we will show the importation of a file into BlockSim.
| |
| | |
| | |
| {{APIComment|Declare a new repository connection class.}}
| |
| Private WithEvents MyRepository As New Repository
| |
| {{APIComment|Connect to the Synthesis repository.}}
| |
| Dim Success As Boolean = False
| |
| Success = MyRepository.ConnectToSQLRepository("SQLServerPath", "SQLDatabaseName")
| |
| {{APIComment|Import the XML File to the Synthesis repository.}}
| |
| Dim SuccessImportXML As Boolean
| |
| SuccessImportXML = MyRepository.ImportXFRACASXMLFile("XMLFilePath")
| |
| | |
| | |
| The file has been imported. Now we will demonstrate the use of Synthesis API in Weibull.
| |
| | |
| | |
| {{APIComment|Declare the WeibullDataSet. See [[New WeibullDataSet]] for additional details.}}
| |
| Dim WDS as New WeibullDataSet
| |
| | |
| {{APIComment|Add values to the raw data. See [[WeibullDataSet.AddFailure|AddFailure]] for additional details.}}
| |
| WDS.AddFailure(1, 1)
| |
| WDS.AddFailure(2, 1)
| |
| WDS.AddFailure(3, 1)
| |
| | |
| {{APIComment|Add values to the raw data. See [[WeibullDataSet.AddSuspension|AddSuspension]] for additional details.}}
| |
| WDS.AddSuspension(1, 1)
| |
| WDS.AddSuspension(2, 1)
| |
| WDS.AddSuspension(3, 1)
| |
| | |
| {{APIComment|Calculate the WeibullDataSet. See [[WeibullDataSet.Calculate|Calculate]] for additional details.}}
| |
| WDS.Calculate
| |
| | |
| {{APIComment|Get the number of failures. In this example, NumberOfFailures will be 3. See [[WeibullDataSet.FailureCount|FailureCount]] for additional details.}}
| |
| Dim NumberOfFailures as Integer
| |
| NumberOfFailures = WDS.FailureCount
| |
| | |
| {{APIComment|Calculate the Fitted Model using the raw data. See [[WeibullDataSet.CalculateBestFit|CalculateBestFit]] for additional details.}}
| |
| WDS.CalculateBestFit
| |
| | |
| {{APIComment|Use the Fitted Model using the raw data. See [[WeibullDataSet.FittedModel|FittedModel]] for additional details.}}
| |
| Dim WDSFittedModel as cModel
| |
| WDSFittedModel = WDS.FittedModel
| |
| | |
| {{APIComment|Use ClearDataSet to clear data and fitted model. See [[WeibullDataSet.ClearDataSet|ClearDataSet]] for additional details.}}
| |
| '''WDS.ClearDataSet'''
| |
| | |
| {{APIComment|Get the number of failures. In this example, NumberOfFailures will be 0. See [[WeibullDataSet.FailureCount|FailureCount]] for additional details.}}
| |
| Dim NumberOfFailures as Integer
| |
| NumberOfFailures = WDS.FailureCount
| |
| | |
| The below demonstrates that plots may also be utilized.
| |
| | |
| {{APIComment|Create a new Weibull/ALTA Plot instance.}}
| |
| Dim WeibullALTAPlot As New WAPlots
| |
| | |
| {{APIComment|Declare a WeibullDataSet. See [[New WeibullDataSet]] for additional details.}}
| |
| Dim WDS As New WeibullDataSet
| |
| | |
| {{APIComment|Add values to the raw data. See [[WeibullDataSet.AddFailure|AddFailure]] for additional details.}}
| |
| WDS.AddFailure(1, 1)
| |
| WDS.AddFailure(2, 1)
| |
| WDS.AddFailure(3, 1)
| |
| | |
| {{APIComment|Add the WeibullDataSet to the WAPlots.}}
| |
| WeibullALTAPlot.AddDataset(WDS)
| |
| | |
| {{APIComment|Create the WAPlot. In this example, it will create a Probability plot.}}
| |
| Dim FinalPlot As Bitmap = WeibullALTAPlot.CreatePlot(WAPlotType.Probability)
| |
| | |
| {{APIComment|If there were any issues creating the plot, [[WAPlots.ErrorHappened|ErrorHappened]] would be True, and ErrorString will display the reason.}}
| |
| Dim ErrorString as String
| |
| If WeibullALTAPlot.[[WAPlots.ErrorHappened|ErrorHappened]] Then
| |
| ErrorString = '''WeibullALTAPlot.ErrorMessage'''
| |
| End If
| |