Bundle data as integer?

Bundle data as integer?

craig_dickson
Not applicable
7 Views
3 Replies
Message 1 of 4

Bundle data as integer?

craig_dickson
Not applicable

[ FlexSim 18.2.2 ]

I am reading a large table from Excel (several actually), and I'll be searching it, so I want to use a bundle for speed. But for some reason it reads all numeric values as double even if they're integers in the original Excel. If I query, I have to make my reference double then, even if they're integers. But if I use a table instead of bundle, they are definitely integers.

Am I missing something or is this just a charcteristic of bndles?

0 Likes
Accepted solutions (1)
8 Views
3 Replies
Replies (3)
Message 2 of 4

JordanLJohnson
Autodesk
Autodesk
Accepted solution

Excel stores values only as doubles. You can format them as integers, but when FlexSim gets the values from Excel, Excel reports them as doubles.

If you use a table instead of a bundle, it means you are storing the data on treenodes, which always store values as a double. The table view formats them as integers, but they are doubles. The treenode does not distinguish between integers and doubles.

Also, if you are searching each row, a bundle is not any faster than a treenode table. The bundle's advantage is that it takes significantly less memory. For memory purposes, if you make a bundle yourself, you can instruct the bundle to store values as integers. However, when you retrieve the value, the bundle will convert it to a double, for compatibility with the rest of FlexSim.

All that being said, in FlexScript, you can easily treat a number as an integer:

int myValue = Table("SomeTable")[3][2];
Table("SomeOtherTable")[2][1] = myValue;
double otherValue = 5.0;
if (otherValue == myValue)
    print("values are equal);
.


Jordan Johnson
Principal Software Engineer
>

Message 3 of 4

craig_dickson
Not applicable

So how does that work if I am doing a query() on the table? The match is going to be an integer by definition, as it is the index for a while loop.

0 Likes
Message 4 of 4

JordanLJohnson
Autodesk
Autodesk

When you compare an integer to a double, the integer is upgraded to a double, and then those values are compared. This is true, even inside the query command.

.


Jordan Johnson
Principal Software Engineer
>

0 Likes