Page 1 of 1

Wrong results when simulate (WASM)

Posted: Mon May 23, 2022 5:43 am
by saubla
Hi, I have experienced some problems when running a Vensim model in the browser (through WASM).

First things first, the model works, I mean when I run the simulation within Vensim it generates the right outputs, as well, when I run the simulation in the console (CMD) with a CIN and LST files it generates right outputs too... I publish the "Web files" to generate the WASM model (everything goes well I think, because there is no error output), after Vensim shows a success dialog, there is a "web" folder with all the stuff needed.

I have a custom interface to render the model outputs, at the moment it loads all the constants of the CIN file, run the simulation, and show the LST policies in a graph. Well, when I do this with the WASM model, it renders a sort curve on the X axis and the remaining values are NaN (not a number)... (does not work as expected).

Additional info, I am using the Vensim WASM API (https://www.vensim.com/documentation/api.html) to interact with the model.

If you need to review the model, please provide me an email to send it.

Thank you.

Re: Wrong results when simulate (WASM)

Posted: Mon May 23, 2022 7:17 am
by Administrator
Your profile says you are a Vensim Pro user, WASM and browser functionality is not available in Vensim Pro.

Can you modify your profile and enter the correct licence details?

Can you point us to where you have uploaded the WASM files on the web?

Re: Wrong results when simulate (WASM)

Posted: Mon May 23, 2022 7:42 am
by saubla
I have updated my profile.

The WASM file isn't published in web yet, but I can send it via email, preferably.

Re: Wrong results when simulate (WASM)

Posted: Mon May 23, 2022 7:47 am
by Administrator
Please email us and clarify your licence details, the email on your account does not belong to the institution that purchased the licence.

Also, you do need to publish to the web.
http://vensim.com/documentation/limitations.html

Re: Wrong results when simulate (WASM)

Posted: Mon May 23, 2022 4:57 pm
by tomfid
There's a known issue with sliders & cin file values that will be fixed in the next release. However, if the model's generating NaN values as a result of wrong slider settings within their ranges, there might be a model robustness issue as well.

Re: Wrong results when simulate (WASM)

Posted: Fri May 27, 2022 10:00 am
by saubla
Hi again and thanks for the response.

I have published the application with the WASM model in: https://tools.cartif.es/wasm/

Without changing the sliders ( values from https://tools.cartif.es/wasm/api/vensim/inputVariables ):

If you run the simulation for the first time, you can see a short set of values ( outputs from https://tools.cartif.es/wasm/api/vensim/outputVariables ) rendered in the graph.

You can check the values of a serie in the "Developer Tools > Console" with the function "GetSeries" ( https://www.vensim.com/documentation/api.html ), as you can see there are a lot of NaNs.

Bonus: another weird thing that I discovered is when you run the simulation 3 times, the results change...


As I say before,
the model works as expected, running the simulation within Vensim.
If you need to check the model (MDL) with Vensim, please provide an email to send it.

Re: Wrong results when simulate (WASM)

Posted: Fri May 27, 2022 10:08 am
by Administrator
Please email us and clarify your licence details, the email on your account does not belong to the institution that purchased the licence.

If you want to send the model only to us, please do (vensim@vensim.com). Ensure you include your licence details, and a detailed description of why you think the results are different when you publish to WASM. We cannot assist in debugging the HTML/JScript that you have written yourself.

Re: Wrong results when simulate (WASM)

Posted: Mon Jun 06, 2022 6:19 am
by saubla
Hi, I have updated my license details, I hope that issue is solved now.

I just send you the MDL via email.

Here are the specific versions used:
- Vensim DSS: 9.1.1 (x64)
- emsdk: 2.0.6
- Node 14.18.2
- Python 3.9.2
- Java 8.152

Re: Wrong results when simulate (WASM)

Posted: Mon Jun 20, 2022 9:01 am
by saubla
tomfid wrote: Mon May 23, 2022 4:57 pm There's a known issue with sliders & cin file values that will be fixed in the next release. However, if the model's generating NaN values as a result of wrong slider settings within their ranges, there might be a model robustness issue as well.
Hi tomfid,

It is not a robustness problem in the model, it has been tested within Vensim, and it has been subjected to some sensitivity tests that it has passed correctly, it also generates the expected results.

The problem is in the translation of the model to WASM, since running the simulation with the same inputs you get wrong results and many values are NaN ( you can see this at https://tools.cartif.es/wasm/ ).

Re: Wrong results when simulate (WASM)

Posted: Mon Jun 20, 2022 9:19 am
by Administrator
saubla wrote: Mon Jun 20, 2022 9:01 amIt is not a robustness problem in the model, it has been tested within Vensim, and it has been subjected to some sensitivity tests that it has passed correctly, it also generates the expected results.

The problem is in the translation of the model to WASM, since running the simulation with the same inputs you get wrong results and many values are NaN ( you can see this at https://tools.cartif.es/wasm/ ).
The NaN values are almost certainly the result of a floating point error(s). This can be overflow/underflow or division by zero which is a robustness issue.

I'd suggest making sure the model passes the units check, and has an appropriate time step. Then you can use the sensitivity testing to make sure the bounds you put on any constants that a user can change produce a valid range of results. Once you have done this, then look at publishing to WASM.

Re: Wrong results when simulate (WASM)

Posted: Tue Jun 21, 2022 12:05 am
by tomfid
I think variation from one run to another is a symptom of the bug I mentioned above (fixed, not yet released). The NaNs are possibly related, but I haven't seen the model to verify.