Define Custom Requirement and Link Types

To define custom requirement and link types in addition to the built-in requirement and link types described in Requirement Types and Link Types, you customize your Simulink®user interface by registering a Simulink customization. For more information, Registering Customizations (Simulink).

In this example, you define custom requirement and link types by creating an sl_customization.m file in the current working folder. The following sl_customization.m file creates a custom requirement type called Heading and two custom link types called Satisfy and Solve. You can define custom requirement and link types to exclude requirements from contributing to the Implementation and Verification status metrics as shown in this code example.

function sl_customization(cm)
    cObj = cm.SimulinkRequirementsCustomizer;
    cObj.addCustomRequirementType('Heading', slreq.custom.RequirementType.Container, ...
    'Headings of functional requirements')
    cObj.addCustomLinkType('Satisfy', slreq.custom.LinkType.Verify, 'Satisfies', ...
    'Satisfied by', 'Links to Verification objects')
    cObj.addCustomLinkType('Solve', slreq.custom.LinkType.Implement, 'Solves', ... 
    'Solved by', 'Description')
end

  • The Heading custom requirement type is defined as a subtype of the built-in Container requirement type. Heading requirements do not contribute to the Implementation status metric. All Functional requirements that are grouped under them do.

  • The Satisfy custom link type comprises a source and destination artifact: Satisfies and Satisfied by. It is defined as a subtype of the Verifies/Verified by built-in link type. All Satisfies/Satisfied by requirement links contribute to the Verification status metric.

  • The Solve custom link type comprises a source and destination artifact: Solves and Solved by. It is defined as a subtype of the Implements/Implemented by built-in link type. All Solves/Solved by requirement links contribute to the Implementation status metric.

You can select the custom requirement or link type from the Requirements Editor or the Requirements Perspective view. To select the custom requirement type, navigate to the Requirements view and select a requirement. Select the custom requirement type from the Type drop-down list in the Properties pane.

To select the custom link type, navigate to the Links view and select a link. Select the custom link type from the Type drop-down list in the Properties pane.