-1

How can I change draw a value from a distribution stored in a parameter during runtime?

Let's suppose my parameter value is "triangular (0.5 , 1 , 1.5)", for example. In my model, this parameter is called parDelayUnloading. I have many delays along my model that refer to the same parameter. I created this parameter because it is easier to change the values at only one place than doing it at each "delay". A value will be assigned when the simulation starts.

Note that I want the parameted value to be refreshed each time a a new entity enters the "delay" boxes. On enter: .....

What should I do?

Thank you!

Benjamin
  • 10,603
  • 3
  • 16
  • 28
Leo
  • 1
  • 2
  • you can change parameters by using their specific "set_" method. If your parameter is called "myParameter", then you can change it by calling "set_myParameter(...)" . In the argument, you can set a new triangular distribution or anything else you like. So call that in your "onEnter" block. (All can be found in the Help on Parameters ;-) ) – Benjamin Jan 30 '17 at 08:43
  • But it doesn't make sense to do that. Because it will always have the same distribution. I don't need to change the distribution I just need to get a new value of it. Well, if this is the only way to do it, I would prefer to write the distribution at the field "Delay time". Otherwise I would have set the parameter "on enter" and then read the parameter at "Delay time". – Leo Jan 30 '17 at 23:14
  • ah, you just want the entities to draw a different value from the distribution, I see. See answer below – Benjamin Jan 31 '17 at 07:25

1 Answers1

0

If you just want to draw values from your distribution, encoded into a parameter, all you need to do is to call the parameter at the appropriate Java code blocks. So if you need a value from it to be used for an entity on entering a delay block, you can write agent.whateverINeedItFor = myParameter. The latter automatically draws a value from your distribution.

Hope that makes sense.

Benjamin
  • 10,603
  • 3
  • 16
  • 28