APISynthesisResourcesTutorial2

 << Back to Quick Start Guide

Synthesis Resources Tutorial
 * 1) Connect to a Synthesis Repository and Project
 * 2) Create a New Synthesis Resource
 * 3) Update an Existing Resource
 * 4) Calculate Results from a Model

Now that we've learned how to connect to a repository and a project, let’s try adding a new model resource to the repository.

Part 2: Create a New Synthesis Resource
1. Create a new module and begin again by connecting to the Synthesis repository and project.

VBA|VB.NET MyRepository Repository MyRepository.ConnectToRepository MyRepository.Project.SetCurrentProject(1)

2. Use the  class to create a 2-parameter Weibull reliability model with beta 1 and eta 100. Name the model, "MyNewModel."

For VBA, use the  method to define the model. For VB.NET, use the parameterized constructor to create and define the model.

VBA  Amodel cModel ModelType ModelTypeEnum ModelCategory ModelCategoryEnum ModelName String ModelParams(1) Double ModelType = ModelTypeEnum_Weibull2 ModelCategory = ModelCategoryEnum_Reliability ModelName = ModelParams(0) = 1 ModelParams(1) = 100 AModel.SetModel(ModelType, ModelCategory, ModelName, ModelParams)

VB.NET AModel cModel(ModelTypeEnum.Weibull2, ModelCategoryEnum.Reliability,, 1, 100) 3. Use the  method to save the new model to the repository.

VBA MyRepository.Model.AddModel(AModel)

VB.NET MyRepository.Model.AddModel(AModel)

Test the Code
Below are the VBA and VB.NET code lists for this example. On the Debug menu, click Start to run the application. Then in the Synthesis repository, open the project’s Resource Manager (Project > Synthesis> Resource Manager) and then select the Models page. A model named "MyNewModel" should be on the list. (You may need to click the Refresh or Show All command to update the display.)

VBA Sub Main MyRepository Repository MyRepository.ConnectToRepository MyRepository.Project.SetCurrentProject(1) Amodel cModel ModelType ModelTypeEnum ModelCategory ModelCategoryEnum ModelName String ModelParams(1) Double ModelType = ModelTypeEnum_Weibull2 ModelCategory = ModelCategoryEnum_Reliability ModelName = ModelParams(0) = 1 ModelParams(1) = 100 AModel.SetModel(ModelType, ModelCategory, ModelName, ModelParams) MyRepository.Model.AddModel(AModel) End Sub

VB.NET Sub Main MyRepository Repository MyRepository.ConnectToRepository MyRepository.Project.SetCurrentProject(1) AModel cModel(ModelTypeEnum.Weibull2, ModelCategoryEnum.Reliability,, 1, 100) MyRepository.Model.AddModel(AModel) End Sub

Now that you've learned how to add a model resource to a project, try adding other types of Synthesis resources to the project. For example, to create a Universal Reliability Definition (URD) resource, use the methods and properties in the  class, and the use the   method to save the URD to the project.