Variable#

class ansys.aedt.core.application.variables.Variable(expression: float | str, units: str | None = None, si_value: float | None = None, full_variables: dict | None = None, name: str | None = None, app=None, readonly: bool | None = False, hidden: bool | None = False, sweep: bool | None = True, description: str | None = None, postprocessing: bool | None = False, circuit_parameter: bool | None = True)#

Stores design properties and project variables and provides operations to perform on them.

Parameters:
expressionfloat or str

Variable expression.

unitsstr, optional

Unit string to enforce. If provided, must be consistent with parsed units.

si_valuefloat, optional

Value in SI units. If provided, it overrides the parsed/calculated value.

full_variablesdict, optional

Map of known variables for expression decomposition.

namestr, optional

Variable name in AEDT.

appobject, optional

AEDT application of type ansys.aedt.core.application.

readonlybool, optional

Flag controlling read only property. The default is False.

hiddenbool, optional

Flags controlling hidden property. The default is False.

sweepbool, optional

Flags controlling sweep property. The default is True.

postprocessingbool, optional

Flags controlling postprocessing property.

circuit_parameterbool, optional

Define Parameter Default variable in Circuit design.

Examples

>>> from ansys.aedt.core.application.variables import Variable

Define a variable using a string value consistent with the AEDT properties.

>>> v = Variable("45mm")

Define an unitless variable with a value of 3.0.

>>> v = Variable(3.0)

Define a variable defined by a numeric result and a unit string.

>>> v = Variable(3.0 * 4.5, units="mm")
>>> assert v.numeric_value = 13.5
>>> assert v.units = "mm"

Methods

Variable.decompose()

Decompose the evaluated expression into a floating-point number and units.

Variable.format(fmt)

Return the string value using the specified numeric format ('06.2f').

Variable.rescale_to(units)

Rescale the expression to the provided units within the same unit system.

Variable.update_var()

Push the current variable state to AEDT via variable manager.

Attributes

Variable.description

Current description.

Variable.evaluated_value

Concatenated numeric value and unit string.

Variable.expression

Raw AEDT expression.

Variable.has_definition_parameters

Whether the design type has DefinitionParameters or only LocalVariables.

Variable.hidden

Current hidden flag.

Variable.is_circuit_parameter

Whether this variable is a circuit parameter (for supported design types).

Variable.is_optimization_enabled

Whether optimization is enabled for this variable.

Variable.is_sensitivity_enabled

Whether sensitivity analysis is enabled.

Variable.is_statistical_enabled

Whether statistical analysis is enabled.

Variable.is_tuning_enabled

Whether tuning is enabled.

Variable.name

Variable name.

Variable.numeric_value

Numeric value of the expression in current units.

Variable.optimization_max_value

Optimization upper bound.

Variable.optimization_min_value

Optimization lower bound.

Variable.post_processing

Whether this variable is a post-processing variable.

Variable.public_dir

Shortcut for dir(self).

Variable.read_only

Current read-only flag.

Variable.sensitivity_initial_disp

Sensitivity initial displacement (if applicable).

Variable.sensitivity_max_value

Sensitivity upper bound.

Variable.sensitivity_min_value

Sensitivity lower bound.

Variable.si_value

Current value in SI units (float).

Variable.sweep

Current sweep flag.

Variable.tuning_max_value

Tuning upper bound.

Variable.tuning_min_value

Tuning lower bound.

Variable.tuning_step_value

Tuning step value.

Variable.unit_system

Unit system name.

Variable.units

Unit string associated with the expression.