Creating and Using User-Defined System Constants

Note

Keep in mind the rules for the creation of subkinds of system constants.

A subkind of system constants is defined via a set of four options declared in an *.ascd.xml file; that file must be placed in the Tools\System Constant subdirectory of your ASCET installation. A template *.ascd.xml.template is provided in Tools\System Constant.

  1. Close ASCET.
  2. In the Tools\System Constant directory of your ASCET installation, create a copy of the template file *.ascd.xml.template.
  3. Give the copy a unique name and the extension ascd.xml (e.g., mySystemConstant.ascd.xml).

    The extension is mandatory for system constant definition files.

    Each subkind of system constants needs its own *.ascd.xml file. If you need another subkind of system constants, you have to create another *.ascd.xml file.

    An example file is given in Example: User-Defined System Constants File.

  4. Enter a unique identifier and a unique label for your subkind of system constants.
  5. Proceed as follows to set up your subkind of system constants:

    • Enter path and name of the image file to be used as overlay for this subkind in the <DefaultValue>... line of the Icon file option.

      Note

      The image file must be an *.ico file with a 1-bit alpha channel.

    • Enter the desired resolution time (the Closedfollowing values are available) in the <DefaultValue>... line of the Resolve System Constant option.

      Default

      System constants of this subkind use the resolution time selected in the target options of the current target.

      Generation Time

      System constants of this subkind behave like literals, i.e. they can be used by the code generation for optimization.

      Compile Time

      System constants of this subkind are generated as C code macros (via #define statements) and can be used by the compiler for optimizations.

      RTE Generation Time

      For AUTOSAR projects, system constants of this subkind are generated through the AUTOSAR RTE with binding time RTE GenerationTime.

      For non-AUTOSAR projects, the behavior is the same as for Compile Time.

      RTE PreCompile Time

      For AUTOSAR projects, system constants of this subkind are generated through the AUTOSAR RTE with binding time RTE PreCompileTime.

      For non-AUTOSAR projects, the behavior is the same as for Compile Time.

      Compile Time (No RTE)

      System constants of this subkind are generated as C code macros (via #define statements) and can be used by the compiler for optimizations.

      System constants are never generated through the RTE.

      Run Time

      System constants of this subkind behave like parameters. In an experiment, you can calibrate the system constant.

      Note

      If Run Time is selected for an ASCET‑SE target, a warning WMdl28 is issued during code generation. By default, this warning is promoted to an error.

    • Enter the desired optimization level (the Closedfollowing values are available) for this subkind in the <DefaultValue>... line of the Optimization Level option.

      Default

      Depending on the resolution time, this resolves as follows:

      Resolve System Constants

      Optimization Level

      Generation Time

      Constant Folding

      Compile Time

      Case Distinction

      Run Time

      None

      Constant Folding

      The initial value of the system constant is used directly in the generated code and constant folded with other constants, if possible.

      Note

      Only available if the resolution time is set to Generation Time".

      Case Distinction

      Conditions with such system constants are used to create a case distinction (regular if or #if, depending on the resolution time), and the branches are optimized for these cases.

      None

      System constants of this subkind behave like parameters. In an experiment, you can calibrate the system constant.

    • If you want to use an external package with system constant definitions, activate Autosar: Use external package with system constant definitions and use External Package Name and External Value Set Package Name to specif the external packages.

Your subkind of system constants is now available in ASCET. It can be Closedconfigured in the ASCET options window, Modeling\User-defined System Constants\<subkind> node, and Closedselected in the Kind combo box of an element's properties editor.

Note

If you change the configuration of a subkind of system constants, you have to re-start ASCET for the changes to become effective.

See also

Example: User-Defined System Constants File

User-Defined System Constants

Constants and System Constants

Setting ASCET Options

Properties Editor