ContextAdd

Use this forum to post Vensim related questions.
Post Reply
nika85
Junior Member
Posts: 17
Joined: Sat Jan 17, 2009 10:26 am

ContextAdd

Post by nika85 »

Hello,

If i use vensim.contextAdd(1); Vensim not recognize me this command. I am working with vendlstc.dll.

Thank you

[Edited on 2-18-2009 by nika85]
bob@vensim.com
Senior Member
Posts: 1107
Joined: Wed Mar 12, 2003 2:46 pm

Post by bob@vensim.com »

do you mean that the function is returning 0?
nika85
Junior Member
Posts: 17
Joined: Sat Jan 17, 2009 10:26 am

Post by nika85 »

No, don´t recognize me the command, it show me an error message
bob@vensim.com
Senior Member
Posts: 1107
Joined: Wed Mar 12, 2003 2:46 pm

Post by bob@vensim.com »

From the syntax I assume you are using Java - the function is vensim.ContextAdd and vensim.ContextDrop - the first C is capital.
nika85
Junior Member
Posts: 17
Joined: Sat Jan 17, 2009 10:26 am

Post by nika85 »

We have get that it recognize the command ContextAdd.

Other question:
We are using multicontext dll and we wanted to know if it is necessary to use threads, and how is it used in servlet?

Thank you

[Edited on 2-19-2009 by nika85]
bob@vensim.com
Senior Member
Posts: 1107
Joined: Wed Mar 12, 2003 2:46 pm

Post by bob@vensim.com »

If you want to provide responsive web performance you will need to use threads. If you are using Apache it will take care of creating the threads for you, so you only need to keep some information on the connection through cookies or another mechanism. You should also set a timer somewhere to drop contexts after a period of inactivity. You can probably find hints for doing these types of things on Apache or other web server forums.
nika85
Junior Member
Posts: 17
Joined: Sat Jan 17, 2009 10:26 am

Post by nika85 »

Then, we are using Apache Tomcat so we need not enter anything in the code about threads?

And another question:
We are using the command:

Vensim vensim = new Vensim("library");
/**The library load correctly**/

- with CComand:
int cid = vensim.ContextAdd(0);
int r = vensim.CCommand(cid,"SPECIAL>LOADMODEL|c:\\.....\\WORLDAPP.vpm");

-with command
int r = vensim.command("SPECIAL>LOADMODEL|c:\\.....\\WORLDAPP.vpm");

withthe two commands returns 0, and we have the model in the specified path.


thanks for your help

[Edited on 2-20-2009 by nika85]

[Edited on 2-20-2009 by nika85]
bob@vensim.com
Senior Member
Posts: 1107
Joined: Wed Mar 12, 2003 2:46 pm

Post by bob@vensim.com »

Look for the files vensim.err and vensim_ctxt001.err which might be in \system\win32 or in the windows temp directory or under VirtualStore\system\win32 under Vista and these will have more detailed information about errors encountered.
nika85
Junior Member
Posts: 17
Joined: Sat Jan 17, 2009 10:26 am

Post by nika85 »

Ok, thank you.

And the other question:
When we are using Apache Tomcat we need not enter anything in the code about threads?

Thank you very much
nika85
Junior Member
Posts: 17
Joined: Sat Jan 17, 2009 10:26 am

Post by nika85 »

In vensim.err i don´t have anything about load the model, no clues. And vensim_ctxt001.err fle does not exist.

All command returns 0 and the library it is load...
Where can be the problem?

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

Post by bob@vensim.com »

There may be more than 1 vensim.err file. If ContextAdd function returned a positive number vensim_ctxt001.err will exist. Delete vensim.err then try the application again. If vensim.err does not reappear it is because it is located somewhere else.
Post Reply