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

External files

External files

Hi all,

is there a possibility to read data from an external file as input to a simulation?  A typical example is a meteo file.
How can I do this?

Kind regards,
Roel

Re: External files

Use external C functions:
Described in Peter Fritzson's book, section 9.4.
Or http://www.modelica.org/documents/ModelicaSpec32.pdf section 12.9 (and 12.9.7 for external objects if using those is simpler for you).

You can either declare it as parameter and read an array that you use in the simulation. Or open a file and read more data during some samples; depends on the problem.

Re: External files

Thanks, I'll study this!

It would be great if anybody could share both the modelica-code,  C-code and table format required to read data at  sample interval (eg. hourly meteo data) in the simulation.   I'have absolutely no C-experience, so I'm reluctant to learn another language just for reading data into Modelica.

Regards,
Roel

There are 0 guests and 0 other users also viewing this topic