Skip to main content

MATLAB/Simulink Requirements Traceability

Overview

NirmIQ integrates seamlessly with MATLAB/Simulink Requirements Toolbox via ReqIF (Requirements Interchange Format). This enables complete requirements traceability from customer requirements through system design to Simulink implementation and testing.

Prerequisites
  • NirmIQ: Any tier (ReqIF export available in Free tier)
  • MATLAB: R2019b or later
  • Simulink Requirements: License required (formerly Requirements Toolbox)
  • Optional: Simulink Test (for test case traceability)

Use Cases

Automotive (ISO 26262):

  • Manage customer requirements in IntelliSE
  • Link system requirements to Simulink models
  • Verify functional safety compliance
  • Generate traceability matrices for audits

Aerospace (DO-178C):

  • Requirements management in IntelliSE
  • Model-based design in Simulink
  • Complete traceability for certification
  • Automated test case linking

Medical Devices (IEC 62304):

  • Regulatory requirements in IntelliSE
  • Software design in Simulink
  • FDA submission traceability
  • V&V documentation

Workflow Overview

graph LR
A[NirmIQ<br/>Requirements] -->|Export ReqIF| B[ReqIF File<br/>.reqif]
B -->|Import| C[MATLAB<br/>Requirements Editor]
C -->|Link| D[Simulink<br/>Model Elements]
D -->|Verify| E[Test Cases]
E -->|Report| F[Traceability<br/>Matrix]
F -->|Update| A

style A fill:#0ea5e9
style C fill:#f97316
style D fill:#f97316
style F fill:#10b981

Key Benefits:

  • ✅ Bidirectional traceability
  • ✅ Standards-compliant workflow
  • ✅ No vendor lock-in (ReqIF standard)
  • ✅ Automated link verification
  • ✅ Gap analysis and coverage reports

Step-by-Step Integration Guide

Step 1: Export Requirements from IntelliSE

1.1 Prepare Your Requirements

Ensure your IntelliSE project has:

  • ✅ Complete requirement hierarchy (CR001 → SYS-001 → SUB-001)
  • ✅ Clear requirement text
  • ✅ Proper type classification
  • ✅ Status and version information

Example Structure:

CR001 - System shall detect obstacles
├── CR001.SYS-001 - Radar shall scan at 10Hz
│ └── CR001.SYS-001.SUB-001 - Signal processing algorithm
└── CR001.SYS-002 - Ultrasonic sensors backup

1.2 Export to ReqIF

  1. Open your project in NirmIQ
  2. Click ProjectExportExport to ReqIF (.reqif)
  3. Save the .reqif file (e.g., ProjectName_Requirements_v1.0.reqif)

What's Exported:

  • All requirement IDs (custom_id)
  • Requirement text and descriptions
  • Hierarchy (parent-child relationships)
  • Attributes (type, status, version, Jira links)
  • Metadata (project name, export timestamp)
Best Practice

Include version number in filename (e.g., ADAS_Requirements_v2.1.reqif) for change tracking.


Step 2: Import ReqIF into MATLAB Requirements Toolbox

2.1 Open MATLAB Requirements Editor

Option A - Command Line:

slreq.editor

Option B - GUI:

  1. Open MATLAB
  2. Click Apps tab
  3. Under Verification, Validation, and TestRequirements Editor

2.2 Import ReqIF File

  1. In the Requirements Editor, click Import
  2. In the Importing Requirements dialog:

Document Settings:

  • Document type: ReqIF file (*.reqif or *.reqifz)
  • Document location: Browse to your exported .reqif file
  • Source tool: Select Generic (or Custom if creating mapping)

Attribute Mapping:

  • Default mapping: NirmIQ attributes map automatically:
    • custom_id → Requirement ID
    • text → Summary
    • type → Type (Functional, Information, etc.)
    • status → Status
    • version → Version

Source Links:

  • ✅ Check Import links to preserve requirement relationships
  • This maintains parent-child hierarchy from IntelliSE

Specifications:

  • Single specification: Import entire project as one set
  • Multiple specifications: If ReqIF contains multiple projects, choose to:
    • Import selected specification only
    • Combine all into one set
    • Import each into separate sets

Destination:

  • Save as: Browse location for requirement set (e.g., ProjectName_Requirements.slreqx)
  • Allow updates from external source:
    • ✅ Check if managing requirements in NirmIQ (recommended)
    • ❌ Uncheck for full migration to MATLAB
  1. Click Import

