Jump to: navigation, search

The ALIASES statement is used to create a local alias of another variable elsewhere in an ASCEND model. You might for example have a complicated object-oriented model containing some important variables nested in a sub-MODEL. Using an ALIASES statement you can pull out that nested variable and make it more visible by being available in your top-level model.

pipe IS_A pipe_model;
D ALIASES pipe.diameter;

r IS_A distance;
r = D/2.;

The ALIASES statement differs from the ARE_THE_SAME statement in that the equivalence between the two variables is established at the same time as the new variable is named, which makes things simpler from the point of view of building up the model's Instance hierarchy.


ALIASES with arrays

The following information comes from the ASCEND Manual (see Category:Documentation)

More complex ALIASES statements are possible. We can take a set of symbol_constant or integer_constant and pair it with a list of instances to create an array. For the moment, the syntax and semantics is as follows:

alias_array_instance[aset] ALIASES (list_of_instances) WHERE aset IS_A set OF settype;


alias_array_instance[aset] ALIASES (list_of_instances) WHERE aset IS_A set OF settype WITH_VALUE (value_list_matching_settype);

aset is the name of the set that will be created by the IS_A to index the array of aliases. If value_list_matching_set_type is not given, the compiler will make one up out of the integers (1..number of names in list_of_instances) or symbols derived from the individual names given. If the value list is given, it must have the same number of elements as the list of instances does. The value list elements must be unique because they form a set. The list of instances can contain duplicates. If any of these conditions are not met properly, the statement is in error.

ALIASES/IS_A can be used inside a FOR statement. When this occurs, the definition of aset must be indexed and it must be the last subscript of alias_array_instance. The statement must look like:

alias_array_instance[FOR_index][aset[FOR_index]] ALIASES (list_of_instances) WHERE aset[FOR_index] IS_A set OF settype WITH_VALUE value_list_matching_settype);

Here, as with the unindexed version, the WITH_VALUE portion is optional.

If this explanation is unclear, just try it out. The compiler error messages for ALIASES/IS_A are particularly good because we know it is a bit tricky to explain.

These tricks with ALIASES can be especially useful when Plotting in ASCEND.