How to use Test Sequence as a function call for a test harness

33 次查看(过去 30 天)
Hi everyone,
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 :
Run
%% Initialize data outputs.
a = single(0);
b = false;
send(D1);
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
Swetha Murali 2022-7-19
编辑:Swetha Murali 2022-7-19
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.

更多回答(1 个)

Pat Canny
Pat Canny 2022-7-19
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.

类别

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

产品


版本

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by