ATTENTION

This FlexSim Community Forum is read-only. Please post any new questions, ideas, or discussions to our new community (we call it Answers) at https://answers.flexsim.com/. Our new Question & Answer site brings a modern, mobile-friendly interface and more focus on getting answers quickly. There are a few differences between how our new Q&A community works vs. a classic, threaded-conversation-style forum like the one below, so be sure to read our Answers Best Practices.


flexsim.com

Go Back   FlexSim Community Forum > FlexSim Software > Q&A
Downloads

Q&A Using Flexsim and building models

  #1  
Old 06-20-2008
Steven Hamoen's Avatar
Steven Hamoen Steven Hamoen is offline
Talumis, Flexsim Distributor, The Netherlands
 
Join Date: Aug 2007
Location: Soest, NL
Posts: 854
Downloads: 43
Uploads: 0
Thanks: 391
Thanked 661 Times in 379 Posts
Rep Power: 684
Steven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond repute
Default size of arrays in Flexscript

Hello,

We are building a warehouse model and tried to use the makearray command to create a temporary storage for information. But clearly an array of 10800 was too big, Flexsim crashed. So can anybody from Flexsim tell us how big we can make them?

Might also be a good point to put in the helpfile

Steven
  #2  
Old 06-20-2008
Alex Christensen Alex Christensen is offline
Flexsim Technical Support
 
Join Date: Nov 2007
Location: Provo, UT
Posts: 96
Downloads: 41
Uploads: 8
Thanks: 29
Thanked 141 Times in 56 Posts
Rep Power: 298
Alex Christensen is a splendid one to beholdAlex Christensen is a splendid one to beholdAlex Christensen is a splendid one to beholdAlex Christensen is a splendid one to beholdAlex Christensen is a splendid one to beholdAlex Christensen is a splendid one to beholdAlex Christensen is a splendid one to behold
Default

Flexscript's arrays are just a bunch of nodes with a common parent. I'm pretty sure the max number of nodes allowed in memory at one time depends on the amount of RAM in your computer, just like any other kind of data.
It is more efficient, especially for storing large amounts of data like that, to use C++ arrays and C++ code to handle them. That way you don't have any of the overhead of storing a fsnode for each element.
  #3  
Old 06-20-2008
Steven Hamoen's Avatar
Steven Hamoen Steven Hamoen is offline
Talumis, Flexsim Distributor, The Netherlands
 
Join Date: Aug 2007
Location: Soest, NL
Posts: 854
Downloads: 43
Uploads: 0
Thanks: 391
Thanked 661 Times in 379 Posts
Rep Power: 684
Steven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond repute
Default

Alex,

Are you sure they are just nodes? If that is the case can you tell me where in the tree they are stored. Because if they are nodes we should be able to see them.

Besides that we use it in code quite a lot and if that is the case and you create that amount of nodes all the time, you would notice it and we don't. I was always under the impression that they are simply flexscript overloads of C++ arrays and in that case I could imagine that the arrays are limited to a certain number.(1024 sounds logical)

Steven

PS I am aware that using C++ is easier and we might end up putting it in a DLL but during the modelling fase we use flexscript as long as possible before we go to C++. Just speeds up development
  #4  
Old 06-20-2008
Phil BoBo's Avatar
Phil BoBo Phil BoBo is offline
Flexsim Development
 
Join Date: Jan 2008
Posts: 756
Downloads: 109
Uploads: 18
Thanks: 385
Thanked 1,483 Times in 525 Posts
Rep Power: 1174
Phil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond repute
Default

Push the + sign in the tree next to a built Flexscript node, Steven.
  #5  
Old 06-20-2008
Steven Hamoen's Avatar
Steven Hamoen Steven Hamoen is offline
Talumis, Flexsim Distributor, The Netherlands
 
Join Date: Aug 2007
Location: Soest, NL
Posts: 854
Downloads: 43
Uploads: 0
Thanks: 391
Thanked 661 Times in 379 Posts
Rep Power: 684
Steven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond repute
Default

You mean like in the attached bitmap?

