CModel.SetModel: Difference between revisions

From ReliaWiki
Jump to navigation Jump to search
No edit summary
Line 1: Line 1:
{{DISPLAYTITLE:cModel.SetModel}}
{{DISPLAYTITLE:cModel.SetModel}}{{Template:API}}{{Template:APIBreadcrumb|9|.[[CModel Class|cModel]]}}
{{Template:APIClass|CModel Class|cModel}}  
 
{{Template:CModel.SetModel.Cmt}}
 
<onlyinclude>Defines an existing [[CModel Class|cModel]] object.</onlyinclude>


== Syntax ==
== Syntax ==
*SetModel( ModelType {{APIPrefix|As}} [[ModelTypeEnum Enumeration|ModelTypeEnum]], ModelCategory {{APIPrefix|As}} [[ModelCategoryEnum Enumeration|ModelCategoryEnum]], ModelParams(){{APIPrefix|As Double}} )
'''.SetModel'''(''ModelType'', ''ModelCategory'', ''ModelName'', ''ModelParams()'')
 
===Parameters===
''ModelType''
:The model type (e.g., 2-parameter Weibull). Can be any [[ModelTypeEnum Enumeration|ModelTypeEnum]] constant. (Required)
 
''ModelCategory''
:The model category (e.g., reliability model). Can be any [[ModelCategoryEnum Enumeration|ModelCategoryEnum]] constant. (Required)
 
''ModelName''
:String. The model name. (Required)  


Parameters
''ModelParams()''
:''ModelType'': The [[ModelTypeEnum Enumeration|ModelTypeEnum]] describing the model type (e.g., 2-parameter Weibull).
:Double. An array of the model's parameters. (Required)


:''ModelCategory'': The [[ModelCategoryEnum Enumeration|ModelCategoryEnum]] describing the model category (e.g., reliability model).


:''ModelParams'': An array of the model's parameters.
== Example ==
This example assumes that a model with ID#1 exists in a repository.
'''VBA'''
{{APIComment|'Add code to connect to a Synthesis repository.}}
  {{APIPrefix|Dim}} MyRepository {{APIPrefix|As New}} Repository
  {{APIComment|...}}
{{APIComment|'Get model #1 from project# 1.}}
  {{APIPrefix|Dim}} AModel {{APIPrefix|As New}} cModel
  MyRepository.Project.SetCurrentProject(1)
  {{APIPrefix|Set}} AModel = MyRepository.Model.GetModel(1)
{{APIComment|'Change the model's properties.}}
  {{APIPrefix|Dim}} params(1) {{APIPrefix|As Double}}
  params(0) = 5
  params(1) = 1
  {{APIPrefix|Call}} AModel.SetModel(ModelTypeEnum_Lognormal, ModelCategoryEnum_Reliability, {{APIString|"Model1"}}, params)


== Usage Example ==
'''VB.NET'''
  {{APIComment|'Declare the cModel class using an in-line parameter list.}}
   Dim newModel As New cModel(ModelTypeEnum.Weibull2,
  {{APIComment|'Add code to connect to a Synthesis repository.}}
    ModelCategoryEnum.Reliability, "NewModel1", 1, 100)
   {{APIPrefix|Dim}} MyRepository {{APIPrefix|As New}} Repository
 
  {{APIComment|...}}
  {{APIComment|'Change the model type and parameters.}}
   newModel.SetModel(ModelTypeEnum.Lognormal, ModelCategoryEnum.Reliability, 200)
{{APIComment|'Get model #1 from project# 1.}}
  {{APIPrefix|Dim}} AModel {{APIPrefix|As New}} cModel
  MyRepository.Project.SetCurrentProject(1)
  AModel = MyRepository.Model.GetModel(1)
  {{APIComment|'Change the model's properties.}}
   {{APIPrefix|Dim}} params(1) {{APIPrefix|As Double}}
  params(0) = 5
  params(1) = 1
  AModel.SetModel(ModelTypeEnum.Lognormal, ModelCategoryEnum.Reliability, {{APIString|"Model1"}}, params)

Revision as of 18:00, 28 July 2015

APIWiki.png


Member of: SynthesisAPI9.cModel


Defines 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)