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-12-2008
Liu Bin Liu Bin is offline
Beijing Beta Tech Ltd, Flexsim distributor
 
Join Date: Aug 2007
Posts: 11
Downloads: 61
Uploads: 0
Thanks: 7
Thanked 0 Times in 0 Posts
Rep Power: 155
Liu Bin is on a distinguished road
Default 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  
Old 06-13-2008
Lars-Olof Leven Lars-Olof Leven is offline
Flexsim Distributor
 
Join Date: Aug 2007
Location: Sweden, Borlnge
Posts: 312
Downloads: 278
Uploads: 2
Thanks: 300
Thanked 256 Times in 139 Posts
Rep Power: 330
Lars-Olof Leven is a splendid one to beholdLars-Olof Leven is a splendid one to beholdLars-Olof Leven is a splendid one to beholdLars-Olof Leven is a splendid one to beholdLars-Olof Leven is a splendid one to beholdLars-Olof Leven is a splendid one to beholdLars-Olof Leven is a splendid one to behold
Default

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  
Old 06-13-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

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  
Old 06-13-2008
Lars-Olof Leven Lars-Olof Leven is offline
Flexsim Distributor
 
Join Date: Aug 2007
Location: Sweden, Borlnge
Posts: 312
Downloads: 278
Uploads: 2
Thanks: 300
Thanked 256 Times in 139 Posts
Rep Power: 330
Lars-Olof Leven is a splendid one to beholdLars-Olof Leven is a splendid one to beholdLars-Olof Leven is a splendid one to beholdLars-Olof Leven is a splendid one to beholdLars-Olof Leven is a splendid one to beholdLars-Olof Leven is a splendid one to beholdLars-Olof Leven is a splendid one to behold
Default

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  
Old 06-13-2008
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

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  
Old 06-14-2008
AlanZhang's Avatar
AlanZhang AlanZhang is offline
Flexsim Super Moderator
 
Join Date: Aug 2007
Location: CA
Posts: 289
Downloads: 64
Uploads: 0
Thanks: 88
Thanked 91 Times in 47 Posts
Rep Power: 225
AlanZhang is a jewel in the roughAlanZhang is a jewel in the roughAlanZhang is a jewel in the rough
Default

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  
Old 06-15-2008
Liu Bin Liu Bin is offline
Beijing Beta Tech Ltd, Flexsim distributor
 
Join Date: Aug 2007
Posts: 11
Downloads: 61
Uploads: 0
Thanks: 7
Thanked 0 Times in 0 Posts
Rep Power: 155
Liu Bin is on a distinguished road
Default

Quote:
Originally Posted by Brandon Peterson View Post
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
I have just tried a simple example following you guys' suggestion:

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  
Old 06-16-2008
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

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  
Old 06-16-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

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


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.