Fix floating points error

Use this forum to discuss any issues relating to Systems Dynamics and Systems Thinking.
Post Reply
stantad
Junior Member
Posts: 2
Joined: Tue Mar 31, 2015 1:16 pm
Vensim version: PLE

Fix floating points error

Post 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?
Attachments
Cocaine-with-explanations.mdl
Dutch cocaine dynamics
(12.42 KiB) Downloaded 320 times
Administrator
Super Administrator
Posts: 4590
Joined: Wed Mar 05, 2003 3:10 am

Re: Fix floating points error

Post 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.
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
stantad
Junior Member
Posts: 2
Joined: Tue Mar 31, 2015 1:16 pm
Vensim version: PLE

Re: Fix floating points error

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