modelica / ModelicaStandardLibrary

Free (standard conforming) library to model mechanical (1D/3D), electrical (analog, digital, machines), magnetic, thermal, fluid, control systems and hierarchical state machines. Also numerical functions and functions for strings, files and streams are included.
https://doc.modelica.org
BSD 3-Clause "New" or "Revised" License
452 stars 165 forks source link

Unrealistic expectation on size of err_u #4410

Open henrikt-ma opened 4 weeks ago

henrikt-ma commented 4 weeks ago

It appears problematic that ModelicaTest.Media.TestAllProperties.PartialMediumFunctions has a single eps constant used to define absolute error tolerance different media properties. https://github.com/modelica/ModelicaStandardLibrary/blob/7a2a5ed3a1c92bd6d2eaed1a2813a0ae6ab75d91/ModelicaTest/Media.mo#L104

Take ModelicaTest.Media.TestAllProperties.CO2 for example. The expected value of medium.u is 156518.651861815, and the value of eps is 1e-10. This means that the assertion that err_u < eps requires medium.u to have a relative error smaller than 6e-16. Considering that double precision is the de facto standard (the specification only has a recommendation regarding the range, not the precision of Real), this does not seem realistic.