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

1 次查看(过去 30 天)
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.

回答(1 个)

Kothuri
Kothuri 2024-4-24
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.

类别

Help CenterFile Exchange 中查找有关 Dependency Analysis 的更多信息

产品


版本

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by