Hi,
I'm working on a project to get Vensim DSS and arcGIS 9.3 to exchange data. For the moment, i've made a C++ program to convert between the two programs different output files (from GIS text format to .cin, then from tab back to GIS text), but it would be nice if I could automate this using DDE.
I haven't used DDE before, so i'm uncertain of the best way to go about doing this (using vensim as a client or server, etc). We've had to rule out excel as the dataset is too big for it to handle. I've gone through the VensimDSSreference PDF, but I'm still a bit in the dark.
What is the best way to link these programs, either between GIS and Vensim, or using my converter to communicate with both, or a third option we havent thought of yet?
Thanks for you advice,
Oz
DDE between Venism and arcGIS
-
- Super Administrator
- Posts: 4590
- Joined: Wed Mar 05, 2003 3:10 am
DDE is pretty straightforward. I've written functions in the past to link Vensim and MapInfo.
The following link has an example of it in VBA
http://support.microsoft.com/kb/213626
If I were you I would start with VBA to work out the commands to use with arcGIS to send/receive data (purely because it's very quick to prototype using VBA). Then you can use this to create some external functions. If you look in the comp sub-directory of Vensim, there is a Visual Studio workspace called VENEXT6. This can be compiled to create an external function library, and you also have access to the following DDE functions as well
int (VEFCC *vdde_initiate)(unsigned char *servname,unsigned char *topic) ;
int (VEFCC *vdde_request)(int dde_channel,unsigned char *item,unsigned char **buf,unsigned max_wait) ;
int (VEFCC *vdde_vrequest)(int dde_channel,unsigned char **item,unsigned char **buf,int nitem,unsigned max_wait) ;
int (VEFCC *vdde_poke)(int dde_channel,unsigned char *item,unsigned char *value) ;
int (VEFCC *vdde_terminate)(int dde_channel) ;
int (VEFCC *vdde_execute)(int dde_channel,unsigned char *ddecommand) ;
int (VEFCC *vdde_wait_execute)(int dde_channel,unsigned char *ddecommand,unsigned maxwait) ;
void (VEFCC *vensim_transmit_dde)(void) ;
You can use "simulation_setup" and "simulation_shutdown" to create the link to arcGIS, and then call some send/receive functions.
I hope this makes sense.
Tony.
The following link has an example of it in VBA
http://support.microsoft.com/kb/213626
If I were you I would start with VBA to work out the commands to use with arcGIS to send/receive data (purely because it's very quick to prototype using VBA). Then you can use this to create some external functions. If you look in the comp sub-directory of Vensim, there is a Visual Studio workspace called VENEXT6. This can be compiled to create an external function library, and you also have access to the following DDE functions as well
int (VEFCC *vdde_initiate)(unsigned char *servname,unsigned char *topic) ;
int (VEFCC *vdde_request)(int dde_channel,unsigned char *item,unsigned char **buf,unsigned max_wait) ;
int (VEFCC *vdde_vrequest)(int dde_channel,unsigned char **item,unsigned char **buf,int nitem,unsigned max_wait) ;
int (VEFCC *vdde_poke)(int dde_channel,unsigned char *item,unsigned char *value) ;
int (VEFCC *vdde_terminate)(int dde_channel) ;
int (VEFCC *vdde_execute)(int dde_channel,unsigned char *ddecommand) ;
int (VEFCC *vdde_wait_execute)(int dde_channel,unsigned char *ddecommand,unsigned maxwait) ;
void (VEFCC *vensim_transmit_dde)(void) ;
You can use "simulation_setup" and "simulation_shutdown" to create the link to arcGIS, and then call some send/receive functions.
I hope this makes sense.
Tony.
-
- Senior Member
- Posts: 1107
- Joined: Wed Mar 12, 2003 2:46 pm
An alternative to using DDE would be to use the Vensim DLL. Since it sounds like you have already got a way of doing things step by step in both Vensim and the GIS you could just automate that using calls to the DLL. The controlling logic could reside in the GIS, or in a separate program (assuming the GIS was callable in this way). This will probably be easier to do.