COM Automation


The COM Server in OpenDSSEngine.DLL may be automated.  The installer will register either or both versions, depending on your selection.  Even though the file names and registration commands match, they are in separate locations and Windows will activate the correct version required by the calling program.  For example, 64-bit MATLAB will call the 64-bit OpenDSSEngine.DLL and 32-bit Microsoft Excel will call the 32-bit version.  

(Note: In corporate IT implementations of Microsoft Office, it is common for only the 32-bit version to be installed.)

Files


The OpenDSS Installer will automatically register the COM servers during the installation process. However, you can still do it manually if you prefer. Although it has gotten a little more complicated, installation of the OpenDSS program is still one of the easiest you will encounter in programs today: Simply copy the program files to a folder of your choosing (such as C:\OpenDSS or C:\Users\MyUserName\OpenDSS) and start the program.


The following are the key program files:


  1. OpenDSS.exe        (Stand alone executable)
  2. OpenDSSEngine.DLL        (The in-process COM server version)
  3. KLUSolve.DLL        (Sparse matrix solver)
  4. DSSView.exe        (Viewer for DSS graphics output)
  5. OpenDSSDirect.DLL        (Direct call DLL – alternative to the COM interface)


The OpenDSSDirect.DLL file is a relatively new option for driving OpenDSS without using the COM interface.  It is a stdcall DLL that mimics the COM interface in many aspects but has special functions as well. You can use this to basically build OpenDSS into your application or use OpenDSS to do parallel processing on systems with this capability (such as with the Julia language, for example, which does not support COM). For documentation, see OpenDSS_Direct_DLL.pdf in the ..\Doc directory where OpenDSS was installed.

The OpenDSSEngine.DLL is an in-process COM server that will have to be registered if you intend to access it from other programs/languages such as MATLAB and VBA in MS Office. This will occur automatically if you use the installer from the download. 

Manual Registration of COM Server


If you do not intend to automate OpenDSS, and simply use the OpenDSS.EXE stand-alone version, you could skip this step and simply copy the EXE and DLL files to some convenient location on your disk. Afterward, you can manually register the server by issuing the following command to the (DOS) command prompt when in the folder you have placed the files:

Regsvr32  OpenDSSEngine.DLL


The RegisterDSSEngine.BAT file provided within the standard zip file download to perform this action. Registration need only be done once.  You may simply double-click on the .BAT file and it will execute the registration. 

Note: You may need Administrator privileges on your computer to do this. This applies more to Windows 10, 8, 7 and Vista than previous versions of Windows. 

On Windows Vista, 7, 8, and 10 you will have to execute the .BAT file from an elevated Admin status.  One way to do this is right click on the Windows buttonand select Command Prompt (Admin).  Then run the .BAT file from the command window, or DOS window. Some corporate IT policies may require you to go through additional steps. It may be necessary to have an administrator install the intial copy of OpenDSS.  Once installed, you can simply update by copying the newer EXE or DLL over the older one in most cases.

After registration, if you start the Windows registry editor (Type ‘regedit’ in the command box on the start menu) you will find the OpenDSSEngine listed under Classes as shown in Figure 2. If you then look up the GUID in the registry, it should point to the OpenDSSEngine.DLL file in the folder where you installed it (Figure 3).

The OpenDSSEngine will show up as “OpenDSS Engine” or “OpenDSSEngine.DSS” in the list of available object references in most development environments. For example, to instantiate an OpenDSSEngine object in MATLAB, you would issue the following statement:


    %instantiate the DSS Object

    Obj = actxserver('OpenDSSEngine.DSS');


When both the 32-bit and 64-bit versions are available, Windows will automagically load the appropriate one for your application.