all test harness signals are initialized to the wrong values (ZEROS)

3 visualizzazioni (ultimi 30 giorni)
Issue: When i create a test harness for a specific subsystem, all the subsystem input ports signals shows up initialized to ZEROS in the test sequence - wrong initialization. I know i can change these initialization statements manually, but the system under test has more than a 100 signals which makes it tedious.
In the model, these signals are each associated with Simulink.Signal object where each initialized to a specific InitialValue. Note that the test sequence was able to the pull the datatype information for each signal from the workspace definition that is enforced by the non-virtual bus definition. refer to below as an example:
% SIGNALS OBJECTS
<SignalName> = Simulink.Signal;
<SignalName>.CoderInfo.StorageClass = 'ExportedGlobal';
<SignalName>.CoderInfo.Alias = '';
<SignalName>.CoderInfo.Alignment = -1;
<SignalName>.Description = '';
<SignalName>.DataType = 'auto';
<SignalName>.Min = [];
<SignalName>.Max = [];
<SignalName>.DocUnits = '';
<SignalName>.Dimensions = -1;
<SignalName>.DimensionsMode = 'auto';
<SignalName>.Complexity = 'real';
<SignalName>.SampleTime = -1;
<SignalName>.InitialValue = '1';
% BUS OBJECTS
elems(3) = Simulink.BusElement;
elems(3).Name = 'SignalName';
elems(3).Dimensions = 1;
elems(3).DimensionsMode = 'Fixed';
elems(3).DataType = 'boolean';
elems(3).SampleTime = -1;
elems(3).Complexity = 'real';
elems(3).Min = [];
elems(3).Max = [];
elems(3).DocUnits = '';
elems(3).Description = '';
how do I make test harness to pull/adopt the intial value information for each signal defined in the workspace upon its creation and set them in the initialization step of the test sequence.
Any help is appreciated; thank you in advance!

Risposte (1)

Fangjun Jiang
Fangjun Jiang il 1 Lug 2020
Find the source of the signal in the model (the output of a Gain block or could be a root level Inport block, where the signal is originated), right click the signal line, select properties, the signal label should be the same as the signal name, check the "signal name must resolve to Simulink data object". That is how the signal properties (including data type and initial value) are linked to the Simulink.Signal object.
  4 Commenti
Yamen
Yamen il 4 Lug 2020
Modificato: Yamen il 4 Lug 2020
Attached is an example that explains the context of "subsystem", "test harness", "test sequence", and decribe what my issue is.

Accedi per commentare.

Prodotti


Release

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by