ladybug-tools / honeybee-legacy

:bee: Honeybee is a free and open source plugin to connect Grasshopper3D to EnergyPlus, Radiance, Daysim and OpenStudio for building energy and daylighting simulation
http://ladybug.tools
Other
125 stars 145 forks source link

PINVOKE Error With Most Recent ExportToOpenStudio #214

Closed chriswmackey closed 3 years ago

chriswmackey commented 9 years ago

@chiensiTB , Do you know why I get this error with the OpenStudio Component that you just committed?

image

macumber commented 9 years ago

@mostaphaRoudsari this is slightly unrelated, but going forward I would suggest that you try to use the OpenStudio C# bindings directly from an OpenStudio installation. That way your directions to your users are "Install OpenStudio version XXX" then point Ladybug to it somehow. This will have the added benefit of allowing you to find the version of E+ and Ruby that get installed with OpenStudio, which will also allow you run measures at some point in the future.

macumber commented 9 years ago

@mostaphaRoudsari this is really frustrating, sorry about that. Just so we know we are all on the same page, can you install OS 1.6.0, launch Rhino from a clean environment, and try this code:

import scriptcontext as sc
import os

if sc.sticky.has_key('honeybee_release'):

    #openStudioLibFolder = os.path.join(sc.sticky["Honeybee_DefaultFolder"], "OpenStudio")
    openStudioLibFolder = "C:\\Program Files\\OpenStudio 1.6.0\\CSharp\\openstudio"

    if os.path.isdir(openStudioLibFolder) and os.path.isfile(os.path.join(openStudioLibFolder, "OpenStudio.dll")):

        print os.environ['PATH']
        os.environ['PATH'] = openStudioLibFolder + ";" + os.environ['PATH']
        print os.environ['PATH']

        import sys

        if openStudioLibFolder not in sys.path:
            sys.path.append(openStudioLibFolder)

        import clr
        clr.AddReferenceToFileAndPath(openStudioLibFolder+"\\OpenStudio.dll")

        import OpenStudio as ops

        print ops.Model()
    else:
        print "Can't find OpenStudio library in " + openStudioLibFolder
mostaphaRoudsari commented 9 years ago

Still the same! Maybe I should do a comparison with my work machine?

image

mostaphaRoudsari commented 9 years ago
@mostaphaRoudsari this is slightly unrelated, but going forward I would suggest that you try to use the OpenStudio C# bindings directly from an OpenStudio installation. That way your directions to your users are "Install OpenStudio version XXX" then point Ladybug to it somehow. This will have the added benefit of allowing you to find the version of E+ and Ruby that get installed with OpenStudio, which will also allow you run measures at some point in the future.

Totally! We had it this way since the OpenStudio's default release was not 64bits at the time. Thanks.

mostaphaRoudsari commented 9 years ago

Just for the record the first time that we wanted to get the libraries loaded we emailed 70 times, and this is only one thread!

image

https://docs.google.com/presentation/d/1wexas-XWMWaQdEVpOmPP8oVTR3D2xRhNtLAw7M-UzsA/edit#slide=id.ge3cf2cba_6133

Too soon to give up! ;)

macumber commented 9 years ago

@mostaphaRoudsari you wrote half of those emails so thank you for not giving up on us!

mostaphaRoudsari commented 9 years ago

:+1: Never! I'm sure we'll get this one fixed too at some point.

macumber commented 9 years ago

@mostaphaRoudsari @chiensiTB are you guys still having this issue?

mostaphaRoudsari commented 9 years ago

@macumber I still have this issue on my laptop! :|

mostaphaRoudsari commented 9 years ago

This is [potentially] a good news! I downloaded OpenStudio1.8.0 today and tested the libraries and it worked with no issues on my machine. @chriswmackey and @chiensiTB can you guys also try and let me know. This can be a great news for all of us. The development for OpenStudio has been on hold for awhile because of this issue.

chriswmackey commented 9 years ago

Software gods be praised! It works!

I am going to draw up a new github issue for all of the backlogged features that we need to work into the OpenStudio exporter. Finally, it seems a dark age of development has passed!

-Chris

chiensiTB commented 9 years ago

Oh shit. Does this mean I don't have to be the ugly black sheep of the family anymore?

Sent from my iPhone

On Jul 15, 2015, at 4:55 PM, Chris Mackey notifications@github.com wrote:

Software gods be praised! It works!

I am going to draw up a new github issue for all of the backlogged features that we need to work into the OpenStudio exporter. Finally, it seems a dark age of development has passed!

-Chris

— Reply to this email directly or view it on GitHub.

mostaphaRoudsari commented 9 years ago

I guess so! Also now the defaults for HVAC is supposedly way much better than what it is used to be, and apparently there is a going to be a json for the ASHRAE HVAC types > https://github.com/NREL/OpenStudio-Prototype-Buildings#resourceshvacsizing

macumber commented 9 years ago

Well this is great news! I'm curious what might have changed between 1.7.0 and 1.8.0, I can't think of anything (dependencies, etc) that might have fixed this. @axelstudios can you think of anything that changed in the OpenStudio installer?

