Which data type use System composer to simulate

I'm using System Composer to model a system and test his requirement. I've done the architecture with System Composer and the requirement with Simulink and Excel. Now I want to simulate my model to do that I've to mapp my Input of the top level:
System composer -> Model Explorer -> Configurations -> Data Import -> Connect Input -> Signals -(Scenario ->from model)> Save to ".mat" file. Then I choose Map by Port order. But I received the following error:
Input data ('RserieMatx1.getElement(1)') loaded by In Bus Element block 'ReSerie/R_i' must be a scalar structure with scalar SimulationDatastore, timeseries, or timetable objects at the leaf nodes or an object derived from Simulink.SimulationData.BlockData whose Values field is a structure that meets those requirements.
It says it has to be a scalar structure with scalar simulationDatastore, timeseries... I've tried to do a vector with type "timeserie"
ts1 = timeseries((1:5)','Name','MyTimeSeries');
But the errors stays. Also which data type must I use to mapp and the simulate?
Thank you for your answer

Respuestas (1)

Raj Tarikere Phaniraja Setty
Raj Tarikere Phaniraja Setty el 16 de Dic. de 2020
Editada: Raj Tarikere Phaniraja Setty el 16 de Dic. de 2020
I understand that there is an issue with connecting the timeseries object as an input to the simulation.
I suspect that the issue is arising because the timeseries object is not wrapped in a bus object and the data type of the input port is not changed to handle bus types.
Kindly make sure to follow these steps to resolve the issue:
  1. Create a Simulink.Bus object which has the same structure as that of the time series data.
ts1 = timeseries((1:5)','Name','MyTimeSeries');
myBus = Simulink.Bus
  1. Open the bus editor or programmatically add a bus element to bus 'myBus' with the matching name ‘MyTimeSeries
  2. Go to the ‘Model Explorer’ and change the datatype of the input port to be of type ‘Bus: myBus
  3. Go to the ‘Root Inport Mapper’ dialog from the ‘Configuration Parameters’ window by clicking on the ‘Connect input’. Then select ‘From Workspace’, choose the bus object from which needs to be mapped and save it as a MAT file on the disk
  4. Choose ‘Port Order’ as the preferred way of mapping as others won’t work and say ‘Map to Model’ and choose ‘Map All’ or ‘Map Selected’
A green tick is shown in the ‘Root Inport Mapper’ dialog saying that the inputs are connected if all the steps are followed properly.
More information on how to import structures of matlab timeseries objects through a root level input port can be obtained here:

Categorías

Más información sobre System Composer en Centro de ayuda y File Exchange.

Productos

Versión

R2019b

Preguntada:

el 4 de Dic. de 2019

Editada:

el 16 de Dic. de 2020

Community Treasure Hunt

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

Start Hunting!

Translated by