{"id":4958,"date":"2015-12-18T12:10:16","date_gmt":"2015-12-18T17:10:16","guid":{"rendered":"https:\/\/blogs.mathworks.com\/seth\/?p=4958"},"modified":"2017-09-03T16:55:43","modified_gmt":"2017-09-03T21:55:43","slug":"creating-custom-requirements-link-type","status":"publish","type":"post","link":"https:\/\/blogs.mathworks.com\/simulink\/2015\/12\/18\/creating-custom-requirements-link-type\/","title":{"rendered":"Creating Custom Requirements Link Type"},"content":{"rendered":"<p>If you\u2019re working in the system engineering space, you are very likely familiar with the Requirement Traceability feature of <a href=\"https:\/\/www.mathworks.com\/products\/simverification\/\">Simulink Verification and Validation<\/a>. I have discussed this topic in <a href=\"https:\/\/blogs.mathworks.com\/seth\/2013\/12\/03\/tracing-requirements-to-models-tests-and-generated-code\/\">previous posts<\/a>.<\/p>\r\n\r\n<p>This feature allows you to link Simulink blocks to many types of documents, including Microsoft Word, PDF, HTML, etc. <\/p>\r\n\r\n<p>But what if your requirements are stored in type of document that is not in the list? <\/p>\r\n\r\n<p>Today, my colleague <strong>Shawn Bonneau<\/strong> from <a href=\"https:\/\/www.mathworks.com\/services\/consulting\/\">MathWorks Consulting Services<\/a> describes how use Simulink V&V\u2019s Requirements Management Interface (RMI) to create custom requirement link type to Microsoft PowerPoint.<\/p>\r\n\r\n<p><img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/images\/seth\/2015Q4\/lCustomLinkEntry.png\" alt=\"Linking to PowerPoint document.png\" \/><\/p>\r\n\r\n<p><strong>What is a custom link type?<\/strong><\/p>\r\n\r\n<p>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:<\/p>\r\n\r\n<ol>\r\n\t<li>Write a main MATLAB function file defining which callbacks you plan to implement<\/li>\r\n\t<li>Write the callbacks which perform the desired actions<\/li>\r\n\t<li>Register the new link type with Simulink. <\/li>\r\n<\/ol>\r\n\r\n<p>After that, your custom functionality will be available under the Requirements Traceability menus and Link Editor.<\/p>\r\n\r\n<p>Depending on functionality needed and the complexity of your requirements tool\u2019s 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.<\/p>\r\n\r\n<p><strong>An Example<\/strong><\/p>\r\n\r\n<p>Let's begin with the main MATLAB function file defining the custom link type.<\/p>\r\n\r\n<p>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:<\/p>\r\n\r\n<p><img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/images\/seth\/2015Q4\/registrationFile.png\" alt=\"Registration file\" \/><\/p>\r\n\r\n<p>Let's now look at the callback implementing the linking.<\/p>\r\n\r\n<p>In this example, we use an <a href=\"https:\/\/www.mathworks.com\/help\/matlab\/using-com-objects-in-matlab.html\">ActiveX server<\/a> to interact with Microsoft PowerPoint and populate the fields of a requirements link data structure.<\/p>\r\n\r\n<p><img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/images\/seth\/2015Q4\/linkcb.png\" alt=\"link callback.png\" \/><\/p>\r\n\r\n<p>Once this is done, you can register the custom link type by executing <tt><strong>rmi register linktype_rmi_custom<\/strong><\/tt>, where <tt>linktype_rmi_custom<\/tt> is the name of the function created earlier.<\/p>\r\n\r\n<p>After creating and registering the custom link type, I opened a Microsoft PowerPoint document and selected the third slide (titled \u201cExample Requirement\u201d). Next, I right click on the Simulink block I need to link and the new PowerPoint option appears.<\/p>\r\n\r\n<p>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.<\/p>\r\n\r\n<p><img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/images\/seth\/2015Q4\/finalLink.png\" alt=\"Link for navigation\" \/><\/p>\r\n\r\n<p>Even with Microsoft PowerPoint closed, clicking on the \u201cExample Requirement\u201d menu item opens the document and navigates to the third slide.<\/p>\r\n\r\n<p><strong>What else can a custom link type do?<\/strong><\/p>\r\n\r\n<p>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:<\/p>\r\n\r\n<ul>\r\n\t<li>The Link Editor\u2019s Document Index tab<\/li>\r\n\t<li>Selection based linking<\/li>\r\n\t<li>Requirements navigation<\/li>\r\n\t<li>Consistency checking<\/li>\r\n\t<li>Requirements reports<\/li>\r\n<\/ul>\r\n\r\n<p><strong>Now it\u2019s your turn<\/strong><\/p>\r\n\r\n<p>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.<\/p>\r\n\r\n<p>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\u2019ve come up with.<\/p>\r\n","protected":false},"excerpt":{"rendered":"<div class=\"overview-image\"><img decoding=\"async\"  class=\"img-responsive\" src=\"https:\/\/blogs.mathworks.com\/images\/seth\/2015Q4\/finalLink.png\" onError=\"this.style.display ='none';\" \/><\/div><p>If you\u2019re 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... <a class=\"read-more\" href=\"https:\/\/blogs.mathworks.com\/simulink\/2015\/12\/18\/creating-custom-requirements-link-type\/\">read more >><\/a><\/p>","protected":false},"author":41,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[63],"tags":[351],"_links":{"self":[{"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/posts\/4958"}],"collection":[{"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/users\/41"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/comments?post=4958"}],"version-history":[{"count":24,"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/posts\/4958\/revisions"}],"predecessor-version":[{"id":6726,"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/posts\/4958\/revisions\/6726"}],"wp:attachment":[{"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/media?parent=4958"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/categories?post=4958"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/tags?post=4958"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}