axelstudios commented 9 years ago

I was wondering that myself - All I can guess is that maybe it was resolved with Swig 3.0.5 (3.0.6 just came out btw)

chriswmackey commented 9 years ago

It's time to take care of some major backlogged development!! https://github.com/mostaphaRoudsari/Honeybee/issues/359 -Chris

jacoposartore commented 9 years ago

I just wanted to add that I had to update OpenStudio to version 1.8.1 (and so the openstudio libraries) in order to get the example file working fine (https://www.dropbox.com/s/pwpsravhwk0vlal/OpenStudioExample.gh?dl=0). Did you have this kind of error? However both the versions imported correctly the libraries (https://www.dropbox.com/s/p6ze63n3k3ctmqt/testImportingOpenStudioLibs.gh?dl=0).

mostaphaRoudsari commented 9 years ago

Thanks @jacoposartore. Strange! It works also with 1.8.0 on my system. In any case as far as it works with the newest version I will be a happy guy! :tada: :balloon:

@chiensiTB can you also try it and let us know so we can close this long-time open unsolvable issue!

jacoposartore commented 9 years ago

@mostaphaRoudsari I did some tests and I had to revert to OpenStudio 1.7.0: I figured out that when my definition is using the 1.8.1 libraries is generating a file that in OpenStudio is missing some fields (like the Water Loops) and the simulation fails. With the libraries from version 1.7.0 it has all the expected HVAC systems and the simulation runs fine.

chiensiTB commented 9 years ago

Ok. Looks like we are back on! Everything is running fine. I did have to update all the references to 8-1-0 to 8-3-0 in the OpenStudio component. I don't know if anyone else had this issue. I guess it just depends on what version of E+ you have running. But this is great news! New life....

jacoposartore commented 9 years ago

@mostaphaRoudsari I did another test today and it's now working with 1.8.0 libraries. Strange! Maybe I forgot to copy some dll.

mostaphaRoudsari commented 9 years ago

Perfect! Thank you all. I'm closing this with so much pleasure.

@jacoposartore back to your comment about systems such a Water Loops if there is any case that doesn't work please report them as an issue. They might be a bug in OpenStudio or a change in the API so we can update accordingly.

antonszilasi commented 8 years ago

@chriswmackey @mostaphaRoudsari @macumber

Gentlemen how do I actually solve this issue? I am experiencing it with Open Studio version 1.9 at the moment. Where can I download an earlier release of Open Studio? My understanding from this discussion is that using version 1.8 should fix the issue.

mostaphaRoudsari commented 8 years ago

@antonszilasi did you try what I suggested on Grasshopper group? You should not see the issue if you're using 1.9+ OpenStudio libraries. You can download older versions from github. Check release tags here: https://github.com/NREL/OpenStudio/tags

chriswmackey commented 8 years ago

@antonszilasi , Did you conclude that the error was an idiosyncrasy on your system or has the PINVOKE Error returned? Please let me know and, if it is the former, I will update to 1.9 now.

antonszilasi commented 8 years ago

@chriswmackey when I updated to OpenStudio 1.9.5 it went away. I had to manipulate the code within Export to Open Studio to get 1.9.5 to work however.

chriswmackey commented 8 years ago

Great gurus of energy modelling software,

It is with a grave heart that I report that this issue has not been fully stamped-out. It dangles to life by a thread but we have one confirmed user (in a total of maybe a thousand that have used the OpenStudio component) that still faces this issue in OpenStudio 1.12.0: http://www.grasshopper3d.com/group/ladybug/forum/topics/cannot-export-to-openstudio?commentId=2985220%3AComment%3A1586957&xg_source=msg_com_gr_forum

The error is exactly the same as it has been reported here with a failure happening when the model object is initiated. We were hoping to completely phase out our IDF-writing component in order to direct all users to OpenStudio but it seems we might not be able to do this unless we find a solution here.

@macumber and @axelstudios , given that the SWIG update seems to have fixed this issue in the past, are there any plans on the horizon for another SWIG update in the coming version of OpenStudio?

Thank you, -Chris

Worrily commented 6 years ago

Omg, Ive been suffering from this issue as well. Is there any possible solution to this issue? OpenStudio has updated to 2.6.0 in 2018 now, the problem still exists. And Ive read all things youve talked about in 2016, and have tried things you said, nothing worked. Im so depressed.

CongzhengZOU commented 3 years ago

Hi, all, sorry to disturb all of you. I have the same error. I am using the example file " Multizone_Energy_Balance_Chart "in Hydra Everything went well. This error occurs only when "_writeOSM" is conntected to "True" at the end. Error-Multizone_Energy_Balance_Chart I have Rhino 6, Ladybug tools, Openstudio 3.0.1, Radiance 5.1.0 installed.

mostaphaRoudsari commented 3 years ago

@CongzhengZOU, see the forum. This is a very old issue and has been resolved.

https://discourse.ladybug.tools