Skip to content

YAKINDU Model Viewer (will become itemis Model Viewer)

The itemis Model Viewer (formerly known as YAKINDU Model Viewer) is a tool to visualize Matlab Simulink and Matlab Stateflow models. itemis ANALYZE is able to extract blocks, states, and transitions from these models as traceable artifacts. It can also read element (block, state, transition) parameters, including name, path, and type.

The blog post "Traceability for Matlab Simulink and Matlab Stateflow" presents the YAKINDU Model Viewer adapter as our April 2017 „feature of the month”, on the occasion of several improvements we did to the adapter.

Data Access

Configuration

Open the ANALYZE configuration with the ANALYZE configuration editor, and add a new data access as described in section "Data accesses". Select YAKINDU Model Viewer files as data access type.

Supported options:

  • resource – A pattern for a project, folder or file in the workspace. Supported formats are MDL and SLX.
  • undefined attribute value – Optional: Specify the value to use when trying to read the parameter of an element when the parameter doesn’t exist, see "Artifact type".

The configuration may contain several resource definitions.

Example:

resource "*.mdl"
undefined attribute value = "<N/A>"

In the above example, elements from files with names ending on .mdl are taken into account.

Artifact type

Configuration

Open the ANALYZE configuration with the ANALYZE configuration editor, and add a new artifact type as described in section "Artifact types". Select your previously-configured YAKINDU Model Viewer data access in the Data access drop-down list.

Supported options:

  • include blocks – Starts an include blocks expression. An artifact will be created for each block.
  • include states – Starts an include states expression. An artifact will be created for each state.
  • include transitions – Starts an include transitions expression. An artifact will be created for each transition.
  • if – optional expression following an include expression. If no if expression is specified, all elements will be matched. If several conditions are specified in the same expression, an artifact will be created only if the element matches all conditions.
  • valueOf – Retrieves the value of the specified attribute for the current element. The attribute can be the name of any parameter defined in the model for this element. The following attributes are predefined for convenience, but any value can be specified:
    • name – The name of the block, or the label of the state or transition
    • type – The type of the block, empty for states and transitions
    • path – The path of the element. It is unique within a given file resp. model
    • source – For transitions, the name of the source element (state label or junction ID). May be empty.
    • target – For transitions, the name of the target element (state label or junction ID). May be empty.
  • != – „Not equals” operator to use within a condition. The operator will match if the left and right operands have different values.
  • == – „Equals” operator to use within a condition. The operator will match if the left and right operands have the same value.
  • in – „In” operator to use within a condition. The operator will match if the value of the left operand is equal to one of the values in the right operand.
  • contains – „Contains” operator to use within a condition. The operator will match if the value of the right operand is a substring of the value of the left operand.
  • name – Specifies an element name or a generic name of matched artifact.
  • map – Starts a mapping element for an element or a generic mapping for all elements.
  • to – Defines the relation of a custom attribute to the value it is mapped to.

Please note: An empty configuration is valid. In this case, one artifact will be created for each element (block, state, or transition) found in the model. The name of the artifact will correspond to the name of the element. If the element has no name, a default name will be assigned, i.e., Block , State , source -> target, respectively.

Example:

include blocks if(
	valueOf(name) in ("data""speed""Gain")
	valueOf(type) == "Inport"
){
	name "B1_"+valueOf(name)
	map{
		nameB to valueOf(name)
	}
}
include blocks if( valueOf(path) contains "collision_avoidance/collision avoidance/"){
	name "B2_"+valueOf(name)
	map{
		pathB to valueOf(path)
		typeB to valueOf(type)
	}
}
include states {
	name "S_"+valueOf(name)
	map {
		nameS to valueOf(name)
	}
}
include transitions if(valueOf(name)!=""){
	name  "T_"+valueOf(name)
	map{
		nameT to valueOf(name)
	}
}
map{
	Custom to "Test"+valueOf(name)
	IconDisplay to valueOf("IconDisplay")
}

