Hello,
We are using Vensim Multi Context version on Linux, with a model. The model runs correctly if we use it in .vpmx format, but not if we use it in .mdl format.
Additionally, the model takes a long time to complete compared to the execution in the DSS version, we understand that because it is not working with the compiled model.
We have seen this information in the documentation, but it talks about a .dll, and does not indicate the alternative for linux (.so):
https://www.vensim.com/documentation/25965.html
1. Is it possible to work with the compiled model in Linux? Is there a way to generate the model_simdp.dll file for linux (model_simdp.so???)?
2. If not, is it possible to work with the compiled model with DLL windows version?
Thank you very much.
Best regrads,
Rafael.
Compiled model with Vensim Multicontext (DLL) in Linux
-
- Super Administrator
- Posts: 4590
- Joined: Wed Mar 05, 2003 3:10 am
Re: Compiled model with Vensim Multicontext (DLL) in Linux
This is correct. The MC DLL will only load packaged models.
It might work. First, make a note of the compiled sim DLL name when running windows (it will be something like modelname_simdp.dll). The "modelname_simdp" is the important part. Now in Linux, open a command prompt and run whatever commands are needed to generate a .so file. It will be something like
cc /DDBLPREC /D_LINUX mdl.c
Hopefully it will generate a .so file. Now try running, it all has gone well, the .so will be loaded and run.
The Windows DLL should load the compiled model correctly if it is in there.
Advice to posters seeking help (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Units are important!
http://www.bbc.co.uk/news/magazine-27509559
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Units are important!
http://www.bbc.co.uk/news/magazine-27509559
Re: Compiled model with Vensim Multicontext (DLL) in Linux
First of all thank you very much for your quick response.
We could generate the library with the following command, adding the file simext.c to the compilation path:
The simplified code we use is:
Best regards,
Rafael.
We could generate the library with the following command, adding the file simext.c to the compilation path:
Despite this, the model computation has not been reduced, so maybe we are not load the model correctly.cc -DLINUX -DDBLPREC -shared -fPIC -o modelname_simdp.so mdl.c
The simplified code we use is:
modelname.vpmx and modelname_simdp.so are in the same folder. Could you please tell us if we are doing something wrong?#include <stdio.h>
#include <dlfcn.h>
int main() {
void* libraryHandle;
int (*vensimCommand)();
libraryHandle = dlopen("path_to_vensim_lib", RTLD_LAZY);
vensimCommand = dlsym(libraryHandle, "vensim_command");
(*vensimCommand)("SPECIAL>LOADMODEL|modelname.vpmx");
(*vensimCommand)("SPECIAL>LOADDLL|modelname_simdp.so"); /* Tested with and without this line */
(*vensimCommand)("SIMULATE>SAVELIST|output.lst");
(*vensimCommand)("SIMULATE>RUNNAME|escenario_1");
(*vensimCommand)("SIMULATE>READCIN|escenario_1.cin");
(*vensimCommand)("MENU>RUN|O");
return 0;
}
Best regards,
Rafael.
Re: Compiled model with Vensim Multicontext (DLL) in Linux
We try with Windows version of Vensim Multicontext, using a WinForms .NET Framework example from your examples folder
The simplified code that we use is:
In the folder of the model we includes the file "modelname_simdp_x64.dll", generated with our DSS version, but .dll is not used for calculations (because the time of calculation if too much greater than the time when using .MDL and .DLL files in DSS version.
Could you please clarify us if we are doing something wrong, or if simply de comipled .dll is not used in Vensim Multicontex (Linux or Windows versions)?
Best regards,
Rafael.
The simplified code that we use is:
Code: Select all
var strModelPath = "C:\\test\\modelname.vpmx";
VensimDLLWrapper.vensim_command(string.Concat("SPECIAL>LOADMODEL|", strModelPath));
VensimDLLWrapper.vensim_command("SIMULATE>RUNNAME|escenario");
VensimDLLWrapper.vensim_command("SIMULATE>READCIN|escenario.cin");
VensimDLLWrapper.vensim_command("MENU>RUN");
VensimDLLWrapper.vensim_command(MENU>vdf2TAB|escenario.vdfx|escenario.csv|output.lst|||||:escenario);
Could you please clarify us if we are doing something wrong, or if simply de comipled .dll is not used in Vensim Multicontex (Linux or Windows versions)?
Best regards,
Rafael.
-
- Super Administrator
- Posts: 4590
- Joined: Wed Mar 05, 2003 3:10 am
Re: Compiled model with Vensim Multicontext (DLL) in Linux
Make sure you open modelname.vpmx in Vensim, run it and compile it. Now try with the MC DLL (Windows only).
It may be that the compiled simulation does not exactly match the original model. It has to be an exact match.
It may be that the compiled simulation does not exactly match the original model. It has to be an exact match.
Advice to posters seeking help (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Units are important!
http://www.bbc.co.uk/news/magazine-27509559
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Units are important!
http://www.bbc.co.uk/news/magazine-27509559