Question-and-Answer Resource for the Building Energy Modeling Community
Get started with the Help page
Ask Your Question
3

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

asked 2016-01-26 11:14:59 -0500

Astronaut's avatar

updated 2016-01-26 15:15:09 -0500

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 ?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2016-01-27 16:32:12 -0500

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.

edit flag offensive delete link more

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

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Careers

Question Tools

1 follower

Stats

Asked: 2016-01-26 11:14:59 -0500

Seen: 458 times

Last updated: Jan 27 '16