Single precision problem in Vensim PLE Plus?

Use this forum to post Vensim related questions.
Post Reply
Robyn Letts
Junior Member
Posts: 6
Joined: Tue Jun 05, 2018 9:32 am
Vensim version: PLE+

Single precision problem in Vensim PLE Plus?

Post by Robyn Letts »

Hi

Before I consider purchasing Vensim DSS, could I ask for your opinion on the following error in Vensim PLE Plus for Windows version 7.2 Single Precision (x32)?

I have condensed my model down to a single level with inflow and outflow rates (attached). The order of the level is large (1e5) in comparison to the rates (1e2) and following some disturbance (either not starting at the steady-state value or following a small impulse in the inflow rate), the level does not return to the expected steady-state exactly (0.001% error, which has ramifications for the rest of my more complex model with multiple linked levels). The effect is worse the smaller I make the timestep, no matter the type of integration, which makes me think there's a rounding-off error creeping in due to single precision.

I have run the same differential equations in Octave (although I don't think it's quite the same ODE solver) and there is no steady-state error.

Would double precision solve my problem?

Regards
Robyn
Attachments
Test_Vensim.mdl
Model
(2.5 KiB) Downloaded 185 times
tomfid
Administrator
Posts: 3806
Joined: Wed May 24, 2006 4:54 am

Re: Single precision problem in Vensim PLE Plus?

Post by tomfid »

It returns to 100,000 in DP Vensim.

Email us for a trial license if you need to do further double-precision testing.
LAUJJL
Senior Member
Posts: 1421
Joined: Fri May 23, 2003 10:09 am
Vensim version: DSS

Re: Single precision problem in Vensim PLE Plus?

Post by LAUJJL »

Hi

The level goes very quicky to 100000, in simple PLE and in Vensim DSS simple precision event starting the level at a 0 value!

I do not see where is the problem.

JJ
tomfid
Administrator
Posts: 3806
Joined: Wed May 24, 2006 4:54 am

Re: Single precision problem in Vensim PLE Plus?

Post by tomfid »

Is this a physical system, like orbital mechanics? Normally an error of .001% is insigificant compared to the noise and uncertainty in a system.
Robyn Letts
Junior Member
Posts: 6
Joined: Tue Jun 05, 2018 9:32 am
Vensim version: PLE+

Re: Single precision problem in Vensim PLE Plus?

Post by Robyn Letts »

Thanks for the responses.

The trouble is that I'm not sure whether the problem is inherent to the system I'm trying to model (a tank reactor with multiple solutes and I've determined that the volume error manifests in the concentration but only at large volumes) or a precision problem.

I would like to do further double-precision testing on the full model to check if this is indeed the problem. Thank you for the offer, I will email Vensim regarding a trial version.

Regards
Robyn
Robyn Letts
Junior Member
Posts: 6
Joined: Tue Jun 05, 2018 9:32 am
Vensim version: PLE+

Re: Single precision problem in Vensim PLE Plus?

Post by Robyn Letts »

Definitely a precision problem! I have been testing the full model with a trial version of Vensim DSS double-precision and I'm no longer getting a steady-state error at large volumes. That's not to say there are no physical system limitations lurking in my model but at least now they won't be masked by a lack of precision. Thank you.
tomfid
Administrator
Posts: 3806
Joined: Wed May 24, 2006 4:54 am

Re: Single precision problem in Vensim PLE Plus?

Post by tomfid »

I'm not surprised - I don't recall exactly what the single precision epsilon is, but errors on a scale of 10^-5 are plausible, and you'd expect things to get worse for small time steps, because the discrete flow within a step gets smaller relative to the stock. Glad DP works.
LAUJJL
Senior Member
Posts: 1421
Joined: Fri May 23, 2003 10:09 am
Vensim version: DSS

Re: Single precision problem in Vensim PLE Plus?

Post by LAUJJL »

Hi

It does not look like a problem of precision.

I have joined the model with an intialization of the level to 100000.

Whatever the format of the table, pretty or scientific and whatever its precision, the value for the level is not printed correctly, already at the beginning. If the value of the steady state volume is
100000 and the value of the table is 100003, the table tool writes 100000, same for the initial volume. It seems that the table does not print correctly some values, but the difference between the steady state volume and the level is correct!

I have tried some ways to print the level with the correct value, but I did not find it.

After different tries, I think that I have understood how it works.

In fact, when the level is 100020 for instance it prints 100000, rounding the value, but if the value is 100050 it prints 100100, rounding again the value.

I have joined a model that shows the process very well.

If one uses the synthesim and one clicks on the initial volume shadow variable below the graphs and one clicks on the right arrow, strange things are happening. The initial value is increased by increment of one, as one can see it with the difference. But on the initial value and level tables the value stays the same, until the real initial value reaches the value of 100050 and the difference 50.
At this stage, the initial value and the level jumps to 100100 etc…

This can be very misleading. The same happens in Vensim PLE, DSS single and double precision.

Regards.

JJ
Attachments
Test_Vensim_2.mdl
(2.85 KiB) Downloaded 181 times
tomfid
Administrator
Posts: 3806
Joined: Wed May 24, 2006 4:54 am

Re: Single precision problem in Vensim PLE Plus?

Post by tomfid »

I'll take a look at the rounding algorithm.
Post Reply