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

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 Phil BoBo ♦♦ commented ·

That should work fine. You would need to post an example model demonstrating the problem for us to be able to figure out why that isn't working.

0 Likes 0 ·
Sebastien avatar image Sebastien Phil BoBo ♦♦ commented ·

Here is a test model that replicates the issue.

Actually when I stop the model, the collecting time is updated, but when I continue running the model it sill displays 0. So the proposed solution is unfortunately not helping me.

Sink_test.fsm

0 Likes 0 ·
sink-test.fsm (33.8 KiB)
Benjamin W2 avatar image Benjamin W2 commented ·

Hi @Sebastian, was phil.bobo's or Matt Long's answer helpful? If so, please click the red "Accept" button on one of their answers!

0 Likes 0 ·
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:

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.

Sebastien avatar image Sebastien commented ·

@Matt Long. Thank you for the answer !

I did not notice the collecting time was not updating until the state changes. I will find a solution knowing that.

0 Likes 0 ·
Phil BoBo avatar image Phil BoBo ♦♦ Sebastien commented ·

When you use getTotalTimeAt(), it should account for the current state without having to explicitly change the state.

It seems to be working fine to me:

0 Likes 0 ·
1588610656708.png (157.4 KiB)