You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm ecstatic over this update. Sundials was making me crazy. Thank you for your hard work.
Here is a small item:
@instantiateModel fails when the Model contains Unitful quantities, as in the pendulum example in the README.
Unitful's default behavior is to render exponents as unicode subscripts. Upon parsing those expressions, Unitful does not recognize them as units, causing @instantiateModel to fail.
Setting
ENV["UNITFUL_FANCY_EXPONENTS"]=false
before calling @instantiateModel prevents the problem.
The text was updated successfully, but these errors were encountered:
@instantiateModel fails when the Model contains Unitful quantities, as in the pendulum example in the README.
The pendulum example in the README file is available as Modia/examples/Pendulum.jl. When executing it on my (Windows) machine, it translates and simulates correctly.
The docu in Unitful states:
By default, exponents on units or dimensions are indicated using Unicode superscripts on macOS and without superscripts on other operating systems. You can set the environment variable UNITFUL_FANCY_EXPONENTS to either true or false to force using or not using the exponents.
So, you are probably working on macOS. It feels a bit dangerous that a global environment variable is set inside Modia. It would be better to extend Modia, so that units with exponents are also correctly handled on macOS without setting this environment variable. When inspecting https://en.wikipedia.org/wiki/Unicode_subscripts_and_superscripts it seems quite complicated to support this, because there are Unicode superscripts for a large set of characters. We also have no access to macOS, and cannot test such a bug fix.
The simplest solution is probably to follow your suggestion, so set ENV["UNITFUL_FANCY_EXPONENTS"]=false on macOS when entering @instantiateModel, and additionally print a warning message, if ENV["UNITFUL_FANCY_EXPONENTS"] was not set or has a value of true on macOS.
I'm ecstatic over this update. Sundials was making me crazy. Thank you for your hard work.
Here is a small item:
@instantiateModel
fails when the Model contains Unitful quantities, as in the pendulum example in the README.Unitful's default behavior is to render exponents as unicode subscripts. Upon parsing those expressions, Unitful does not recognize them as units, causing
@instantiateModel
to fail.Setting
before calling
@instantiateModel
prevents the problem.The text was updated successfully, but these errors were encountered: