|
|
Line 4: |
Line 4: |
|
| |
|
| '''Synthesis Resources Tutorial''' | | '''Synthesis Resources Tutorial''' |
| #[[#Part 1: Connecting to a Synthesis Repository and Project|Connecting to a Synthesis Repository and Project]] | | #Connect to a Synthesis Repository and Project |
| #[[#Part 2: Creating a New Synthesis Resource|Creating a New Synthesis Resource]] | | #[[APISynthesisResourcesTutorial2|Create a New Synthesis Resource]] |
| #[[#Part 3: Updating an Existing Resource|Updating an Existing Resource]] | | #[[APISynthesisResourcesTutorial3|Update an Existing Resource]] |
| #[[#Part 4: Calculating Results from Models|Calculating Results from Models]] | | #[[APISynthesisResourcesTutorial4|Calculate Results from a Model]] |
| '''[[APISDWTutorial|Synthesis Data Warehouse (SDW) Tutorial]]
| |
| </div> | | </div> |
|
| |
|
Line 18: |
Line 17: |
|
| |
|
|
| |
|
| ==Part 1: Connecting to a Synthesis Repository and Project== | | ==Part 1: Connect to a Synthesis Repository and Project== |
| 1. We'll start with the <code>Repository</code> class, which provides several methods for connecting to standard or enterprise repositories. In this example, we will use the basic <code>ConnectToRepository</code> method to create a simple application. | | 1. We'll start with the <code>Repository</code> class, which provides several methods for connecting to standard or enterprise repositories. In this example, we will use the basic <code>ConnectToRepository</code> method to create a simple application. |
|
| |
|
Line 112: |
Line 111: |
|
| |
|
|
| |
|
| ==Part 2: Creating a New Synthesis Resource==
| |
| 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.
| |
|
| |
|
| 1. Create a new module and begin again by connecting to the Synthesis repository and project.
| |
|
| |
|
| '''VBA|VB.NET'''
| |
|
| |
| {{APIComment|'Connect to the Synthesis repository and set project ID#1 as the current project.}}
| |
| {{APIPrefix|Dim}} MyRepository {{APIPrefix|As New}} Repository
| |
| MyRepository.ConnectToRepository({{APIString|"C:\RSRepository1.rsr10"}})
| |
| MyRepository.Project.SetCurrentProject(1)
| |
|
| |
| 2. Use the <code>cModel</code> class to create a 2-parameter Weibull reliability model with beta 1 and eta 100. Name the model, "MyNewModel."
| |
|
| |
| For VBA, use the <code>SetModel</code> method to define the model. For VB.NET, use the parameterized constructor to create and define the model.
| |
|
| |
| '''VBA '''
| |
|
| |
| {{APIComment|'Declare a new instance of the cModel class.}}
| |
| {{APIPrefix|Dim}} Amodel {{APIPrefix|As New}} cModel
| |
|
| |
| {{APIComment|'Define the model.}}
| |
| {{APIPrefix|Dim}} ModelType {{APIPrefix|As}} ModelTypeEnum
| |
| {{APIPrefix|Dim}} ModelCategory {{APIPrefix|As}} ModelCategoryEnum
| |
| {{APIPrefix|Dim}} ModelName {{APIPrefix|As}} String
| |
| {{APIPrefix|Dim}} ModelParams(1) {{APIPrefix|As}} Double
| |
|
| |
| ModelType = ModelTypeEnum_Weibull2
| |
| ModelCategory = ModelCategoryEnum_Reliability
| |
| ModelName = {{APIString|"MyNewModel"}}
| |
| ModelParams(0) = 1
| |
| ModelParams(1) = 100
| |
|
| |
| {{APIPrefix|Call}} AModel.SetModel(ModelType, ModelCategory, ModelName, ModelParams)
| |
|
| |
| '''VB.NET'''
| |
|
| |
| {{APIComment|'Declare a new instance of the cModel class. You can use an in-line parameter list to define the model.}}
| |
| {{APIPrefix|Dim}} AModel {{APIPrefix|As New}} cModel(ModelTypeEnum.Weibull2, ModelCategoryEnum.Reliability, {{APIString|"MyNewModel"}}, 1, 100)
| |
|
| |
| 3. Use the <code>AddModel</code> method to save the new model to the repository.
| |
|
| |
| '''VBA'''
| |
|
| |
| {{APIComment|'Add the new model to the current project.}}
| |
| {{APIPrefix|Call}} MyRepository.Model.AddModel(AModel)
| |
|
| |
| '''VB.NET'''
| |
|
| |
| {{APIComment|'Add the new model to the current project.}}
| |
| 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()
| |
|
| |
| {{APIComment|'Connect to the Synthesis repository and set project ID#1 as the current project.}}
| |
| {{APIPrefix|Dim}} MyRepository {{APIPrefix|As New}} Repository
| |
| MyRepository.ConnectToRepository({{APIString|"C:\RSRepository1.rsr10"}})
| |
| MyRepository.Project.SetCurrentProject(1)
| |
|
| |
| {{APIComment|'Declare a new instance of the cModel class.}}
| |
| {{APIPrefix|Dim}} Amodel {{APIPrefix|As New}} cModel
| |
|
| |
| {{APIComment|'Define the model.}}
| |
| {{APIPrefix|Dim}} ModelType {{APIPrefix|As}} ModelTypeEnum
| |
| {{APIPrefix|Dim}} ModelCategory {{APIPrefix|As}} ModelCategoryEnum
| |
| {{APIPrefix|Dim}} ModelName {{APIPrefix|As}} String
| |
| {{APIPrefix|Dim}} ModelParams(1) {{APIPrefix|As}} Double
| |
|
| |
| ModelType = ModelTypeEnum_Weibull2
| |
| ModelCategory = ModelCategoryEnum_Reliability
| |
| ModelName = {{APIString|"MyNewModel"}}
| |
| ModelParams(0) = 1
| |
| ModelParams(1) = 100
| |
|
| |
| {{APIPrefix|Call}} AModel.SetModel(ModelType, ModelCategory, ModelName, ModelParams)
| |
|
| |
| {{APIComment|'Add the new model to the current project.}}
| |
| {{APIPrefix|Call}} MyRepository.Model.AddModel(AModel)
| |
|
| |
| End Sub
| |
|
| |
| '''VB.NET'''
| |
|
| |
| Sub Main()
| |
|
| |
| {{APIComment|'Connect to the Synthesis repository and set the first available project in the repository as the active project.}}
| |
| {{APIPrefix|Dim}} MyRepository {{APIPrefix|As New}} Repository
| |
| MyRepository.ConnectToRepository({{APIString|"C:\RSRepository1.rsr10"}})
| |
| MyRepository.Project.SetCurrentProject(1)
| |
|
| |
| {{APIComment|'Declare a new instance of the cModel class. You can use an in-line parameter list to define the model.}}
| |
| {{APIPrefix|Dim}} AModel {{APIPrefix|As New}} cModel(ModelTypeEnum.Weibull2, ModelCategoryEnum.Reliability, {{APIString|"MyNewModel"}}, 1, 100)
| |
|
| |
| {{APIComment|'Add the new model to the current project.}}
| |
| MyRepository.Model.AddModel(AModel)
| |
|
| |
| End Sub
| |
|
| |
| ===References===
| |
| To learn more, see the reference documentation for the classes and methods discussed in this section:
| |
|
| |
| *[[CModel Class|cModel Class]]
| |
| *[[CModel.SetModel|cModel.SetModel Method]]
| |
| *[[CModel_Constructors|cModel Constructor (VB.NET Only)]]
| |
| *[[ModelTypeEnum Enumeration]]
| |
| *[[ModelCategoryEnum Enumeration]]
| |
| *[[Repository.Model.AddModel|Repository.Model.AddModel Method]]
| |
|
| |
|
| |
| ==Part 3: Updating an Existing Resource==
| |
| In this section, we'll update the properties of the model we've created in the previous section and also update its definition.
| |
|
| |
| 1. Create a new module and add code to connect to the Synthesis repository and project.
| |
|
| |
| '''VBA|VB.NET'''
| |
|
| |
| {{APIComment|'Connect to the Synthesis repository and set project ID#1 as the current project.}}
| |
| {{APIPrefix|Dim}} MyRepository {{APIPrefix|As New}} Repository
| |
| MyRepository.ConnectToRepository({{APIString|"C:\RSRepository1.rsr10"}})
| |
| MyRepository.Project.SetCurrentProject(1)
| |
|
| |
| 2. Next, use the <code>GetModel</code> method to the retrieve the model (called "MyNewModel") from the repository. The following code assumes that the model's ID number is 21.
| |
|
| |
| '''VBA'''
| |
|
| |
| {{APIComment|'Retrieve the model with ID# 21 from the repository.}}
| |
| {{APIPrefix|Dim}} Amodel {{APIPrefix|As New}} cModel
| |
| {{APIPrefix|Set}} AModel = MyRepository.Model.GetModel(21)
| |
|
| |
| '''VB.NET'''
| |
|
| |
| {{APIComment|'Retrieve the model with ID# 21 from the repository.}}
| |
| {{APIPrefix|Dim}} Amodel {{APIPrefix|As New}} cModel
| |
| AModel = MyRepository.Model.GetModel(21)
| |
|
| |
| <div id="Anchor1"></div>
| |
| 3. Let's update the model's properties. Use the following code to add a description and part number for the model.
| |
|
| |
| '''VBA|VB.NET'''
| |
|
| |
| {{APIComment|'Add a description and part number for the model.}}
| |
| Amodel.ItemDescription = {{APIString|"A specific type of light bulb."}}
| |
| Amodel.ItemPartNumber = {{APIString|"PN5461"}}
| |
|
| |
| 4. Let's also update the model's definition by changing its name to "MyNewModel_Updated" and the values of beta = 2 and eta = 150. Use the <code>SetModel</code> method to define the model. In VB.NET, you can use an in-line parameter list to define the values of the parameters.
| |
|
| |
| '''VBA'''
| |
|
| |
| {{APIComment|'Define a new model name and values for beta and eta.}}
| |
| {{APIPrefix|Dim}} ModelParams(1) {{APIPrefix|As}} Double
| |
| ModelParams(0) = 2
| |
| ModelParams(1) = 150
| |
|
| |
| {{APIPrefix|Call}} AModel.SetModel(ModelTypeEnum_Weibull2, ModelCategoryEnum_Reliability, {{APIString|"MyNewModel_Updated"}}, ModelParams)
| |
|
| |
| '''VB.NET'''
| |
|
| |
| {{APIComment|'Define a new model name and values for beta and eta.}}
| |
| AModel.SetModel(ModelTypeEnum.Weibull2, ModelCategoryEnum.Reliability, {{APIString|"MyNewModel_Updated"}}, {{APIPrefix|New Double}}() {2, 150})
| |
|
| |
| 5. Use the <code>UpdateModel</code> method to apply the changes to the model.
| |
|
| |
| '''VBA'''
| |
|
| |
| {{APIComment|'Apply the changes to the model.}}
| |
| {{APIPrefix|Call}} MyRepository.Model.UpdateModel(AModel)
| |
|
| |
| '''VB.NET'''
| |
|
| |
| {{APIComment|'Apply the changes to the model.}}
| |
| MyRepository.Model.UpdateModel(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, and then check the project's Resource Manager to verify that the model's name has been changed to "MyNewModel_Updated" and that beta = 2 and eta = 150.
| |
|
| |
| '''VBA'''
| |
|
| |
| Sub Main()
| |
|
| |
| {{APIComment|'Connect to the Synthesis repository and set project ID#1 as the current project.}}
| |
| {{APIPrefix|Dim}} MyRepository {{APIPrefix|As New}} Repository
| |
| MyRepository.ConnectToRepository({{APIString|"C:\RSRepository1.rsr10"}})
| |
| MyRepository.Project.SetCurrentProject(1)
| |
|
| |
| {{APIComment|'Retrieve the model with ID# 21 from the repository.}}
| |
| {{APIPrefix|Dim}} Amodel {{APIPrefix|As New}} cModel
| |
| {{APIPrefix|Set}} AModel = MyRepository.Model.GetModel(21)
| |
|
| |
| {{APIComment|'Add a description and part number for the model.}}
| |
| Amodel.ItemDescription = {{APIString|"A specific type of light bulb."}}
| |
| Amodel.ItemPartNumber = {{APIString|"PN5461"}}
| |
|
| |
| {{APIComment|'Define a new model name and values for beta and eta.}}
| |
| {{APIPrefix|Dim}} ModelParams(1) {{APIPrefix|As}} Double
| |
| ModelParams(0) = 2
| |
| ModelParams(1) = 150
| |
|
| |
| {{APIPrefix|Call}} AModel.SetModel(ModelTypeEnum_Weibull2, ModelCategoryEnum_Reliability, {{APIString|"MyNewModel_Updated"}}, ModelParams)
| |
|
| |
| {{APIComment|'Apply the changes to the model.}}
| |
| {{APIPrefix|Call}} MyRepository.Model.UpdateModel(AModel)
| |
|
| |
| End Sub
| |
|
| |
| '''VB.NET'''
| |
|
| |
| Sub Main()
| |
|
| |
| {{APIComment|'Connect to a Synthesis repository and set the first available project in the repository as the active project.}}
| |
| {{APIPrefix|Dim}} MyRepository {{APIPrefix|As New}} Repository
| |
| MyRepository.ConnectToRepository({{APIString|"C:\RSRepository1.rsr10"}})
| |
| MyRepository.Project.SetCurrentProject(1)
| |
|
| |
| {{APIComment|'Retrieve the model with ID# 21 from the repository.}}
| |
| {{APIPrefix|Dim}} Amodel {{APIPrefix|As New}} cModel
| |
| AModel = MyRepository.Model.GetModel(21)
| |
|
| |
| {{APIComment|'Add a description and part number for the model.}}
| |
| Amodel.ItemDescription = {{APIString|"A specific type of light bulb."}}
| |
| Amodel.ItemPartNumber = {{APIString|"PN5461"}}
| |
|
| |
| {{APIComment|'Define a new model name and values for beta and eta.}}
| |
| AModel.SetModel(ModelTypeEnum.Weibull2, ModelCategoryEnum.Reliability, {{APIString|"MyNewModel_Updated"}}, {{APIPrefix|New Double}}() {2, 150})
| |
|
| |
| {{APIComment|'Apply the changes to the model.}}
| |
| MyRepository.Model.UpdateModel(AModel)
| |
|
| |
| End Sub
| |
|
| |
| ===References===
| |
| To learn more, see the reference documentation for the methods discussed in this section:
| |
|
| |
| *[[Repository.Model.GetModel|Repository.Model.GetModel Method]]
| |
| *[[Repository.Model.UpdateModel|Repository.Model.UpdateModel Method]]
| |
|
| |
|
| |
| ==Part 4: Calculating Results from Models==
| |
| Models are used by other Synthesis resources to represent the reliability of a task, the duration of a task, the expected cost of a repair, and many other characteristics. In this section, we'll learn how to obtain calculated results from models.
| |
|
| |
| 1. Create a new module, and then add code to retrieve the model that we've been working on in the previous sections (recall that the model's name is now "MyNewModel_Update"). The following code example assumes that the model's ID number is 21.
| |
|
| |
| '''VBA'''
| |
|
| |
| {{APIComment|'Connect to the Synthesis repository and retrieve model ID#21.}}
| |
| {{APIPrefix|Dim}} MyRepository {{APIPrefix|As New}} Repository
| |
| MyRepository.ConnectToRepository({{APIString|"C:\RSRepository1.rsr10"}})
| |
| MyRepository.Project.SetCurrentProject(1)
| |
|
| |
| {{APIPrefix|Dim}} AModel {{APIPrefix|As}} cModel
| |
| {{APIPrefix|Set}} AModel = MyRepository.Model.GetModel(21)
| |
|
| |
| '''VB.NET'''
| |
|
| |
| {{APIComment|'Connect to the Synthesis repository and retrieve model ID#21.}}
| |
| {{APIPrefix|Dim}} MyRepository {{APIPrefix|As New}} Repository
| |
| MyRepository.ConnectToRepository({{APIString|"C:\RSRepository1.rsr10"}})
| |
| MyRepository.Project.SetCurrentProject(1)
| |
|
| |
| {{APIPrefix|Dim}} AModel {{APIPrefix|As}} cModel
| |
| AModel = MyRepository.Model.GetModel(21)
| |
|
| |
| 2. Use the <code>Reliability</code> method to calculate for the reliability at 100 hrs and the <code>MeanTime</code> method to return the mean time to failure.
| |
|
| |
| '''VBA|VB.NET'''
| |
|
| |
| {{APIComment|'Calculate the model's reliability at time = 100 hrs and mean time.}}
| |
| {{APIPrefix|Dim}} Result1 {{APIPrefix|As}} Double
| |
| {{APIPrefix|Dim}} Result2 {{APIPrefix|As}} Double
| |
|
| |
| Result1 = AModel.Reliability(100)
| |
| Result2 = AModel.MeanTime()
| |
|
| |
| 3. Let's add confidence bounds calculations to the results. Use the <code>SetConfidenceLevel</code> method to specify 90% two-sided confidence bounds.
| |
|
| |
| '''VBA'''
| |
|
| |
| {{APIComment|'Set the confidence level to 90% two-sided bounds.}}
| |
| {{APIComment|'Declare a string variable for any errors found during this method.}}
| |
| {{APIPrefix|Dim}} ErrorMsg {{APIPrefix|As}} String
| |
| {{APIPrefix|Call}} AModel.SetConfidenceLevel(0.9, ConfBoundsSides_TwoSidedBoth, False, ErrorMsg)
| |
|
| |
| {{APIComment|'Initiate new instances of the BoundsValues class.}}
| |
| {{APIPrefix|Dim}} BResult1 {{APIPrefix|As}} BoundsValues
| |
| {{APIPrefix|Dim}} BResult2 {{APIPrefix|As}} BoundsValues
| |
|
| |
| {{APIComment|'Calculate bounds for the reliability at 100 hrs and the mean time.}}
| |
| {{APIPrefix|Set}} BResult1 = AModel.Bounds_Reliability(100)
| |
| {{APIPrefix|Set}} BResult2 = AModel.Bounds_MeanTime()
| |
|
| |
| {{APIComment|'Display the output.}}
| |
| MsgBox ({{APIString|"Reliability <nowiki>=</nowiki> "}} & Result1 & vbNewLine & _
| |
| {{APIString|"Upper Bound <nowiki>=</nowiki> "}} & BResult1.upper & vbNewLine & _
| |
| {{APIString|"Lower Bound <nowiki>=</nowiki> "}} & BResult1.lower & vbNewLine)
| |
| MsgBox ({{APIString|"Mean Time <nowiki>=</nowiki> "}} & Result2 & vbNewLine & _
| |
| {{APIString|"Upper Bound <nowiki>=</nowiki> "}} & BResult2.upper & vbNewLine & _
| |
| {{APIString|"Lower Bound <nowiki>=</nowiki> "}} & BResult2.lower & vbNewLine)
| |
|
| |
| '''VB.NET'''
| |
|
| |
| {{APIComment|'Set the confidence level to 90% two-sided bounds.}}
| |
| {{APIComment|'Declare a string variable for any errors found during this method.}}
| |
| {{APIPrefix|Dim}} ErrorMsg {{APIPrefix|As}} String
| |
| AModel.SetConfidenceLevel(0.9, ConfBoundsSides.TwoSidedBoth, False, ErrorMsg)
| |
|
| |
| {{APIComment|'Initiate new instances of the BoundsValues class.}}
| |
| {{APIPrefix|Dim}} BResult1 {{APIPrefix|As}} BoundsValues
| |
| {{APIPrefix|Dim}} BResult2 {{APIPrefix|As}} BoundsValues
| |
|
| |
| {{APIComment|'Calculate bounds for the reliability at 100 hrs and the mean time.}}
| |
| BResult1 = AModel.Bounds_Reliability(100)
| |
| BResult2 = AModel.Bounds_MeanTime()
| |
|
| |
| {{APIComment|'Display the output.}}
| |
| MsgBox ({{APIString|"Reliability <nowiki>=</nowiki> "}} & Result1 & vbNewLine & _
| |
| {{APIString|"Upper Bound <nowiki>=</nowiki> "}} & BResult1.upper & vbNewLine & _
| |
| {{APIString|"Lower Bound <nowiki>=</nowiki> "}} & BResult1.lower & vbNewLine)
| |
| MsgBox ({{APIString|"Mean Time <nowiki>=</nowiki> "}} & Result2 & vbNewLine & _
| |
| {{APIString|"Upper Bound <nowiki>=</nowiki> "}} & BResult2.upper & vbNewLine & _
| |
| {{APIString|"Lower Bound <nowiki>=</nowiki> "}} & BResult2.lower & vbNewLine)
| |
|
| |
| ===Test the Code===
| |
| Below are the VBA and VB.NET code lists for this example. You can experiment with the code by retrieving ''published'' models from the repository and then comparing the results obtained by the API with results obtained by the Quick Calculation Pad (QCP).
| |
|
| |
| '''VBA'''
| |
|
| |
| Sub Main()
| |
|
| |
| {{APIComment|'Connect to the Synthesis repository and retrieve model ID#21.}}
| |
| {{APIPrefix|Dim}} MyRepository {{APIPrefix|As New}} Repository
| |
| MyRepository.ConnectToRepository({{APIString|"C:\RSRepository1.rsr10"}})
| |
| MyRepository.Project.SetCurrentProject(1)
| |
|
| |
| {{APIPrefix|Dim}} AModel {{APIPrefix|As}} cModel
| |
| {{APIPrefix|Set}} AModel = MyRepository.Model.GetModel(21)
| |
|
| |
| {{APIComment|'Calculate the model's reliability at time = 100 hrs and mean time.}}
| |
| {{APIPrefix|Dim}} Result1 {{APIPrefix|As}} Double
| |
| {{APIPrefix|Dim}} Result2 {{APIPrefix|As}} Double
| |
|
| |
| Result1 = AModel.Reliability(100)
| |
| Result2 = AModel.MeanTime()
| |
|
| |
| {{APIComment|'Set the confidence level to 90% two-sided bounds.}}
| |
| {{APIComment|'Declare a string variable for any errors found during this method.}}
| |
| {{APIPrefix|Dim}} ErrorMsg {{APIPrefix|As}} String
| |
| {{APIPrefix|Call}} AModel.SetConfidenceLevel(0.9, ConfBoundsSides_TwoSidedBoth, False, ErrorMsg)
| |
|
| |
| {{APIComment|'Initiate new instances of the BoundsValues class.}}
| |
| {{APIPrefix|Dim}} BResult1 {{APIPrefix|As}} BoundsValues
| |
| {{APIPrefix|Dim}} BResult2 {{APIPrefix|As}} BoundsValues
| |
|
| |
| {{APIComment|'Calculate bounds for the reliability at 100 hrs and the mean time.}}
| |
| {{APIPrefix|Set}} BResult1 = AModel.Bounds_Reliability(100)
| |
| {{APIPrefix|Set}} BResult2 = AModel.Bounds_MeanTime()
| |
|
| |
| {{APIComment|'Display the output.}}
| |
| MsgBox ({{APIString|"Reliability <nowiki>=</nowiki> "}} & Result1 & vbNewLine & _
| |
| {{APIString|"Upper Bound <nowiki>=</nowiki> "}} & BResult1.upper & vbNewLine & _
| |
| {{APIString|"Lower Bound <nowiki>=</nowiki> "}} & BResult1.lower & vbNewLine)
| |
| MsgBox ({{APIString|"Mean Time <nowiki>=</nowiki> "}} & Result2 & vbNewLine & _
| |
| {{APIString|"Upper Bound <nowiki>=</nowiki> "}} & BResult2.upper & vbNewLine & _
| |
| {{APIString|"Lower Bound <nowiki>=</nowiki> "}} & BResult2.lower & vbNewLine)
| |
|
| |
| End Sub
| |
|
| |
| '''VB.NET'''
| |
|
| |
| Sub Main()
| |
|
| |
| {{APIComment|'Connect to the Synthesis repository and retrieve model ID#21.}}
| |
| {{APIPrefix|Dim}} MyRepository {{APIPrefix|As New}} Repository
| |
| MyRepository.ConnectToRepository({{APIString|"C:\RSRepository1.rsr10"}})
| |
| MyRepository.Project.SetCurrentProject(1)
| |
|
| |
| {{APIPrefix|Dim}} AModel {{APIPrefix|As}} cModel
| |
| AModel = MyRepository.Model.GetModel(21)
| |
|
| |
| {{APIComment|'Calculate the model's reliability at time = 100 hrs and mean time.}}
| |
| {{APIPrefix|Dim}} Result1 {{APIPrefix|As}} Double
| |
| {{APIPrefix|Dim}} Result2 {{APIPrefix|As}} Double
| |
|
| |
| Result1 = AModel.Reliability(100)
| |
| Result2 = AModel.MeanTime()
| |
|
| |
| {{APIComment|'Set the confidence level to 90% two-sided bounds.}}
| |
| {{APIComment|'Declare a string variable for any errors found during this method.}}
| |
| {{APIPrefix|Dim}} ErrorMsg {{APIPrefix|As}} String
| |
| AModel.SetConfidenceLevel(0.9, ConfBoundsSides.TwoSidedBoth, False, ErrorMsg)
| |
|
| |
| {{APIComment|'Initiate new instances of the BoundsValues class.}}
| |
| {{APIPrefix|Dim}} BResult1 {{APIPrefix|As}} BoundsValues
| |
| {{APIPrefix|Dim}} BResult2 {{APIPrefix|As}} BoundsValues
| |
|
| |
| {{APIComment|'Calculate bounds for the reliability at 100 hrs and the mean time.}}
| |
| BResult1 = AModel.Bounds_Reliability(100)
| |
| BResult2 = AModel.Bounds_MeanTime()
| |
|
| |
| {{APIComment|'Display the output.}}
| |
| MsgBox ({{APIString|"Reliability <nowiki>=</nowiki> "}} & Result1 & vbNewLine & _
| |
| {{APIString|"Upper Bound <nowiki>=</nowiki> "}} & BResult1.upper & vbNewLine & _
| |
| {{APIString|"Lower Bound <nowiki>=</nowiki> "}} & BResult1.lower & vbNewLine)
| |
| MsgBox ({{APIString|"Mean Time <nowiki>=</nowiki> "}} & Result2 & vbNewLine & _
| |
| {{APIString|"Upper Bound <nowiki>=</nowiki> "}} & BResult2.upper & vbNewLine & _
| |
| {{APIString|"Lower Bound <nowiki>=</nowiki> "}} & BResult2.lower & vbNewLine)
| |
|
| |
| End Sub
| |
|
| |
| ===References===
| |
| To learn more, see the reference documentation for the class and methods discussed in this section:
| |
|
| |
| *[[CModel.Reliability|cModel.Reliability Method]]
| |
| *[[CModel.MeanTime|cModel.MeanTime Method]]
| |
| *[[CModel.SetConfidenceLevel|cModel.SetConfidenceLevel Method]]
| |
| *[[CModel.Bounds_Reliability|cModel.Bounds_Reliability Method]]
| |
| *[[CModel.Bounds_MeanTime|cModel.Bounds_MeanTime Method]]
| |
| *[[BoundsValues Class]]
| |
|
| |
|
| |
| ==Do More==
| |
| In this tutorial, we've learned the basics of working with models. Expand your learning by experimenting with other types of Synthesis resources.
| |
|
| |
| Unlike models, the following resources do not need a <code>SetModel</code> method to be defined. You can set their definitions by simply updating their properties (as was demonstrated in [[#Anchor1|Part3, Step 3]] of the tutorial).
| |
|
| |
|
| *[[cAction Class|cAction]]
| | '''<span style="color:#808080;">Next: [[APISynthesisResourcesTutorial2|Create a New Synthesis Resource >>]]</span>''' |
| *[[cURD Class|cURD]]
| |
| *[[cVariable Class|cVariable]]
| |
| *[[cCrew Class|cCrew]]
| |
| *[[cPool Class|cPool]]
| |
| *[[cCorrectiveTask Class|cCorrectiveTask]]
| |
| *[[cScheduledTask Class|cScheduledTask]]
| |
| *[[cXfmeaControl Class|cXfmeaControl]]
| |