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

Open a library, which was designed in Dymola

Open a library, which was designed in Dymola

Hey Community,

I would like to open a library in OM witch was designed in Dymola. The following error messages appear when opening. I tired to save the libraries on the MODELICAPATH but the error still appears.

Do anyone have an idea how I can fix the errors?
Thank you.

[1] 18:05:36 Syntax Error
[C:/Users/name/AppData/Roaming/.openmodelica/libraries/Dymola_Library/Data/Media/Interfaces/PartialHumidGas/ 29:6-29:26]: Subscripting modifiers is not allowed. Apply the modification on the whole identifier using an array-expression or an each-modifier.

[2] 18:05:36 Scripting Error
Failed to load package Dymola_Library () using MODELICAPATH C:/Program Files/OpenModelica1.17.0-64bit/lib/omlibrary;C:/Users/name/AppData/Roaming/.openmodelica/libraries/.

[3] 18:05:36 Syntax Error
[C:/Dymola/Libs/ModelicaLibs/Dymola_Library/Utilities/Tables/ 69:64-69:64]: Missing token: SEMICOLON

[4] 18:05:36 Syntax Error
[C:/Dymola/Libs/ModelicaLibs/Dymola_Library/Utilities/Tables/ 67:65-67:65]: Missing token: SEMICOLON

Edited by: PaDo - May-06-21 16:22:05

Re: Open a library, which was designed in Dymola

The first error is because subscripted modifiers are not legal Modelica, i.e. something like


x(y[1] = 0)

is not allowed and needs to be rewritten so that it modifies the whole array instead. The other errors I can't say anything about without seeing the actual source code of the library.

Re: Open a library, which was designed in Dymola

Thank you very much for your answer.
For the first error, I have attached the code here:


or in a other package:


For the third error with the Semicolon, the code is in the line where the problem occurs here:

      u_min =  (readMatrix(fileName, tableName, dim[1], dim[2]))[1,1];
      u_max =  (readMatrix(fileName, tableName, dim[1], dim[2]))[dim[1],1];

Can you help me to fix this errors?

Re: Open a library, which was designed in Dymola

For the modifiers you can remove the [:] parts since they're wrong and unnecessary. So instead of e.g. extraPropertiesNames[:]=fill("",0) it should just be extraPropertiesNames=fill("",0).

For the third error the issue is that Modelica does not allow subscripting generic expressions, only arrays. One solution is to store the result of readMatrix in an array, for example:


  parameter matrix[:,:] = readMatrix(fileName, tableName, dim[1], dim[2]);
  u_min = matrix[1, 1];
  u_max = matrix[dim[1], 1];

Edited by: perost - May-25-21 13:23:35
There are 0 guests and 0 other users also viewing this topic
You are here: