Floating point overflow problem

Use this forum to post Vensim related questions.
Post Reply
Pierre
Junior Member
Posts: 7
Joined: Fri Nov 21, 2008 11:38 am

Floating point overflow problem

Post 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
Administrator
Super Administrator
Posts: 4590
Joined: Wed Mar 05, 2003 3:10 am

Post 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]
Pierre
Junior Member
Posts: 7
Joined: Fri Nov 21, 2008 11:38 am

Post 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...
bob@vensim.com
Senior Member
Posts: 1107
Joined: Wed Mar 12, 2003 2:46 pm

Post 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]
Pierre
Junior Member
Posts: 7
Joined: Fri Nov 21, 2008 11:38 am

Post 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.
Administrator
Super Administrator
Posts: 4590
Joined: Wed Mar 05, 2003 3:10 am

Post by Administrator »

Are you using an external function library? If yes, you need to make sure that is loaded as well.
Pierre
Junior Member
Posts: 7
Joined: Fri Nov 21, 2008 11:38 am

Post 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
bob@vensim.com
Senior Member
Posts: 1107
Joined: Wed Mar 12, 2003 2:46 pm

Post 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.
Post Reply