ATTENTIONThis 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 |
#1
|
||||
|
||||
Reading Tables from a Database !!
Hello
We are working on a model, and we have around 500 big tables of ( 86400 rows x 10 columns ) which are in a database and we need to read them frequently. We did try to put them in as global tables, but some thing went wrong and it didnt work. We made our model read from the database every time tick, but that made our model run very slow. Is there any option that we have missed which would make things run smoothly, like arrays or matrix. Thanks |
#2
|
|||
|
|||
Usually you would try and load it into tables - I'd try and do this again.
You could also set up your database to reside in memory if your engine supports it. Is it a coincidence that the number of rows in each table is the number of seconds in a day? If it is seconds, and you have a timetable or similar stored in this way, why not instead transform the data so that only events are listed - rather than samples. I'm just guessing about your data here based on the previous posts about your project, so if this idea is irrelevant - please accept my apologies. |
#3
|
||||
|
||||
Is there a limit( in size and in no: ) for the global tabels, that i can load into a flexsim model, as flexsim is crashing when i load these tables...
You were right, my tables are basically the availability of stations at a particular instant of time, so i have 86400 rows, which show the availability each second in a day. |
#4
|
||||
|
||||
Nischith,
I believe that I had a similar problem a long time ago and the description below should help you. It is possible that this information is no longer valid if the developers have made any changes that would affect this issue. All programs have a limit to the amount of ram that they can access that is dictated by the type of program (32-bit or 64-bit / Flexsim = 32). Given the number of tables you are accessing and their size it is possible that you are exceeding this amount. Remember, because Flexsim stores table values as individual nodes in the tree; that when you load a table into Flexsim it uses more memory than an array in C++ would. I would recommend looking at the windows task manager when you load the tables to check the amount of ram that Flexsim is trying to allocate. I believe that the max is 4Gb for a 32-bit application but it may be as low as 1.6 - 2Gb. Remember that even if you load the tables OK, it is still possible to exceed the value once the model starts running because of the memory used by the flowitems that you create. If you are maxing out the amount of memory that you are using then you will either have to look for an alternative to loading the tables into standard tree tables or look at reducing the number of flowitems that are in the model at any given time. Good Luck, Brandon
__________________
thats not normal. |
The Following User Says Thank You to Brandon Peterson For This Useful Post: | ||
Scott Mackay (03-08-2011) |
#5
|
||||
|
||||
If memory and or speed is an issue one could also look at using a DLL and use C++ arrays to store the data.
|
#6
|
|||
|
|||
Here's a SQL example of how you could transform your data into something that should be smaller. An access database with this query along with the Samples and Transitions tables is also attached.
Code:
INSERT INTO Transitions SELECT b.Datetime AS [Datetime], b.Available AS Available FROM Samples AS b, Samples AS a WHERE a.Datetime>(b.Datetime-1.1/86400) AND a.Datetime<(b.Datetime-0.9/86400) AND a.Available<>b.Available; |
The Following User Says Thank You to Jason Lightfoot For This Useful Post: | ||
Scott Mackay (03-08-2011) |
#7
|
||||
|
||||
Wouldn´t it be more efficient to don´t look into 500 timetables every time tick at all?
I´m thinking about phases in which the NN´s are opened or closed. Maybe with sending delayed messages. Or giving every NN a processor. On arrival of Processor close the NN, and on exit open it again. This way you only have to set the processtime. This could be set with a label on the Item. And this even reduces your table sizes.
__________________
Hemmi |
Thread | Thread Starter | Forum | Replies | Last Post |
A Few Misc. Notes while reading through the Book | Sean HensleyMSU | Flexsim Student Forum | 3 | 08-19-2011 11:41 PM |
Database Stored Procedures | AJ Bobo | Tips and Tricks | 0 | 11-04-2010 03:09 PM |
advise on using database operation | David Chan | Q&A | 2 | 09-27-2010 03:38 AM |
Reading Stats function from global table | David Chan | Q&A | 4 | 05-27-2008 08:51 AM |
What are you reading? | Nico Zahn | Q&A | 4 | 05-09-2008 11:46 AM |