question

Beatriz Spaggiari avatar image
0 Likes"
Beatriz Spaggiari asked Beatriz Spaggiari commented

Statistics Collector - event fired when label change

I need help creating a statistics collector to search for information about a label in a 3D object. I want to build a table with the total time that the label holds at each of the values assumed by it. When the current value changes, the statistics collector should collect the time the new value stays actived and so on, updating the times as label value changes. Reinforcing that the label must be traced on the 3D object and not on the item.

If anyone can help me, thank you very much!

labelsstatistics collector
· 3
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

zacharyh avatar image zacharyh ♦ commented ·

Do you have a model that you are working on that you could share for this problem?

0 Likes 0 ·
Beatriz Spaggiari avatar image Beatriz Spaggiari zacharyh ♦ commented ·

Yes, but it`s a litlle complex to share my model. If there is a way to do this in generic way, or in a simple exemple model, it will help a lot!

0 Likes 0 ·
Braydn T avatar image Braydn T Beatriz Spaggiari commented ·

@Beatriz S3

Did this answer help you? If so, could you please accept it? If not, could you let us know what else we can do to help you? Thanks!

0 Likes 0 ·

1 Answer

·
Jordan Johnson avatar image
0 Likes"
Jordan Johnson answered Beatriz Spaggiari commented

The first step is to make your label a Tracked Variable label. A Tracked Variable fires an "OnChange" event, where regular labels do not. To add this kind of label, you can use the quick properties view:

Once you have added this label, click on the label in the quick properties, then click the "Edit" button that appears:

edit-tv-label.png

Make sure to set it's type to Categorical, and that you check the "Use Profile" box. By making a Tracked Variable, you can listen to the OnChange event. By making it categorical, and by tracking the profile, you can ask how long the label has been set to a certain value.

In the attached example model, I have also added a trigger to the processor, to set the tracked variable label to record the type of the item on the processor.

At this point, what to do next depends on what kind of table you want. I have added two kinds of tables in the attached model. One reports the time that the Tracked Variable changes state, and how long it was in that state. The other simply asks the tracked variable how long it has been in each state, and reports that value in columns.

You can investigate the attached model to see how both are made. If you need something different, comment on this answer.

time-at-value-demo.fsm


· 1
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Beatriz Spaggiari avatar image Beatriz Spaggiari commented ·

Thank you!! That was what I needed :)

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.