FMU questions

4 posts / 0 new
Last post
roel
Offline
Joined: 2010-02-23
FMU questions

Dear,

I'm trying to import and run FMU's in JModelica.
First I need to say that this really works fine. Thanks for this great work!

I have one question: how can i influence the size and type of the resulting file? It seems that the keyword protected is not taken into account in the FMU, blowing up my result file. Is there another solution? Also, I'd rather have the .mat format for the output file cause it is more compact, is this supported by JModelica?

If I cannot influence the size of the output file, I'm unable to run my building simulations for a whole year, and the whole FMU-thing becomes irrelevant for me.

And finally an issue. Sometimes however I get an error when I try to import the same FMU again. Could it be influenced by opening the FMU in Dymola? I can't reproduce it on purpose.
Here's an error log:
---------------------------------------------------------------------------
WindowsError Traceback (most recent call last)

c:\workspace\modelica\tests\FMURun.py in ()
17
18 # Simulation ###########################################################
####

---> 19 mymodel=FMUModel(fmu_name)
20 opts = mymodel.simulate_options()
21 opts['ncp'] = final_time / interval

C:\JModelica.org-1.6b1\Python\jmodelica\fmi.pyc in __init__(self, fmu, path, rel
oad_dll, enable_logging)
300 #Retrieve and load the binary

301 self._dll = jmodelica.jmi.load_DLL(
--> 302 self._tempdll[:-len(suffix)],self._tempdir)
303
304 #Load calloc and free

C:\JModelica.org-1.6b1\Python\jmodelica\jmi.pyc in load_DLL(libname, path)
306 # Don't catch this exception since it hides the actual source

307 # of the error.

--> 308 dll = Nct.load_library(libname, path)
309 return dll
310

C:\Python27\lib\site-packages\numpy\ctypeslib.pyc in load_library(libname, loade
r_path)
129 except OSError, e:
130 exc = e
--> 131 raise exc
132
133 ctypes_load_library = deprecate(load_library, 'ctypes_load_library',

WindowsError: [Error 126] The specified module could not be found
WARNING: Failure executing file:

Thanks a lot for your answers,
Roel

roel
Offline
Joined: 2010-02-23
update: the error occured now

update: the error occured now right after a run that failed (tolerance too low), when I wanted to reload the model with FMUModel().

When I restart pylab, the same script works again.

jakesson
Offline
Joined: 2009-03-14
Hi Roel,   first some

Hi Roel,
 
first some comments on the size of the simulation result file size. The FMUs does not contain any information about weather a variable is public or protected - this information is only available in the Modelica tool. What tool are you using to export the FMU? You may also affect the size of the output by specifying an output mesh with a number of points of your choice. By default, the one mesh point is written to file for each integrator step. You set the number of mesh points by setting the simulation algorithm option ncp to a positive number.
 
We have currently no plans of supporting writing of to file in MATLAB format, but rather we are looking at he HDF5 format - there is a proposal in the Modelica Association that is based on FMI. We plan to start working on this during the spring of 2012.
 
About the error you get when reopen an FMU - Tove, ideas?
 
Best
/Johan 

roel
Offline
Joined: 2010-02-23
Dear Johan, thanks for your

Dear Johan,
thanks for your answer.
I'm currently using dymola 2012 for creating the FMU. Do you think there are options to reduce the size of the FMU in the tool from which you create it?

I tried the ncp option already: it's not sufficient. Currently, I'd like to run a building model for a year with 10 minute output interval. In dymola, the output file takes about 33-50 Mb, depending on the model (many objects are protected).

The simulated FMU in JModelica gives an output file of 53 Mb for 1 week only. Some more info for this case:
- len(res.keys()) = 13k
- result array in the .txt file: float data_2(1010,2443).
I thought maybe that's because of the overhead, but it's not, cause a 2 week simulation gives a file of 104 Mb. So I cannot do a yearly simulation :-( . I really hope we can find a solution to this?

Using the HDF5 format looks promising. I was thinking of using this format with pytables for managing my simulation results of different runs. I made already a class to create an index of different simulations and keep record of the different parameters used. Extending this class with pytables to keep also the results together (raw outputs + postprocessed results) is on my to-do-if-time-list. Maybe there are options for collaboration, or testing?

Regards,
Roel

Login or register to post comments