Expected Result:

  • New requirement set created (.slreqx file)
  • Hierarchy preserved
  • All attributes mapped
  • Requirements ready for linking

2.3 Verify Import

  1. In Requirements Editor, expand the requirement tree
  2. Verify hierarchy matches IntelliSE structure
  3. Check requirement IDs, text, and attributes
  4. Inspect Properties pane (right side) for details

Common Issues:

IssueSolution
Attributes missingCustomize attribute mapping in import dialog
Hierarchy flatEnsure "Import links" was checked
Special characters corruptedUse UTF-8 encoding in ReqIF export
Custom fields not importedMap custom attributes in Attribute Mapping section

open_system('your_model_name')

Or double-click .slx file in MATLAB Current Folder browser.

3.2 Enable Requirements Perspective

  1. In Simulink Editor, click Perspectives icon (lower-right corner)
  2. Select Requirements

This opens:

  • Requirements Browser (left pane)
  • Model (center)
  • Property Inspector (right pane)

3.3 Load Requirement Set

If not already loaded:

  1. In Requirements Browser, click Load button
  2. Browse to your .slreqx file
  3. Requirement tree appears in browser

Link a requirement to a block:

  1. Select requirement in Requirements Browser (e.g., CR001.SYS-001)
  2. Drag it onto a Simulink block (e.g., Radar Signal Processing subsystem)
  3. A Requirements icon (📋) appears on the block

Link Types:

  • Implements: Block implements the requirement (most common)
  • Derives From: Requirement derived from another
  • Refines: Block refines the requirement
  • Custom: Define your own link type

To set link type:

  1. Right-click the block
  2. RequirementsOpen Outgoing Links
  3. In Outgoing Links dialog, select link
  4. Change Link Type dropdown
  5. Add Description (optional)
  6. Click OK

Alternative method for precise linking:

  1. Select a Simulink block/subsystem
  2. Right-click → RequirementsLink to Selection in Requirements Browser
  3. In Requirements Browser, select the requirement
  4. Link created automatically

3.6 Bulk Linking (MATLAB Script)

For large models, automate linking with scripts:

% Load requirement set
rs = slreq.load('ProjectName_Requirements.slreqx');

% Get reference to model
model = 'your_model_name';

% Create link
% Syntax: slreq.createLink(source, destination)
% Source: Simulink element path
% Destination: Requirement object

% Example: Link requirement to subsystem
req = rs.find('Id', 'CR001.SYS-001');
elementPath = [model '/Radar_Signal_Processing'];
link = slreq.createLink(elementPath, req);
link.Type = 'Implements';
link.Description = 'Implements radar signal processing requirement';

% Save changes
rs.save();

Batch Linking Example:

% Link multiple requirements to corresponding blocks
reqIDs = {'CR001.SYS-001', 'CR001.SYS-002', 'CR001.SYS-003'};
blockPaths = {
'model/Radar_Processing',
'model/Ultrasonic_Processing',
'model/Sensor_Fusion'
};

rs = slreq.load('Requirements.slreqx');

for i = 1:length(reqIDs)
req = rs.find('Id', reqIDs{i});
if ~isempty(req)
link = slreq.createLink(blockPaths{i}, req);
link.Type = 'Implements';
end
end

rs.save();
disp('Linking complete!');

From Requirement to Model:

  • Select requirement in Browser → Linked blocks highlight in model

From Block to Requirements:

  • Select block → Click Requirements icon → View linked requirements
  • Or: Property Inspector shows all outgoing links

Show/Hide Link Annotations:

  • Requirements tab → Annotation section
  • Toggle ID, Summary, Link Type visibility

Step 4: Verify Traceability and Coverage

4.1 Traceability Matrix

Open Traceability Matrix:

  1. In Requirements Editor, click ViewsTraceability Matrix
  2. Configure:
    • Rows: Requirements (from your set)
    • Columns: Model elements (from Simulink model)
    • Show: Links, coverage gaps

Matrix View:

                  | Radar Block | Ultrasonic | Fusion |
CR001.SYS-001 | ✓ | | |
CR001.SYS-002 | | ✓ | |
CR001.SYS-003 | ✓ | ✓ | ✓ |
CR001.SYS-004 | | | | ← GAP!

Export Matrix:

  • Click Export → Excel, Word, or PDF
  • Use for design reviews and audits

4.2 Highlight Unlinked Elements

Find gaps in model:

  1. In Simulink, Requirements tab → Highlight Model
  2. Select highlighting criteria:
    • Unlinked elements: Red
    • Linked elements: Green
    • Partially satisfied: Yellow

