Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting value to variables using PyFMI #34

Closed
lymereJ opened this issue Sep 4, 2019 · 8 comments
Closed

Setting value to variables using PyFMI #34

lymereJ opened this issue Sep 4, 2019 · 8 comments

Comments

@lymereJ
Copy link

lymereJ commented Sep 4, 2019

I built an FMU of the _fmu-export-variable.idf example file and I am using PyFMI to run the simulation. I've noticed that the value of yShadeFMU is always 0. I've tried to modify it using .set() (see here) but yShadeFMU stays at 0. I've tried doing the same using a FMU shipped with PyFMI, and there it worked. I'm concerned that there might something wrong with my FMU. I've tried on different operating system and get the same result. Am I missing something?

@tsnouidui
Copy link
Member

tsnouidui commented Sep 6, 2019

Which version of E+ are you using? Could you try the same example using the _fmu-export-actautor.idf instead. Recent versions of E+ are not supporting erl-variables with the EnergyPlusFMU well. A similar issue has been reported in #16.

@tsnouidui
Copy link
Member

@lymereJ any feedback on this? Otherwise, I will close the issue.

@lymereJ
Copy link
Author

lymereJ commented Nov 27, 2019

@tsnouidui, I have not tried your suggestion yet. I'll try this week and get back to you.

@lymereJ
Copy link
Author

lymereJ commented Dec 12, 2019

@tsnouidui, I'm using EnergyPlus 9.0 but I've also tried using version 8.9. I got the same results when trying the same example using the _fmu_export_actuator.idf.

@Denzo77
Copy link

Denzo77 commented Mar 25, 2020

@lymereJ, I had to pass yShade into the input parameter of model.simulate() to get it to work. I've uploaded an example here.

@lymereJ
Copy link
Author

lymereJ commented Mar 25, 2020

@Denzo77, thanks for getting back to me! I actually did try using input as an argument in model.simulate() using a slightly different approach than what you proposed in your gist (see below) and ... It was actually working 🙄. I was under the impression that it wasn't working because res['yShade'] is always return an array of 0s, I got so fixated on it that I didn't notice that it actually did have an impact on res['TRoo']. Anyway, thanks for bringing this topic back up and providing an answer!

For what it's worth, here's the approach I was following using the input argument:

def f(time):
    return 6

input_object = ('yShade', f)

res = model.simulate(start_time=0, final_time=60*60*24*3, input=input_object, options=opts)

@tsnouidui is it expected behavior to return an array of 0s?

@JChung-rpi
Copy link

JChung-rpi commented May 14, 2024

Hi @lymereJ , I am wondering if you have solved this issue. I have been struggling with the same one for the past week. I have attached the figure I have generated using @Denzo77 's codes. I am using EnergyPlus v.9.4 which is the same version as the '_fmu-export-actuator.idf' file.

screenshot

@lymereJ
Copy link
Author

lymereJ commented May 14, 2024

@JChung-rpi - Wow, that's a blast from the past!

I think that I did find a solution but I don't have that particular example anymore, I think., I've moved on to using the EnergyPlus Python API for newer projects. That being said, in a script that I still have on my machine (which is a bit more complex than the example) and also relies on PyFMI, it looks like I ended up using do_step() instead of simulate(), I think that was part of the solution since I see set() being used in the script.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants