Variable

From ASCEND
Jump to: navigation, search

In ASCEND, variables (which we also call atoms) must be declared before they can be used. Variables are declared using the IS_A statement:

x IS_A solver_var;
L IS_A distance;
h IS_A specific_enthalpy;

m1, m2, m3 IS_A mass;

Variables in ASCEND can be

  • real-valued solver variables, the most common kind (solver_var)
  • boolean variables (TRUE or FALSE)
  • symbol variables
  • integer variables

Although ASCEND can handle all of these types of variables, in practise most solvers only provide support for solving systems of real-valued variables. We have CMSlv which provides support for conditional modelling, allowing some degree of mixed integer/boolean/symbol and real-valued equation systems.

Variables can be assigned values in the METHODs section of a MODEL:

METHOD values;
   x := 10;
   L := 5.6 {m};

   h := 2700 {kJ/kg};
END values;

Variables can have properties, including upper and lower bounds and nominal and default values. These can be accessed in the METHODS section of the model, but can not be used in the equations themselves. Variable properties are considered to be 'metadata'.

METHOD values;
   x.lower_bound := 1;
   x.upper_bound := 100;

END values;

See Types for the full taxonomy of object types that are available in ASCEND, including relations, sets, arrays, MODELs.

See also WILL_BE, equation, Constant, arrays.