Hi.
I'm Mukul Choudhury And I'm a developer
working on Simulink solutions for TI C2000 processors.
Embedded Coder support package for TI C2000 processors
enable you to generate optimized code,
create real time executable, and download it
to TI C2000 development boards.
You can also run your algorithm in External Mode
and do back-to-back testing using SIL or SIL Workflow.
In this video, I would like to present the use of TI C2000
processors to verify the numerical equivalence
of the simulation and code generation results
as required by the ISO 26262 or DO-178 for certification.
For this, I'm going to use the ISO 26262 project shipped
as part of the IEC Certification Kit
along with F28379D LaunchPad.
Type iso26262CaseStudyStart in the MATLAB command window.
Go to the Live Editor.
It shows the Highway Lane Following project
and shows the user Simulink that a model-based design workflow,
at various stage of the ISO 26262 project.
Click on the link, Functional Verification
Using MIL Simulation.
It takes you to the link for the test file
for ControllerModeSelector.
ControllerModeSelector is a subsystem
of the Highway Lane Following model,
for which we are going to run our PIL and SIL workflow.
Before running the test, we need to configure the model
for the target on which the generated code would execute.
Go to this Arrow and click on it to open the model.
On the Modeling tab, click on Model
Settings to open the config set.
This uses a reference config set.
Click on the Gear button to have an editable copy.
In the Hardware Implementation tab,
you find the list of TI Hardware Boards
that we are currently supporting.
Select TI Delfino F28379D LaunchPad
as part of Hardware selection some settings
are done automatically, like Support long, long is checked.
In the Optimization tab, remove root level I/O
zero initialization is unchecked.
Maximum stack size is selected depending upon the processor,
which is 1024 in this case.
In the Interface tab, TI C28x library
is used to replace the math functions
with TI-optimized functions.
In Math and Data Types, Simulation behavior
is changed to Flush To Zero.
And default for underspecified data type is changed to single.
Next, ensure that the serial port required
during serial communication for PIL
should match the COM port in the Device
Manager for the target hardware connected to your system.
Here, we see that the COM9 is the matching COM port.
Also ensure that the enabled portable wordsizes
is checked in the Verification tab
under Code Generation in Config set.
Just note, this setting is required only
for Software-in-the-Loop method.
You must ensure that your model does not
use any double data type.
Because all targets from TI, except F28x,
is either FPU 32 or fixed point.
And TI compiler in code format interprets double data type
as 32-bit float.
The inputs to the subsystem has a data type
of Acceleration DType, which has a value of double
by default. In order to change it to single,
go to the Modeling, Model Explorer,
and change the value of Acceleration DType to single.
Once you make this change, you're
ready to run your model in SIL or PIL mode.
Go to the SIL/PIL app and change the SIL/PIL mode
to Software-in-the-Loop and click on Run Verification.
A Software-in-the-Loop simulation compiles simulated
source code and executes it as a separate process on the host
computer.
It compares the normal simulation results
with the SIL simulation results.
In this way, we can test the numerical equivalence
of the model and the generated code.
In order to qualify the above method,
let us now run a Test Case on the same model.
In the Test app, click on Add Test Harness.
It creates a Test Harness with the top model
as model referenced with a set of inputs and outputs.
Now, in the Harness tab, select the Test Harness
that you have recently created.
Also ensure that the inputs do not use any double data type.
Select Required and put the Data.mat file and click
on the Edit button.
In the Signal Editor window that appears,
change the data type of the variables that
use double data type, for example, Acceleration
and Deceleration.
Once you make this change, go to the Signal Editor
and Save the changes.
Also ensure that the baseline data, with which the results
are going to be compared with, do not
use any double data type.
Next, in the Simulation Settings and Release Overrides,
change the Simulation mode to the Software-in-the-Loop.
Next, in the Test Browser, Right-Click and run the test.
We find that the tests have the baseline criteria.
However, the coverage is not 100%.
In the coverage report, we find the expression
that has been covered.
That is the saturation block.
Moreover, the entire range of expression
has not been exercised.
In order to enhance coverage, let us now
run the second set of tests.
After ensuring the same set of conditions for the second set
of tests, let us now run it.
We find that the second test of tests
have also passed with 100% good coverage.
Next, let us run the same model in PIL mode.
For that, go to the SIL/PIL tab and change the SIL/PIL mode
to Processor-in-the-Loop and click on Run Verification.
It will generate code for the top model
and deploy it on hardware.
It will compare the results that is obtained from the hardware
through serial communication with the simulation results.
In this way, we can test the equivalence of the target
object code and the model.
Next, let us run the same set of test cases, which we had
run for SIL, in the PIL mode.
In order to do that, come to the Test Manager
and change the Simulation mode to PIL.
And then run the Requirement Test and Interface Test.
We see that both the tests have passed,
similar to the SIL mode.
It is important to note here that running
the same set of tests in SIL and PIL mode
is a form of back-to-back testing.
Successfully passing of these tests
ensuring numerical equivalence of the model and target
object code.
Next, I present the Comparison report between the model .c
file for SIL and PIL.
We see they are identical without any differences.
Similarly, there are no differences in model .h file.
Another important point is that there are no hardware related
code in the model .c and model .h files.
This is how we can use TI C2000 processors
for certification activities.
Thank you for listening.