Search code examples
python-2.7simulationfmi

Co-simulation FMU 'ncp' options


If I set variable 'ncp' value to big number like 400000 for simulation_options and simulate it. I am getting error as shown in the attachment. simulation result with final_time=4.0. If I give ncp=100000 it is working. I need to use 400000 for my script. I am not able to know the reason for the error. Thanks for your help in advance


Solution

  • The error you receive is an memory problem, i.e. Python is not able to allocate enough memory for your simulation results.

    During the simulation, the result is continuously written to file and in your case with ncp=400000, 400000 result points are written. If your model is large (in terms of variables) this amounts to an enormous amount of data being written. Note though that the simulation succeeds and it is only when the results are being loaded back into memory in order to return it to the user that it fails. Your simulation results are stored in a file in your current directory.

    If not all variables in your model is of interest I'd recommend to use the 'filter' option so that only results are stored for the variables that are of interest.

        opts["filter"] = "*x" #Store all variables that ends with x
        opts["filter"] = ["Myvar1", "Myvar2*"] #Store "Myvar1" and all variables that starts with "Myvar2".
    

    For more information about the options, see http://www.jmodelica.org/assimulo_home/pyfmi_1.0/pyfmi.html#pyfmi.fmi_algorithm_drivers.FMICSAlgOptions