Difference between revisions of "CModel Constructors"

From ReliaWiki
Jump to navigation Jump to search
 
(20 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{Template:APIClass|cModel_Class|cModel}}{{DISPLAYTITLE:cModel Constructors}}
+
{{DISPLAYTITLE:cModel Constructors}}{{Template:API}}{{Template:APIBreadcrumb|.[[CModel_Class|cModel]]}}
Constructors for the [[cModel_Class|cModel]] class.
+
 
 +
 
 +
<onlyinclude>A parameterized constructor for the [[CModel Class|cModel]] class. (.NET only)</onlyinclude>
  
 
== Syntax ==
 
== Syntax ==
*cModel()                                                {{APIComment|{{Template:cModel_Constructors1.Cmt}}}}
+
'''cModel'''(''ModelType'', ''ModelCategory'', ''ModelName'', {{APIPrefix|ParamArray}} ''ModelParams()'')
*cModel( ModelType{{APIPrefix|As ModelTypeEnum}}, ModelCategory {{APIPrefix|As ModelCategoryEnum}}, ModelName {{APIPrefix|As String}},{{APIPrefix|ParamArray}} ModelParams(){{APIPrefix|As Double}})                   {{APIComment|{{Template:cModel_Constructors2.Cmt}}}}
+
 
 +
===Parameters===
 +
''ModelType''
 +
:Required. The type of model (e.g., 2-parameter Weibull). Can be any of the model types listed in the table below. The model types are part of the [[ModelTypeEnum Enumeration|ModelTypeEnum]].
 +
''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. The table below shows the order of the parameters in the array, for each type of model.
 +
 
  
Parameters
+
{|border="1" cellpadding="5" cellspacing="0" style="border-collapse: collapse; text-align: left; cellborder"
:''ModelType'': The type of model (e.g., 2-parameter Weibull), specified with a [[ModelTypeEnum Enumeration|ModelTypeEnum]] value. Not that some models cannot be created through the API (i.e., some can be created only within the user interface of a Synthesis application).
+
|- style="background:#F2F2F2;"
:''ModelCategory'': The model category (e.g., reliability model), specified with a [[ModelCategoryEnum Enumeration|ModelCategoryEnum]] value.
+
!<span style="color:#585858;">Model Type</span>
:''ModelName'': The model name.
+
!<span style="color:#585858;">Enum Value</span>
:''ModelParams()'': An array of parameter values. <!--Need to create/link page explaining how the values should be ordered, depending on distribution.-->
+
!<span style="color:#585858;">Order of Parameters</span>
 +
|-
 +
|Weibull1<br>Weibull2<br>Weibull3||100<br>101<br>102||style="width: 550px;"|Beta, Eta, Gamma
 +
|-
 +
|style="width: 130px;"|MixedWeibull2<br>MixedWeibull3<br>MixedWeibull4||style="width: 90px;"|103<br>104<br>105||Subpop1-Beta, Subpop1-Eta, Subpop1-Portion, Subpop2-Beta, Subpop2-Eta, Subpop2-Portion, Subpop3-Beta, Subpop3-Eta, Subpop3-Portion, Subpop4-Beta, Subpop4-Eta, Subpop4-Portion
 +
|-
 +
|Exponential1<Br>Exponential2||106<br>107||Lambda, Gamma
 +
|-
 +
|Normal||108||Mean, Std
 +
|-
 +
|Lognormal||109||LogMean, LogStd
 +
|-
 +
|GenGamma||110||Mu, K
 +
|-
 +
|Gamma||111||Mu, K
 +
|-
 +
|Logistic||112||Mu, Sigma
 +
|-
 +
|LogLogistic||113||Mu, Sigma
 +
|-
 +
|Gumbel||114||Mu, Sigma
 +
|-
 +
|FixedUnreliability||0||rowspan="3"|If creating a constant model, enter a value for Parameter 1, the set Parameter 2 to zero (0) or nothing. <br>If creating a dynamic model, enter the numeric ID of the variable resource for Parameter 2, then set Parameter 1 to zero (0) or nothing. If the variable does not exist, it creates a dynamic model with no predefined variable.
 +
|-
 +
|FixedDuration||1
 +
|-
 +
|FixedCost||2
 +
|}
  
== Usage Example ==
 
{{APIComment|Declare the cModel class using a pre-defined parameter list.}}
 
        Dim newParams(1) As Double
 
        newParams(0) = 1
 
        newParams(1) = 100
 
        Dim newModel As New cModel(ModelTypeEnum.Weibull2, ModelCategoryEnum.Reliability, "NewModel1", newParams)
 
  
{{APIComment|Alternatively, declare the cModel class using an in-line parameter list.}}
+
== Example ==
        Dim newModel As New cModel(ModelTypeEnum.Weibull2, ModelCategoryEnum.Reliability, "NewModel1", 1, 100)
+
'''VB.NET'''
 +
 +
{{APIComment|'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|'Alternatively, you can create a new model using an in-line parameter list.}}
 +
  {{APIPrefix|Dim}} newModel {{APIPrefix|As New}} cModel(ModelTypeEnum.Weibull2, ModelCategoryEnum.Reliability, {{APIString|"MyNewModel"}}, 1, 100)

Latest revision as of 15:14, 3 August 2017

APIWiki.png


Member of: SynthesisAPI.cModel


A parameterized constructor for the cModel class. (.NET only)

Syntax

cModel(ModelType, ModelCategory, ModelName, ParamArray ModelParams())

Parameters

ModelType

Required. The type of model (e.g., 2-parameter Weibull). Can be any of the model types listed in the table below. The model types are part of the ModelTypeEnum.

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. The table below shows the order of the parameters in the array, for each type of model.


Model Type Enum Value Order of Parameters
Weibull1
Weibull2
Weibull3
100
101
102
Beta, Eta, Gamma
MixedWeibull2
MixedWeibull3
MixedWeibull4
103
104
105
Subpop1-Beta, Subpop1-Eta, Subpop1-Portion, Subpop2-Beta, Subpop2-Eta, Subpop2-Portion, Subpop3-Beta, Subpop3-Eta, Subpop3-Portion, Subpop4-Beta, Subpop4-Eta, Subpop4-Portion
Exponential1
Exponential2
106
107
Lambda, Gamma
Normal 108 Mean, Std
Lognormal 109 LogMean, LogStd
GenGamma 110 Mu, K
Gamma 111 Mu, K
Logistic 112 Mu, Sigma
LogLogistic 113 Mu, Sigma
Gumbel 114 Mu, Sigma
FixedUnreliability 0 If creating a constant model, enter a value for Parameter 1, the set Parameter 2 to zero (0) or nothing.
If creating a dynamic model, enter the numeric ID of the variable resource for Parameter 2, then set Parameter 1 to zero (0) or nothing. If the variable does not exist, it creates a dynamic model with no predefined variable.
FixedDuration 1
FixedCost 2


Example

VB.NET

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

 'Alternatively, you can create a new model using an in-line parameter list. 
 Dim newModel As New cModel(ModelTypeEnum.Weibull2, ModelCategoryEnum.Reliability, "MyNewModel", 1, 100)