Fix gaps:

  • Click unlinked (red) blocks
  • Link to appropriate requirements
  • Re-run highlighting to verify

4.3 Coverage Report

Generate coverage report:

% Load requirement set
rs = slreq.load('Requirements.slreqx');

% Generate report
rpt = slreq.report(rs, 'model_name');

% Open report (HTML format)
web(rpt, '-browser');

Report Contents:

  • Requirements with/without links
  • Model elements with/without requirements
  • Coverage percentage
  • Traceability gaps
  • Link type distribution

Prerequisite: Simulink Test license

Create test file:

  1. In Simulink, AppsSimulink Test
  2. Test Manager opens
  3. Create Test File (.mldatx)
  4. Add Test Suite and Test Cases

Example Test Case:

Test Suite: Radar Processing Tests
├── Test Case 1: Verify 10Hz scan rate
├── Test Case 2: Verify detection range 100m
└── Test Case 3: Verify obstacle classification

In Test Manager:

  1. Select test case
  2. In Properties pane, find Requirements section
  3. Click Add Link
  4. Browse to requirement (e.g., CR001.SYS-001)
  5. Set link type: Verifies
  6. Save

Script-based linking:

% Load test file
tf = sltest.testmanager.load('RadarTests.mldatx');

% Get test case
tc = tf.getTestCaseByName('Verify 10Hz scan rate');

% Load requirement set
rs = slreq.load('Requirements.slreqx');
req = rs.find('Id', 'CR001.SYS-001');

% Create verification link
link = slreq.createLink(tc, req);
link.Type = 'Verifies';

% Save
rs.save();

5.3 Verification Matrix

Complete traceability chain:

Requirement → Implementation → Verification
CR001.SYS-001 → Radar Block → Test Case 1 (Verifies)

Generate V&V report:

slreq.generateReport(rs, 'Format', 'html', 'IncludeTests', true);

Advanced Workflows

Bidirectional Updates (Round-Trip)

Scenario: Requirements change in IntelliSE after initial import to MATLAB.

Update Workflow:

  1. Update requirements in NirmIQ
  2. Export new ReqIF (v2.0)
  3. In MATLAB Requirements Editor:
    • Select requirement set
    • Click Update from Source
    • Browse to new ReqIF file
    • Review changes in diff view
    • Accept/reject changes
  4. Links preserved (MATLAB maintains links through requirement IDs)

