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

energyConsumptionsByMonth in OpenStudio returns nothing?

asked 2014-11-02 17:40:02 -0500

Chienman gravatar image

updated 2015-11-07 14:22:54 -0500

Hi there-

I am using C# bindings via IronPython to leverage OpenStudio version 1.4.x. Everything is working really well. Today, when I tried to get SQL data using OpenStudio::SqlFile, I was having a lot of success, until I tried to call energyConsumptionByMonth(endUseFuelType,endUseCategoryType,Month). It just returns nothing.

I'm pretty sure that the enums for endUseFuelType, endUseCategoryType, and Month are all working, and I'm sure that the fuelType, CategoryType, and Month should have a in the SQL file, but as I said, it returns nothing.

In the SDK documentation, it states that this function only works if the Building Energy Performance table is enabled (like BEPS, I guess), but I have no real way of knowing what this means precisely. The only SQLite options I am aware of is Simple, and SimpleAndTabular, the second of which I would guess turns on the Building Energy Performance table.

Alas, no luck and I'm not quite sure how to diagnose the problem.

Here is my pseudocode in Python (which I use to bind to the C# dlls)

sqlFile = ops.SqlFile(ops.Path(sqlPath)) eucatty = ops.EndUseCategoryType("Heating") eufty = ops.EndUseFuelType("Gas") month = ops.MonthOfYear("Jan") print month.value() print month.value(),eufty.value(),eucatty.value() val = sqlFile.energyConsumptionByMonth(eufty,eucatty,month) print val

val returns nothing

edit retag flag offensive close merge delete

Comments

Is the E+ run generating an HTM (or other format) file? And if so is the tabular data in that file in SI or IP units. If it is in SI units then your SQL file looks fine.

David Goldwasser gravatar imageDavid Goldwasser ( 2014-11-02 18:55:35 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted
7

answered 2014-11-02 22:47:52 -0500

This is a case where it might pay to look at the source code directly. Here is the code that implements that function:

https://github.com/NREL/OpenStudio/bl...

To diagnose this, I would try to recreate the SQLite queries in a third party tool (like SQLiteMan or one of the many SQLite browser plugins). With these tools you can see the data in the database directly and figure out what is going on. My guess is that you may need to request all of the Output:Table:Monthly reports that are added by the EnergyPlusPreProcess job. You can either run this job with RunManager or duplicate its content in your own scripts:

https://github.com/NREL/OpenStudio/bl...

HTH, Dan

edit flag offensive delete link more

Comments

Also notice that function returns an optional double, you should check that it is initialized before called get to return the value as a double.

macumber gravatar imagemacumber ( 2014-11-02 22:56:57 -0500 )edit

Dan, I think this is really great direction. I think that my only question, is: Is there not a way to add Table Monthly reports directly from the OpenStudio dll's, without having to rely on run manager? As far as I know, I still can't access the Run Manager via C#. We tried to at the hackathon but it failed to work at that time. If that is the case, does this leave me with having to post-edit the idf in my script after OpenStudio has created it?

Chienman gravatar imageChienman ( 2014-11-04 06:24:23 -0500 )edit

Also wanted to add...your advice on using the Queries was right on. There is not a ReportName WHERE ReportName="Building Energy Performance", so I think that confirms why nothing is returned. I find it interesting though that SQLite doesn't return an error even when that table is not present.

Chienman gravatar imageChienman ( 2014-11-04 06:37:44 -0500 )edit

If you aren't able to get RunManager to work then yes I think the best approach is to grab the Idf after you have translated your OpenStudio model to Idf and add those objects directly.

macumber gravatar imagemacumber ( 2014-11-04 07:58:13 -0500 )edit

Dan-I took your advice and have been working on an implementation where I modify the idf file after OS has created it. One thing that I've noticed, though I'm not quite done with this exercise, is that in your github example showing source code for energyConsumptionByMonth...the sql query looks like :

"SELECT Value FROM tabulardatawithstrings WHERE \ .... ..."

The thing I notice when I open the sql file is that after we call OS and write to IDF, we have a table "TabularData" but not "TabularDataWithStrings".

I realize that this is not a real table. Wonder if this is somehow contributing

Chienman gravatar imageChienman ( 2014-11-08 14:07:51 -0500 )edit
2

answered 2014-11-09 21:17:29 -0500

Chienman gravatar image

@macumber, this is working great now. I did have to replicate your code that you referenced on github, overwriting the idf produced by OpenStudio vial the C# dlls in Grasshopper.

Everything is working beautifully now in Honeybee.

I have a couple of related questions which I'll post in the AM on the site.

edit flag offensive delete link more

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: 2014-11-02 17:40:02 -0500

Seen: 192 times

Last updated: Nov 09 '14