question

Ali Asghar avatar image
0 Likes"
Ali Asghar asked Felix Möhlmann commented

Different Process time for different inter arrival time flow item

I want to develop a logic where I can have different process time for different flowitems that arrives in the model.


The source creates model based on uniform distribution(10,70), now I need my processor to process items based on this logic

1. If the interarrival time is >= 50 Process time is 50

2. If interarrival time >40, process time is 40

3. If interarrival time is <30 process time is 30


I am trying to use global table method but not able to develop it

FlexSim 19.0.0
processorsourcelogicinterarrival times
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

Felix Möhlmann avatar image
0 Likes"
Felix Möhlmann answered Felix Möhlmann commented

You can modify the code in the Inter-Arrivaltime field of the source to first determine the time value, then set the process time of the processor based on the generated value and only then return the value.

/**Custom Code*/
Object current = ownerobject(c); double interTime = exponential(0, 10, getstream(current)); Object processor = ...; if(interTime >= 50) {     getvarnode(processor, "cycletime") = 50; } else if(...) {     ... } else {     ... } return interTime;
· 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.

Ali Asghar avatar image Ali Asghar commented ·
Hi Felix, Thankyou for commenting but sorry I couldn't get it

Can you explain it


0 Likes 0 ·
Felix Möhlmann avatar image Felix Möhlmann Ali Asghar commented ·

The code in the interarrival time field of a source by default looks like this.

1729159573384.png

1729159259890.png

Most of it is markup used to generate the GUI for the properties window. Without we are left with just this: The statistical distribution which generates the value which is returned as the 'result' of the code.

1729159359557.png

This is the only point where we can know the interarrival time. So we inject some more logic in the code. Instead of directly returning the value from the distribution, we assign it to a variable and use it to set the process time of a processor. At the end we still need to return the value, so FlexSim knows when to schedule the next creation event.

1729159544924.png

0 Likes 0 ·
1729159259890.png (14.0 KiB)
1729159359557.png (8.2 KiB)
1729159544924.png (25.8 KiB)
1729159573384.png (4.2 KiB)