{"id":8141,"date":"2022-07-12T21:12:29","date_gmt":"2022-07-13T01:12:29","guid":{"rendered":"https:\/\/blogs.mathworks.com\/student-lounge\/?p=8141"},"modified":"2022-07-12T21:12:29","modified_gmt":"2022-07-13T01:12:29","slug":"requirements-verification-and-validation-for-an-autonomous-driving-scenario","status":"publish","type":"post","link":"https:\/\/blogs.mathworks.com\/student-lounge\/2022\/07\/12\/requirements-verification-and-validation-for-an-autonomous-driving-scenario\/","title":{"rendered":"Requirements Verification and Validation for an Autonomous Driving Scenario"},"content":{"rendered":"<div class=\"rtcContent\">\n<p><em>In today\u2019s post, <span class=\"TextRun Highlight SCXW229581546 BCX8\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW229581546 BCX8\" data-ccp-parastyle=\"paragraph\"><a href=\"https:\/\/www.linkedin.com\/in\/akshra-narasimhan-ramakrishnan-7b6845136\">Akshra Ramakrishnan<\/a> will talk about how to write<\/span><span class=\"NormalTextRun SCXW229581546 BCX8\" data-ccp-parastyle=\"paragraph\"> functional<\/span><span class=\"NormalTextRun SCXW229581546 BCX8\" data-ccp-parastyle=\"paragraph\"> requirements <\/span><span class=\"NormalTextRun SCXW229581546 BCX8\" data-ccp-parastyle=\"paragraph\">for a driving scenario made in Driving Scenario <\/span><span class=\"NormalTextRun SCXW229581546 BCX8\" data-ccp-parastyle=\"paragraph\">Designer, and<\/span><span class=\"NormalTextRun SCXW229581546 BCX8\" data-ccp-parastyle=\"paragraph\"> write test cases to verify and validate these requirements.<\/span><\/span>\u00a0Over to you, Akshra..<\/em><\/p>\n<\/div>\n<div><\/div>\n<div class=\"rtcContent\">\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\">In a model-based design workflow, <a href=\"https:\/\/www.mathworks.com\/help\/slcheck\/verification-and-validation.html\"><span style=\"text-decoration: underline;\">verification and validation<\/span><\/a> against a set of requirements is integral for successful system development and deployment. This ensures that your system design meets team-defined requirements, is compliant with team standards, and is free of run-time errors.<\/div>\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\"><a href=\"https:\/\/www.mathworks.com\/products\/requirements-toolbox.html\"><span style=\"text-decoration: underline;\">Requirements Toolbox\u2122<\/span><\/a> lets you author, import, and validate requirements within MATLAB\u00ae and Simulink\u00ae, track their implementation and verification status, and trace them to the source blocks. You can use <a href=\"https:\/\/www.mathworks.com\/help\/sltest\/index.html?s_tid=CRUX_lftnav\"><span style=\"text-decoration: underline;\">Simulink\u00ae Test\u2122<\/span><\/a> to author, manage, and execute tests for Simulink models. The Test Manager provides an interactive way to author tests from scratch, import existing test data and harness models, and organize your tests. You can also link requirements to test cases.<\/div>\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\">In this blog, I will create and link requirements for a <a href=\"https:\/\/www.mathworks.com\/help\/driving\/ref\/drivingscenariodesigner-app.html\"><span style=\"text-decoration: underline;\">Driving Scenario Designer<\/span><\/a> scenario, and author test cases to verify those requirements.<\/div>\n<h2 style=\"margin: 20px 10px 5px 4px; padding: 0px; line-height: 20px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 20px; font-weight: bold; text-align: left;\">Scenario and Model Overview:<\/h2>\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\">The scenario that I will be using and writing requirements for contains one ego vehicle, a right turn, one traffic light and one stop sign. The ego vehicle\u2019s path is pre-defined.<\/div>\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: center;\"><img decoding=\"async\" loading=\"lazy\" class=\"imageNode\" style=\"vertical-align: baseline; width: 586px; height: 314px;\" src=\"https:\/\/blogs.mathworks.com\/student-lounge\/files\/2022\/07\/July11_1.png\" alt=\"capture2.PNG\" width=\"586\" height=\"314\" \/><\/div>\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: center;\"><span style=\"font-style: italic;\">Figure <\/span><span style=\"font-style: italic;\">1<\/span><span style=\"font-style: italic;\">: DSD scenario with 1 traffic light and 1 stop sign<\/span><\/div>\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\">The Simulink model I will be using contains the following subsystems<\/div>\n<ul style=\"margin: 10px 0px 20px; padding-left: 0px; font-family: Helvetica, Arial, sans-serif; font-size: 14px;\">\n<li style=\"margin-left: 56px; line-height: 21px; min-height: 0px; text-align: left; white-space: pre-wrap;\"><span style=\"font-style: italic;\">Vehicle Dynamics<\/span>: contains the vehicle dynamics model for a chosen vehicle. This subsystem outputs the ego vehicle states (position, velocity, acceleration, orientation, and angular velocity).<\/li>\n<li style=\"margin-left: 56px; line-height: 21px; min-height: 0px; text-align: left; white-space: pre-wrap;\"><span style=\"font-style: italic;\">Scenario ground truth<\/span>: contains the scenario ground truth information for the chosen scenario. This includes the scenario reader block which takes a Driving Scenario Designer file as input and outputs the actor poses and lane boundaries. This subsystem also contains a couple of transformation blocks that perform the required coordinate and unit transformation.<\/li>\n<li style=\"margin-left: 56px; line-height: 21px; min-height: 0px; text-align: left; white-space: pre-wrap;\"><span style=\"font-style: italic;\">Requirements<\/span>: This subsystem contains a custom block that reads all the traffic lights and stop signs actor ID from the workspace. Requirements written will be linked to this block.<\/li>\n<li style=\"margin-left: 56px; line-height: 21px; min-height: 0px; text-align: left; white-space: pre-wrap;\"><span style=\"font-style: italic;\">Traffic lights and signs<\/span>: This subsystem contains the traffic light sensor block which hosts a Stateflow chart that assigns traffic light states (colors) to all the traffic lights in the scenario. Traffic light states are then passed to a function block that maps them to the correct traffic light ID. This outputs a bus that contains traffic light states, ID, and positions for each traffic light in the scenario. Another function block does the same for stop signs, minus the states.<\/li>\n<li style=\"margin-left: 56px; line-height: 21px; min-height: 0px; text-align: left; white-space: pre-wrap;\"><span style=\"font-style: italic;\">Visualization<\/span>: The visualization block provides a 2D visualization of the scenario, ego vehicle path, traffic light positions and states, and stop sign positions.<\/li>\n<\/ul>\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: center;\"><img decoding=\"async\" loading=\"lazy\" class=\"imageNode\" style=\"vertical-align: baseline; width: 660px; height: 215px;\" src=\"https:\/\/blogs.mathworks.com\/student-lounge\/files\/2022\/07\/July11_2.png\" alt=\"Capture4.PNG\" width=\"660\" height=\"215\" \/><\/div>\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: center;\"><span style=\"font-style: italic;\">Figure 2<\/span><span style=\"font-style: italic;\">: Simulink model overview<\/span><\/div>\n<h2 style=\"margin: 20px 10px 5px 4px; padding: 0px; line-height: 20px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 20px; font-weight: bold; text-align: left;\">Adding Requirements Using Requirements Editor<\/h2>\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\">This section shows how to define system requirements, and add requirements to a block.<\/div>\n<h4 style=\"margin: 10px 10px 5px 4px; padding: 0px; line-height: 18px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 15px; font-weight: bold; text-align: left;\">Step 1: Define the system requirements<\/h4>\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\">When following a model-based-design workflow, the first step is always specifying the system requirements. This ensures that all members of your team are on the same page regarding system design goals for the year. For an autonomous system, this can range from sensor specifications (field of view (FOV), range etc.), ego vehicle maximum speed limitations, system performance targets to scenario variation requirements.<\/div>\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\">In this example, I am defining two simple scenario requirements:<\/div>\n<ul style=\"margin: 10px 0px 20px; padding-left: 0px; font-family: Helvetica, Arial, sans-serif; font-size: 14px;\">\n<li style=\"margin-left: 56px; line-height: 21px; min-height: 0px; text-align: left; white-space: pre-wrap;\">The number of traffic lights in the scenario is 1<\/li>\n<li style=\"margin-left: 56px; line-height: 21px; min-height: 0px; text-align: left; white-space: pre-wrap;\">The number of stop signs in the scenario is 1<\/li>\n<\/ul>\n<h4 style=\"margin: 10px 10px 5px 4px; padding: 0px; line-height: 18px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 15px; font-weight: bold; text-align: left;\"><span style=\"font-weight: bold;\">Step 2: Add requirements to a block<\/span><\/h4>\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\">Select the required Simulink block (Lights and Stop Signs ID). Open \u2018requirements editor\u2019 in the \u2018Apps\u2019 tab &#8211;&gt; Select \u2018New Requirements Set &#8211;&gt; Give a file name. This creates a <span style=\"font-family: monospace;\">.slreqx<\/span> file which shows up in the requirements editor. You can add multiple requirements under a requirements set. I&#8217;m adding the previously mentioned two requirements to this set, with their requirement IDs 1 and 2.<\/div>\n<h2 style=\"margin: 20px 10px 5px 4px; padding: 0px; line-height: 20px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 20px; font-weight: bold; text-align: left;\">Test Case Verification using Simulink Test Manager<\/h2>\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\">Once requirements are added, test cases must be written to verify these requirements.<\/div>\n<h4 style=\"margin: 10px 10px 5px 4px; padding: 0px; line-height: 18px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 15px; font-weight: bold; text-align: left;\"><span style=\"font-weight: bold;\">Step 3: Add test cases to a test suite<\/span><\/h4>\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\">Open \u2018Simulink Test Manager\u2019 from Simulink Apps &#8211;&gt; New test suite &#8211;&gt; Give a file name. More information about Simulink Test Manager can be found <a href=\"https:\/\/www.mathworks.com\/help\/sltest\/ref\/testmanager.html\"><span style=\"text-decoration: underline;\">here<\/span><\/a>. I will be creating two test cases TL and SS inside a test suite: one will link to requirement ID #1 and the other to requirement ID #2. Provide the name of your Simulink model, along with a test harness model.<\/div>\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: center;\"><img decoding=\"async\" loading=\"lazy\" class=\"imageNode\" style=\"vertical-align: baseline; width: 555px; height: 222px;\" src=\"https:\/\/blogs.mathworks.com\/student-lounge\/files\/2022\/07\/July11_3.png\" alt=\"Capture5.PNG\" width=\"555\" height=\"222\" \/><\/div>\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: center;\"><span style=\"font-style: italic;\">Figure 4<\/span><span style=\"font-style: italic;\">: Simulink Test Manager<\/span><\/div>\n<h4 style=\"margin: 10px 10px 5px 4px; padding: 0px; line-height: 18px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 15px; font-weight: bold; text-align: left;\"><span style=\"font-weight: bold;\">Step 3.1: Create a test harness<\/span><\/h4>\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\">A test harness is a test-specific simulation environment. You can insolate blocks for unit testing, add verification logic, and test parts of your model before you make changes to the final model. I will be adding 2 test assessment blocks to verify my two requirements.<\/div>\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: center;\"><img decoding=\"async\" loading=\"lazy\" class=\"imageNode\" style=\"vertical-align: baseline; width: 306px; height: 245px;\" src=\"https:\/\/blogs.mathworks.com\/student-lounge\/files\/2022\/07\/July11_4.png\" alt=\"dialogue1.png\" width=\"306\" height=\"245\" \/><\/div>\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: center;\"><span style=\"font-style: italic;\">Figure <\/span><span style=\"font-style: italic;\">5<\/span><span style=\"font-style: italic;\">: Creating a test harness<\/span><\/div>\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: center;\"><img decoding=\"async\" loading=\"lazy\" class=\"imageNode\" style=\"vertical-align: baseline; width: 435px; height: 202px;\" src=\"https:\/\/blogs.mathworks.com\/student-lounge\/files\/2022\/07\/July11_5.png\" alt=\"Capture6.PNG\" width=\"435\" height=\"202\" \/><\/div>\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: center;\"><span style=\"font-style: italic;\">Figure 6: External test harness with test assessment block<\/span><\/div>\n<h4 style=\"margin: 10px 10px 5px 4px; padding: 0px; line-height: 18px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 15px; font-weight: bold; text-align: left;\"><span style=\"font-weight: bold;\">Step 3.2: Adding verification logic<\/span><\/h4>\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\">In a test case, you can:<\/div>\n<ul style=\"margin: 10px 0px 20px; padding-left: 0px; font-family: Helvetica, Arial, sans-serif; font-size: 14px;\">\n<li style=\"margin-left: 56px; line-height: 21px; min-height: 0px; text-align: left; white-space: pre-wrap;\">Compare simulation output to baseline data<\/li>\n<li style=\"margin-left: 56px; line-height: 21px; min-height: 0px; text-align: left; white-space: pre-wrap;\">Compare the output if two simulations<\/li>\n<li style=\"margin-left: 56px; line-height: 21px; min-height: 0px; text-align: left; white-space: pre-wrap;\">Post-process simulation output using a custom script<\/li>\n<li style=\"margin-left: 56px; line-height: 21px; min-height: 0px; text-align: left; white-space: pre-wrap;\">Run-time assessments<\/li>\n<\/ul>\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\">In a test harness or model, you can:<\/div>\n<ul style=\"margin: 10px 0px 20px; padding-left: 0px; font-family: Helvetica, Arial, sans-serif; font-size: 14px;\">\n<li style=\"margin-left: 56px; line-height: 21px; min-height: 0px; text-align: left; white-space: pre-wrap;\">Verify logical conditions in run-time using a verify statement, which returns a pass, fail, or untested result for each time step.<\/li>\n<li style=\"margin-left: 56px; line-height: 21px; min-height: 0px; text-align: left; white-space: pre-wrap;\">Use assert statements to stop simulation on a failure.<\/li>\n<li style=\"margin-left: 56px; line-height: 21px; min-height: 0px; text-align: left; white-space: pre-wrap;\">Use blocks from the Model Verification or Simulink\u00ae Design Verifier\u2122 library.<\/li>\n<\/ul>\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\">More detailed information on authoring test cases can be found <a href=\"https:\/\/www.mathworks.com\/help\/sltest\/ug\/test-assessment-basics.html\"><span style=\"text-decoration: underline;\">here<\/span><\/a>. For this model, I will be performing run-time assessments of test cases using verify statements. Add a test assessment block inside the test harness (automatically added in the previous step through a check box). I want to verify that the following criteria are met when time=0, and output that the requirement has been met once passed.<\/div>\n<ul style=\"margin: 10px 0px 20px; padding-left: 0px; font-family: Helvetica, Arial, sans-serif; font-size: 14px;\">\n<li style=\"margin-left: 56px; line-height: 21px; min-height: 0px; text-align: left; white-space: pre-wrap;\">Number of traffic lights is 1<\/li>\n<li style=\"margin-left: 56px; line-height: 21px; min-height: 0px; text-align: left; white-space: pre-wrap;\">Number of stop signs is 1<\/li>\n<\/ul>\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\">I only have one step \u2013 the verification step. I\u2019m checking the number of elements in the arrays \u2018TL\u2019 and \u2018Stop_Sign\u2019 (these arrays contain the IDs of all the traffic lights and stop signs in a scenario and is given as input to the \u2018Lights and Stop Signs ID\u2019 block). Add the following lines in the \u2018Test Sequence\u2019 Editor.<\/div>\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: center;\"><img decoding=\"async\" loading=\"lazy\" class=\"imageNode\" style=\"vertical-align: baseline; width: 636px; height: 138px;\" src=\"https:\/\/blogs.mathworks.com\/student-lounge\/files\/2022\/07\/July11_6.png\" alt=\"Capture7.PNG\" width=\"636\" height=\"138\" \/><\/div>\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: center;\"><span style=\"font-style: italic;\">Figure 7<\/span><span style=\"font-style: italic;\">: Test sequence editor<\/span><\/div>\n<h4 style=\"margin: 10px 10px 5px 4px; padding: 0px; line-height: 18px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 15px; font-weight: bold; text-align: left;\"><span style=\"font-weight: bold;\">Step 4: Link requirements to test case<\/span><\/h4>\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\">I need to add my first requirement to the created \u2018TL\u2019 test case in the current test suite.<\/div>\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\">Select \u2018Requirements\u2019 in Test Manager &#8211;&gt; Add &#8211;&gt; New Requirement &#8211;&gt; Document type as Requirement Set -&gt; Select previously saved requirement set <span style=\"font-family: monospace;\">.slreqx<\/span> file &#8211;&gt; Provide requirement ID.<\/div>\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: center;\"><img decoding=\"async\" loading=\"lazy\" class=\"imageNode\" style=\"vertical-align: baseline; width: 295px; height: 280px;\" src=\"https:\/\/blogs.mathworks.com\/student-lounge\/files\/2022\/07\/July11_7.png\" alt=\"dialogue2.png\" width=\"295\" height=\"280\" \/><\/div>\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: center;\"><span style=\"font-style: italic;\">Figure 9<\/span><span style=\"font-style: italic;\">: Add requirement to test case<\/span><\/div>\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\">In order to link the requirement to the test case, right click on the block &#8211;&gt; Requirements &#8211;&gt; Link to current test case. Make sure the required test case is selected in the test manager before linking.<\/div>\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\">Create the \u2018SS\u2019 test case to the test suite and add requirement #2 to it. The test harness created in Step 3.1 has verification logic for both the requirements, hence can be specified for both the \u2018TL\u2019 and \u2018SS\u2019 test cases. Follow the steps for adding and linking requirement to a test case.<\/div>\n<h4 style=\"margin: 10px 10px 5px 4px; padding: 0px; line-height: 18px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 15px; font-weight: bold; text-align: left;\"><span style=\"font-weight: bold;\">Step 5: Link requirements to subsystem<\/span><\/h4>\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\">In the requirements editor, select requirement &#8211;&gt; Right click &#8211;&gt;Link from subsystem. This makes sure that subsystems and test cases are correctly linked to the requirements and can be navigated form the requirements editor.<\/div>\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: center;\"><img decoding=\"async\" loading=\"lazy\" class=\"imageNode\" style=\"vertical-align: baseline; width: 628px; height: 339px;\" src=\"https:\/\/blogs.mathworks.com\/student-lounge\/files\/2022\/07\/July11_8.png\" alt=\"Capture8.PNG\" width=\"628\" height=\"339\" \/><\/div>\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: center;\"><span style=\"font-style: italic;\">Figure 10<\/span><span style=\"font-style: italic;\">: Linking requirements to block and test <\/span><span style=\"font-style: italic;\">case<\/span><\/div>\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\">The requirements editor now contains the test suite with two requirements. These are linked to a block and verified by a test case.<\/div>\n<h4 style=\"margin: 10px 10px 5px 4px; padding: 0px; line-height: 18px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 15px; font-weight: bold; text-align: left;\"><span style=\"font-weight: bold;\">Step 6: Verification and implementation<\/span><\/h4>\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\">Right click on the requirements in the Simulink requirement view &#8211;&gt; Check implementation and verification. This adds two tabs that show the status of that requirement.<\/div>\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: center;\"><img decoding=\"async\" loading=\"lazy\" class=\"imageNode\" style=\"vertical-align: baseline; width: 619px; height: 310px;\" src=\"https:\/\/blogs.mathworks.com\/student-lounge\/files\/2022\/07\/July11_9.png\" alt=\"Capture9.PNG\" width=\"619\" height=\"310\" \/><\/div>\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\">In order to run all the test cases and generate a test report, go to Test manager &#8211;&gt; Test browser &#8211;&gt; Check generate test report. Here you can select and fill in information that you want in your test report. Run all the test cases.<\/div>\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: center;\"><img decoding=\"async\" loading=\"lazy\" class=\"imageNode\" style=\"vertical-align: baseline; width: 554px; height: 280px;\" src=\"https:\/\/blogs.mathworks.com\/student-lounge\/files\/2022\/07\/July11_10.png\" alt=\"Capture10.PNG\" width=\"554\" height=\"280\" \/><\/div>\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\">The green check marks show which requirements passed which test case. The generated test report has all this information, along with plots on the status of requirements in each timestep.<\/div>\n<h2 style=\"margin: 20px 10px 5px 4px; padding: 0px; line-height: 20px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 20px; font-weight: bold; text-align: left;\">Summary<\/h2>\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\">In conclusion, we saw how to write requirements for a DSD scenario using requirements editor, create test cases using Simulink test, create test harness for requirements verification, and verify and validate requirements for all the test cases inside a test suite.<\/div>\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: center;\"><img decoding=\"async\" loading=\"lazy\" class=\"imageNode\" style=\"vertical-align: baseline; width: 254px; height: 316px;\" src=\"https:\/\/blogs.mathworks.com\/student-lounge\/files\/2022\/07\/July11_11.png\" alt=\"Picture2.png\" width=\"254\" height=\"316\" \/><\/div>\n<h2 style=\"margin: 20px 10px 5px 4px; padding: 0px; line-height: 20px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 20px; font-weight: bold; text-align: left;\">Learning Resources<\/h2>\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\"><a href=\"https:\/\/www.mathworks.com\/help\/slrequirements\/gs\/introduction-to-requirements-toolbox.html\"><span style=\"text-decoration: underline;\">Introduction to Requirements Toolbox<\/span><\/a><\/div>\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\"><a href=\"https:\/\/github.com\/mathworks\/requirements-based-testing-example\"><span style=\"text-decoration: underline;\">Requirements-based testing example<\/span><\/a><\/div>\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\"><a href=\"https:\/\/github.com\/mathworks\/requirements-advanced-checks-getting-started\"><span style=\"text-decoration: underline;\">Managing requirements and advanced checks<\/span><\/a><\/div>\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\">In case of any queries related to this blog please feel free to reach out to us at <a href=\"http:\/\/racinglounge@mathworks.com\">racinglounge@mathworks.com<\/a>.<\/div>\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\"><\/div>\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\"><\/div>\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\"><\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<div class=\"overview-image\"><img src=\"https:\/\/blogs.mathworks.com\/student-lounge\/files\/2022\/07\/July11_11.png\" class=\"img-responsive attachment-post-thumbnail size-post-thumbnail wp-post-image\" alt=\"\" decoding=\"async\" loading=\"lazy\" \/><\/div>\n<p>\nIn today\u2019s post, Akshra Ramakrishnan will talk about how to write functional requirements for a driving scenario made in Driving Scenario Designer, and write test cases to verify and validate these&#8230; <a class=\"read-more\" href=\"https:\/\/blogs.mathworks.com\/student-lounge\/2022\/07\/12\/requirements-verification-and-validation-for-an-autonomous-driving-scenario\/\">read more >><\/a><\/p>\n","protected":false},"author":183,"featured_media":8111,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[4],"tags":[291,189,153,623,620],"_links":{"self":[{"href":"https:\/\/blogs.mathworks.com\/student-lounge\/wp-json\/wp\/v2\/posts\/8141"}],"collection":[{"href":"https:\/\/blogs.mathworks.com\/student-lounge\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.mathworks.com\/student-lounge\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/student-lounge\/wp-json\/wp\/v2\/users\/183"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/student-lounge\/wp-json\/wp\/v2\/comments?post=8141"}],"version-history":[{"count":8,"href":"https:\/\/blogs.mathworks.com\/student-lounge\/wp-json\/wp\/v2\/posts\/8141\/revisions"}],"predecessor-version":[{"id":8165,"href":"https:\/\/blogs.mathworks.com\/student-lounge\/wp-json\/wp\/v2\/posts\/8141\/revisions\/8165"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/student-lounge\/wp-json\/wp\/v2\/media\/8111"}],"wp:attachment":[{"href":"https:\/\/blogs.mathworks.com\/student-lounge\/wp-json\/wp\/v2\/media?parent=8141"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/student-lounge\/wp-json\/wp\/v2\/categories?post=8141"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/student-lounge\/wp-json\/wp\/v2\/tags?post=8141"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}