Best Practices:

  • ✅ Keep requirement IDs stable (don't renumber)
  • ✅ Use version control for ReqIF files
  • ✅ Document changes in requirement descriptions
  • ✅ Re-run coverage reports after updates

Custom Attribute Mapping

Scenario: IntelliSE has custom fields (e.g., safety_level, verification_method)

Create Custom Mapping:

  1. During ReqIF import, click Customize in Attribute Mapping
  2. Add Custom Attributes:
    • Name: SafetyLevel
    • Type: String or Enumeration
    • Map to ReqIF attribute: safety_level
  3. Save mapping as .json or .xml
  4. Reuse for future imports

View custom attributes in MATLAB:

  • Select requirement
  • Property Inspector → Custom Attributes section

Integration with Embedded Coder

Generate production code with traceability:

  1. Configure model for code generation:

    set_param('model_name', 'RTWInlineParameters', 'on');
    set_param('model_name', 'GenerateTraceInfo', 'on');
  2. Generate code:

    slbuild('model_name');
  3. Traceability in generated code:

    • Code comments include requirement IDs
    • HTML report links code to requirements
    • Bidirectional navigation (code ↔ model ↔ requirements)

Example generated code:

/* Requirement: CR001.SYS-001
* Description: Radar shall scan at 10Hz
* Implemented by: Radar_Signal_Processing subsystem
*/
void Radar_Signal_Processing_step(void) {
// Implementation...
}

Multi-Model Traceability

Scenario: Large system with multiple Simulink models (e.g., Powertrain, Chassis, ADAS)

Approach:

  1. Export complete requirement set from IntelliSE (all subsystems)
  2. Import once into MATLAB
  3. Link different requirements to different models:
    • CR001.PWR-*Powertrain_Model.slx
    • CR001.CHA-*Chassis_Model.slx
    • CR001.ADAS-*ADAS_Model.slx

Consolidated reporting:

% Generate report across multiple models
models = {'Powertrain_Model', 'Chassis_Model', 'ADAS_Model'};
rs = slreq.load('Complete_Requirements.slreqx');

for i = 1:length(models)
rpt = slreq.report(rs, models{i});
% Reports saved to current folder
end

Real-World Use Case: Automotive ADAS

Scenario

Developing Advanced Driver Assistance System (ADAS) for autonomous emergency braking.

Requirements Breakdown

IntelliSE Project Structure:

CR001 - ADAS shall prevent collisions
├── CR001.SYS-001 - System shall detect obstacles within 100m
│ ├── CR001.SYS-001.SUB-001 - Radar sensor processing
│ ├── CR001.SYS-001.SUB-002 - Camera fusion algorithm
│ └── CR001.SYS-001.SUB-003 - Object classification
├── CR001.SYS-002 - System shall calculate time-to-collision
│ └── CR001.SYS-002.SUB-001 - TTC algorithm (ISO 26262 ASIL-D)
└── CR001.SYS-003 - System shall apply brakes when TTC < 2s
├── CR001.SYS-003.SUB-001 - Brake actuator control
└── CR001.SYS-003.SUB-002 - Driver warning HMI
ADAS_Controller.slx
├── Sensor_Fusion (implements CR001.SYS-001)
│ ├── Radar_Processing (implements CR001.SYS-001.SUB-001)
│ ├── Camera_Processing (implements CR001.SYS-001.SUB-002)
│ └── Object_Classifier (implements CR001.SYS-001.SUB-003)
├── TTC_Calculator (implements CR001.SYS-002)
│ └── TTC_Algorithm (implements CR001.SYS-002.SUB-001)
└── Brake_Controller (implements CR001.SYS-003)
├── Brake_Actuator (implements CR001.SYS-003.SUB-001)
└── HMI_Warning (implements CR001.SYS-003.SUB-002)

Implementation Steps

1. Export from IntelliSE:

File: ADAS_Emergency_Braking_v1.2.reqif
Size: ~45KB
Requirements: 47 total (8 customer, 15 system, 24 subsystem)

2. Import to MATLAB:

% Import ReqIF
slreq.editor
% GUI: Import → ADAS_Emergency_Braking_v1.2.reqif
% Save as: ADAS_Requirements.slreqx

3. Link to Model (Scripted):

rs = slreq.load('ADAS_Requirements.slreqx');
model = 'ADAS_Controller';

% Define mapping
links = {
'CR001.SYS-001', 'ADAS_Controller/Sensor_Fusion';
'CR001.SYS-001.SUB-001', 'ADAS_Controller/Sensor_Fusion/Radar_Processing';
'CR001.SYS-001.SUB-002', 'ADAS_Controller/Sensor_Fusion/Camera_Processing';
'CR001.SYS-001.SUB-003', 'ADAS_Controller/Sensor_Fusion/Object_Classifier';
'CR001.SYS-002', 'ADAS_Controller/TTC_Calculator';
'CR001.SYS-002.SUB-001', 'ADAS_Controller/TTC_Calculator/TTC_Algorithm';
'CR001.SYS-003', 'ADAS_Controller/Brake_Controller';
'CR001.SYS-003.SUB-001', 'ADAS_Controller/Brake_Controller/Brake_Actuator';
'CR001.SYS-003.SUB-002', 'ADAS_Controller/Brake_Controller/HMI_Warning';
};

% Create all links
for i = 1:size(links, 1)
req = rs.find('Id', links{i,1});
if ~isempty(req)
link = slreq.createLink(links{i,2}, req);
link.Type = 'Implements';
fprintf('Linked %s → %s\n', links{i,1}, links{i,2});
end
end

rs.save();
disp('All requirements linked successfully!');

4. Create Test Cases:

% Create test file
tm = sltest.testmanager;
tf = tm.createTestFile('ADAS_Tests');
ts = tf.createTestSuite('Emergency_Braking_Tests');

% Test Case 1: Obstacle detection at 100m
tc1 = ts.createTestCase('scenario', 'Detect_Obstacle_100m');
tc1.assignToBaseWorkspace('obstacle_distance', 100);

% Link to requirement
req = rs.find('Id', 'CR001.SYS-001');
link = slreq.createLink(tc1, req);
link.Type = 'Verifies';

% Test Case 2: TTC calculation accuracy
tc2 = ts.createTestCase('scenario', 'Verify_TTC_Calculation');
req = rs.find('Id', 'CR001.SYS-002.SUB-001');
link = slreq.createLink(tc2, req);
link.Type = 'Verifies';

% Test Case 3: Brake activation at TTC < 2s
tc3 = ts.createTestCase('scenario', 'Brake_Activation_TTC_2s');
req = rs.find('Id', 'CR001.SYS-003');
link = slreq.createLink(tc3, req);
link.Type = 'Verifies';

tf.saveToFile('ADAS_Tests.mldatx');
disp('Test cases created and linked!');

5. Generate Traceability Report:

% Coverage report
rpt = slreq.report(rs, model);
web(rpt, '-browser');

% Results:
% - 47 requirements
% - 47 linked to model (100% coverage)
% - 15 verified by tests (32% verification coverage)
% - 0 gaps

6. ISO 26262 Compliance:

% Export traceability matrix for safety audit
slreq.generateReport(rs, ...
'Format', 'docx', ...
'IncludeLinks', true, ...
'IncludeTests', true, ...
'Title', 'ADAS Emergency Braking - Traceability Report', ...
'FileName', 'ADAS_ISO26262_Traceability.docx');

Deliverables:

  • ✅ Complete requirements traceability (Req → Design → Code)
  • ✅ Test verification matrix
  • ✅ ISO 26262 safety documentation
  • ✅ Automated regression testing
  • ✅ Code generation with embedded traceability

Troubleshooting

Import Issues

ProblemCauseSolution
"Invalid ReqIF file"Malformed XMLValidate XML structure; re-export from IntelliSE
Attributes not importedUnmapped attributesCustomize attribute mapping during import
Hierarchy flatLinks not importedEnable "Import links" in import dialog
Special characters corruptedEncoding mismatchUse UTF-8 encoding in ReqIF
Import very slowLarge file (1000+ reqs)Split into multiple requirement sets

Linking Issues

ProblemCauseSolution
Drag-drop not workingPerspective not enabledEnable Requirements Perspective in Simulink
Links not visibleAnnotations hiddenRequirements tab → Show Annotations
Cannot find requirementWrong set loadedLoad correct .slreqx in Requirements Browser
Link to subsystem failsModel not savedSave model before creating links
Script links failIncorrect element pathUse Simulink.BlockDiagram.getBlocksByName to verify paths

Update Issues

ProblemCauseSolution
Update breaks linksRequirement IDs changedKeep IDs stable; don't renumber requirements
New requirements not showingCache issueClose/reopen requirement set
Conflicts in updateBoth sources modifiedManually merge changes; document conflicts

Best Practices

Requirements Management

DO:

  • Use stable, hierarchical IDs (CR001.SYS-001.SUB-001)
  • Include version numbers in exports (v1.0, v1.1, etc.)
  • Document requirement changes in description field
  • Export regularly (after each major update)
  • Keep ReqIF files in version control (Git)

DON'T:

  • Don't renumber requirement IDs mid-project
  • Don't manually edit ReqIF XML (use tools)
  • Don't skip attribute mapping customization
  • Don't delete parent requirements before children

Linking Strategy

DO:

  • Link at appropriate abstraction level (system req → subsystem, not individual blocks)
  • Use consistent link types (Implements, Verifies, Refines)
  • Document rationale in link description
  • Review links during design reviews
  • Automate linking for large models (scripts)

DON'T:

  • Don't over-link (every block doesn't need a requirement)
  • Don't use vague link descriptions
  • Don't skip traceability matrix verification
  • Don't link requirements to generated code (link to model)

Verification

DO:

  • Link every requirement to at least one test case
  • Generate coverage reports regularly
  • Highlight unlinked elements in model
  • Include traceability in code reviews
  • Archive reports with each release

DON'T:

  • Don't assume 100% model coverage = 100% requirement coverage
  • Don't skip verification for "obvious" requirements
  • Don't forget to update tests when requirements change
  • Don't rely solely on automated tests (manual review essential)

Additional Resources

MathWorks Documentation

NirmIQ Documentation

Standards


Support

Get Help

Training


Summary

NirmIQ + MATLAB/Simulink provides complete requirements traceability from customer needs through implementation to verification:

Export requirements from NirmIQ as ReqIF ✅ Import into MATLAB Requirements Toolbox ✅ Link requirements to Simulink model elements ✅ Verify with Simulink Test cases ✅ Report traceability matrices for compliance ✅ Update bidirectionally as requirements evolve

Perfect for: Automotive (ISO 26262), Aerospace (DO-178C), Medical (IEC 62304), and any model-based development requiring standards compliance.


Last Updated: October 2025 NirmIQ Version: 2.0+ MATLAB Version: R2019b+ Simulink Requirements: Required