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

How can i apply an EMS program to multiple windows in a building using eppy? [closed]

asked 2020-08-02 13:05:25 -0500

Padfoot's avatar

I am writing an energy plus ems program and i need to use eppy to use that ems on all the windows simultaneously

edit retag flag offensive reopen merge delete

Closed for the following reason duplicate question by Padfoot
close date 2020-08-10 02:59:53.247193

1 Answer

Sort by ยป oldest newest most voted

answered 2020-08-03 02:24:26 -0500

nvskumar.m's avatar

Using Eppy, you can list all the fenestration names for Input Data File (IDF) parsed to the python script. Add the EMS program as string in python script. Append the EMS program into IDF by adding new fenestration name into while iterating the fenestration names using "for" loop. The following sample code explains in detail-

  1. from eppy import modeleditor
  2. from eppy.modeleditor import IDF
  3. iddFn = [Assign ur IDD file name with path]
  4. idfFn = [Assign ur IDF file name with path]
  5. idf = IDF(idfFn)
  6. fenNamesList = [x.Name for x in idf.idfobjects[''FENESTRATIONSURFACE:DETAILED"]
  7. emsProgramLine2 = "[Mathematical operation],"
  8. emsProgramLine3 = "[if clause],"
  9. emsProgramLastLine = "[last line of program];"
  10. programNames = []
  11. i = 0
  12. for fenName in fenNamesList:
  13. i += 1
  14. idf1.newidfobject(''FENESTRATIONSURFACE:DETAILED")
  15. program = idf.idfobjects[''ENERGYMANAGEMENTSYSTEM:PROGRAM"][-1]
  16. program.Name = 'p'+str(i)
  17. program.Program_Line_1 = [ according my code i want to assign fenName in line1 of ems program)
  18. program.Program_Line_2 = emsProgramLine2
  19. program.Program_A4 = emsProgramLine3 [and this continues based on the ems logic to be scripted
  20. idf.saveas('emsProgramAppended.idf')

In May of 2020, Python Plugin was added to EP version 9.3 by NREL, where you can script the logic in Python directly and assign the file as function for EP runtime simulation. This avoids the use of Erl and you can use or call complex mathematical models in python. Please go through the documentation to learn python plugin if you are interested (

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2020-08-02 13:05:25 -0500

Seen: 492 times

Last updated: Aug 02 '20