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
453 stars 165 forks source link

Fix assertions #4276

Open tobolar opened 5 months ago

tobolar commented 5 months ago

This PR especially

  1. fixes senseless assertions like

    assert( body.r_0[2] - body.r_0[2] < tol ...);

    (so comparing the variable body.r_0[2] to itself).

    Fixing this, the assertion is triggered for tol=1e-4. So I additionally changed the intialization prismatic1.a(..., start=9-world.g) to have more precise value.

    Note: for ModelicaTest.MultiBody.Forces.Spring, this PR changes values of reference signals prismatic1.s and prismatic1.v over time. So regression check could be broken => reference signals shall be recalculated/re-generated.

    No such behaviour expected for ModelicaTest.MultiBody.Forces.Spring2.

  2. Fixes missing absolute differences like abs(x - y) for assertions.

  3. Separate tolerances to different physical quantities

  4. SI units for tolerances

Refs #4193