help with vensim_get_data in visual studio 2008

Use this forum to post Vensim related questions.
Post Reply
Paul Anim
Junior Member
Posts: 19
Joined: Thu Jun 09, 2011 12:19 am

help with vensim_get_data in visual studio 2008

Post by Paul Anim »

Hi,

I need to display all the variable data after simulation. Output the result of the vensim_get_data to say listbox or Datagrid.

the final result of what i need to do is to display the data for each variable in a tabular form for each run.

In the long run, I will like to use these data to plot graphs

thanks
gwr
Senior Member
Posts: 209
Joined: Sun Oct 04, 2009 8:40 pm
Vensim version: DSS

Re: help with vensim_get_data in visual studio 2008

Post by gwr »

Hi Paul,

I do not know about Visual Studio but you should get all you want by running your model saving the runs to 'runname.vdf'. You can then go to the menu and choose 'Model>Export Dataset...' from the main menu. This let's you choose your saved runs and convert them into excel of tab delimitered files. Using Pivot charts and the like in Excel for example let's you plot nice 3D surfaces and the like. It is a bit experimenting.

Kind regards,

Guido
Administrator
Super Administrator
Posts: 4590
Joined: Wed Mar 05, 2003 3:10 am

Re: help with vensim_get_data in visual studio 2008

Post by Administrator »

Paul Anim wrote:Hi,

I need to display all the variable data after simulation. Output the result of the vensim_get_data to say listbox or Datagrid.

the final result of what i need to do is to display the data for each variable in a tabular form for each run.

In the long run, I will like to use these data to plot graphs

thanks
So is vensim_get_data working for you? The C++ example that ships with Vensim uses it to get data from runs, have you tried compiling and running that?
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
Paul Anim
Junior Member
Posts: 19
Joined: Thu Jun 09, 2011 12:19 am

Re: help with vensim_get_data in visual studio 2008

Post by Paul Anim »

Administrator wrote:
So is vensim_get_data working for you? The C++ example that ships with Vensim uses it to get data from runs, have you tried compiling and running that?
Hi,
I am having a problem with the vesnim_get_data. I am not into C++ but rather VB. So i compiled the vb example that was shipped with vensim. since i am using vb.net 2008, and the example seems to be in vb5 or so. I used vb2008 to upgrade the code and I was able to compile the example in vb2008. Most of the features on the example works except the get data button(which runs vensim_get_data command) and the plot command.
What i want to do is to be able to display output of the vensim_get_data command. I want output the vensim_get_data to grid control in vb2008

this is the code for the get data button
Private Sub Command2_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Command2.Click
tpoints = vensim_get_data("base.vdf", "population", "time", rval(1), tval(1), 500)
tpoints = vensim_get_data("bobblah.vdf", "population", "time", rval2(1), tval(1), 500)


End Sub

This is also the code for the Plot graph button

Private Sub Command3_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Command3.Click
Dim i As Integer
Dim NumPoints As Integer
Dim NumSets As Integer
Dim ThisSet As Integer
Dim ThisPoint As Integer
Dim GraphData As Integer

If tpoints = 0 Then Exit Sub
'UPGRADE_ISSUE: PictureBox property Graph1.DrawMode was not upgraded. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="CC4C7EC0-C903-48FC-ACCC-81861D12DA4A"'
'Graph1.DrawMode = 0
'Graph1.DrawMode = 0
'UPGRADE_WARNING: Couldn't resolve default property of object Graph1.NumPoints. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'

NumPoints = tpoints

NumSets = 2
'UPGRADE_WARNING: Couldn't resolve default property of object Graph1.ThisSet. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
ThisSet = 1
For i = 1 To tpoints
'UPGRADE_WARNING: Couldn't resolve default property of object Graph1.ThisPoint. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
ThisPoint = i
'UPGRADE_WARNING: Couldn't resolve default property of object Graph1.GraphData. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
GraphData = rval(i)
Next i
'UPGRADE_WARNING: Couldn't resolve default property of object Graph1.ThisSet. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
ThisSet = 2
For i = 1 To tpoints
'UPGRADE_WARNING: Couldn't resolve default property of object Graph1.ThisPoint. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
ThisPoint = i
'UPGRADE_WARNING: Couldn't resolve default property of object Graph1.GraphData. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
GraphData = rval2(i)
Next i




'UPGRADE_ISSUE: PictureBox property Graph1.DrawMode was not upgraded. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="CC4C7EC0-C903-48FC-ACCC-81861D12DA4A"'
'Graph1.DrawMode = 2
End Sub

Private Sub Command4_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Command4.Click
Dim result As Object
Dim winint As Integer
winint = Me.Picture1.Handle.ToInt32
'UPGRADE_WARNING: Couldn't resolve default property of object result. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
result = vensim_tool_command("WORKBENCH>Causes Tree", winint, 0)


End Sub

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

Re: help with vensim_get_data in visual studio 2008

Post by Administrator »

So what happens, does the vensim_get_data command work ok? Does it retrieve the values for you?
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
Paul Anim
Junior Member
Posts: 19
Joined: Thu Jun 09, 2011 12:19 am

Re: help with vensim_get_data in visual studio 2008

Post by Paul Anim »

Administrator wrote:So what happens, does the vensim_get_data command work ok? Does it retrieve the values for you?
Thanks so much for your help.
I finally got the vensim_get_data to work. i tested it by collecting the data to a listbox. Below is the sample in Vb2008 that i used

Private Sub Command2_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Command2.Click

tpoints = vensim_get_data("bobblah.vdf", "population", "time", rval2(1), tval(1), 500)

Dim i As Integer

For i = 1 To tpoints
lsgetdata.Items.Add(rval2(i))
lsgetdata2.Items.Add(tval(i))
Next
End Sub


Thanks :lol:
Post Reply