question

Sebastien avatar image
0 Likes"
Sebastien asked Benjamin W2 commented

How to get the collecting time of a process flow Sink from its tree ?

Hi,

I asked this question before for getting the processing time of a Process Flow instance of a FixedResource from its tree.

https://answers.flexsim.com/questions/63315/how-to-get-process-time-of-an-instance-from-its-tr.html

I got a very good answer from @phil.bobo and now i am trying to do the same for getting the collecting time of a custom Process Flow Sink. For that I just modified a FixedResource to make it destroy all objects getting in and set its state to "collecting".

I tried using the same method

  1. current.stats.state().getTotalTimeAt("collecting")

but it returns 0 although the collecting time in the tree has a positive value. The tree looks like this on reset:

How should I proceed for getting the collecting time of a custom Sink via FlexScript ?

Best regards,


FlexSim 20.0.1
process flowflexscriptflexsim 20.0.1
sink-collecting.png (11.5 KiB)
· 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.

Phil BoBo avatar image
0 Likes"
Phil BoBo answered Phil BoBo edited

I'm not sure why passing the category as a string isn't giving you back the result you are looking for, but you can work around it by passing the state number:

  1. current.stats.state().getTotalTimeAt(STATE_COLLECTING)

I'll add a case to the dev list to look into it.

5 |100000

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

Matt Long avatar image
0 Likes"
Matt Long answered Matt Long rolled back

@Sebastian Using FlexSim 2020 using the getTotalTimeAt() seems to be working fine. It calculates the current time at that state, even though the value in the tree may show 0. The tree value only updates when the object changes states or when the model stops.

If your'e trying to get the total time between the first flowitem that enters the Sink and some other flowitem entering, you can add a Wait for Event activity and listen to the Sink's OnEntry trigger to record that information.

I hope this helps!

· 2
5 |100000

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