First time here? Check our help page!
1

Status of OpenStudio SDK python bindings

Hello all,

I am attempted to write a reporting measure with Python using the OpenStudio SDK, however, try as I might I ran into many problems with Python bindings not working as an example:

sqlFile = runner.lastEnergyPlusSqlFile().get() - # works

hours_simulated = sqlFile.hoursSimulated().get() -  # Returns an error then nothing

sqlFile.availableEnvPeriods() = # Returns nothing

So may I ask what is the current status of the Python bindings should I expect these to? It seems to me that it is still WIP.

Thank you,

Anton

antonszilasi's avatar
1.5k
antonszilasi
asked 2024-04-11 01:02:54 -0500
Julien Marrec's avatar
29.7k
Julien Marrec
updated 2024-04-15 09:09:18 -0500
edit flag offensive 0 remove flag close merge delete

Comments

add a comment see more comments

1 Answer

2

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/is... 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/bl...

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/1l7ug...

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

Julien Marrec's avatar
29.7k
Julien Marrec
answered 2024-04-15 11:43:49 -0500, updated 2024-04-15 12:20:42 -0500
edit flag offensive 0 remove flag delete link

Comments

add a comment see more comments