Main Content

Define Custom Requirement and Link Types and Properties

Requirements Toolbox™ includes built-in requirement and link types that you can use to indicate the role of your requirements and how linked items relate to each other. You can define your own custom requirement or link types that extend the built-in types by using stereotypes or an sl_customization file.

Additionally, Requirements Toolbox includes properties that you can use to provide information about your requirements and links. You can define your own custom requirement or link properties that extend the built-in properties by using stereotype properties or custom attributes.

Define Custom Requirement and Link Types

To define custom requirements or link types, you can define a stereotype or create an sl_customization file.

This table summarizes the differences between the two approaches:

Stereotypessl_customization Files
You can use stereotypes only with the requirement set or link set that you assigned the profile to.You can use the custom types with all open requirements or links. However, you must execute slreq.refreshCustomizations during each MATLAB® session.
You can reuse stereotypes across projects.You can reuse sl_customization files across projects.
You can create multiple profiles in a single project and assign multiple profiles to a single requirement set or link set.You can have only one sl_customization file on the MATLAB path.
To share requirement or link sets with other users, you must share the requirement or link set and the profile XML filesTo share requirement or link sets with other users:
  1. You must share the requirement or link set and the sl_customization file.

  2. They must execute slreq.refreshCustomizations for Requirements Toolbox to recognize the custom types.

When you make changes to profile or stereotype and then load the requirement or link set, you must fix the outdated profile.When you make changes to the sl_customization file, you must execute slreq.refreshCustomizations to update the custom types.

Define Custom Types by Using Stereotypes

To define custom types by using stereotypes, you must create a profile to contain the stereotype, then define the stereotype. To use the stereotype, assign the profile to the requirement set or link set. Set the requirement or link type to the stereotype in the Requirements Editor or at the MATLAB command line. For more information, see Customize Requirements and Links by Using Stereotypes.

Define Custom Types by Using sl_customization Files

To define custom types by using sl_customization files, you must create a MATLAB code file that defines a function called sl_customization, then add definitions for the custom types to the file. Register the custom types by using slreq.refreshCustomizations. For more information, see Define Custom Requirement and Link Types by Using sl_customization Files.

Set the requirement or link type to the custom type in the Requirements Editor or at the MATLAB command line.

Define Custom Properties for Requirements and Links

To define custom properties for requirements or links, you can define a stereotype that has stereotype properties or define custom attributes for a requirement set or link set.

This table summarizes the differences between the two approaches:

Custom Properties Defined by Stereotype PropertiesCustom Properties Defined by Custom Attributes
You must apply the profile to a requirement set or link set before you can use the stereotype properties.You must define custom attributes for each requirement set or link set.
You can use stereotype properties only with requirements or links that use that stereotype.You can use custom attributes only with requirements or links in the requirement set or link set that you defined custom attributes for.
You can reuse stereotype properties across projects by reusing profiles.You cannot reuse custom attributes across projects unless you reuse the entire requirement set.
When you share requirement sets or link sets and profile XML files with other users, Requirements Toolbox recognizes stereotype properties.When you share requirement sets or link sets with other users, Requirements Toolbox recognizes custom attributes. You do not need to share additional files.
If you make changes to the profile or stereotype and then load the requirement set or link set, you must fix outdated profile.If you make changes to the custom attributes, Requirements Toolbox automatically applies the changes, but might lose some data. For more information, see the section Edit Custom Attributes in Add Custom Attributes to Requirements and Add Custom Attributes to Links.

Define Custom Properties by Using Stereotypes

To define custom properties by using stereotypes, you must create a profile, define a stereotype, then add properties to the stereotype. After you set the requirement or link type to the stereotype, you can set the values of your custom property in the Requirements Editor or at the MATLAB command line. For more information, see Customize Requirements and Links by Using Stereotypes.

Define Custom Properties by Using Custom Attributes

To define custom properties by using custom attributes, you must define each property as a custom attribute for each requirement set or link set. You can define the custom attributes in the Requirements Editor or at the MATLAB command line. For more information, see Add Custom Attributes to Requirements and Add Custom Attributes to Links.

Choose a Built-in Type as a Base Behavior

Because all custom types must be based on one of the built-in types, custom types contribute to the implementation and verification status in the same way as the built-in types. Additionally, custom link types inherit their impact direction from the built-in link types.

  • To create a custom requirement type that you can implement and verify by linking to design elements and tests, use the Functional built-in type as the base behavior. Functional requirements contribute to the implementation and verification status. For more information, see:

  • To create a custom link type that contributes to the implementation status, use the Implement link type as the base behavior.

  • To create a custom link type that contributes to the verification status, use the Verify link type as the base behavior.

  • To create a custom link type that verifies requirements by linking to external test results, use the Confirm link type as the base behavior. For more information, see the Link Types section of Create and Store Links.

  • To create a link type with forward and backward names that align with the impact direction, use the same link direction as the built-in types. For more information, see the table under Link Types.

    Note

    Impact direction describes how changes propagate between nodes in a traceability diagram. For more information, see the Impact Direction section of Visualize Links with a Traceability Diagram.

Related Topics