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

How to delete an object from the idf file in an energyplus measure?

asked 2018-01-31 14:06:09 -0500

mldichter gravatar image

updated 2018-01-31 15:02:21 -0500

I know this is very easy in an openstudio measure, but how do I delete an object from the idf file using an energyplus measure?

Also, is there any documentation for writing energyplus measures similar to the openstudio documentation?

https://openstudio-sdk-documentation....

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
4

answered 2018-01-31 17:31:23 -0500

updated 2018-02-01 12:03:46 -0500

Per Eric's comment below, the best way to do this is using the remove call of a Workspace Object. API documentation for the Workspace object here. You can get an instance of an object in your Workspace with the getObjectByTypeAndName or related method call. Be careful about removing workspace objects - you may end up deleting an object needed by another object.

For a tutorial on writing EnergyPlus measures, see the EnergyPlus Measures section in the OpenStudio Measure Writer's Reference Guide provides an example.

edit flag offensive delete link more

Comments

@mdahlhausen I wasn't able to find the string getObjectByTypeAndName anywhere on that webpage by using Ctrl-f on the webpage. There only appears to be instructions on creating new objects and modifying fields on existing objects in an energyplus model.

Ctrl-f on getObject does result in 6 found places on that webpage though, but all 6 instances are the front of getObjectsByType on the webpage.

mldichter gravatar imagemldichter ( 2018-01-31 17:44:18 -0500 )edit

That's strange, it's right here.

Eric Ringold gravatar imageEric Ringold ( 2018-02-01 09:33:18 -0500 )edit

Also WorkspaceObject has the methodremove that works just fine.

Eric Ringold gravatar imageEric Ringold ( 2018-02-01 09:55:19 -0500 )edit

@Eric Ringold Yes. Your "here" link leads to a webpage with documentation on the workspace class. The "EnergyPlus Measures section" link from @mdahlhausen led to a short tutorial on writing measures, one section of which is writing energyplus measures. This is absolutely everything I need. Thanks!

mldichter gravatar imagemldichter ( 2018-02-01 09:57:24 -0500 )edit

@mdahlhausen Please change your first sentence to reference @Eric Ringold's link, then I'll accept your answer.

mldichter gravatar imagemldichter ( 2018-02-01 09:59:03 -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

1 follower

Stats

Asked: 2018-01-31 14:06:09 -0500

Seen: 112 times

Last updated: Feb 01 '18