Page 1 of 1
Floating point overflow problem
Posted: Fri Nov 21, 2008 2:57 pm
by Pierre
Hi everybody !
I've got a vensim model (.mdl) that works perfectly when I launch it in Vensim by Model -> Simulate including my changes and data files. I want to launch this model from Excel.
So I publish my model in order to obtain a .vpm file and I use the following VBA code :
result = vensim_command("SPECIAL>LOADMODEL|C:\...\myModel.vpm")
If result = 0 Then Exit Sub
result = vensim_command("SIMULATE>ADDCIN|cst1.cin, cst2.cin")
result = vensim_command("SIMULATE>DATA|Var - dat1.vdf,Var - dat2.vdf")
result = vensim_command("SIMULATE>RUNNAME|myRun")
If result = 0 Then Exit Sub
result = vensim_command("MENU>RUN")
If result = 0 Then Exit Sub
A message box appears saying : "Floating point overflow".
I need some help to understand what I'm doing wrong.
Thanks, Pierre
Posted: Fri Nov 21, 2008 3:53 pm
by Administrator
I am not sure the syntax for ADDCIN and DATA commands are correct. Can you try
result = vensim_command("SIMULATE>ADDCIN|cst1.cin")
result = vensim_command("SIMULATE>ADDCIN|cst2.cin")
result = vensim_command("SIMULATE>ADDDATA|Var - dat1.vdf")
result = vensim_command("SIMULATE>ADDDATA|Var - dat2.vdf")
and see what happens?
Tony.
[Edited on 21-11-2008 by Administrator]
Posted: Fri Nov 21, 2008 4:07 pm
by Pierre
Thank you for your answer. But unfortunately I still have the same message.
I don't know if I need to include or not all my changes and datas files when I publish my packaged model (and If I have to extract them). I have tried both, but I always get the same error...
Posted: Sat Nov 22, 2008 12:18 pm
by bob@vensim.com
When Vensim simulates through the DLL it creates a .vdf file just as it would for a normal simulation. You can load that run in nomral Vensim and look at it to see what is different with the runs compare tool. Most likely, from your description, either some of these files are not being loadedor they are being loaded in the wrong order. Generally the best strategy is
SIMULATE>READCIN|firtchanges.cin
SIMULATE>ADDCIN|secondchange.cin
and so on. and
SIMULATE>DATA|firstdatafile
SIMULATE>ADDDATE|seconddatafile
and so on.
All that said - if the model is running in vensim when you publish it then it already has the data and changes files in place. So you can leave out the READCIN/ADDCIN and DATA/ADDDATA completely and it should work.
[Edited on 2008-11-22 by
bob@vensim.com]
Posted: Mon Nov 24, 2008 5:58 pm
by Pierre
Thank you for your answer.
I tried to publish my model including my changes files, my data files and also my external dll. When I launch the .vdf run in vensim it works perfectly.
So I leave out the READCIN/ADDCIN and DATA/ADDDATA of my VBA code and I tried to launch my published model. But I still have the same error message...
If soemone can help me, I would be very grateful.
Posted: Mon Nov 24, 2008 6:08 pm
by Administrator
Are you using an external function library? If yes, you need to make sure that is loaded as well.
Posted: Tue Nov 25, 2008 10:20 am
by Pierre
I am using an external function library, but if I include it when I publish my model, when I launch the .vpm generated I get the error message : "external function version mismatch need version 400 (got 401)". Message that I do not get if I simulate from the .mdl file.
If I don't include the .dll file, I am able to publish my model, and when I launch it, I receive the message "Floating point overflow" but the date on which the error appears is later that one in my first post... So I don't if these two messages come from the same error.
Thank you for your help.
Pierre
Posted: Tue Nov 25, 2008 11:37 am
by bob@vensim.com
You will need to switch to single precision DSS for development. The DLL does not support double precision computation. This also means you will need to change the external function DLL to single precision.
All that said if your external function library is linked with vensim.lib you will actually need to create another one linked with vendll32.lib to use with the DLL. Vesion 5.8c coming soon will make this much easier. If you can just take away vensim.lib and still link without errors you should be OK with the current release.