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 02-28-2011
Nischith Kashyap's Avatar
Nischith Kashyap Nischith Kashyap is offline
Flexsim User
 
Join Date: Nov 2010
Location: Wollongong, Australia
Posts: 51
Downloads: 26
Uploads: 0
Thanks: 19
Thanked 0 Times in 0 Posts
Rep Power: 118
Nischith Kashyap is on a distinguished road
Default 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  
Old 03-01-2011
Jason Lightfoot Jason Lightfoot is offline
Flexsim Consultant
 
Join Date: Aug 2007
Location: Somerset, UK
Posts: 719
Downloads: 20
Uploads: 0
Thanks: 123
Thanked 953 Times in 446 Posts
Rep Power: 773
Jason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond repute
Default

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  
Old 03-01-2011
Nischith Kashyap's Avatar
Nischith Kashyap Nischith Kashyap is offline
Flexsim User
 
Join Date: Nov 2010
Location: Wollongong, Australia
Posts: 51
Downloads: 26
Uploads: 0
Thanks: 19
Thanked 0 Times in 0 Posts
Rep Power: 118
Nischith Kashyap is on a distinguished road
Default

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  
Old 03-02-2011
Brandon Peterson's Avatar
Brandon Peterson Brandon Peterson is offline
The Flexsim Consultant
 
Join Date: Jul 2007
Location: Salt Lake City, Utah
Posts: 382
Downloads: 29
Uploads: 6
Thanks: 192
Thanked 516 Times in 235 Posts
Rep Power: 490
Brandon Peterson has a brilliant futureBrandon Peterson has a brilliant futureBrandon Peterson has a brilliant futureBrandon Peterson has a brilliant futureBrandon Peterson has a brilliant futureBrandon Peterson has a brilliant futureBrandon Peterson has a brilliant futureBrandon Peterson has a brilliant futureBrandon Peterson has a brilliant futureBrandon Peterson has a brilliant futureBrandon Peterson has a brilliant future
Default

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  
Old 03-02-2011
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

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  
Old 03-02-2011
Jason Lightfoot Jason Lightfoot is offline
Flexsim Consultant
 
Join Date: Aug 2007
Location: Somerset, UK
Posts: 719
Downloads: 20
Uploads: 0
Thanks: 123
Thanked 953 Times in 446 Posts
Rep Power: 773
Jason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond repute
Default

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 list of transitions can then be read into Flexsim and used to create events that set flags on specific objects (or close and open edges like I originally suggested). So if you want to find out if an object is available, you can just read the flag (variable or label).
Attached Files
File Type: zip SampleToTransitions.zip (22.5 KB, 169 views)
The Following User Says Thank You to Jason Lightfoot For This Useful Post:
Scott Mackay (03-08-2011)
  #7  
Old 03-03-2011
Sebastian Hemmann's Avatar
Sebastian Hemmann Sebastian Hemmann is offline
Flexsim User
 
Join Date: Sep 2009
Location: Braunschweig (Germany)
Posts: 439
Downloads: 52
Uploads: 0
Thanks: 472
Thanked 217 Times in 154 Posts
Rep Power: 319
Sebastian Hemmann is a splendid one to beholdSebastian Hemmann is a splendid one to beholdSebastian Hemmann is a splendid one to beholdSebastian Hemmann is a splendid one to beholdSebastian Hemmann is a splendid one to beholdSebastian Hemmann is a splendid one to beholdSebastian Hemmann is a splendid one to behold
Default

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


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.