 | IVariablesAdd Method |
Adds new variable to the project. Once the variable is added, Expression is evaluated to calculate
variable
DoubleValue. If equation is specified as the Expression, variables
used in the equation must be already present in the project. Mathematical function, e.g. sin(), exp() etc.,
can also be used in Expression.
Namespace:
EMInvent.InventSim.COMServer
Assembly:
InventSim (in InventSim.exe) Version: 5.1.12.6+develop
SyntaxIVariable Add(
string name,
string expression,
bool isOptimizable,
double min,
double max
)
Function Add (
name As String,
expression As String,
isOptimizable As Boolean,
min As Double,
max As Double
) As IVariable
Dim instance As IVariables
Dim name As String
Dim expression As String
Dim isOptimizable As Boolean
Dim min As Double
Dim max As Double
Dim returnValue As IVariable
returnValue = instance.Add(name, expression,
isOptimizable, min, max)
Parameters
- name
- Type: SystemString
Variable name. - expression
- Type: SystemString
Expression to be evaluated. - isOptimizable
- Type: SystemBoolean
Flag indicating the the variable should be used in optimization. - min
- Type: SystemDouble
Minimum value of optimizable variable. - max
- Type: SystemDouble
Maximum value of optimizable variable.
Return Value
Type:
IVariableReference to newly created variable.
Examples
To add two variables "a" and "b", where second is sinus function of the first:
IVariable a = app.ActiveProject.Variables.Add("a", "4.34", false, 0, 0);
IVariable b = app.ActiveProject.Variables.Add("b", "sin(a)", false, 0, 0);
See Also