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
  • Index
  • » Users
  • » alidaf
  • » Profile

Posts

Posts

Nov-21-19 08:17:16
Illegal Instruction when running external C library function.
Category: Programming

I think more examples are needed so if anyone is interested I have attached the files that now actually work.
SteamTables.zip

I compiled the C code in NetBeans as a dynamic library and copied the .so file to /usr/lib/x86_64-linux-gnu, which is one of the standard library locations in linux. The .c and .h files are in the same folder as the .mo file. Using the method where the .h file isn't needed doesn't work for me. I also couldn't get the Python version to work but this does exactly what I want it to.

Nov-20-19 15:49:39
Illegal Instruction when running external C library function.
Category: Programming

Ok, I think I sorted it out. The function is expecting a char array (C doesn't have strings) but OM was passing a string. I changed the requirement from string to an enumerated type in the C function and passed an integer from OM. At least the there are no errors now but the returned value isn't what I was expecting. At least its a step in the right direction.

Nov-20-19 15:00:18
Illegal Instruction when running external C library function.
Category: Programming

I've coded a lookup table in C and trying to call the function from within OM but it keeps crashing and I can't figure out why.

I pass the function a lookup string and a temperature. The function then looks up the coefficients and calculates the polynomial, which is returned. The function works fine when called from C but not OM. OMEdit compiles the code but on running produces errors:

Process crashed
Process crashed
Simulation process failed. Exited with code 4.

Any help will be appreciated.

SteamTables.zip

Aug-12-19 15:18:13
Category: Programming

I've been having a look at the example code in the Modelica_DeviceDrivers package but I can't make heads nor tails of how to just have something that captures UDP packets and unpacks the data. Does anyone have any code examples that I could use to learn from? There's very little information on networking.

Ta.

  • Index
  • » Users
  • » alidaf
  • » Profile
You are here: