# Modifying Modelica C library for WSM

GROUPS:
 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)
1 month ago
4 Replies
 Where is the extrapolation hardcoded? You have the extrapolation parameter in CombiTimeTable that you can use to control the extrapolation.Otto
 I've updated the post with the code in C and WSM. The interpolation method is an argument, but not the extrapolation (unless it's bundled somehow, and I missed it).Edit: I opened CombiTimeTable and see that extrapolation is an input parameter here, but not in the CombiTable2D external function.