Simulink block warning suppression for identifier 'Simulink:​blocks:Ass​ertionAsse​rt' does not work.

10 visualizzazioni (ultimi 30 giorni)
Hello,
I am trying to use Simulink/Model Verification/Assertion block with Simulink Test because it is treated like a verify() function and In fact it does not require Simulink Test license, so other team members can still benefit from that.
The only drawback is that it produces warning every time the assertion fails and reports are spammed with those. Then I would like to suppress the warning. This works:
warning('off', 'Simulink:blocks:AssertionAssert')
but for all asserts in this Matlab session. There is selective suppression per block:
Simulink.suppressDiagnostic(gcb,'Simulink:blocks:AssertionAssert')
but it results in error: "The message identifier Simulink:blocks:AssertionAssert cannot be suppressed.". This is the same answer for all unknown identifiers. Is there another way to do that?

Risposte (1)

Pavan Guntha
Pavan Guntha il 15 Nov 2021
Hello Piotr,
You could supress the warnings from Assertion blocks in a Simulink model by disabling the Assertion for those blocks. The following example illustrates this process. Consider the following model (assertion_blocks.slx) where there are 2 assertion blocks:
In order to suppress the assertion warnings from these blocks, the following can be done:
% Open the Simulink model
open_system('assertion_blocks')
% Find all the Assertion blocks in the model
list = find_system('SearchDepth',1,'BlockType','Assertion')
% Set the 'enabled' property of the Assertion blocks to 'off'
set_param(list{1}, 'enabled', 'off') % Suppress warnings from 'Assertion' block
set_param(list{2}, 'enabled', 'off') % Suppress warnings from 'Assertion1' block
In this manner you could suppress the warnings from few specific Assertion blocks as required.
For more information, you could look at the documentation pages of find_system, set_param and assertion.
Hope this helps!
  1 Commento
Piotr Kluczek
Piotr Kluczek il 9 Dic 2021
Hello Pavan,
I already knew that - if I disable Assertion I will not get a warning. I could even do that without the script anyway.
But I will not get the verify() alike behavior either, so that is not the point
Maybe you will come up with other ideas.

Accedi per commentare.

Categorie

Scopri di più su Programmatic Model Editing in Help Center e File Exchange

Prodotti


Release

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by