Vensim dll

Use this forum to post Vensim related questions.
Post Reply
francapita2
Junior Member
Posts: 8
Joined: Thu May 28, 2009 2:35 pm

Vensim dll

Post by francapita2 »

I am developing a C++ project to show and represent Vensim simulation results. I do not need to simulate from this program just to represent results.

Our filesystem have the "&" character into filenames and folder names. When I try to open a model calling vensim_command from my C++ application and the model name or the folder name has the "&" character, vensim does not find the model to open.


On 21-11-2008 propose a solution by saying this:

This will be in the next release and done by using quotes around options as in

SPECIAL>LOADMODEL|"c:\vensim\projects\prueba&veras\empty.vpm"

so in C the command would be

vensim_command("SPECIAL>LOADMODEL|\"c:\\vensim\\Projects\\prueba&veras\\empty.vpm\"")

But I can not fix the problem. If I do this, the path change:

can not open C: / Vensim / C: / Archivos de programa/Vensim/samples/bpr3.vpm

How can I solve this?
bob@vensim.com
Senior Member
Posts: 1107
Joined: Wed Mar 12, 2003 2:46 pm

Post by bob@vensim.com »

Is

vensim_command("SPECIAL>LOADMODEL|\"c:\\vensim\\Projects\\prueba&veras\\empty.vpm\"")


the exact command you are using?

Are you using version 5.9?
francapita2
Junior Member
Posts: 8
Joined: Thu May 28, 2009 2:35 pm

Post by francapita2 »

HI BOB ;

I AM USING VENSIM VERSION 5.9.

AND MY COMMAND IS

vensim_command("SPECIAL>LOADMODEL|\"c:\\vensim\\prueba&veras\\BPR3.vpm\"")

BUT THE DIALOG BOX PUTS CAN NOT OPEN c:/vensim/c:/vensim/prueba&veras\\BPR3.vpm

HOW YOU SEE IT IS A DIRECTORY DUPLICATED; c:vensim/c:/vensim/........

I don´t know what is the problem.
Thank you very much by your help

bye bob
bob@vensim.com
Senior Member
Posts: 1107
Joined: Wed Mar 12, 2003 2:46 pm

Post by bob@vensim.com »

Try

vensim_command("\"SPECIAL>LOADMODEL|c:\\vensim\\prueba&veras\\BPR3.vpm\"")

to see if that works.
francapita2
Junior Member
Posts: 8
Joined: Thu May 28, 2009 2:35 pm

Post by francapita2 »

Thank you BOb; but it does not work.

when I puts this:

vensim_command("\"SPECIAL>LOADMODEL|c:\\vensim\\prueba&veras\\BPR3.vpm\"")

Mi program load the model but it cannot be simulated and it has not turned out that to show.

Already not that to put.
Excuse me for the inconveniences.

You would have another solution
Thank you
bob@vensim.com
Senior Member
Posts: 1107
Joined: Wed Mar 12, 2003 2:46 pm

Post by bob@vensim.com »

Both the loading and simulation work fine for me. I suspect the simulation difficulty is related to some other problem and not the name of the path the .vpm file is located in.
francapita2
Junior Member
Posts: 8
Joined: Thu May 28, 2009 2:35 pm

Post by francapita2 »

Thank you very much bob.

Thanks to your help I could have corrected my mistake.

Sincerely thank you very much
francapita2
Junior Member
Posts: 8
Joined: Thu May 28, 2009 2:35 pm

Post by francapita2 »

Hi Bob;

Sorry again but I have another question.

when my program tries to open a model mdl. or VMF. with vensim 5.9 a message appears saying:

the model ... ....... ... .. need published model ..........

To fix this I use the command FILE> PUBLISH but does not create the file. vpm and I do not know why?

do you know???

Thank you
bob@vensim.com
Senior Member
Posts: 1107
Joined: Wed Mar 12, 2003 2:46 pm

Post by bob@vensim.com »

The model must be published from within Vensim DSS. You can use the FILE>PUBLISH command from a command script run by Vensim DSS but it is not valid for the DLL.
francapita2
Junior Member
Posts: 8
Joined: Thu May 28, 2009 2:35 pm

Post by francapita2 »

hi bob.

I am trying to make a script called publicar.cmd and write in:

SPECIAL> LOADMODEL|C:\ ......\AGE.MDL
FILE> PUBLISH|C:\ .....\AGE.MDL

But it does not work. A message appears saying:

FILE> PUBLISH|C:\ .....\AGE.MDL failed

And not for that?

You can help me
francapita2
Junior Member
Posts: 8
Joined: Thu May 28, 2009 2:35 pm

Post by francapita2 »

Hello BOB;

FILE> PUBLISH needs a form file created from the publication dialog and then I need to enter in vensim.

But I want that my external program already does this and does not need to open vensim.

How I can do this, bob?
bob@vensim.com
Senior Member
Posts: 1107
Joined: Wed Mar 12, 2003 2:46 pm

Post by bob@vensim.com »

You will first need to create the .frm file in Vensim (click on the Save... button on the File>Publish dialog). Once you have created that file you will need to copy it to the location of the model and use it with the FILE>PUBLISH command. The .frm file is a simple text file so if you want to modify it (eg by changing the model name) that is straightforward.
francapita2
Junior Member
Posts: 8
Joined: Thu May 28, 2009 2:35 pm

file frm

Post by francapita2 »

Hello bob,

Already I have almost finished the changes of my program; nevertheless; I wanted to know if some command exists to create the file .frm without need to have to use the publication dialog

Thank you; bob
bob@vensim.com
Senior Member
Posts: 1107
Joined: Wed Mar 12, 2003 2:46 pm

Post by bob@vensim.com »

You will need to use the publication dialog to get the form file - but can the modify the contents as I noted before.
Post Reply