CModel.SetModel: Difference between revisions

From ReliaWiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 2: Line 2:




<onlyinclude>Defines an existing [[CModel Class|cModel]] object.</onlyinclude>
<onlyinclude>Defines the model type, model category, name and parameters of an existing [[CModel Class|cModel]] object.</onlyinclude>


== Syntax ==
== Syntax ==

Revision as of 18:03, 28 July 2015

APIWiki.png


Member of: SynthesisAPI9.cModel


Defines the model type, model category, name and parameters of an existing cModel object.

Syntax

.SetModel(ModelType, ModelCategory, ModelName, ModelParams())

Parameters

ModelType

The model type (e.g., 2-parameter Weibull). Can be any ModelTypeEnum constant. (Required)

ModelCategory

The model category (e.g., reliability model). Can be any ModelCategoryEnum constant. (Required)

ModelName

String. The model name. (Required)

ModelParams()

Double. An array of the model's parameters. (Required)


Example

This example assumes that a model with ID#1 exists in a repository.

VBA

 'Add code to connect to a Synthesis repository. 
 Dim MyRepository As New Repository
  ... 


 'Get model #1 from project# 1. 
 Dim AModel As New cModel
 MyRepository.Project.SetCurrentProject(1)
 Set AModel = MyRepository.Model.GetModel(1)

 'Change the model's properties. 
 Dim params(1) As Double
 params(0) = 5
 params(1) = 1
 Call AModel.SetModel(ModelTypeEnum_Lognormal, ModelCategoryEnum_Reliability, "Model1", params)
VB.NET

 'Add code to connect to a Synthesis repository. 
 Dim MyRepository As New Repository
  ... 


 'Get model #1 from project# 1. 
 Dim AModel As New cModel
 MyRepository.Project.SetCurrentProject(1)
 AModel = MyRepository.Model.GetModel(1)

 'Change the model's properties. 
 Dim params(1) As Double
 params(0) = 5
 params(1) = 1
 AModel.SetModel(ModelTypeEnum.Lognormal, ModelCategoryEnum.Reliability, "Model1", params)