Clear Filters
Clear Filters

Model based Software Development-How to?

8 views (last 30 days)
Gary on 25 Jul 2022
Answered: Ronald on 2 Aug 2023
I have to design an embedded system that takes in 75 digital inputs and generates 40 outputs. The system interacts with the outside world through LAN. In my current design, I am using Wiznet hardware TCP/IP module, which uses all 4 sockets. I understand that no simulink model is currently available for the LAN module. My software team has already developed the requisite driver for this module and we are ready to test. Before prototyping, I was interested to simulate all of these in matlab. Could anybody help of how to get started.
btw: I need the procedure for complete workflow for design and automated verification using test cases (script based) and generate C code after testing

Answers (1)

Ronald on 2 Aug 2023
To get started with model-based software development for your embedded system using MATLAB, you can follow the workflow outlined below. This approach allows you to design, simulate, and automatically verify your system using test cases before generating C code.
System Requirements and Architecture:
Clearly define the requirements for your embedded system, including the desired behavior, input-output mappings, and performance constraints. Design the system architecture, considering the number of digital inputs and outputs, as well as the integration of the LAN module.
Simulink Modeling:
Create a Simulink model to represent your embedded system. Use Simulink blocks to represent the various components, including the digital inputs, outputs, and the LAN module. Implement the driver for the LAN module using MATLAB Function blocks or S-Functions.
Interface Design:
Define the interfaces between the digital inputs/outputs and the LAN module in your Simulink model. Map the inputs/outputs to the appropriate signals in the LAN module.
Test Case Generation:
Define a set of test cases that cover various scenarios and edge cases for your system. Write test case scripts using MATLAB to simulate different input conditions and verify the expected output behavior. Use MATLAB's scripting capabilities to automate the execution of these test cases.
Simulation and Verification:
Run the simulation using the defined test cases to verify the behavior of your system. Monitor the digital inputs, outputs, and LAN module behavior during the simulation to ensure correctness. Analyze the simulation results and compare them with expected outcomes from the test cases.
Code Generation:
Once your Simulink model and test cases are validated, you can proceed with code generation. Use the Simulink Coder to generate C code from your validated Simulink model. Configure the code generation settings according to your target hardware and requirements. Verify the generated C code using additional test cases if necessary.
Hardware Implementation:
Take the generated C code and integrate it with your hardware platform. Compile and build the code for your target hardware. Flash the firmware onto the embedded system.
Testing on Hardware:
Test the functionality of your embedded system on the hardware platform. Use the same test cases developed during simulation to verify the behavior of the system in a real-world scenario.
By following this workflow, you can leverage MATLAB's Simulink modeling capabilities, simulation environment, and code generation tools to design, simulate, and validate your embedded system before prototyping and deployment. If your experience does not allow you to implement this, you can seek help from software development specialists


Find more on Test Model Components in Help Center and File Exchange




Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!