Switch Executive and Exclusions with Single Pole Double Throw Relays

Updated Mar 4, 2019

Reported In

Software

  • Switch Executive

Issue Details

In Switch Executive, using Single Pole Double Throw (SPDT) relays, the software state of the relay looks as if nothing is connected.  But I know there is a hardware connection. Why does this happen?

Solution

The problem is caused by a combination of the IVI standard, IVI-specific switch driver behavior, and NI Switch Executive. This combination of requirements causes exclusions to be violated with SPDT relays.  Due to the tradeoffs involved, "Exclusions with SPDTs" is not an implemented feature of NI Switch Executive.  
  1. What is an Exclusion?

Exclusions are connection rules used to prevent specific channels from connecting to one another - primarily used for safety purposes.  Let's say an exclusion is set up to prevent NO0 from connecting to NO1.  A real world example would be that NO0 and NO1 are both connected to different power supplies, and we don't want to connect the supply outputs together.  Once set up, before every Connect call, NI Switch Executive must verify this route will not occur.  If it will, then NI Switch Executive will return an error citing the proposed connection will result in the creation of an excluded route.

 

  1.  Background On IVI Switch Class Driver

Switch Executive calls into the IVI Switch class driver.  IVI requires all relay connections to be disconnected before a new, different connection can be made.  This doesn't make much sense with SPDT relays, where there is no disconnected state.  As shown below, an SPDT relay is always connected to either the Normally Closed terminal (NC) or the Normally Open terminal (NO).  It cannot be disconnected from both!


 

To make software work with SPDTs and IVI requirements, IVI-compliant driver software typically stores the state of SPDT relays in a unique and potentially confusing manner.  The example below is comprised of two relays with their COMs connected together (hardwired together).  On the left are the default physical relay states in hardware.  On the right is how IVI-compliant drivers typically characterize the default relay states in software.

As shown above, the default state in software is characterized by no connection.  Although this might be confusing to a user, this characterization is recommended and is done so either the Normally Closed or Normally Open terminals can be initially connected to COM upon the first function call (without first requiring a disconnect call). 

The "ability to connect initially without disconnect" feature of IVI-specific driver software (i.e. NI-Switch) results in an inability for NI Switch Executive to determine SPDT hardware states in certain circumstances.  In the end, there exist the exclusion caveats with SPDTs that are discussed in this document.
 

  1. The Issue: Exclusions can be violated when using SPDTs

We can violate the exclusions by performing the following sequence:

  1. Starting from our default state 
  2. Connecting NO0 to COM0 
  3. Disconnecting NO0 from COM0 
  4. Connecting NO1 to COM1

This creates the following hardware and software states. 


Once again, to avoid any and all issues: Always Connect a SPDT relay immediately after a Disconnect.