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
|
|||
|
|||
Writing to a CSV
Hi,
I have a processor with a processing time of 100 with an output to a sink. Using the OnEntry trigger for the sink I have the code: fileopen("C:\Models\MachineShopFolder\Q1_03.csv"); fpt("HI"); fpr(); fileclose(); I let the model run 350 time units and I would expect to see three HI entries in the file- I see only one. Even when I leave off fileclose(); I see only one. I guess I’m new to writing data out to csv’s.
__________________
"A bird is an instrument working according to mathematical law, which is within the capacity of man to reproduce." -Leonardo da Vinci, 1502 |
#2
|
||||
|
||||
Gavin,
The fileopen command opens the file and erases the current content. You can add a second parameter to the fileopen command: fileopen("C:\\Models\\MachineShopFolder\\Q1_03.csv", "a"); This will append to the file instead of clearing. My advice, however, would be to simply call fileopen once, at time 0 when the model starts, using a UserEvent, and then call fileclose using another UserEvent that fires on reset, so the file will be opened as soon as you start running the model, and will be closed the next time you reset the model. |
The Following User Says Thank You to Anthony Johnson For This Useful Post: | ||
Gavin Douglas (07-18-2008) |
#3
|
|||
|
|||
Great!! Thanks ..........
__________________
"A bird is an instrument working according to mathematical law, which is within the capacity of man to reproduce." -Leonardo da Vinci, 1502 |
The Following User Says Thank You to Gavin Douglas For This Useful Post: | ||
RalfGruber (07-31-2008) |