DynamoDS / DynamoRevit

Dynamo Libraries for Revit
https://dynamobim.org
339 stars 188 forks source link

Running EnergyPlus from a ZeroTouch node throughs an error #1127

Open j12kemp opened 8 years ago

j12kemp commented 8 years ago

If this issue is not a bug report or improvement request, please check the Dynamo forum, and start a thread there to discuss your issue.

Dynamo version

1.0

Revit version

2015

Operating system

Windows 7 & Windows 10

What did you do?

Running EnergyPlus from a zero touch library. See code below: ` public static bool TestRunEplus() { bool success = false; string dllPth = @"C:\Users\jkemp_000\AppData\Roaming\Dynamo\Dynamo Revit\1.0\packages\Prototype\extra\Eplus"; SetDllDirectory(dllPth); EnergyPlusManaged("C:\EplusTest"); success = true; return success; }

    [DllImport("energyplusapi.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)]
    private static extern void EnergyPlusManaged(string filePath);

    [DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)]
    private static extern bool SetDllDirectory(string lpPathName);`

What did you expect to see?

The code above runs fine from a console application

What did you see instead?

Once the EneryPlus simulation completes an error occurs. See attached. error

ikeough commented 8 years ago

@ke-yu @sharadkjaiswal @aparajit-pratap Do you know if the FFI supports methods which us [DLLImport...] of native code? I would guess that it must because that's how we do the geometry library. Any gotchas?

sharadkjaiswal commented 8 years ago

I see that [DllImport..] method is being called from C# code and zero touch imports the C# method TestRunEplus. This workflow is fully supported. I am not sure if the native binaries are built for x64 platform. If they are built for x86, it won't work on top of Revit.

ikeough commented 8 years ago

@j12kemp I'll also point out, just in case you didn't know about it, the Energy Analysis for Dynamo package, which talks to Green Building Studio.