question

Daniel avatar image
0 Likes"
Daniel asked Daniel commented

can I set the inter arrival time by using flexscript?

Hello, I would like to know if it is possible to set the inter-arrival time using FlexScript. If yes, could you provide some guidance? Thanks a lot!

FlexSim 24.2.1
flexscriptinter-arrival time
· 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.

Sebastián Cañas avatar image Sebastián Cañas commented ·
@Daniel ,

Are you looking to change the inter arrival time in a 3D source or a Process Flow activity?

0 Likes 0 ·
Daniel avatar image Daniel Sebastián Cañas commented ·

Is in a 3D source, thanks!

0 Likes 0 ·

1 Answer

Joerg Vogel avatar image
0 Likes"
Joerg Vogel answered Daniel commented

You can read a node value. This can be tree node, label, table cell and so on. This value can you change. When ever an item is leaving your source, then next inter arrival will be read and an event is created in the event list. You can alter such written events by commands.

· 7
5 |100000

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

Felix Möhlmann avatar image Felix Möhlmann commented ·

The inter arrival time can be set through the "setProperty()" method.

For example:

  1. Object source = Model.find("Source1");
  2. source.setProperty("InterArrivalTime", 2.71);

You can check the documentation for object properties that can be changed this way. Or, what I often do, check out which properties exist by looking at the columns available in an object property table.

1733385593672.png

0 Likes 0 ·
1733385593672.png (23.8 KiB)
Daniel avatar image Daniel Felix Möhlmann commented ·

Thank you so much for providing the method to set the InterArrivalTime property using setProperty. It works perfectly when setting it to a fixed number like 2.71.

However, I would like to set it to a dynamic function, such as exponential(0, 10, getstream(current)), to allow for variability in the inter-arrival times. Could you please guide me on how to achieve this? Is there a specific way to pass such expressions into setProperty, or is there an alternative approach I should use?

Thank you again for your assistance!

0 Likes 0 ·
Felix Möhlmann avatar image Felix Möhlmann Daniel commented ·

You can put the distribution into the function as a string. But since this will overwrite the code header, you need to derive "current" how it would normally be done in the header

  1. object.setProperty("InterArrivalTime", "exponential(0, 10, getstream(ownerobject(c)))");

Instead of setting the time as a property you could of course also just write code that takes parameters from somewhere else in the model (for example labels on the source) and then you change those.

0 Likes 0 ·
Show more comments
Show more comments