First time here? Check our help page!
3

Why I don't get enough files as the outputs of the simulation of Dymola model with python ?

I'm simulating a Dymola model with python with this code :

 # Import the function for compilation of models and the load_fmu method
from pymodelica import compile_fmu
from pyfmi import load_fmu
# Import the plotting library
import matplotlib.pyplot as plt
# Compile model
model_name = 'ObjectiveFunction'
mo_file = 'ObjectiveFunction.mo'
VDP_fmu = compile_fmu('ObjectiveFunction', compiler_options = {'extra_lib_dirs':'D:\JModelica.org-1.17\ObjectiveFunction'})
# Load model
vdpid = load_fmu(VDP_fmu)
res = vdpid.simulate(final_time=1000)

the problem is that, this will give me only 3 files as outputs: ObjectiveFunction_result.txt result.txt ObjectiveFunction_log.txt

but I need also dsin.txt , dsfinal.txt and .... so that I can run Genopt or other related programs, what is the problem ?

Astronaut's avatar
85
Astronaut
asked 2016-01-26 11:14:59 -0500
__AmirRoth__'s avatar
4.4k
__AmirRoth__
updated 2016-01-26 15:15:09 -0500
edit flag offensive 0 remove flag close merge delete

Comments

add a comment see more comments

1 Answer

1

You are currently trying to use pyfmi to simulate an FMU which has been compiled using JModelica. If you want to have dsin.txt and dsfinal.txt, then you should use Dymola to translate your Modelica model.

Thierry Nouidui's avatar
1.5k
Thierry Nouidui
answered 2016-01-27 16:32:12 -0500
edit flag offensive 0 remove flag delete link

Comments

yes it's right but since I want to make thos files(dsin.txt...) using python and simulating from that, do you think that simulationg from Pyhton make those files or no ?

Astronaut's avatar Astronaut (2016-01-28 19:55:22 -0500) edit

Python does not write any dsin.txt or dsfinal.txt. Dymola writes those file. If you want to have dsin.txt and dsfinal.txt, then you will have to translate your Modelica model using Dymola.

Thierry Nouidui's avatar Thierry Nouidui (2016-01-29 12:40:21 -0500) edit
add a comment see more comments