Clear Filters
Clear Filters

How add timestamp to entities upon creation and determine arrival times upon arrival.

5 views (last 30 days)
All,
I want to measure delays of entities flowing through my model in simulink. The idea is to add a timestamp as an attribute to an entity when created and at the end of this entity's journey i need to record its arrival time. Using both, I can determine its travel time or delay.
Is there a clever way to measure these two timings, e.g. use a timestamp?
Your help is much appreciated,
Frank

Answers (1)

Umar
Umar on 25 Jun 2024
Moved: Walter Roberson on 25 Jun 2024
Hi Frank,
You can indeed utilize timestamps to measure the creation and arrival times of entities. One clever way to implement this is by incorporating MATLAB functions within your Simulink model. You can use MATLAB functions to generate timestamps when entities are created and record their arrival times at the end of their journey.
Here is a step-by-step guide on how you can achieve this:
1. Create a MATLAB function block within your Simulink model. 2. Use the MATLAB function block to generate a timestamp when an entity is created. You can utilize MATLAB's clock function to obtain the current time. 3. Pass this timestamp as an attribute to the entity. 4. At the end of the entity's journey, use another MATLAB function block to record the arrival time by generating another timestamp. 5. Calculate the travel time or delay by subtracting the creation timestamp from the arrival timestamp.
By following this approach, you can effectively measure the delays of entities flowing through your Simulink model with precision and accuracy using timestamps. I hope this guidance helps you in implementing a clever way to measure these two timings in your Simulink model. If you have any further questions or need additional assistance, feel free to ask.
  3 Comments
Umar
Umar on 26 Jun 2024
Hi Frank, In Simulink, when using MATLAB functions to generate timestamps for entity creation and arrival times, you do not need to explicitly call the MATLAB function created for timestamp generation within the entity creation block. The timestamp generation and recording processes can be handled within separate MATLAB function blocks in the Simulink model. By following the outlined steps, you can efficiently generate and record timestamps without the need for direct calls within the entity creation block.

Sign in to comment.

Categories

Find more on Messages in Help Center and File Exchange

Products


Release

R2017b

Community Treasure Hunt

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

Start Hunting!