The "Modelica Standard Tables" library is in C, and the extrapolation method is hardcoded (in C) in the init function. I need to use "NO_EXTRAPOLATION" instead of "LAST_TWO_POINTS" So I pulled the Modelica source code from Github.
I used Terminal (macOS) to run the Makefile. It created
libModelicaO.a
libModelicaMatIO.a
libModelicaStandardTables.a
libzlib.a
I put libModelicaStandardTables.a
into /Applications/SystemModeler/Contents/lib/osx64/msl/3.2.2
and the model failed. I thought maybe it depended on one of the other libraries, and that's when I noticed that libModelicaExternalC.a
is not in the standard (Github) code for Modelica but libzlib.a
is.
Is there a way to build the C code from Github that's compatible with WSM?
Relevant C code
void* ModelicaStandardTables_CombiTable2D_init(_In_z_ const char* tableName,
_In_z_ const char* fileName,
_In_ double* table, size_t nRow,
size_t nColumn, int smoothness) {
return ModelicaStandardTables_CombiTable2D_init2(fileName, tableName,
table, nRow, nColumn, smoothness, LAST_TWO_POINTS, 1 /* verbose */);
}
void* ModelicaStandardTables_CombiTable2D_init2(_In_z_ const char* fileName,
_In_z_ const char* tableName,
_In_ double* table, size_t nRow,
size_t nColumn, int smoothness,
int extrapolation,
int verbose) {
Modelica code in WSM
external "C" externalCombiTable2D = ModelicaStandardTables_CombiTable2D_init(tableName, fileName, table, size(table, 1), size(table, 2), smoothness)
Maybe the better way to do this is to duplicate the table library and use CombiTable2D_init2
directly and pass the extrapolation integer (4 = NO_EXTRAPOLATION)