Opened 4 years ago
Last modified 3 years ago
#6325 assigned defect
Support for ExternData
Reported by: | Dietmar Winkler | Owned by: | Per Östlund |
---|---|---|---|
Priority: | high | Milestone: | |
Component: | New Instantiation | Version: | 1.16.0 |
Keywords: | Cc: |
Description
When trying to test/verify an example from https://github.com/modelica/ModelicaSpecification/issues/2425#issuecomment-751835905 I got the following error messaged in OMEdit (Connected to OpenModelica 1.17.0~dev-305-gb74c531):
[2] 13:43:27 Translation Error [/var/lib/jenkins/ws/LINUX_BUILDS/tmp.build/openmodelica-1.17.0~dev-305-gb74c531/OMCompiler/Compiler/NFFrontEnd/NFEvalFunction.mo: 181:7-183:92]: Internal error NFEvalFunction.evaluateExternal failed on ExternData.Types.ExternXMLFile.constructor, evaluation of userdefined external functions not yet implemented
Which I'm not sure what it is trying to tell me. So not sure if this is an issue of OMC or the library.
I've attached both my test model and the xml file once more here.
Attachments (2)
Change History (10)
by , 4 years ago
Attachment: | SizingExampleXML3.mo added |
---|
by , 4 years ago
Attachment: | multiTank1.xml added |
---|
comment:1 by , 4 years ago
Component: | *unknown* → New Instantiation |
---|---|
Milestone: | NeedsInput → 1.18.0 |
Owner: | changed from | to
Status: | new → assigned |
comment:2 by , 4 years ago
The thing I'm interested here is what has to happen in order to be able to use ExternData in connection with OMC. Is there something that can be solved inside ExternData by the library devs or is it depending on that #5240 gets finally fixed. In which case it doesn't look to promising given the last action on that ticket was 20 months ago.
comment:3 by , 4 years ago
I set it as a blocker for 2.0.0, which means, we have to take care of this for the "no-compromise" version of OpenModelica that we will eventually release. How long it takes to get there depends on how many resources we get in the next 1-3 years to achieve this goal, that requires to take care of a few hundred issues.
Of course if you're interested specifically we can try to get it solved earlier than that.
@perost, can you estimate how much work would be needed?
comment:4 by , 4 years ago
Ah I see. OK that is a shame then since we are working on a MoConf 2021 paper about ExternData and being able to test it with OMC would have been a nice addition to it. So far we could only test it on Dymola and SimulationX.
comment:5 by , 4 years ago
The issue is as casella mentions that you're using an external function as an array dimension. OpenModelica requires dimension sizes in models to be determined at compile time, and since the function is impure it technically shouldn't be allowed.
It seems this is expected behaviour though, since even the MSL uses this pattern (which we can handle since we link the compiler against ModelicaExternalC anyway). So we probably need to implement support for evaluating external functions in the NF even if I'm not convinced it's a good idea.
comment:7 by , 4 years ago
In the old frontend with -d=gen
, yes. Otherwise we need #5240 resolved. But if you mark it pure
, you are also lying to the compiler. The file might change in-between compiling the model and running it (there can be several months in-between for example in FMUs).
@dietrmarw, I guess this is because of #5240. Apparently, your data file provide some structural parameter (e.g. an array dimension) which the NF should be able to evaluate during flattening.
If that is the case, then please close this ticket as duplicate and follow #5240. Otherwise, please post more info. It could be, as in ticket:5240#comment:6, that it is not necessary to actually evaluate those parameters, in which case a workaround until
NFEvalFunction.evaluateExternal
is implemented could be devised.