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.
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:
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.
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:
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:
We use the following model from YAKINDU Model Viewer:
And here are the resulting artifacts in itemis ANALYZE:
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 :
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.
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
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