Page 1 of 1

Problem with Percentages

Posted: Monday 29 December, 2014 - 18:52
by Whitefang
Hello.

I'm starting with Enterprise Dynamics but I have a question (sorry if it's answered somewhere, but i couldn't find it): I have a server that is communicated with 3 other servers (the output of the first one must go to the others following some percentages).

I try it using the "percentages option", but it reffers to only 2 connections (for example, 80% to channel 1, 20% otherwise, which is a Bernouilli Distribution) and I don't know how to change it if I want this case (for example): 50% channel 1, 20% channel 2, 30% channel 3.

Thanks and Merry Christmas and Happy Holidays!

Re: Problem with Percentages

Posted: Wednesday 07 January, 2015 - 15:26
by HarryBunnik
Ha Whitefang,

Happy wishes for you as well!

What I sometime use is the following code:

Code: Select all

Do(
  var([valDrawnPerc], vbValue, Random(100)), {A random value between 0 and 100}

  Case(
    WhichIsTrue(
      valDrawnPerc <= 50, 
      valDrawnPerc <= 70, 
      valDrawnPerc <= 100
    ), 
    1, 
    2, 
    3
  )
)
This code randomly selects a number between 0 and 100 and then check which exit, based on the accumulating percentage, it should take. If your replace the SendTo statement with this code, it should work.

As you see, you can expand it quite easily. Or course there are also more sophisticated options possible where you loop through a small table in which these accumulating percentages are standing (or you accumulate them while looping through the table). This makes it easier to "control" the percentages used. However that is a bit depending on how complicated the model becomes and how often these percentages have to be changed.

I hope this helps you further,

Cheers,

Harry