Message Boards Message Boards

Import parameters into System Modeller from Excel?

Posted 6 years ago

Hi, I am have several models of dynamical systems with a significant number of parameters for each. The best way to work with these would be to use an Excel sheet/tabs, and have SystemModeller use this data. With Dymola, I could use ExternData which allows one to specify sheet/row/column of Excel for parameters. Unfortunately, this does not work in SM as it seems to have a dependence on Dymola. There are some workaround for OpenModelica, but I have not had any luck in getting these to work in SM.

Could anyone suggest a way to get ExternData to work in SM, or perhaps some hacks to it?

The alternative is to use Records and Combi-Time and .rtf, but this is really taking a two decade step backwards. ExternData would be great if it could be made to work.

Thanks for the help.

POSTED BY: Chris Benson
5 Replies

Chris,

Look at the example Modelica->Utilities>Examples->readRealParameterModel. It reads a text file for a list of parameters. Here is the example file that it reads:

// Motor data

J        = 2.3     // inertia
w_rel0   = 1.5*2;  // relative angular velocity
phi_rel0 = pi/3;

You could save the excel file as text and read it as in the example. This is a very human readable format so its not a bad option for a large amount of data. (There is also a matrix reading example but it appears to crash -- I'll report it to WSM but the underlying functions may work.)

Alternatively, you can write a simple C external function that reads a parameter file or a matrix of data and call it.

These are the two ways I am aware of -- maybe the WSM people have another suggestion.

Regards,

Neil

POSTED BY: Neil Singer
POSTED BY: Otto Tronarp
Posted 6 years ago
POSTED BY: Chris Benson
POSTED BY: Neil Singer

Neil,

yes that is correct I was referring to ExternData.

Otto

POSTED BY: Otto Tronarp
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract