MATLAB Answers

Store generated Entity type in Workspace

1 view (last 30 days)
Aldo Rapisarda
Aldo Rapisarda on 30 Jul 2020
Hello! I'm having some trouble with my simulink model: I have an entity generator that creates 3 different type of entity at each generation step (let's consider them as product 1,2,3 and so the entity type are 1, 2, 3).
Now, I would like to trace in the Workspace which is the type of entity that is generated in a specific point in time.
My output store correctly the intergeneration time (At start) and the Time in system, but I would like to add also which type of attribute is generated.
How can I solve this Issue?
Thanks, Aldo.

  0 Comments

Sign in to comment.

Answers (1)

Abdolkarim Mohammadi-Balani
You need a Simulink function, whose output port is connected to a "To workspace" block. Let's call this function RecordGenerationTime().
You also need a function to get the simulation time. This function contains a Digital clock block. Let's call this function GetSimulationTime().
In the Entry event action for all of the generators, you first get the current simulation time, and then record it:
CurrentSimulationTime = GetSimulationTime();
RecordGenerationTime(CurrentSimulationTime);
When Simulink is done executing the model, you can see the results in the structure created in the base workspace, which contains a timeseries object that contains the exact records for the generation times.

  0 Comments

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!