matrix

Use this forum to post Vensim related questions.
Post Reply
khalediwm
Member
Posts: 42
Joined: Sun Mar 07, 2010 9:58 am

matrix

Post by khalediwm »

Hi
I have a text file, which contains around 40 parameter value for each timestep. My intension is to read those data at every timestep during the simulation period. If anyone can help me to findout, how to read those data in Vensim from the Matrix format.

Best
Khaled
Administrator
Super Administrator
Posts: 4626
Joined: Wed Mar 05, 2003 3:10 am

Re: matrix

Post by Administrator »

There is a section in the Vensim documentation that should help you, search for "Importing Data".

It might also help if you show us the format of the data you want to import. There is not much we can recommend/suggest if we cannot see what you are trying to do.

Tony.
Advice to posters seeking help (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391

Units are important!
http://www.bbc.co.uk/news/magazine-27509559
khalediwm
Member
Posts: 42
Joined: Sun Mar 07, 2010 9:58 am

Re: matrix

Post by khalediwm »

Hi Tony
Thanks for the quick response. However, Vensim manual dosent't have much information that I am asking for.
In every time step I will get a text file and need to read those in matrix format while simulation is going on . What do you think?
Administrator
Super Administrator
Posts: 4626
Joined: Wed Mar 05, 2003 3:10 am

Re: matrix

Post by Administrator »

Does the text file change every time step?
Advice to posters seeking help (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391

Units are important!
http://www.bbc.co.uk/news/magazine-27509559
Administrator
Super Administrator
Posts: 4626
Joined: Wed Mar 05, 2003 3:10 am

Re: matrix

Post by Administrator »

If the text file does change every time step, you will need to write some external functions to do this.
Advice to posters seeking help (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391

Units are important!
http://www.bbc.co.uk/news/magazine-27509559
tomfid
Administrator
Posts: 3816
Joined: Wed May 24, 2006 4:54 am

Re: matrix

Post by tomfid »

If you want to use a different text file every time step, but the files themselves don't change during the simulation, you could do one of the following:
- import each text file to a separate data variable; then have a switch in the model that chooses the appropriate variable at each time step (this would probably be a lot easier using arrays)
- aggregate all of your text files into a spreadsheet with multiple tabs, and access the data with the GET XLS functions
khalediwm
Member
Posts: 42
Joined: Sun Mar 07, 2010 9:58 am

Re: matrix

Post by khalediwm »

Hi Tony
Thanks for the reply. Actually its a single *.txt file which is updated in each time step. It seems that I have to use external function but couldn't figure it out. Do you have any advice for me?

Thanks again
Administrator
Super Administrator
Posts: 4626
Joined: Wed Mar 05, 2003 3:10 am

Re: matrix

Post by Administrator »

What was the problem you couldn't work out?

There is sample external function code that ships with Vensim.

Search for the files
VENEXT.DEF
VENEXT.C
VENEXT6.DSP
VENEXT6.DSW

VENEXT6.DSW is a Microsoft Visual Studio workspace. Open it and build the DLL. VENEXT.C is commented to show what to do to build functions.

Tony.
Advice to posters seeking help (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391

Units are important!
http://www.bbc.co.uk/news/magazine-27509559
tomfid
Administrator
Posts: 3816
Joined: Wed May 24, 2006 4:54 am

Re: matrix

Post by tomfid »

What are you trying to accomplish? How is an updated .txt file being generated in sync with the model, if you aren't already using an external function?

Tom
Post Reply