But then I still don't see anything, or is it just during runtime that he builds the array (which would be strange because that would really take a long time)

Steven
Attached Thumbnails
Click image for larger version
Name:	makearraytree.JPG
Views:	293
Size:	12.0 KB
ID:	336  
  #6  
Old 06-20-2008
Phil BoBo's Avatar
Phil BoBo Phil BoBo is offline
Flexsim Development
 
Join Date: Jan 2008
Posts: 756
Downloads: 109
Uploads: 18
Thanks: 385
Thanked 1,483 Times in 525 Posts
Rep Power: 1174
Phil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond repute
Default

It only makes the nodes it needs. Try a fillarray() command.

Last edited by Phil BoBo; 11-19-2014 at 06:27 PM.
The Following User Says Thank You to Phil BoBo For This Useful Post:
Alex Christensen (06-20-2008)
  #7  
Old 06-20-2008
Alex Christensen Alex Christensen is offline
Flexsim Technical Support
 
Join Date: Nov 2007
Location: Provo, UT
Posts: 96
Downloads: 41
Uploads: 8
Thanks: 29
Thanked 141 Times in 56 Posts
Rep Power: 298
Alex Christensen is a splendid one to beholdAlex Christensen is a splendid one to beholdAlex Christensen is a splendid one to beholdAlex Christensen is a splendid one to beholdAlex Christensen is a splendid one to beholdAlex Christensen is a splendid one to beholdAlex Christensen is a splendid one to behold
Default

Steven,
I'm pretty sure that's what it does because you can pass an integer variable into makearray(), which means it has to do memory allocation during execution, unless it has a chunk preallocated and it uses it if the array size <= preallocated size.

Last edited by Alex Christensen; 06-20-2008 at 09:54 AM. Reason: phil's post was posted while I was writing mine (redundancy)
  #8  
Old 06-20-2008
Steven Hamoen's Avatar
Steven Hamoen Steven Hamoen is offline
Talumis, Flexsim Distributor, The Netherlands
 
Join Date: Aug 2007
Location: Soest, NL
Posts: 854
Downloads: 43
Uploads: 0
Thanks: 391
Thanked 661 Times in 379 Posts
Rep Power: 684
Steven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond repute
Default

Thanks Phil, but it does mean that it creates the nodes during runtime if the array was only declared and during the execution of a function filled.
That would also explain why it might look like Flexsim is locked up while in fact it is only building the node structure.

Thanks,

Steven
  #9  
Old 06-20-2008
Phil BoBo's Avatar
Phil BoBo Phil BoBo is offline
Flexsim Development
 
Join Date: Jan 2008
Posts: 756
Downloads: 109
Uploads: 18
Thanks: 385
Thanked 1,483 Times in 525 Posts
Rep Power: 1174
Phil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond repute
Default

A.J. is going to post a more thorough explanation of what is going on. Those nodes don't actually hold the array's data, just a representation of the code. The data is stored as an array in memory.
  #10  
Old 06-20-2008
AJ Bobo's Avatar
AJ Bobo AJ Bobo is offline
Flexsim Senior Developer
 
Join Date: Jul 2007
Posts: 108
Downloads: 8
Uploads: 0
Thanks: 23
Thanked 89 Times in 41 Posts
Rep Power: 221
AJ Bobo is a jewel in the roughAJ Bobo is a jewel in the roughAJ Bobo is a jewel in the roughAJ Bobo is a jewel in the rough
Default

Steven,

There are a lot of things going on with arrays that I think I can clear up for you.

First, you can make lists of nodes that are as large as you want. This uses a lot of memory and isn't the fastest way to do things in most cases. The advantage to this, though, is that the nodes are not local to a single function, so they (and the values they hold) can be reused later.

Second, Flexscript arrays (created with the makearray() command) are NOT stored in the tree. They are stored purely in memory, making them much more efficient to access for reading or writing. The tree Phil showed is the tree representation of a Flexscript node function. This tree is used by Flexsim to execute the Flexscript node, but it does not change while the node is executing. In other words, the hard-coded values for the fillarray() command are there, but the actual array is not. You should not attempt to change the nodes in this tree while the nodefunction is executing.

