Can I Use the NI-SLSC Switch API Without Real Hardware?

Updated Mar 16, 2026

Issue Details

I am developing code in LabVIEW or C that uses the NI-SLSC Switch API to control routing and faulting modules such as the SLSC-12251/2 and the SET-2010. I do not yet have access to real hardware. Is it possible to run my code to test its functionality using simulated devices?

Solution

The NI-SLSC Switch API does support calling its functions in simulation mode. In this mode, you do not need to have real hardware present, and the driver will behave as if you were controlling actual hardware. For example, you can control individual relays, make endpoint connections, and read back the relays states.

To use simulation mode with this API, you need to choose the correct options when initializing the SLSC Switch session. The method to do this is different between LabVIEW and C:

LabVIEW

To use simulation mode in LabVIEW, you will use the Initialize with Topology VI with the polymorphic selector set to Simulate.

In this mode, you do not provide an SLSC Device identifier to initialize the session. Instead, you must provide:

  • A Switches JSON string - This is a JSON text string that contains the SLSC Switch topology, including available relays, initial relay states, and available endpoint connections. For an example of these files, refer to the LRU TS Reference Architecture Topology files for SET-2010 and SET-2310. If you are using the NI SLSC-12251 or 12252, example topology files can be found in the following directory: C:\Program Files\National Instruments\Shared\NI-SLSC Switch\Modules
  • A topology string - This is the name of topology that you want to use. The selected topology must be defined in the Switches JSON string. For example, if you were using the SLSC-12252-switches.json file found in the directory mentioned above, you would use NI12252_topology in the topology string control

After initializing the session in simulation mode, you can use the other SLSC Switch VI calls, such as Get Relay Names.vi, Get Channel Names.vi, Connect Channels.vi, Relay Control.vi, etc. Here is a VI Snippet showing an example of using the SLSC Switch API in LabVIEW with a simulated device:

 

C

In C, you can call the niSLSC_Switch_OpenSession function to initialize the SLSC Switch session:

// Returns an niSLSC_Switch_Status session handle used to identify the SLSC Switch module in all subsequent driver calls; sets the topology of the switch module.
niSLSC_Switch_Status NISLSC_SWITCH_DECL niSLSC_Switch_OpenSession(
   niSLSC_Switch_LibraryHandle libraryHandle,
   const char* deviceIName,
   const char* topologyName,
   bool reset,
   bool simulate,
   const char* capabilities,
   niSLSC_Switch_SessionHandle* sessionHandle);

 

To use this function in simulation mode:

  • Obtain the niSLSC_Switch_LibraryHandle by calling the NISLSC_SWITCH_DECL niSLSC_Switch_InitializeLibrary function
  • deviceIName can be a null char
  • topologyName should be the name of the topology you want to use (ex: "NI12252_topology"). Similar to the LabVIEW example, this topology must be defined in the Switch JSON string
  • simulate should be set to true
  • capabilities should contain the Switch JSON string. For an example of these files, refer to the LRU TS Reference Architecture Topology files for SET-2010 and SET-2310. If you are using the NI SLSC-12251 or 12252, example topology files can be found in the following directory: C:\Program Files\National Instruments\Shared\NI-SLSC Switch\Modules