Switch Hardware and Software

cancel
Showing results for 
Search instead for 
Did you mean: 

Detect connected routes

Solved!
Go to solution

I'm trying to figure out the easiest way to do something.  This is being driven in TestStand using Switch Executive.

 

I have a 2-wire 213 column x 4 row Matrix.  The 4 rows connect up to 4 PXI-5105 channels.  I have defined logical names for each column to go to each of r0, r1, r2, and r3.  The users will pick up to 4 from the 213 columns to route to the 5105 for sampling. If a user connects 4 channels and then decide they want to sample a different channel I'd like to be able to only disconnect the 1 channel they no longer want and connect up the new channel.  I defined route groups called All_To_R0, All_To_R1, etc. with the idea that if the user wants to swap the channel on R0 then I'd call a Disconnect on the All_To_R0 that will guarantee anything connected to R0 gets disconnected and then I'll connect up the new channel.

 

However, this generates errors saying routes don't exist, which makes sense I suppose.  I could just call a DisconnectAll and leave it up to my users to keep up with which routes they want connected.  I could keep up with this in my driver code but aborts/terminates would prevent me from accurately managing the state of the switch.  Is there a "built in" way to do this?

0 Kudos
Message 1 of 5
(6,651 Views)

Hello SmokeMonster, 

 

Inside of your route group, you can create an individual route for each of your 4 channels. Then, you can disconnect just Route0, instead of disconnecting all of RouteGroup0. 

 

You can create these routes by going to the Routes/Groups tab at the bottom of the Switch Executive screen, or by selecting "Show Routes" on the Schematic Configuration tab. 

Maggie
National Instruments
Applications Engineer
ni.com/support
0 Kudos
Message 2 of 5
(6,630 Views)
Solution
Accepted by topic author CoastalLabVIEWER

To find out whether a route is connected or not, you can call FindRoute on a NISE session. That's one way of doing it, but you need to figure out what are the endpoints of a route. You can use NISE configuration API to figure out which routes are the part of a route group, and which are the endpoints for any given route, if you're not comfortable hard-coding those channel names in your program.

Another way of figuring out whether the route is connected or not, especially if your end goal is to disconnect it, is to call Disconnect on that route and ignore the error that states that the route did not exist. (You may still want to capture other errors, though).

 

 

Message 3 of 5
(6,626 Views)

In NI Switch Executive 3.6 and later, you can call:

niSE_IsConnected

You can call the function from TestStand using TestStand's ActiveX and C adapters.

Here is a sample .seq file.

 

Brian

Message 4 of 5
(6,610 Views)

Another way of figuring out whether the route is connected or not, especially if your end goal is to disconnect it, is to call Disconnect on that route and ignore the error that states that the route did not exist. (You may still want to capture other errors, though).

 


 

This actually ended up working well.  We ignore the specific error message for a route not existing and handle all the others.  It takes ~10ms to execute this command and we only disconnect the route on a specific row (thanks to route grouping) rather than having to disconnect all routes on the card or manage the connection state with variables in TestStand.

0 Kudos
Message 5 of 5
(6,502 Views)