Third, the limit for a single array's size seems to be 10,000 elements. I was unable to crash Flexsim when I tried to create an array that was larger than that, but the function I wrote didn't work when I declared an array with 10001 elements. By looking through the engine source code, I found a section relating to arrays where the engine has to check to see if a number that it is reading is an integer or a pointer. 10000 is the "magic number" that makes that decision. Anything greater than that is considered a pointer. Exactly what situation this check is for and why 10000 was picked, I don't know. I'll have to look into that one.

I hope this helps. Let me know if you still have questions.
The Following 4 Users Say Thank You to AJ Bobo For This Useful Post:
Steven Hamoen (06-23-2008)
  #11  
Old 06-23-2008
Steven Hamoen's Avatar
Steven Hamoen Steven Hamoen is offline
Talumis, Flexsim Distributor, The Netherlands
 
Join Date: Aug 2007
Location: Soest, NL
Posts: 854
Downloads: 43
Uploads: 0
Thanks: 391
Thanked 661 Times in 379 Posts
Rep Power: 684
Steven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond repute
Default

AJ,

Thank you for the clear explanation (and luckily I'm not a complete fool)

I was wondering about the 10.000, this seems like a large number but I can imagine a number of situations where it really isn't, so if possible could it be enlarged in one of the next releases? I can put it on the development list if you want?

Steven
  #12  
Old 06-23-2008
AJ Bobo's Avatar
AJ Bobo AJ Bobo is offline
Flexsim Senior Developer
 
Join Date: Jul 2007
Posts: 108
Downloads: 8
Uploads: 0
Thanks: 23
Thanked 89 Times in 41 Posts
Rep Power: 221
AJ Bobo is a jewel in the roughAJ Bobo is a jewel in the roughAJ Bobo is a jewel in the roughAJ Bobo is a jewel in the rough
Default

Steven,

The 10,000 number was chosen by Anthony. I don't know his reasoning for not using a larger number. You can put it on the development list, I suppose. If raising that value over 10,000 isn't feasible, he can always mention that in the development list.
The Following User Says Thank You to AJ Bobo For This Useful Post:
Steven Hamoen (06-23-2008)
  #13  
Old 06-23-2008
Anthony Johnson's Avatar
Anthony Johnson Anthony Johnson is offline
Manager of Product Development
 
Join Date: Jul 2007
Posts: 440
Downloads: 86
Uploads: 4
Thanks: 171
Thanked 899 Times in 288 Posts
Rep Power: 735
Anthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond repute
Default

Hey Guys,
I chose 10,000 just because I thought it was high enough. I thought that I had changed it to a much higher value, like 1,000,000, in a previous release, but apparently I didn't. AJ is right on the pointer vs. index issue. Somewhere in the engine the flexscript interpreter needs to decipher whether a value represents a pointer or an index, and I just had to say, if it's higher than some value, it's a pointer, otherwise, it's an index. I guess I just chose the value too low.
The Following User Says Thank You to Anthony Johnson For This Useful Post:
Steven Hamoen (06-23-2008)
  #14  
Old 06-23-2008
Steven Hamoen's Avatar
Steven Hamoen Steven Hamoen is offline
Talumis, Flexsim Distributor, The Netherlands
 
Join Date: Aug 2007
Location: Soest, NL
Posts: 854
Downloads: 43
Uploads: 0
Thanks: 391
Thanked 661 Times in 379 Posts
Rep Power: 684
Steven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond repute
Default

I just put it on the development list.

Steven


Thread Thread Starter Forum Replies Last Post
optimal size of a 3DS file David Chan Q&A 4 04-28-2008 08:05 AM
Clean Flexscript Steven Hamoen Q&A 1 04-04-2008 07:00 AM
Using multi-dimensional arrays with flexscript Cliff King Tips and Tricks 0 12-15-2007 11:25 AM
Adding member eith Flexscript Lars-Olof Leven Q&A 2 08-22-2007 08:00 AM


All times are GMT -6.
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.
Copyright 1993-2018 FlexSim Software Products, Inc.