question

Gabriela Gomes avatar image
1 Like"
Gabriela Gomes asked Gabriela Gomes commented

How can I use probability distributions in the FloWorks source?

I tried to insert the variability of the fluid amount in the trigger “On Output Amount”-> “Set Flow Trigger Interval” and also the “Change Max. Flow Rate”, but I believe it’s not working, because the Output Rate continues the same. How can I add a stochastic measure to represent a variable inflow rate?imagem-2023-10-03-180117537.png

FlexSim 23.1.1
sourceFloWorksprobability distribution
5 |100000

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

Kavika F avatar image
0 Likes"
Kavika F answered Gabriela Gomes commented

Hey @Gabriela Gomes, you can set the flowrate of a Source by setting the source's output maxRate through FlexScript.

FlowObject source = Model.find("Flow Source1");
source.output.maxRate = uniform(1, 100, getstream(source));

I made a simple model with this script that demonstrates this behavior.

source-output.fsm

You can apply this script to a ProcessFlow that spawns a token every X seconds to run a custom code with this script so the flow will change periodically without your input needed.


source-output.fsm (37.0 KiB)
· 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.

Gabriela Gomes avatar image Gabriela Gomes commented ·
Thank you! Applying it to a Process Flow, I managed to make the rate change!
0 Likes 0 ·
Mischa Spelt avatar image
1 Like"
Mischa Spelt answered Gabriela Gomes commented

Hi Gabriela,

The "On Output Amount" trigger is meant to be used together with a "Set output trigger". For example, in the On Reset event or another event, you can set

source.output.triggerAmount = 1000;  // (1)
// or
source.output.triggerInterval = 1000; // (2)

And then FloWorks will run the code in the On Output Amount event after the source has released 1000 units of flow. If you use option (1) the event will only fire once, option (2) will continue firing it after output of 1000, 2000, 3000, etc. Instead of using code, you can also use the Set flow trigger Process Flow activity to set the trigger amount, then use a Wait for Event or Event Triggered Source to wait for the amount.

So this is useful if you want to switch rates each time after a certain amount of flow. To switch after a certain amount of time you can use the solution that @Kavika F provided. Note that you don't even have to write code, you can use the Set Maximum Flow activity that FloWorks provides:

1696842543931.png



1696842543931.png (33.4 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.

Gabriela Gomes avatar image Gabriela Gomes commented ·

Thank you, Mischa! In case of a continuous flow coming through, how can I set the Inter-arrival time of the Source? The "Source" box in the process flow has a statistical distribution arrival, but in this case is always there, and the flow that changes.

1697634064519.png

0 Likes 0 ·
1697634064519.png (16.3 KiB)
Mischa Spelt avatar image Mischa Spelt Gabriela Gomes commented ·
​Hi Gabriela,

If I understand your question correctly, you're looking to continuously change the maximum flow rate (like an acceleration of the flow)? Unfortunately that's not possible in FloWorks. You can make the inter-arrival time of your Process Flow source very small and approximate a continuous change, but that will slow down the model. We usually model ramp-up and ramp-down of flow using an average (e.g. if you ramp up from 0 to 100 L/h over 30 minutes, set the flow rate to 50 L/h for that duration then bump it up to 100 after that). If you can share a bit more about your use case we'd be happy to think about a specific solution


0 Likes 0 ·
Gabriela Gomes avatar image Gabriela Gomes Mischa Spelt commented ·
Yes, that's what I was looking for! But no problem. Thank you!! I'll try to work with the solution of reducing the inter-arrival time to approximate a continuous change, .
0 Likes 0 ·