Variable
A variable expression.
Example
application = cf.Application.GetInstance() project = application:NewProject() -- Create two variables, "freq" and "lambda" freqVar = project.Definitions.Variables:Add("freq", 46e6, "The operating frequency") lambdaVar = project.Definitions.Variables:Add("lambda", "c0/freq") print("Name: "..tostring(lambdaVar)) print("Expression: "..lambdaVar.Expression) print("Value: "..lambdaVar.EvaluatedValue) -- Use the predefined variable 'c0' to calculate a local lambda value c0 = project.Definitions.Variables["c0"] lambda = c0.EvaluatedValue/46e6 print("Lambda: "..lambda)
Inheritance
Usage locations
The Variable object can be accessed from the following locations:
- Properties
- OptimisationConstraint object has property LeftVariable.
- OptimisationConstraint object has property RightVariable.
- OptimisationVariable object has property Variable.
- Methods
- VariableCollection collection has method Add(table).
- VariableCollection collection has method Add(string, Expression).
- VariableCollection collection has method Add(string, Expression, string).
- VariableCollection collection has method Add(string, Variable).
- VariableCollection collection has method Item(number).
- VariableCollection collection has method Item(string).
Property List
- Description
- The variable description. (Read/Write string)
- EvaluatedValue
- The evaluated variable value. (Read only number)
- Expression
- The variable expression. (Read/Write ParametricExpression)
- Label
- The object label. (Read/Write string)
- LimitEnabled
- Enables/disables variable limits. The variable can take on a value in the range defined by the maximum and minimum bounds. (Read/Write boolean)
- Maximum
- Maximum value of variable. Only valid if variable is limited. (Read/Write ParametricExpression)
- Minimum
- Minimum value of variable. Only valid if variable is limited. (Read/Write ParametricExpression)
- Type
- The object type string. (Read only string)
Method List
- Delete ()
- Deletes the entity.
- Duplicate ()
- Duplicates the entity. (Returns a Object object.)
- GetProperties ()
- Returns a table of properties representing the state of the object. The properties table can be used with the SetProperties method to change multiple properties of the object in one step. (Returns a table object.)
- SetProperties (properties Object)
- Modifies the state of the object using the provided table of properties. This method is used to modify multiple properties of the object in a single step.
Static Function List
- GetDefaultProperties ()
- Creates a table containing the default settings to create an object. (Returns a table object.)
Property Details
- Description
- The variable description.
- Type
- string
- Access
- Read/Write
- EvaluatedValue
- The evaluated variable value.
- Type
- number
- Access
- Read only
- Expression
- The variable expression.
- Type
- ParametricExpression
- Access
- Read/Write
- Label
- The object label.
- Type
- string
- Access
- Read/Write
- LimitEnabled
- Enables/disables variable limits. The variable can take on a value in the range defined by the maximum and minimum bounds.
- Type
- boolean
- Access
- Read/Write
- Maximum
- Maximum value of variable. Only valid if variable is limited.
- Type
- ParametricExpression
- Access
- Read/Write
- Minimum
- Minimum value of variable. Only valid if variable is limited.
- Type
- ParametricExpression
- Access
- Read/Write
- Type
- The object type string.
- Type
- string
- Access
- Read only
Method Details
- Delete ()
- Deletes the entity.
- Duplicate ()
- Duplicates the entity.
- Return
- Object
- The new (duplicated) entity.
- GetProperties ()
- Returns a table of properties representing the state of the object. The properties table can be used with the SetProperties method to change multiple properties of the object in one step.
- Return
- table
- A table defining the properties.
- SetProperties (properties Object)
- Modifies the state of the object using the provided table of properties. This method is used to modify multiple properties of the object in a single step.
- Input Parameters
- properties(Object)
- A table of properties defining the new state of the object.
Static Function Details
- GetDefaultProperties ()
- Creates a table containing the default settings to create an object.
- Return
- table
- A table containing the default properties.