Archived OpenModelica forums. Posting is disabled.

Alternative forums include GitHub discussions or StackOverflow (make sure to read the Stack Overflow rules; you need to have well-formed questions)


Forgot password? | Forgot username? | Register

Why are externalObject inputs evaluated at compile time?

Why are externalObject inputs evaluated at compile time?

In CompilerFrontEnd/Static.mo there is a function called evalExternalObjectInput that evaluates the inputs to externalObject constructors at compile time.

The function documentation states:

"External Object requires us to construct before initialization for good results. So try to evaluate the inputs."


The problem I'm having is that it is evaluating parametric inputs to an externalObject and the final c code ends up with a numeric literal instead of a reference to the parameter.  So the only way I can change the parameter value is by recompiling.

For typical cases the compile time is about 25 seconds but the simulation time less than 5 seconds.  I need to run 100s of cases with different parameters so it is running far slower than it could if I could reuse the executable.

I've recompiled OMC with the six calls to evalExternalObjectInput in Static.mo removed and it worked fine.  The parameter references were written into the c code and I could change them without needing to recompile for each simulation.

So my questions are:

1.  Why is this evaluation needed?

2.  If it is needed shouldn't it be restricted to inputs of "constant" variability only? (so "parameter" variability inputs are not evaluated).


Thanks

Tom


There are 0 guests and 0 other users also viewing this topic
You are here: