Page 1 of 1

Fix floating points error

Posted: Tue Mar 31, 2015 1:21 pm
by stantad
Hello,
I am relatively new to System Dynamics and I am currently working on a project for my school in the Netherlands about a nice subject, cocaine use in the Netherlands :D

However after inputting all the equations and fixing problems with simultaneous equations I get a new one- a fix floating point error, I really don't understand why this is happening and how to fix it, especially that I believe that my model is quite correct...

Could you please help?

Re: Fix floating points error

Posted: Tue Mar 31, 2015 1:49 pm
by Administrator
Division by zero is the cause. "Cocaine stock" is zero, causing the floating point problem in "Cocaine Price".

You probably want to use the ZIDZ function. I'd also try and remove "demand for cocaine/cocaine stock*(INITIAL PRICE*(1+CONTAINERS SCAN RATE+SUCCESSFUL DRUG SEARCHES RATE))" into a separate equation, nesting equations makes debugging difficult.

Re: Fix floating points error

Posted: Tue Mar 31, 2015 5:22 pm
by stantad
Thank you for the suggestion, the model does run with that formula, but does not exactly show what I want him to show :)

But one thing puzzles me... Why at time 0 (2009) does cocaine stock show as 0 - it has an initial value of 13500 so it shouldn't be the case...