Creating Custom Requirements Link Type
If you’re working in the system engineering space, you are very likely familiar with the Requirement Traceability feature of Simulink Verification and Validation. I have discussed this topic in previous posts.
This feature allows you to link Simulink blocks to many types of documents, including Microsoft Word, PDF, HTML, etc.
But what if your requirements are stored in type of document that is not in the list?
Today, my colleague Shawn Bonneau from MathWorks Consulting Services describes how use Simulink V&V’s Requirements Management Interface (RMI) to create custom requirement link type to Microsoft PowerPoint.
What is a custom link type?
A custom link type is a collection of callback functions that perform actions like creating a requirements link or navigating to requirements. Implementing the custom link type is simple:
- Write a main MATLAB function file defining which callbacks you plan to implement
- Write the callbacks which perform the desired actions
- Register the new link type with Simulink.
After that, your custom functionality will be available under the Requirements Traceability menus and Link Editor.
Depending on functionality needed and the complexity of your requirements tool’s API, implementing a custom link type may be simple or involved. The example for this post has fewer than 100 lines of code, and shows how to implement navigation and selection-based linking with Microsoft PowerPoint.
Let's begin with the main MATLAB function file defining the custom link type.
In this function, we begin by creating an empty custom link type object, and set relevant properties. In this basic example, we specify the menu label to be displayed when right-clicking on a block, and the function to be executed when linking and navigating to the requirement:
Let's now look at the callback implementing the linking.
In this example, we use an ActiveX server to interact with Microsoft PowerPoint and populate the fields of a requirements link data structure.
Once this is done, you can register the custom link type by executing rmi register linktype_rmi_custom, where linktype_rmi_custom is the name of the function created earlier.
After creating and registering the custom link type, I opened a Microsoft PowerPoint document and selected the third slide (titled “Example Requirement”). Next, I right click on the Simulink block I need to link and the new PowerPoint option appears.
Once a link is created the title of the linked slide appears in the requirements list and clicking on it will execute the NavigateFcn callback.
Even with Microsoft PowerPoint closed, clicking on the “Example Requirement” menu item opens the document and navigates to the third slide.
What else can a custom link type do?
A custom link type can do all the things that you see from a standard link type. You might not need to implement them all, but you can set up the behavior of:
- The Link Editor’s Document Index tab
- Selection based linking
- Requirements navigation
- Consistency checking
- Requirements reports
Now it’s your turn
MathWorks Consulting Services recently helped customers implement requirements tool integrations with more involved features like a tree-based requirement selection UI, a surrogate workflow similar to the one used in the DOORS integration, and connections to a web-based requirements management system.
Do you use custom link types for requirements tracing? Let us know in the comments below the challenges you have run into and solutions that you’ve come up with.
To leave a comment, please click here to sign in to your MathWorks Account or create a new one.