CModel.SetModel: Difference between revisions

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


== Example ==
== Example ==
This example assumes that a model with ID#1 exists in a repository.
  '''VBA'''
  '''VBA'''
   
   
  {{APIComment|'Add code to connect to a Synthesis repository.}}
  {{APIComment|...}}
  {{APIPrefix|Dim}} MyRepository {{APIPrefix|As New}} Repository
  {{APIComment|...}}
   
   
  {{APIComment|'Add code to create a new model or get an existing model.}}
  {{APIComment|'Get model #1 from project# 1.}}
   {{APIPrefix|Dim}} AModel {{APIPrefix|As New}} cModel
   {{APIPrefix|Dim}} AModel {{APIPrefix|As New}} cModel
  MyRepository.Project.SetCurrentProject(1)
{{APIComment|...}}
  {{APIPrefix|Set}} AModel = MyRepository.Model.GetModel(1)
   
   
  {{APIComment|'Change the model's properties.}}
  {{APIComment|'Define or change the model's properties.}}
   {{APIPrefix|Dim}} params(1) {{APIPrefix|As Double}}
   {{APIPrefix|Dim}} params(1) {{APIPrefix|As Double}}
   params(0) = 5
   params(0) = 5
Line 43: Line 38:
  '''VB.NET'''
  '''VB.NET'''
   
   
  {{APIComment|'Add code to connect to a Synthesis repository.}}
  {{APIComment|...}}
  {{APIPrefix|Dim}} MyRepository {{APIPrefix|As New}} Repository
  {{APIComment|...}}
   
   
  {{APIComment|'Get model #1 from project# 1.}}
  {{APIComment|'Add code to create a new model or get an existing model.}}
   {{APIPrefix|Dim}} AModel {{APIPrefix|As New}} cModel
   {{APIPrefix|Dim}} AModel {{APIPrefix|As New}} cModel
  MyRepository.Project.SetCurrentProject(1)
{{APIComment|...}}
  AModel = MyRepository.Model.GetModel(1)
   
   
  {{APIComment|'Change the model's properties.}}
  {{APIComment|'Define or change the model's properties.}}
   {{APIPrefix|Dim}} params(1) {{APIPrefix|As Double}}
   {{APIPrefix|Dim}} params(1) {{APIPrefix|As Double}}
   params(0) = 5
   params(0) = 5
   params(1) = 1
   params(1) = 1
   AModel.SetModel(ModelTypeEnum.Lognormal, ModelCategoryEnum.Reliability, {{APIString|"Model1"}}, params)
   AModel.SetModel(ModelTypeEnum.Lognormal, ModelCategoryEnum.Reliability, {{APIString|"Model1"}}, params)

Revision as of 18:29, 28 July 2015

APIWiki.png


Member of: SynthesisAPI9.cModel


Sets the model type, 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

VBA

 ... 

 'Add code to create a new model or get an existing model. 
 Dim AModel As New cModel
 ... 

 'Define or 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 create a new model or get an existing model. 
 Dim AModel As New cModel
 ... 

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