Closed lmikelsons closed 3 years ago
We wanted to use RuntimeGeneratedFunctions instead of invokelatest. However, we encountered some problems when enabling the correct module context. We will work on this in the coming days (maybe going back to using invokelatest). Note, also that events are not yet supported in TinyModia.
Is the behaviour below related to this?
I just now installed TinyModia
and just tried to follow the Filter
example (in the Julia REPL). However, when trying to instantiate the model, I get:
julia> filter = @instantiateModel(Filter)
Instantiating model Filter
Model error: You must use `RuntimeGeneratedFunctions.init(@__MODULE__)` at module
top level before using runtime generated functions in Main
Aborting instantiateModel
Edit: Ok, just have to do:
using RuntimeGeneratedFunctions
RuntimeGeneratedFunctions.init(@__MODULE__)
... needs to be documented though.
Sorry. All tests were not updated. However, we are now considering using invokelatest() instead since the need to include these lines is then avoided.
We are now using Base.invokelatest instead.
It seems not possible to use a function (apart from Julia built-in functions) inside the equation section (like the getForce(...) function in the Modia example "CollidingBalls.jl"). I tried to define it inside and outside the respective module. While generation of the runtime-generated function for the rhs (in the instantiation) works fine, evaluation of it gives the error that the function is not defined. Is there a work-around or is this a limitation of TinyModia (compared to Modia)?
Thanks in advance!