Repository.Model.AddModel: Difference between revisions

From ReliaWiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
{{Template:APIBreadcrumb|10|Repository}}
{{Template:APIBreadcrumb|10|Repository}}
{{Template:API}}
{{Template:API}}
Creates a new model and saves it in the current project. Returns a '''Boolean''' value; when true, indicates that the model was successfully created and saved in the project.  
Saves a '''[[CModel Class|cModel]]''' object in the current project. Returns a '''Boolean''' value; when true, indicates that the model was successfully saved in the project.  


== Syntax ==
== Syntax ==
Line 17: Line 17:
== Example ==
== Example ==
This example creates a new model in the first available project in a Synthesis repository.
This example creates a new model in the first available project in a Synthesis repository.
'''VBA'''
  {{APIPrefix|Dim}} MyRepository {{APIPrefix|As New}} Repository
{{APIComment|...'Add code to connect to a Synthesis repository.}} 
{{APIComment|'Create a new model. The following example creates a 2-parameter Weibull reliability model,}}
{{APIComment|'with beta 1 and eta 100. The model name is "MyNewModel".}}
  {{APIPrefix|Dim}} ModelType {{APIPrefix|As}} ModelTypeEnum
  {{APIPrefix|Dim}} ModelCategory {{APIPrefix|As}} ModelCategoryEnum
  {{APIPrefix|Dim}} ModelName {{APIPrefix|As String}}
  {{APIPrefix|Dim}} ModelParams(2) {{APIPrefix|As Double}}
 
  ModelType = ModelTypeEnum_Weibull2
  ModelCategory = ModelCategoryEnum_Reliability
  ModelName = {{APIString|"MyNewModel"}}
  ModelParams(0) = 1
  ModelParams(1) = 100
  {{APIPrefix|Dim}} newModel {{APIPrefix|As New}} cModel
  {{APIPrefix|Call}} newModel.SetModel(ModelType, ModelCategory, ModelName, ModelParams)
{{APIComment|'Add the new model to project #1. The model will be visible in the Synthesis repository upon refresh.}}
  MyRepository.Project.SetCurrentProject(1) 
  {{APIPrefix|Call}} MyRepository.Model.AddModel(newModel)
  '''VB.NET'''
  '''VB.NET'''
   
   
Line 22: Line 46:
  {{APIComment|...'Add code to connect to a Synthesis repository.}}   
  {{APIComment|...'Add code to connect to a Synthesis repository.}}   
   
   
  {{APIComment|'Declare a new model.}}
  {{APIComment|'Create a new model. The following example creates a 2-parameter Weibull reliability model,}}
{{APIComment|'with beta 1 and eta 100. The model name is "MyNewModel".}}
   {{APIPrefix|Dim}} newModel {{APIPrefix|As New}} cModel(ModelTypeEnum.Weibull2, ModelCategoryEnum.Reliability, {{APIString|"MyNewModel"}}, 1, 100)
   {{APIPrefix|Dim}} newModel {{APIPrefix|As New}} cModel(ModelTypeEnum.Weibull2, ModelCategoryEnum.Reliability, {{APIString|"MyNewModel"}}, 1, 100)
   
   
  {{APIComment|'Add the model to project #1. The model will be available in the Synthesis repository upon refresh.}}
  {{APIComment|'Add the new model to project #1. The model will be visible in the Synthesis repository upon refresh.}}
  MyRepository.Project.SetCurrentProject(1)   
  MyRepository.Project.SetCurrentProject(1)   
  MyRepository.Model.AddModel(newModel)
  MyRepository.Model.AddModel(newModel)

Revision as of 19:06, 14 July 2015

Member of: SynthesisAPI10Repository

APIWiki.png


Saves a cModel object in the current project. Returns a Boolean value; when true, indicates that the model was successfully saved in the project.

Syntax

object.Model.AddModel(m)

where object is a variable that represents a Repository object.

Parameters

Name Description
mborder="0" cellpadding="5" cellspacing="0" style="border-collapse: collapse; text-align: left; cellborder"
Name Status The cModel object to be added.


Example

This example creates a new model in the first available project in a Synthesis repository.

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

 'Create a new model. The following example creates a 2-parameter Weibull reliability model, 
 'with beta 1 and eta 100. The model name is "MyNewModel". 
 Dim ModelType As ModelTypeEnum
 Dim ModelCategory As ModelCategoryEnum
 Dim ModelName As String
 Dim ModelParams(2) As Double
 
 ModelType = ModelTypeEnum_Weibull2
 ModelCategory = ModelCategoryEnum_Reliability
 ModelName = "MyNewModel"
 ModelParams(0) = 1
 ModelParams(1) = 100

 Dim newModel As New cModel
 Call newModel.SetModel(ModelType, ModelCategory, ModelName, ModelParams)

 'Add the new model to project #1. The model will be visible in the Synthesis repository upon refresh. 
 MyRepository.Project.SetCurrentProject(1)   
 Call MyRepository.Model.AddModel(newModel)
VB.NET

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

 'Create a new model. The following example creates a 2-parameter Weibull reliability model, 
 'with beta 1 and eta 100. The model name is "MyNewModel". 
 Dim newModel As New cModel(ModelTypeEnum.Weibull2, ModelCategoryEnum.Reliability, "MyNewModel", 1, 100)

 'Add the new model to project #1. The model will be visible in the Synthesis repository upon refresh. 
 MyRepository.Project.SetCurrentProject(1)   
 MyRepository.Model.AddModel(newModel)