next up previous contents
Next: 1.2 Overview of SVM Up: 1.1 Overview of DCharts Previous: 1.1.2 Importation   Contents

1.1.3 Macros and Importation Parameters

Macros are a textual feature of the DCharts description format supported by SVM and SCC. They are comparable to macros in programming languages like C. Once defined, the left-hand side of a macro can be used (between square brackets) in the textual description, which is literally substituted by the right-hand side before simulation/execution of the model.

The right-hand sides of some macros may use other macros, provided that the macros that they use are defined before them.

A model may specify parameters for its components by redefining their macros. For example, suppose macro DEST is defined to be StateA in component C. The textual description of C may contain such a segment:

    DEST = StateA

(Note: MACRO is a descriptor here, which starts the macro segment. Under this descriptor, one or more macros can be specified.)

In other parts of the description of C, [DEST] can be used to substitute StateA.

When C is imported into an importation state of model M, the macros defined in C may be redefined. A macro redefinition is written as a property of the importation state. It serves as the parameter given to the submodel at run-time before it is loaded. For example, the following is a part of the textual description of M, which imports C into importation state S and redefines the DEST macro of C to be StateB:

    c_submodel = C.des

    S [c_submodel] [DEST=StateB]

(Note: DCharts model descriptions are usually written in text files ending with postfix .des. IMPORTATION is the descriptor to start an importation definition segment. In this example, submodel C.des is imported and given ID c_submodel. This ID is used in the state hierarchy to refer to the submodel. The same ID may be used for multiple importation states, in which case the same component is imported into different states. S is defined to be an importation state because component ID c_submodel is given to it as a property. The macro redefinition is written as another property between square brackets.)

Macro redefinitions are not supported by SCC but only SVM. This is because SCC statically synthesizes code in a specific programming language for all the models and components. This is no means to dynamically modify their behavior.

next up previous contents
Next: 1.2 Overview of SVM Up: 1.1 Overview of DCharts Previous: 1.1.2 Importation   Contents
Thomas Huining Feng