Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with runner.lastEnergyPlusSqlFile #5147

Closed
jmarrec opened this issue Apr 15, 2024 · 1 comment · Fixed by #5149
Closed

Issue with runner.lastEnergyPlusSqlFile #5147

jmarrec opened this issue Apr 15, 2024 · 1 comment · Fixed by #5149
Labels
Triage Issue needs to be assessed and labeled, further information on reported might be needed

Comments

@jmarrec
Copy link
Collaborator

jmarrec commented Apr 15, 2024

Issue overview

Current Behavior

In measure testing:

-sqlFile = OpenStudio::SqlFile.new(OpenStudio::Path.new(sql_path(test_name))) # Works
+sqlFile = runner.lastEnergyPlusSqlFile.get # Fails
 hours = sqlFile.hoursSimulated
 refute_empty(hours)
 assert_equal(8760.0, hours.get)
OpenStudioResults_Test#test_example_model_si:
RuntimeError: Error creating prepared statement: SELECT Value FROM TabularDataWithStrings
                                  WHERE ReportName='InputVerificationandResultsSummary'
                                  AND ReportForString='Entire Facility'
                                  AND TableName='General'
                                  AND RowName='Hours Simulated'
                                  AND Units='hrs' with error code 21, extended code 21, errmsg: bad parameter or other API misuse
    OpenStudioResults_Test.rb:263:in `hoursSimulated'
    OpenStudioResults_Test.rb:263:in `test_example_model_si

Expected Behavior

Steps to Reproduce

Possible Solution

Pretty sure it's because "sql_file.close" is at the end of the measure template...

Details

Environment

Some additional details about your environment for this issue (if relevant):

  • Platform (Operating system, version):
  • Version of OpenStudio (if using an intermediate build, include SHA):

Context

@jmarrec jmarrec added the Triage Issue needs to be assessed and labeled, further information on reported might be needed label Apr 15, 2024
@jmarrec
Copy link
Collaborator Author

jmarrec commented Apr 15, 2024

Yep, it's becaue sql_file.close

This fixes it.

    sqlFile = runner.lastEnergyPlusSqlFile.get
    if !sqlFile.connectionOpen
      sqlFile.reopen
    end

I'll adjust the templates

@jmarrec jmarrec changed the title Issue with runner.last Issue with runner.lastEnergyPlusSqlFile Apr 15, 2024
jmarrec added a commit that referenced this issue Apr 16, 2024
* make it clear that if you use runner.lastEnergyPlusSQLFile you need to reopen it potentially
* Use a chdir context
jmarrec added a commit that referenced this issue Apr 19, 2024
Fix #5147 and generally modernize measure templates + get openstudio to run pytest
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Triage Issue needs to be assessed and labeled, further information on reported might be needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant