Skip to content

Debug SSC in Windows using VS 2017 and SDKtool

Paul Gilman edited this page Jul 10, 2019 · 20 revisions

The SAM Software Development Kit is a set of developer tools for interfacing with SSC. The SAM SDK comes with an application called SDKtool that you can use to explore SSC compute modules and write test programs in its built-in LK scripting language. It is described in the SSC Guide, which you can download from the SAM SDK web page.

The following instructions explain how to use SAM, SDKtool, and Microsoft Visual Studio 2017 Community (VS 2017) to debug SSC C++ code in Windows.

Overall steps:

Step 1. Use SAM to generate LK for SDKtool.

Step 2. Set breakpoints in VS 2017.

Step 3. Run the LK script in SDKtool.

Step 4. Trace through the C++ code in VS 2017.

Before you begin:

Step 1: Use SAM to generate LK for SDKtool

  1. Start SAM, and either create or open a file that uses the compute module you want to debug. For this example, we are debugging the geothermal compute module, so we generated code from a Geothermal/No Financial Model case in SAM.

  2. On the Case menu, click Generate Code.

    SAM Generate Code command on case menu

  3. Choose LK for SDKtool and click OK. SAM saves an LK script file .lk along with several supporting files. The LK file name is the same as the case name, which by default is “untitled.”

    Choose LK for SDKtool

Step 2: Set breakpoints in VS2017

  1. Start VS 2017 and open the solution file ssc_vs2017.sln, for example .../ssc/build_vs2017/ssc_vs2017.sln.

  2. Set sdktool as the start-up project: Right-click sdktool in the Solution Explorer and click Set as StartUp Project.

  3. Open the C++ file for the compute module to debug. You can do this from the Solution Explorer, by expanding the ssc list, and choosing the file to debug. Compute module names are preceded by cmod_. For this example, to debug the geothermal compute module, we chose the cmod_geothermal.cpp file.

    List of C++ files for SSC compute modules

  4. Set a breakpoint in the code.

  5. Choose Debug and start the Windows debugger, which should run /build_vs2017/x64/Debug/sdktool.exe.

    Run Visual Studio debugger

Step 3: Run the LK Script in SDKtool

  1. When SDKtool opens, click Choose SSC library to load the SSC debug library sscd.dll, for example …/ssc/build_vs2017/x64/Debug/sscd.dll. Be sure to load the same library as the one being used by the VS 2017 debugger. After you load the library, you can see the library path and version number at the bottom of the SDKtool window.

    Load SSC library in SDKtool

  2. In the SDKtool Script Editor, open the LK file you created from SAM’s Code Generator in Step 1 above.

    Open LK file in SDKtool script editor

  3. Click Run.

    Run LK script in SDKtool

Step 4: Trace through C++ in VS 2017

  1. If you set a breakpoint in Step 2 above, the VS 2017 window will appear. Use your mouse to hover over any variable in the code to see its current value.

    Display variable value in Visual Studio

  2. For other debugging tools, right-click a line in the code,

    Visual Studio debugging tools

    or use the buttons in the toolbar.

    Visual Studio debugging toolbar

  3. To end the debugging session, close SDKtool or click Stop in VS2017.

    Stop the Visual Studio debugging session