Clear Filters
Clear Filters

How do we test mask Constraints in Simulink in a production environment

5 views (last 30 days)
In Simulink Mask,we're able to constrain the Mask parameters, how excatly are we suppsed to test that this works in a production enviroment where repeatable tests required.
we could include use Simulink Test("Set_param" function), but that breaks the simulation whenver the constrain is violated during runtime, which defeats the purpose of simulink test.

Answers (1)

Kothuri
Kothuri on 24 Apr 2024
Hi Kamal,
To test the mask parameters constraints in a production environment where repeatable tests are required, you can try to involve a strategy that ensures that the parameters are within the defined constraints without causing simulation failures during the runtime.
When using set_param with the Simulink Test, it directly sets the parameter value and leads to simulation errors or termination when there are constraints violations.
You can try the following methods:
  • By using mask initialization script (in which you can include a MATLAB code that checks if the parameter is within the specified range and if not sets it to the default value), these constraints can be enforced programmatically. This script runs whenever the mask parameters change and helps to validate the parameters to ensure they adhere to the constraints.
  • By creating a Parameter Setup which includes a MATLAB code that checks the constraints defined in the mask before running the simulations. This code can be made part of the custom setup function in the test suite which ensures all the parameter values are valid before the start of simulation.
  • Integrate the testing process into a CI(Continuous Integration) pipeline using MATLAB's Continuous Integration tools (e.g., MATLAB Project). This ensures that parameter constraints are automatically validated every time changes are made, and thereby maintaining the integrity of the production environment.
In this way you can test the mask parameter constraints in Simulink Test.
You can refer the below documentation on Mask Parameters using Constraints.

Categories

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

Products


Release

R2023b

Community Treasure Hunt

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

Start Hunting!