In the above example:

  • All blocks with a name in („data”„speed”„Gain”) and a type of „Inport” will be matched. The name of their respective ANALYZE artifacts will be the name of the Simulink blocks prefixed by „B1”.
  • All blocks with „collision_avoidance/collision avoidance/” in their path will be matched. The name of their respective ANALYZE artifacts will be the name of the Simulink blocks prefixed by „B2”.
  • All states will be matched. The name of their respective ANALYZE artifacts will be the name of the Simulink states prefixed by „S”.
  • All transitions with a non-empty name will be matched. The name of their respective ANALYZE artifacts will be the name of the Simulink transitions prefixed by „T”.
  • The element attributes nameB, pathB, typeB, nameS, and nameT will be mapped to the corresponding attributes of the ANALYZE artifact of each element (B: blocks, S: states, T: transitions).
  • The generic attribute Custom will hold the concatenation of the value „Test” and the name of the Simulink element.
  • The generic attribute IconDisplay will hold the value of the element’s „IconDisplay” parameter. If that parameter doesn’t exist for this element the value will be „<N/A>”, as specified in the Data access configuration.

We use the following model from YAKINDU Model Viewer:

And here are the resulting artifacts in itemis ANALYZE:

Version

An artifact’s version is used for suspicious links validation. The version of an artifact of this type is evaluated as a JSON-like concatenation of all artifact custom attribute values.

Using the YAKINDU Model Viewer link type, it is possible to manage links that start at a Simulink artifact and point to any other artifact.

For example, let’s say Simulink blocks should be linked to requirements, which reside in a totally different data source, e.g., PTC Integrity. To achieve this, you can store the requirement ID in a parameter of the Simulink block, e.g., parameter A. You will do so by configuring ANALYZE in such a way that on link creation it stores the requirement ID in that parameter.

Generally, such links are maintained by populating a parameter of the Simulink element with the ID(s) of the referenced artifact(s) at the other end of the link. If the cardinality of the link is larger than one, the IDs of the referenced artifacts are joined in the parameter.

Using the YAKINDU Model Viewer link type requires at least one link type mapping with a configured YAKINDU Model Viewer data access. At least one of the artifact types selected for the link type must be a configured YAKINDU Model Viewer artifact type.

Open the ANALYZE configuration with the ANALYZE configuration editor, and add a new link type as described in section "Configuring a link type".

Supported keywords are :

  • analyze attribute of … locate links by … where … – Defines the condition to be fulfilled in order to derive trace links from a Simulink block. Left from locate, a custom attribute of the source artifact type must be provided. It must reference artifacts of the target type within the parameter. Right from by, a regular expression is required which is matched against the value of the parameter. The constraints right from where define which values have to match between the pattern and the opposite artifact in order to derive a link.
  • group – Defines access to matching groups of the regular expression in the by clause.
  • A.x, B.y – Allows to reference custom attributes of the opposite artifact (depending on the attribute of clause in the mapping).
  • create links by … – Defines an expression to create links appended with a space at the end of the parameter text, for link creation. Afterwards, the text should be identified using the regular expression in order to load the link.

Link creation and deletion are supported for .slx files only.

Example:

analyze attribute of B.valueOf("data.codecomment")
locate links by "Req-(?<ID>\\d+)" {
	where {
		group("ID") = A.IDX
	}
}
create links by {
	"Req-"+A.IDX
}

The sample configuration above describes a link type mapping from artifacts of the YAKINDU Model Viewer artifact type (artifact B) to requirement (artifact A). The custom attribute A.IDX is used in the parameter of the block of type B to reference the artifact.

The configuration tells ANALYZE that the IDs of the linked artifacts should be written into or read from the map parameter data in the key codecomment" in blocks of artifact type B. Within that parameter, ANALYZE looks for strings starting with the Req- prefix followed by at least one digit. ANALYZE derives a link whenever one of the matching IDs is equivalent to B.IDX, i.e., the ID of the requirement.

If a new link is created, the value of B.IDX is prefixed with Req-, and this value is appended to the end of the parameter value.

Links of this link type will never become suspicious.

YAKINDU Model Viewer Decorations

Currently ANALYZE supports decorations in order to indicate whether an element opened in the YAKINDU Model Viewer editor is linked to other elements. Accordingly, once an element has been opened in the YAKINDU Model Viewer editor, it is decorated with a itemis logo if it is linked. Additionally, if this decoration icon is hovered upon, a tooltip appears, indicating the number of links referring this element. This is shown in figure "Linked elements are marked in YAKINDU Model Viewer".

Linked elements are marked in YAKINDU Model Viewer

Linked elements are marked in YAKINDU Model Viewer

Once the decoration icon is clicked, a context menu listing the linked artifacts opens, see figure "Listing linked artifacts in YAKINDU Model Viewer". If you hover over the context menu item of one of these elements, a tooltip appears showing a small summary of this element. Clicking one of the linked elements in the context menu opens it.

Listing linked artifacts in YAKINDU Model Viewer

Listing linked artifacts in YAKINDU Model Viewer