user17334485
user17334485

Reputation: 11

How to read distribution information from AnyLogic database table

I want to read information about distributions of delay times from an Excel file (already imported into an AnyLogic database table). The format is "distribution(parameter1, parameter2,...)", so for example uniform (0, 0) or normal(0, 1). Is there a direct way for doing this or would I need to delve deeper into programming to link the table directly to the delay duration?

This is what the corresponding information from the database table could look like: Database Table

Maybe some background information before I am showing you the code I wrote so far: In total there are 3-4 columns containing distribution information. For these, I am summing up those rows that meet certain criteria from other string-type rows in that db table.

The first part of the code shows another constraint: The above-described summing up of rows only needs to be done with a given probability (also taken from the database table). This I am trying to achieve by drawing a random uniform(0,1) number and assigning it to a variable. Only if my drawn number is smaller than the probability stated in the database table, do I proceed with the summing up.

So here is what I tried: Code Attempt

And the errors I am getting are "Unresolved reference: XYZ". Most likely because the distributions from the db table couldn't be interpreted, so no random numbers are generated... I set the corresponding columns to type "Code" already, but this doesn't seem to be the way unfortunately.

Can someone help?

Upvotes: 1

Views: 286

Answers (1)

yuriy pidvalny
yuriy pidvalny

Reputation: 124

There is a nice function "executeExpression". More on that here: How to read probability distributions from a database and save them in collections

Upvotes: 2

Related Questions