GAMS/Visual Basic interface

Hello All,

Hope you all the best.

Can we make an interface between GAMS and Visual Basic???

Any idea?


BAZMI


To post to this group, send email to gamsworld@googlegroups.com.
To unsubscribe from this group, send email to gamsworld+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.

Hi Bazmi,

Yes you can, depends on what you want to do. We use an Access database to store our data, created a form with a big “GO” button on it. (Ok not exactly “GO” but you get the idea). The VB code behind the button launches a Dos Shell with the GAMS model command line sent to it, GAMS runs, and the VB code monitors when the DOS window closes to tell us when GAMS is done. Afterward we use VB to pull the model output back into the Access database for further analysis.

Additionally we use GAMS capabilities such as mdb2gms to let GAMS extract the data from Access, and gdx2access to convert gdx files to Access databases for pulling in results, etc.

To get you started I’ve attached some VB code for the DOS shell launch, and some code that calls the module.

Hope this helps,

Dewayne

From: gamsworld@googlegroups.com [mailto:gamsworld@googlegroups.com] On Behalf Of AQEEL AHMED BAZMI
Sent: Wednesday, November 02, 2011 11:50 AM
To: gamsworld@googlegroups.com
Subject: GAMS/Visual Basic interface

Hello All,

Hope you all the best.

Can we make an interface between GAMS and Visual Basic???

Any idea?


BAZMI


RunGAMS.txt (1.95 KB)
ShellControl32bit.bas (2.87 KB)

Seems the VB module might get blocked by some email programs. so here it is in txt format.

Dewayne


Dewayne Delk
Senior Analyst
Global Coal Market Research

T +1 410 295 4213
F +1 410 295 4301
E dewayne.delk@woodmac.com

Wood Mackenzie
One Park Place
Suite 575 T +44 (0)131 243 4400
Annapolis, MD 21401 E energy@woodmac.com
United States W www.woodmac.com

Global Offices

Australia - Brazil - Canada - China - India - Japan - Malaysia - Russia - Singapore - South Korea - United Arab Emirates - United Kingdom - United States

P Consider the environment and business costs. Please don’t print this e-mail unless you really need to.

From: gamsworld@googlegroups.com [mailto:gamsworld@googlegroups.com] On Behalf Of Dewayne Delk
Sent: Wednesday, November 02, 2011 12:24 PM
To: gamsworld@googlegroups.com
Subject: RE: GAMS/Visual Basic interface

Hi Bazmi,

Yes you can, depends on what you want to do. We use an Access database to store our data, created a form with a big “GO” button on it. (Ok not exactly “GO” but you get the idea). The VB code behind the button launches a Dos Shell with the GAMS model command line sent to it, GAMS runs, and the VB code monitors when the DOS window closes to tell us when GAMS is done. Afterward we use VB to pull the model output back into the Access database for further analysis.

Additionally we use GAMS capabilities such as mdb2gms to let GAMS extract the data from Access, and gdx2access to convert gdx files to Access databases for pulling in results, etc.

To get you started I’ve attached some VB code for the DOS shell launch, and some code that calls the module.

Hope this helps,

Dewayne

From: gamsworld@googlegroups.com [mailto:gamsworld@googlegroups.com] On Behalf Of AQEEL AHMED BAZMI
Sent: Wednesday, November 02, 2011 11:50 AM
To: gamsworld@googlegroups.com
Subject: GAMS/Visual Basic interface

Hello All,

Hope you all the best.

Can we make an interface between GAMS and Visual Basic???

Any idea?


BAZMI


ShellControl32bit.txt (2.87 KB)

Dear Dewayne,

Thank you very much for your help and guidance. I will learn and try it and will back in case of some problem. So nice of you.


BAZMI

On Thu, Nov 3, 2011 at 12:24 AM, Dewayne Delk wrote:

Hi Bazmi,

Yes you can, depends on what you want to do. We use an Access database to store our data, created a form with a big “GO” button on it. (Ok not exactly “GO” but you get the idea). The VB code behind the button launches a Dos Shell with the GAMS model command line sent to it, GAMS runs, and the VB code monitors when the DOS window closes to tell us when GAMS is done. Afterward we use VB to pull the model output back into the Access database for further analysis.

Additionally we use GAMS capabilities such as mdb2gms to let GAMS extract the data from Access, and gdx2access to convert gdx files to Access databases for pulling in results, etc.

To get you started I’ve attached some VB code for the DOS shell launch, and some code that calls the module.

Hope this helps,

Dewayne

From: gamsworld@googlegroups.com [mailto:gamsworld@googlegroups.com] On Behalf Of AQEEL AHMED BAZMI
Sent: Wednesday, November 02, 2011 11:50 AM
To: gamsworld@googlegroups.com
Subject: GAMS/Visual Basic interface

Hello All,

Hope you all the best.

Can we make an interface between GAMS and Visual Basic???

Any idea?


BAZMI


To post to this group, send email to gamsworld@googlegroups.com.
To unsubscribe from this group, send email to gamsworld+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.

This e-mail transmission is strictly confidential. It is intended solely for the
addressee. If you are not the addressee, please delete the e-mail and notify us
by return email or by contacting our systems administrator on +44 131 243 4444
forthwith.

Moreover if you are not the addressee, you must not copy, use, act or rely on,
disclose or distribute this e-mail. Wood Mackenzie Limited accepts no
responsibility or liability for any harm to your, or any third party’s, system
or data caused by this e-mail or its attachments or any viruses or similar
contained in it.

Wood Mackenzie Limited may monitor and record e-mails and their content passing
through its network.


To post to this group, send email to gamsworld@googlegroups.com.
To unsubscribe from this group, send email to gamsworld+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.




\

To post to this group, send email to gamsworld@googlegroups.com.
To unsubscribe from this group, send email to gamsworld+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.