How to use Test Sequence as a function call for a test harness
10 views (last 30 days)
I'm trying to create a test harness using the "Add scheduler for function-calls and rates = Test Sequence". When I create the test harness, some default code is implemented in the test sequence code :
%% Initialize data outputs.
a = single(0);
b = false;
If I add more setp to my test sequence I get teh following error:
- Input port 'D1[0.02]' of Model block 'Model' must be executed periodically when it is activated (enabled) by its function-call initiator when the Model block has the 'Show model periodic event ports' parameter selected. The function-call initiator connected to input port 'D1[0.02]' did not execute the Model block on time step '0.02'.
The only way I found to make the test harness run is to add the "send(D1);" command in every step of the test sequence..
What is the correct way to use a test sequence as a function call in a test harness ?
Thanks for your help !
Swetha Murali on 19 Jul 2022
Edited: Swetha Murali on 19 Jul 2022
It seems to me from the image that you posted of the step that the same Test Sequence Block is being used to schedule and drive your inputs. If you want to use the same block for both of these purposes, then yes, you do need to add a "send" to each step.
If you use the above recommendation made by Pat Canny/Rong Mi, the inputs and function calls will be separated in two different Test Sequence blocks and the function call won't have to be triggered again and again when you add additional steps to configure your inputs.
More Answers (1)
Pat Canny on 19 Jul 2022
Hi @ambre allard,
My colleague @Rong Mi has a great suggestion:
Similar as Chart, Test Sequence also supports “send” to schedule function call. Both of them can be used as the function scheduler. In the example of how to schedule using Stateflow, if “Test Sequence” is selected, (Please see the below image), the automatically generated Test Sequence caller in the harness model will be configurated to use “send”. This example how to schedule using Stateflow can be re-used to explain Test Sequence use case.
Hopefully this helps. Thanks.