question

Sebastien avatar image
0 Likes"
Sebastien asked Sebastien commented

How to get process time of an instance from its tree ?

Hello !

I would like to store the total processing time of each instance of my machines.

I used to do it with a statistics collector but all the state times are already registered in each instance's tree under the path: "instance/stats/state_current/profile".

Is it possible to access the processíng time stored in the instance's tree from the model, for instance from the instance's Exit trigger ?

Best regards,

timestatestree
5 |100000

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

1 Answer

·
Joshua S avatar image
1 Like"
Joshua S answered Sebastien commented

You can use this code

executefsnode(getvarnode(Model.find("Processor1"), "cycletime"),0);

The node for processing time is a script node, so this executes the script in that node and returns the processing time, but only if the processing time was a set number, not based off the item's type or such. If the processing time is constantly changing, then in the code for the processing time, tell it to change a label on the processor and read that label on the instances exit trigger.

· 9
5 |100000

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

Sebastien avatar image Sebastien commented ·

@Joshua S

I actually meant the processing time in the stats node.

Can it also be retrieved ?

0 Likes 0 ·
processingtime.png (34.8 KiB)
Phil BoBo avatar image Phil BoBo ♦♦ Sebastien commented ·
Object processor = Model.find("Processor1");
return processor.stats.state().getTotalTimeAt("processing");
From the On Exit trigger:
current.stats.state().getTotalTimeAt("processing")
1 Like 1 ·
Sebastien avatar image Sebastien Phil BoBo ♦♦ commented ·

Great ! Thank you phil ! I did not know of the method.

0 Likes 0 ·
Show more comments
Gabriel Morgante avatar image Gabriel Morgante commented ·

@Joshua S

You said "If the processing time is constantly changing, then in the code for the processing time, tell it to change a label on the processor"

How would I do that?

Thanks!

0 Likes 0 ·
Joshua S avatar image Joshua S Gabriel Morgante commented ·

This picture illustrates what I was referencing. In this case an item coming in already has a label on it that is changing the Process time, but in the code for the Process Time, you can add a line, in this case

current.ProcessTime=item.ProcessTime;

0 Likes 0 ·
capture.png (237.7 KiB)
Gabriel Morgante avatar image Gabriel Morgante Joshua S commented ·

@Joshua S

Thanks for the quick answer!

What if I have a situation of 'process time by case' where for every case I have a statistical distribution?
What I want is to get the process time value generated by the distribution so I can use it to change a keyframe variable for the animation of the processor.

In the end what I'm trying to accomplish is to make a progress bar that works for any time generated by the process time distribution...

0 Likes 0 ·
Show more comments

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.