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

Revision history [back]

First off, I understand the logic of thinking it's because Python Measures aren't prime ready that you're having an issue.

I don't have anything to go on to pinpoint exactly what's your problem, but I don't think it's related to Python Measures (until proven otherwise).

I can run a Python reporting measure fine. For example the template one at https://github.com/NREL/OpenStudio/blob/develop/src/utilities/bcl/templates/ReportingMeasure/measure.py

Which you can generate from:

openstudio measure new -c PythonReporting -t ReportingMeasure -l Python -n "Python Reporting Measure" -d "A sample reporting measure in python " -m "Tests loading sql and co" --taxonomy-tag "Reporting.QAQC" ./python_reporting_measure

Here's a link to a working example: https://drive.google.com/file/d/1l7ug9r_8i185n4uchLpu1cOs-A0UPavw/view?usp=sharing

openstudio run -w workflow.osw

This produces a reports/reporting_measure_name_report.html that works fine and displays the SQL file's outdoor dry bulb conditions.

image description

First off, I understand the logic of thinking it's because Python Measures aren't prime ready that you're having an issue.

I don't have anything to go on to pinpoint exactly what's your problem, but I don't think it's related to Python Measures (until proven otherwise).

I can run a Python reporting measure fine. For example the template one at https://github.com/NREL/OpenStudio/blob/develop/src/utilities/bcl/templates/ReportingMeasure/measure.py

Which you can generate from:

openstudio measure new -c PythonReporting -t ReportingMeasure -l Python -n "Python Reporting Measure" -d "A sample reporting measure in python " -m "Tests loading sql and co" --taxonomy-tag "Reporting.QAQC" ./python_reporting_measure

Here's a link to a working example: https://drive.google.com/file/d/1l7ug9r_8i185n4uchLpu1cOs-A0UPavw/view?usp=sharing

openstudio run -w workflow.osw 

workflow.osw

This produces a reports/reporting_measure_name_report.html that works fine and displays the SQL file's outdoor dry bulb conditions.

image description

Edit: I found the same behavior with Ruby. It's because the default measures do sql_file.close at the end. So you can't query it.

You need to do

if not sqlFile.connectionOpen():
    sqlFile.reopen()

First off, I understand the logic of thinking it's because Python Measures aren't prime ready that you're having an issue.

I don't have anything to go on to pinpoint exactly what's your problem, but I don't think it's related to Python Measures (until proven otherwise).

I can run a Python reporting measure fine. For example the template one at https://github.com/NREL/OpenStudio/blob/develop/src/utilities/bcl/templates/ReportingMeasure/measure.py

Which you can generate from:

openstudio measure new -c PythonReporting -t ReportingMeasure -l Python -n "Python Reporting Measure" -d "A sample reporting measure in python " -m "Tests loading sql and co" --taxonomy-tag "Reporting.QAQC" ./python_reporting_measure

Here's a link to a working example: https://drive.google.com/file/d/1l7ug9r_8i185n4uchLpu1cOs-A0UPavw/view?usp=sharing

openstudio run -w workflow.osw

This produces a reports/reporting_measure_name_report.html that works fine and displays the SQL file's outdoor dry bulb conditions.

image description

Edit: I found the same behavior with Ruby. It's because the default measures do sql_file.close at the end. So you can't query it.

You need to do

if not sqlFile.connectionOpen():
    sqlFile.reopen()

Filed it at https://github.com/NREL/OpenStudio/issues/5147 for clarifications


First off, I understand the logic of thinking it's because Python Measures aren't prime ready that you're having an issue.

I don't have anything to go on to pinpoint exactly what's your problem, but I don't think it's related to Python Measures (until proven otherwise).

I can run a Python reporting measure fine. For example the template one at https://github.com/NREL/OpenStudio/blob/develop/src/utilities/bcl/templates/ReportingMeasure/measure.py

Which you can generate from:

openstudio measure new -c PythonReporting -t ReportingMeasure -l Python -n "Python Reporting Measure" -d "A sample reporting measure in python " -m "Tests loading sql and co" --taxonomy-tag "Reporting.QAQC" ./python_reporting_measure

Here's a link to a working example: https://drive.google.com/file/d/1l7ug9r_8i185n4uchLpu1cOs-A0UPavw/view?usp=sharing

openstudio run -w workflow.osw

This produces a reports/reporting_measure_name_report.html that works fine and displays the SQL file's outdoor dry bulb conditions.

image description