How add timestamp to entities upon creation and determine arrival times upon arrival.
5 次查看(过去 30 天)
显示 更早的评论
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
0 个评论
回答(1 个)
Umar
2024-6-25
移动:Walter Roberson
2024-6-25
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 个评论
Umar
2024-6-26
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.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Messages 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!