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
|
|||
|
|||
Output high volume data
If I need to output high volume data from Flexsim to outside data files during simulation running, which way is faster or better, Database, Excel or Text file? Thanks!
|
#2
|
|||
|
|||
Hi Liu,
Depends on if you need to get the data out under the runs or if you do it after each replication. If you are doing it under the run I would try to use some type of database. If the output are end of each run I would say that text file is fastest, database next and Excel last. The good with Excel is that you can directly start working with the data direct. For text file and database you need to import the data to Excel or what application you use for analyse, this can take some time. Which solution is best is hard to say everything depends on when the data should be send out from Flexsim and how you will you use it later. In Excel, MiniTab etc. Lars-Olof |
#3
|
||||
|
||||
Hi Liu,
In addition to Lars-Olof, I would use text files also under a run because it is much faster then the other 2 options. And if you export it as a csv file, you can open it in Excel very fast, even if it contains large amounts of data. If it is at the end of a run it doesn't really matter and it just depends on the program you are going to use to analyse the data. Although writing large amount of data to excel is not very fast. Maybe if you would use an ODBC link to excel it will be faster than using the standard Flexsim method (I think it is OLE). Steven |
The Following User Says Thank You to Steven Hamoen For This Useful Post: | ||
Liu Bin (06-17-2008) |
#4
|
|||
|
|||
Steven is correct, text file is the fastest.
I normally always save my data in a text file and then import that file to excel or a database, depending what I want to do. Lars-Olof |
The Following User Says Thank You to Lars-Olof Leven For This Useful Post: | ||
Liu Bin (06-17-2008) |
#5
|
||||
|
||||
Liu,
I have always used text files. I usually open the text file with an event at time zero and then close the text file at a specific time in the model run. If you don't know what time you will want to close the text file you can use a button in a GUI or you can use the OnRunStop model trigger. Text files are very easy to use in flexsim and only require that you learn the fileopen, fileclose, fpr, fpt, fpf, and fpd. I have built a lot of Excel files that parse the data from these files into different sheets. If you want an example let me know. Brandon
__________________
thats not normal. |
The Following 2 Users Say Thank You to Brandon Peterson For This Useful Post: | ||
Dustin Derrick (08-26-2008) |
#6
|
||||
|
||||
Text file is easy to use. But the limitation in Flexscript using text file is that you are only allowing to open one file at one time. If you have a lot data and you only organize them in a better way, maybe you should try database. You can also use C++ code to write text files. Writing to Excel is slow. But if you write to Excel at the end of the simulation and have some charts in that Excel, it is a pleasure to watch the graph in Excel is growing when you write the data from Flexsim.
Another option would be using Flexsim Chart with Full History on. As long as you model is not big, this is a good option too. You can use Flexsim Chart tool to analyze your data, or write your own SQL to query Movement Table and State Table, the two main tables of the data collected by Flexsim.
__________________
Best, Alan |
The Following User Says Thank You to AlanZhang For This Useful Post: | ||
Liu Bin (06-17-2008) |
#7
|
|||
|
|||
Quote:
fileopen("D:/aaa.csv"); fpd(4); fpt(","); fpd(99); fpr(); fpf(12.3); fileclose(); I think text files are suitable for my case. Btw, the above codes need any improvement to shorten the execution time? |
#8
|
||||
|
||||
Liu,
The above code is fine. It would print the following: 4,99 12.3 Remember that when you open a file for writing it will erase all of the data in that was previously in that file. So, you will want to make sure to only open the file once during a run. There has been some comments on only being able to open one file at a time. This is true, however; we have found ways around this problem. It this becomes a problem for anyone please let me know we have built both Excel and Access files that can parse out data into multiple sheets or tables depending on the file type. This allows you to write all kinds of data into the text file and then seperate it back out later. This way you keep the speed and still get to have multiple different types of data output. Good Luck, Brandon
__________________
thats not normal. |
The Following 5 Users Say Thank You to Brandon Peterson For This Useful Post: | ||
Liu Bin (06-17-2008) |
#9
|
|||
|
|||
It's still a good idea to open and close a file only once during a run, because opening and closing a file every time you write to it takes a long time. If you don't want it to erase the existing data when you open a file, use "a" as the second parameter for fileopen ("a" for Append), like this:
Code:
fileopen("D:/asdf.csv","a"); |
The Following 5 Users Say Thank You to Alex Christensen For This Useful Post: | ||
Steven Hamoen (06-16-2008) |
Thread | Thread Starter | Forum | Replies | Last Post |
Area/Volume Mapping | Naresh Yamani | Q&A | 2 | 09-26-2012 05:37 AM |
Print information into output console (Debugging) | Tom David | Q&A | 11 | 09-04-2008 03:46 AM |
Problem with Processor Output | avinash | Q&A | 2 | 03-26-2008 09:19 AM |