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

Data file?

Data file?

Hello, for my master project we have to modelyze a house after integration of phase changing materials, and I would like to use a meteo file for my boundary condition. Three week of tutorial reading later, even if I've learnt a lot of thing I still don't know what is the function for getting back external data?
How can I send the result into a data file?
Every answer are welcome.

Re: Data file?

Hi
I assume that you want to extract some part of the result file and insert into another file?
If yes then there is a python script that could help you
In the python script I'm running simulation and parsing the result file and pipe it to a new file for matlab visualization
However you can easily redirect the result to another file.
The files are here: http://openmodelica.org/index.php/home/ … 48-scripts
(beside the other script)

Regards
Mohsen

Re: Data file?

thanks a lot for the help,

as i understood,the scripts you sent are used to visualize the data extracted from OM on matlab,but what exactly i need is a command that can directly be written inside the OM shell to see the values,i need the values the do the calculations afterwards.

as an example (for C) : fputs or fopen

sorry for all these questions but i'm a real beginner

Re: Data file?

Look in the file ModelicaBuiltin.mo if you want to write to file from OMShell:

Code:


function writeFile
  "Write the data to file. Returns true on success."
  input String fileName;
  input String data;
  output Boolean success;
external "builtin";
end writeFile;

Or use the Modelica Standard Library: Modelica.Utilities.Streams.print(string,filename)

Or do you mean how to read the result-file? You could just use simulate(..., outputFormat="csv") and read the data back in most tools...

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