CModel.SetModel: Difference between revisions
Jump to navigation
Jump to search
Chris Kahn (talk | contribs) No edit summary |
Kate Racaza (talk | contribs) mNo edit summary |
||
(17 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
{{DISPLAYTITLE:cModel.SetModel}} | {{DISPLAYTITLE:cModel.SetModel}}{{Template:API}}{{Template:APIBreadcrumb|.[[CModel Class|cModel]]}} | ||
{{Template: | |||
<onlyinclude>Sets the model type, category, name and parameters of an associated cModel object.</onlyinclude> | |||
== Syntax == | |||
'''.SetModel'''(''ModelType'', ''ModelCategory'', ''ModelName'', {{APIPrefix|ByRef}} ''ModelParams()'') | |||
== | ===Parameters=== | ||
''ModelType'' | |||
:Required. The model type (e.g., 2-parameter Weibull). Can be any [[ModelTypeEnum Enumeration|ModelTypeEnum]] constant. | |||
{{APIComment| | ''ModelCategory'' | ||
:Required. The model category (e.g., reliability model). Can be any [[ModelCategoryEnum Enumeration|ModelCategoryEnum]] constant. | |||
''ModelName'' | |||
:Required. String. The model name. | |||
''ModelParams()'' | |||
:Required. Double. An array of the model's parameters. | |||
== Example == | |||
'''VBA''' | |||
{{APIComment|...}} | |||
{{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.}} | |||
MyRepository.Project.SetCurrentProject(1) | |||
{{APIPrefix|Call}} MyRepository.Model.AddModel(newModel) | |||
{{APIComment|'To replace an existing model, first get the model to be replaced.}} | |||
{{APIComment|'The following example assumes that model with ID#47 exists in the repository.}} | |||
{{APIPrefix|Dim}} AModel {{APIPrefix|As New}} cModel | |||
{{APIPrefix|Set}} AModel = MyRepository.Model.GetModel(47) | |||
{{APIComment|'Apply the definitions to the model.}} | |||
{{APIPrefix|Call}} AModel.SetModel(ModelType, ModelCategory, ModelName, ModelParams) | |||
{{APIComment|'Replace the model.}} | |||
{{APIPrefix|Call}} MyRepository.Model.UpdateModel(AModel) | |||
'''VB.NET''' | |||
{{APIComment|...}} | |||
{{APIComment|'Create a new model. The following code creates a 2-parameter Weibull reliability model,}} | |||
{{APIComment|'with beta 1 and eta 100. The model name is "MyNewModel."}} | |||
{{APIPrefix|Dim}} ModelParams(1) {{APIPrefix|As Double}} | |||
ModelParams(0) = 1 | |||
ModelParams(1) = 100 | |||
{{APIPrefix|Dim}} newModel {{APIPrefix|As New}} cModel(ModelTypeEnum.Weibull2,ModelCategoryEnum.Reliability, {{APIString|"MyNewModel"}}, ModelParams) | |||
{{APIComment|'Add the new model to project #1.}} | |||
MyRepository.Project.SetCurrentProject(1) | |||
MyRepository.Model.AddModel(newModel) | |||
{{APIComment|'To replace an existing model, first get the model to be replaced.}} | |||
{{APIComment|'The following example assumes that model with ID#47 exists in the repository.}} | |||
{{APIPrefix|Dim}} AModel {{APIPrefix|As New}} cModel | |||
AModel = MyRepository.Model.GetModel(47) | |||
{{APIComment|'Apply the definitions to the model.}} | |||
AModel.SetModel(ModelTypeEnum.Weibull2,ModelCategoryEnum.Reliability, {{APIString|"UpdatedModel"}}, ModelParams) | |||
{{APIComment|'Replace the model.}} | |||
MyRepository.Model.UpdateModel(AModel) |
Latest revision as of 15:39, 28 April 2016
Member of: SynthesisAPI.cModel
Sets the model type, category, name and parameters of an associated cModel object.
Syntax
.SetModel(ModelType, ModelCategory, ModelName, ByRef ModelParams())
Parameters
ModelType
- Required. The model type (e.g., 2-parameter Weibull). Can be any ModelTypeEnum constant.
ModelCategory
- Required. The model category (e.g., reliability model). Can be any ModelCategoryEnum constant.
ModelName
- Required. String. The model name.
ModelParams()
- Required. Double. An array of the model's parameters.
Example
VBA ... '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. MyRepository.Project.SetCurrentProject(1) Call MyRepository.Model.AddModel(newModel) 'To replace an existing model, first get the model to be replaced. 'The following example assumes that model with ID#47 exists in the repository. Dim AModel As New cModel Set AModel = MyRepository.Model.GetModel(47) 'Apply the definitions to the model. Call AModel.SetModel(ModelType, ModelCategory, ModelName, ModelParams) 'Replace the model. Call MyRepository.Model.UpdateModel(AModel)
VB.NET ... 'Create a new model. The following code creates a 2-parameter Weibull reliability model, 'with beta 1 and eta 100. The model name is "MyNewModel." Dim ModelParams(1) As Double ModelParams(0) = 1 ModelParams(1) = 100 Dim newModel As New cModel(ModelTypeEnum.Weibull2,ModelCategoryEnum.Reliability, "MyNewModel", ModelParams) 'Add the new model to project #1. MyRepository.Project.SetCurrentProject(1) MyRepository.Model.AddModel(newModel) 'To replace an existing model, first get the model to be replaced. 'The following example assumes that model with ID#47 exists in the repository. Dim AModel As New cModel AModel = MyRepository.Model.GetModel(47) 'Apply the definitions to the model. AModel.SetModel(ModelTypeEnum.Weibull2,ModelCategoryEnum.Reliability, "UpdatedModel", ModelParams) 'Replace the model. MyRepository.Model.UpdateModel(AModel)