Simulink model: Invalid data type for root level port

34 visualizaciones (últimos 30 días)
Nafalai
Nafalai el 17 de Nov. de 2021
Editada: Andy Bartlett el 17 de Nov. de 2021
Hi!
I am developping a Simulink model calling another model which is composed of 12 "In" blocks and 4 "Out blocks".
One of the "In" block takes for input a matrix.
The called model calls this variable ("REEC") as such:
And my model calls this variable as such, also with an "In" port block and a Data Type Conversion, from double to single.:
I initialised my input variable "input_REEC" to be a 51x43 double matrix and added it to the input tab in Simulation > Model Configuration Parameters > Data Import/ Export
  1. If I run my simulation as such (input as double then converting it to single), I get the following error:
Invalid data type for root level port 'test_new_version_model_Switch/REEC' external data.
The root level input port is set to use data type 'single' but the external data is an array of type 'double'.
To load external data of non-double data type, change the external input to use structure format,
timeseries format, or disable loading of external input.
Loading of external inputs is disabled by going to the Simulation menu and selecting Configuration Parameters.
On the Data Import/Export page, locate the Load from workspace group and uncheck the Input checkbox.
2. If I run the simulation without the data type conversion (input as double and leaving it as such), I get the exact same error
Invalid data type for root level port 'test_new_version_model_Switch/REEC' external data.
The root level input port is set to use data type 'single' but the external data is an array of type 'double'.
To load external data of non-double data type, change the external input to use structure format,
timeseries format, or disable loading of external input.
Loading of external inputs is disabled by going to the Simulation menu and selecting Configuration Parameters.
On the Data Import/Export page, locate the Load from workspace group and uncheck the Input checkbox.
3. If I run the simulation with first transforming the input_REEC from double to single before starting the simulation (input_REEC = single(input_REEC), I get the error:
Unsupported input format. Available formats include: (1) a double non-complex matrix, (2) a structure with
or without time, (3) a MATLAB timeseries object, (4) a structure with MATLAB timeseries objects at all
leaves (for bus input), (5) a Simulink.Timeseries object, (6) a Simulink.TsArray object (for bus input).
All formats require the data to be finite (not Inf or NaN).
Would anybody know how to solve this by any chance?
Thank you very much!

Respuesta aceptada

Andy Bartlett
Andy Bartlett el 17 de Nov. de 2021
Editada: Andy Bartlett el 17 de Nov. de 2021
I suspect your inport "REEC" is not explicitly specifying its data type and is inheriting data type single via Simulink underspecified data type propagation rule.
To see the actual data type for REEC, go to information overlays and turn on "Base Data Types".
I suspect that will show something like this.
If so, you need to explicitly set the data type of the root inport to agree witht the data type you are feeding in from external data.
FYI: If you open the model's configuration parameters dialog (Ctrl-E) and search for "underspecified", then you'll find a diagnostic you can set to "warning" to alert you to underspecified data types.

Más respuestas (0)

Categorías

Más información sobre Configure and View Diagnostics en Help Center y File Exchange.

Productos


Versión

R2014b

Community Treasure Hunt

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

Start Hunting!

Translated by