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

Can't tell if EnergyPlusToFMU Examples are working

asked 2020-03-23 07:34:29 -0500

Deniz Erbilgin gravatar image

updated 2020-03-24 08:56:37 -0500


I've been having some trouble with running EnergyPlus as an FMU. Hi,

For some reason I haven't been able to install PyFMI on my system, and have been trying to using FMPy. After some initial trouble, I've managed to run the examples that come with EnergyPlusToFMU.

My issue now, is that setting the input variables does not seem to change the simulation output at all. Since none of the examples provide all the files necessary to generate the FMU or document the expected output from running them, I have no idea what the results should be.

Has anyone else successfully run the examples? If so, what .epw did you use, and how does changing the input variables to the examples change the outputs?

Edit: Here's the python code I'm using to run the example.

import fmpy

# FMU compiled with:
# - E+ v9.0.1
# - EnergyPlusToFMU v2.1.0
# - EnergyPlusToFMU-v2.1.0/Examples/Actuator/_fmu-export-actuator.idf
# - EnergyPlus-9-0-1/WeatherData/USA_IL_Chicago-OHare.Intl.AP.725300_TMY3.epw
fmu = '_fmu_export_actuator.fmu'

# prints a description of the FMU.

# Runs the model.
# Needs this patch to be applied:
result = fmpy.simulate_fmu(


And this is the output I get, regardless of what yShade is set to. image description

edit retag flag offensive close merge delete


Why couldn't you install PyFMI on your machine? Was it on Windows or on Linux. PyFMI has pre-compiled binaries that allows it to be easily installed (

What do you mean by been able to run the examples? The examples have one input and one output so you should be able to query the output and see what comes out. You could also modify one of the examples (e.g. Schedule) and add an output variable that tracks the input. You could then set the input and see whether the output is what you are expecting.

Thierry Nouidui gravatar image Thierry Nouidui  ( 2020-03-23 13:39:38 -0500 )edit

@Deniz Erbilgin, are you running into the same issue as me?

Jeremy gravatar image Jeremy  ( 2020-03-23 16:57:19 -0500 )edit

@Thierry, I'm running Fedora 31. I'm not really sure why I couldn't get PyFMI to work, I ran into some pretty bizarre issues and so gave up in the end (I did try the anaconda package as well). I can run all three examples in FMPy, but: a) adjusting the the inputs does not seem to effect the outputs. b) in the absence of a more complete example, I don't know if (a) is because of a problem in the software, or because of the particular .epw I've chosen or what (I assume it's a bug but you never know).

@Jeremy that does looks similar to my problem. How did you read back yShade?

Deniz Erbilgin gravatar image Deniz Erbilgin  ( 2020-03-24 05:48:25 -0500 )edit

Could you share the code you are using to run the example in FMPy? I unfortunately have no experience with it though.

Thierry Nouidui gravatar image Thierry Nouidui  ( 2020-03-24 08:13:58 -0500 )edit

I've added the code and the output to the original question.

Deniz Erbilgin gravatar image Deniz Erbilgin  ( 2020-03-24 08:52:01 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted

answered 2020-03-25 08:06:51 -0500

Deniz Erbilgin gravatar image

updated 2020-03-25 08:10:14 -0500

After much faffing, I finally got it all working.

The key points were:

  • FMPy doesn't work with EnergyPlusToFMU
  • The PyFMI on the chria channel is not being maintained. The one on conda-forge seems to be the best place to get the binary package.
  • The _fmu-export-actuator.idf simulation is in fact three days long, and differences are only visible on the third day!
  • Initialising yShade is not enough, you must pass it in to the input parameter of simulate().

I've added my final python file to a gist (with graphs of the output) as it's pretty long and I can only upload images here. The important bit is this though:

# ...

# Setup the input array.
step_size = seconds_in_hour / idf_steps_per_hour
shade_val = np.array([(i*step_size, yShade) for i in range(ncp)])
shade_val = ('yShade', shade_val)

# Set initial value of yShade
model.set(shade_val[0], shade_val[1][0][1])

res = model.simulate(start_time=0,
                     input=shade_val,  # This must be passed in!

# ...

And here's a couple of graphs so that people know what to look for:

yShade = 0:


yShade = 7:


edit flag offensive delete link more


I am glad that it works.

Thierry Nouidui gravatar image Thierry Nouidui  ( 2020-03-25 08:31:20 -0500 )edit

answered 2020-03-24 11:21:43 -0500

updated 2020-03-24 11:32:55 -0500

I am not familiar with FMPy but based on what I am seeing, I suggest to use the primitive functions setReal(), getReal(), doStep(similar to what is done so you can set time-dependent inputs.

Please note that that example is for FMI 2.0 so you need to adapt it and call the corresponding FMI 1.0 functions.

Currently, it seems like you are only setting the initial value of yShade but EnergyPlus FMU will be updated based on the input values set during the time stepping.

If the simulate_fmu() function you have used in your example accepts a time-dependent input object, it may be easier to control your input that way.

P.S. Looking at it seems like the simulate_fmu() does accept an input object, see line 33 of that example. You may be able to change your input that way as well. Best will be to read the documentation of fmpy to see how to set-up such object.

edit flag offensive delete link more



You can pass simulate_fmu an array of step times and values. It doesn't seem to change anything though.

Deniz Erbilgin gravatar image Deniz Erbilgin  ( 2020-03-24 11:41:04 -0500 )edit

Did you try to use the primitives setReal(), getReal(), doStep()?

Thierry Nouidui gravatar image Thierry Nouidui  ( 2020-03-24 12:07:31 -0500 )edit

Yes, still no change. Before getting into a debugging black-hole, when you personally run these examples with your own usual setup, do you see a change in the output if you change the inputs? There's been too many occasions I've spent days debugging a component of a system, only to realise the problem was elsewhere, so I'd really like some reassurance that the E+/E+ToFMU side of things is behaving as expected. Anyway, thank you for putting so much time into this.

Deniz Erbilgin gravatar image Deniz Erbilgin  ( 2020-03-24 13:03:53 -0500 )edit

I have been running E+FMU with PyFMI, Dymola, C-code and OpenModelica without issues. I am not set-up to run them with fmpy, so can confirm whether it will work or not. Could you try to run the FMU using a different master algorithm? If you are familiar with the BCVTB you may try with it. It is a pity that PyFMI is not working for you. I could install it on Ubuntu 18 with conda without any issues.

Thierry Nouidui gravatar image Thierry Nouidui  ( 2020-03-25 01:53:06 -0500 )edit

Your Answer

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

Add Answer


Question Tools



Asked: 2020-03-23 07:34:29 -0500

Seen: 307 times

Last updated: Mar 25 '20