CModel.SetUseStress: Difference between revisions

From ReliaWiki
Jump to navigation Jump to search
(Created page with '{{Template:APIClass|CModel Class|CModel}} Sets use stress value for a particular stress. == Method Syntax == {{APIName|SetUseStress}} {{APIPrefix|( ByVal}} {{APIName|Index}} {{A…')
 
No edit summary
Line 30: Line 30:


== Usage Example ==
== Usage Example ==
{{APIComment|Declare the cModel class using an in-line parameter list.}}
{{APIComment|Declare a new repository connection class.}}
         Dim newModel As New cModel(ModelTypeEnum.Weibull2, ModelCategoryEnum.Reliability, "NewModel1", 1, 100)
         Private WithEvents MyRepository As New Repository


{{APIComment|Change the model type and parameters.}}
{{APIComment|Connect to the Synthesis repository.}}
         newModel.SetModel(ModelTypeEnum.Lognormal, 2, 200)
        Dim Success As Boolean = False
        Success = MyRepository.ConnectToRepository("RepositoryFileNamePath")
 
{{APIComment|Get the list of Projects in the connected repository.}}
        Dim ListOfModels() As [[NameIdPair Class|NameIdPair]]
        ListOfModels = MyRepository.GetAllModelsInfo()
 
{{APIComment|Select the ID of the model and retrieve it.}}
         Dim AModel as cModel
        AModel = MyRepository.GetModel(ListOfModels(0).ID)
 
{{APIComment|Get the number of stresses.  In this example, the first model is used.}}
        Dim MyNumStresses As Integer
        MyNumStresses = AModel.NumStresses
 
{{APIComment|Create an array and fill Use Stress levels for each of the stresses.  Assume the MyNumStresses in this example is 2.}}
        Dim UseStressArray(MyNumStresses - 1) As Double
        UseStressArray(0) = 500
        UseStressArray(1) = 750
 
{{APIComment|Set the UseStress for the model.}}
        AModel.SetUseStress(UseStressArray)

Revision as of 22:06, 1 October 2013


Sets use stress value for a particular stress.

Method Syntax

SetUseStress ( ByVal Index As Integer, ByVal StressValue As Double )
Sets use stress value for a particular stress.

SetUseStress ( ByVal StressValues() As Double )
Sets use stress value for a particular stress.

Parameters

Index The 0-based index of the Stress of which to update the Use Stress.

StressValue The UseStress to update.

StressValues An array of UseStresses that correspond to the array of Stresses in the model.

Usage Example

Declare a new repository connection class.

       Private WithEvents MyRepository As New Repository

Connect to the Synthesis repository.

       Dim Success As Boolean = False
       Success = MyRepository.ConnectToRepository("RepositoryFileNamePath")

Get the list of Projects in the connected repository.

       Dim ListOfModels() As NameIdPair
       ListOfModels = MyRepository.GetAllModelsInfo()

Select the ID of the model and retrieve it.

       Dim AModel as cModel
       AModel = MyRepository.GetModel(ListOfModels(0).ID)

Get the number of stresses. In this example, the first model is used.

       Dim MyNumStresses As Integer
       MyNumStresses = AModel.NumStresses

Create an array and fill Use Stress levels for each of the stresses. Assume the MyNumStresses in this example is 2.

       Dim UseStressArray(MyNumStresses - 1) As Double
       UseStressArray(0) = 500
       UseStressArray(1) = 750

Set the UseStress for the model.

       AModel.SetUseStress(UseStressArray)