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

Basic example with pyfmi

asked 2019-08-06 09:19:08 -0600

clcs's avatar

Hello,

I am trying to run a dummy test to call EnergyPlus in Python as a FMU. The IDF file is a very slightly modified version of the EP example file "1ZoneUncontrolled". I added an ExternalInterface and a FMUExport:From:Variable to get the "Zone Mean Air Temperature" in ZONE ONE as an output of the FMU. I exported the IDF file as a FMU using the LBL tool. And I try to run it from Python using pyfmi.

Both

model = load_fmu(fmu_path)
start_time = 60.0*60*24*1
final_time = 60.0*60*24*2
idf_steps_per_hour=4
ncp = (final_time-start_time)/(3600./idf_steps_per_hour)
opts = model.simulate_options()
opts['ncp'] = ncp
res = model.simulate(
    start_time=start_time,
    final_time=final_time,
    options=opts)

and

model = load_fmu(fmu_path)
start_time = 60.0*60*24*1
final_time = 60.0*60*24*2
model.initialize(start_time, final_time)

just run forever. What am I doing wrong ? The log file displays

FMIL: module = b'FMI1XML', log level = 2: b'Detected on line:29 of modelDescription.xml'
FMIL: module = b'FMI1XML', log level = 2: b'Found capability flag canSignalEvents which have been deprecated as it fills no function'

Also, when I simulate the IDF file from EP launch, I get the severe error ExternalInterface: Did not find file "socket.cfg"

Thank you for your help !

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2019-08-07 09:42:53 -0600

clcs's avatar

OK, after running the same script from the command line, I got additional info on why nothing was happening. Turns out, energyplus was not in my PATH. Adding the energyplus installation directory solved the issue.

Both options above run fine.

edit flag offensive delete link more

Comments

Hi,

I'm also trying to export IDF as FMU, but got an error. It shows below, I'm wondering if you have any suggestion to solve this? Thank you so much for your time.

XmlParserCApi.cpp Creating library test.lib and object test.exp xmlVersionParser.obj : error LNK2019: unresolved external symbol _xmlFreeTextReader referenced in function "char * __cdecl streamFile(char const *)" (?streamFile@@YAPADPBD@Z)

link text

Yapan's avatar Yapan  ( 2020-05-09 11:50:48 -0600 )edit

Solved. Thank you.

Yapan's avatar Yapan  ( 2020-05-12 16:13:00 -0600 )edit

Your Answer

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

Add Answer

Training Workshops

Careers

Question Tools

1 follower

Stats

Asked: 2019-08-06 09:19:08 -0600

Seen: 801 times

Last updated: Aug 07 '19