Description
Flat Modelica has some issues regarding builtin functions, and there are several ways to deal with them.
Take for example ModelicaServices - it contains vendor-specific functions that may not work in other tools.
Should a Flat Modelica model be allowed to have a uses-annotation on a package such as ModelicaServices and pull in the corresponding external or non-external functions?
Let's say you depend on Modelica_DeviceDrivers and it has many nice libraries and include-files you would like to use. Do you need to copy them to the same location as the flat Modelica file? (Can you even do that if you have files with the same name in the directory structure, etc?)
Or would you be allowed to modify the function and simply add a uses-annotation at the top-level and LibraryDirectory/IncludeDirectory to override the defaults for the function?
So you could have an external object like:
class 'Modelica.Blocks.Types.ExternalCombiTable2D'
extends ExternalObject;
function constructor
input String 'tableName';
input String 'fileName';
input Real[:, :] 'table';
input 'Modelica.Blocks.Types.Smoothness' 'smoothness';
output 'Modelica.Blocks.Types.ExternalCombiTable2D' 'externalCombiTable2D';
external "C" 'externalCombiTable2D' = ModelicaStandardTables_CombiTable2D_init('tableName', 'fileName', 'table', size('table', 1), size('table', 2), 'smoothness') annotation(LibraryDirectory="modelica://Modelica/Resources/Library", Library = {"ModelicaStandardTables"});
end constructor;
function destructor
input 'Modelica.Blocks.Types.ExternalCombiTable2D' 'externalCombiTable2D';
external "C" ModelicaStandardTables_CombiTable2D_close('externalCombiTable2D') annotation(LibraryDirectory="modelica://Modelica/Resources/Library", Library = {"ModelicaStandardTables"});
end destructor;
end 'Modelica.Blocks.Types.ExternalCombiTable2D';
The second issue is possible to solve with a bit of tweaking, but I think ModelicaServices is tricky.