14 Templates

Templates simplify the re-use of configuration elements. A template may contain simple defaults, such that all float signals shall be painted red, but they can also contain a rich set of elements containing multiple scripts and folders.

Using templates

Templates can be used in two ways:

  1. Explicitly selecting and adding them using the context menu.
  2. Implicitly letting the system select them, if you drag and drop a signal into the view tree.

Explicitly

All templates with the flag Show in add/insert menu checked are offered in the context menu. If a group is entered, it will appear in '<group> Templates'. If you add or insert a template, the system will just make a 100% copy of the content without changing anything. Any required signals need to be added manually.
Another option is to use the template table in the plot configuration. Select a template and press Take to overwrite all plot settings with the template ones.

Implicitly

All templates with the flag Use pattern for automatic instantiation checked can be used if you are dragging and dropping signals into the view tree. To let the system detect the correct template, you need to define a pattern (see below). If the pattern of a template matches (depending on the order), a copy of the content will be added/inserted at the drop position. Additionally, the following changes are made:

  1. All input signal references are set to the dropped signal.
  2. All empty name fields are set to the dropped signal name.
  3. All empty description fields are set to the dropped signal description.
  4. All macros ${name} in any name field are replaced by the name of the dropped signal.

Defining templates

There are two steps required to add a template. First define the template itself and its pattern. Then add the content that shall be added when using the pattern.

Templates are located at Preferences->Impulse->Templates. After adding a new template you will find these fields:

Name/Description
Just the name and description. It has no further meaning.
Group
Used to organize templates in the context menu.
Use pattern for automatic instantiation
Check this field for implicit usage. This template matches if all pattern below matches (or left empty).
Process Type / Signal Type pattern (implicit usage)
Enter the signal and process type for matching purpose, or Any for all signal/process types.
Name pattern (implicit usage)
This pattern matches a) if the signal name contains the field text (regular unchecked) or b) the regular expression matches the signal name (regular checked). LEave empty to match all signal names.
Description pattern (implicit usage)
This pattern matches a) if the description contains the field text (regular unchecked) or b) the regular expression matches the description (regular checked). Leave empty to match all signals.
Signal descriptor pattern (implicit usage)
This pattern matches a) if the signal discriptor contains the field text (regular unchecked) or b) the regular expression matches the signal discriptor (regular checked). Leave empty to match all signal discriptors. A signal descriptor has the form: type<par=value,par2=value> (e.g. default<bits=16>).
Show in add/insert menu checked
Check this field for explicit usage (will appear in the add/insert context menus).

After defining the pattern, you can add configuration content. You may use the context menu/buttons to add new elements, or you may copy existing elements from your configuration and paste them into the content area.
Another option to create a template is using the template table in the plot configuration. If you have a plot configuration that you would like to add as templates, open the plot dialogue and press the Add button right-hand of the template table. A new template will be create with the current plot configuration as content.

Examples

Default-line diagram settings for float signals

Create a new template, enter the name, select the Float type, check Use pattern for automatic instantiation and check Enable. Add a new samples configuration, enter the dialogue and set the intended settings for float signals.

Default settings for buses

Create a new template, enter the name, select the Logic type, check Use pattern for automatic instantiation and check Enable. The next step depends on how you identify a bus signal. Let's assume that the buses have got a signal descriptor default<bits=32>, so enter this in the field Signal descriptor and un-check Regular. Add a new samples configuration, enter the dialogue and set the intended settings for the bus.

Script template

Create a new template, enter the name and group, select the Signal Type, check Show in add/insert menu and check Enable. Add a new samples configuration, enter the dialogue, change to script production and enter the script code.

toem

technical software and tooling

Company

Contact Us

This email address is being protected from spambots. You need JavaScript enabled to view it.