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

sql_file.endUses.get.subCategories() fails?

asked 2022-09-13 14:31:38 -0500

mattkoch's avatar

I have a simulation for which I know there are sub-categories, such as "CHW Pumps" and "HW Pumps" under the "Pumps" category - eplustbl.html tells me so. Yet,

sql_file.endUses.get.subCategories()

reports "General" as the the only sub-category, and

sql_file.endUses.get.getEndUse(fuel_type,category_type,"HW Pumps")

reports 0. And obviously,

sql_file.endUses.get.getEndUse(fuel_type,category_type)

reports the right value, but only the total of "CHW Pumps" and "HW Pumps". How can I get to the sub-category values? Also, the OpenStudio 3.4.0 SDK documentation for the EndUses class lists a categories() and a fuelTypes() method as Static Public Member Functions, yet calling, for example:

sql_file.endUses.get.fuelTypes()

crashes the measure? Do Static Public Member Functions not get called that way?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2022-09-13 19:39:34 -0500

updated 2022-09-13 19:41:46 -0500

Someone can correct me if I'm wrong, but I don't think any of the built-in sqlFile methods can handle custom subcategories; I think the standard EnergyPlus subcategories are hard-coded into OpenStudio.

One way to get the value you want is with a simple SQL query:

query = "SELECT Value FROM TabularDataWithStrings WHERE ReportName='AnnualBuildingUtilityPerformanceSummary' AND ReportForString='Entire Facility' AND TableName='End Uses By Subcategory' AND RowName='Pumps:HW Pumps' AND ColumnName='Electricity' AND Units='GJ'"

value = sql_file.execAndReturnFirstDouble(query).get
edit flag offensive delete link more

Comments

Brilliant, thank you! Also, this gives the entire 'Electricity' column:

query = "SELECT Value FROM TabularDataWithStrings WHERE ReportName='AnnualBuildingUtilityPerformanceSummary' AND ReportForString='Entire Facility' AND TableName='End Uses By Subcategory' AND ColumnName='Electricity' AND Units='GJ'"
value = sql_file.execAndReturnVectorOfDouble(query).get
mattkoch's avatar mattkoch  ( 2022-09-14 07:49:46 -0500 )edit

... and this gives the categories and subcategories for the column:

query = "SELECT RowName FROM TabularDataWithStrings WHERE ReportName='AnnualBuildingUtilityPerformanceSummary' AND ReportForString='Entire Facility' AND TableName='End Uses By Subcategory' AND ColumnName='Electricity' AND Units='GJ'"
value = sql_file.execAndReturnVectorOfString(query).get

Note that category and subcategory are returned within the same string, separated by a colon (:).

mattkoch's avatar mattkoch  ( 2022-09-14 07:51:28 -0500 )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: 2022-09-13 14:31:38 -0500

Seen: 98 times

Last updated: Sep 14 '22