Constants and System Constants
Constants store values that can only be read from inside the model. In contrast to parameters, constants cannot be changed from outside the model but are fixed at specification time. Constants cannot be implemented, either.
Constants are created as a define statement in the generated C code. However, they are not necessarily explicitly visible in the generated code. If, e.g., the constant is set against a requantization, the constant does not explicitly appear.
System constants are used like constants, and also created as define statements. Unlike constants, system constants can be implemented. They are always explicitly visible in the generated code. You can use the Resolve System Constants option in the ASCET options window, "Targets\<target>\Build" node, to determine when system constants are resolved. The following selections are available for each target:
Generation Time | The system constant behaves like a literal, i.e. they can be used by the code generation for optimization. | ||
Compile Time | The system constants are generated as C code macros (via #define statements) and can be used by the compiler for optimizations. For each system constant, a condition definition with the current initial value <i> of the system constant is generated in the header file of the component: #ifndef <system constant> #define <system constant> (<i>) #endif | ||
Run Time | The system constants behaves like a parameter, i.e. there is a memory address where the value of the system constant can be read from during run time. In an experiment, you can calibrate the system constant.
|
If desired, you can define sub-kinds of system constants, each with its own resolution time configuration. This is done via an XML file stored in the <ASCET_installation_dir>\Tools\System Constant directory; for ASCET to recognize it, it must have the extension *.ascd.xml. See User-Defined System Constants and Creating and Using User-Defined System Constants for further information.
In the Component manager, all system constants in a database/workspace can be converted into normal constants: open the Tools menu, point to Database or Workspace, then point to Convert and select System Constants to Constants.
See also