help with variables using .dll

Use this forum to post Vensim related questions.
vero
Junior Member
Posts: 18
Joined: Wed Sep 17, 2008 2:23 pm

Post by vero »

I have not explained well, I am trying to simulate like this:

1º Load model

result = vensim.command( "SPECIAL>LOADMODEL|C:\\Documents and Settings\\miriiam\\Escritorio\\PROYECTO\\mariaje\\MODELO\\ACI118MO00\\CIMD9.vmf" );
----ok----

2º store the initial values
result=vensim.get_data("base.vdf","precios[producto1,competidor1]","TIME",precioinicial1,tval,36);
cprecio1.setText(Float.toString(precioinicial1[0]));
----ok-----

3º simulate

result = vensim.command( "SIMULATE>RUNNAME|base" );
-------ok-------

4º Try to send values

PrecioInit1 = cprecio1.getText();
vensimCommand = "SIMULATE>SETVAL|precios [producto1,competidor1] = " + PrecioInit1;
result = vensim.command( vensimCommand );
-----failed-----

5º run

result = vensim.command( "MENU>RUN|O" );

6º store the result

tpoints = vensim.get_data( "base", "EBITDA[competidor1]", "TIME", EBITDA, tval, 36 );


My problem is in 4º point.

someone could help us??

Thank you very much

[Edited on 9-30-2008 by vero]

[Edited on 9-30-2008 by vero]
Administrator
Super Administrator
Posts: 4590
Joined: Wed Mar 05, 2003 3:10 am

Post by Administrator »

You could try removeing the space

vensimCommand = "SIMULATE>SETVAL|precios[producto1,competidor1] = " + PrecioInit1;
result = vensim.command( vensimCommand );

But can you double check what kind of variable "precios" is? It should be a constant.
vero
Junior Member
Posts: 18
Joined: Wed Sep 17, 2008 2:23 pm

Post by vero »

That is not the solution, I have tried and will not be solved.

How can I tell if it's a variable or a constant?

I think that is a variable, all the data that I have are variables, I do not have constants.

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

Post by Administrator »

Can you email the model to me?
vero
Junior Member
Posts: 18
Joined: Wed Sep 17, 2008 2:23 pm

Post by vero »

how can i get your mail?
Administrator
Super Administrator
Posts: 4590
Joined: Wed Mar 05, 2003 3:10 am

Post by Administrator »

tony@ventanasystems.co.uk

I will be able to check the syntax of the commands you are using.

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

Post by Administrator »

The reason it fails is because "precios" is a gaming parameter (not a constant) and as you have not started a game, you cannot set the value. You can only set these once a game has started.

Those calls will work as soon as you have executed the following

result = vensim.command( "MENU>GAME" );

Now if you call

vensimCommand = "SIMULATE>SETVAL|precios[producto1,competidor1] = " + PrecioInit1;
result = vensim.command( vensimCommand );

It should work.
vero
Junior Member
Posts: 18
Joined: Wed Sep 17, 2008 2:23 pm

Post by vero »

Okay, thank you very much, now no longer gives me the error but any value of the variables I always returns the same result by simulating! why??
Post Reply