Variable: Difference between revisions
Restored page from Google Cache, uploaded by John Pye |
No edit summary |
||
| Line 7: | Line 7: | ||
m1, m2, m3 IS_A mass;</source> | m1, m2, m3 IS_A mass;</source> | ||
Variables in ASCEND can be | Variables in ASCEND can be | ||
* real-valued solver variables, the most common kind (<tt>solver_var</tt>) | * real-valued solver variables, the most common kind (<tt>solver_var</tt>) | ||
| Line 17: | Line 16: | ||
Variables can be assigned values in the [[METHOD|METHODs]] section of a [[MODEL]]: | Variables can be assigned values in the [[METHOD|METHODs]] section of a [[MODEL]]: | ||
<source lang="a4c">METHOD values; | <source lang="a4c">METHOD values; | ||
| Line 33: | Line 31: | ||
END values;</source> | END values;</source> | ||
See [[Type]]s for the full taxonomy of object types that are available in ASCEND, including relations, sets, arrays, [[MODEL]]s. | |||
See also [[WILL_BE]], [[equation]], [[Constant]], [[Array|arrays]]. | See also [[WILL_BE]], [[equation]], [[Constant]], [[Array|arrays]]. | ||
[[Category:Documentation]] | [[Category:Documentation]] | ||
Latest revision as of 02:28, 1 June 2010
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.