08-26-2016 06:36 AM
Hello,
i have a 4 PXI switch cartes that i need to reset after some operation of controlling each individual relay, im using this function to reset the 4 switches :
//Close Session if another one is opened CloseSession(); //Creat switch instance switchSession = new NISwitch(sPXIDeviceAddress, sPXIDeviceTopology, false, true); switchSession.DriverOperation.Warning += new System.EventHandler<SwitchWarningEventArgs>(DriverOperationWarning);
this is wrapped inside a loop that call this function for each PXI switch card, the problem is that some relay is not openned to there initial state, when i check again i found some relay still being closed,
how to reset the device to its initial state and oppen all relay in each individual card ?
08-29-2016 01:46 PM
Hi BadreArras,
If your goal is to open all of the relays, have you tried using the niSwitch_DisconnectAll function? This function breaks all existing paths in a specified instrument and will return a warning if a path cannot be broken.
ViStatus niSwitch_DisconnectAll (ViSession Instrument_Handle);
09-05-2016 11:58 AM - edited 09-05-2016 11:59 AM
Hello Matt,
i have implement this function this way :
public Boolean DisconnectAll(string sPXIDeviceAddress, string sPXIDeviceTopology) { try { //Close Session if another one is opened CloseSession(); //Creat switch instace switchSession = new NISwitch(sPXIDeviceAddress, sPXIDeviceTopology, false, false); switchSession.DriverOperation.Warning += new System.EventHandler<SwitchWarningEventArgs>(DriverOperationWarning); // Breaks all path in the given switch
switchSession.Path.DisconnectAll(); return true; } catch (Exception _ex) { throw new System.Exception(_ex.Message); } }
but its not working as expected, may be the implementation is wrong ? can you suggest something else captain !
09-06-2016 09:21 AM
Hi BadreArras,
I’m not an expert on programming with CVI, so I went looking through the help documentation for NI Switch functions. From what I found, I’d like to offer two suggestions:
All of the examples I looked through used one of these three. I’m not sure if your current implementation is working for elsewhere in your code, but you may want to try one of these.
09-06-2016 10:54 AM
Hello Matt,
im using C# not CVI,for the initialisation im using this overload,passing to it the switch name, the topology, simulation , and the reset:
// Creat switch instance switchSession = new NISwitch(sPXIDeviceAddress, sPXIDeviceTopology, false, false);
and for the disconnect all , i creat a switch instance passing to it the instrument name , topology, after that i can access to its proprieties by the DOT notation :
here is the code used :
switchSession = new NISwitch(sPXIDeviceAddress, sPXIDeviceTopology, false, false); switchSession.DriverOperation.Warning += new System.EventHandler<SwitchWarningEventArgs>(DriverOperationWarning); switchSession.Path.DisconnectAll();
many thanks ^^
09-07-2016 03:27 PM
Thanks for clearing that up me. So when uses the DisconnectAll function, are there still relays that aren’t opening? I’m just curious as to what you meant when you said that it’s not working as expected.
09-08-2016 07:42 AM
Hello Matt,
its not working as expected, because some relays still closed after calling the disconnectall function, and please note that when calling the alternative function which is intialise with reset, its works, but sometimes (1 of 10) relays are not oppened !
09-09-2016 09:18 AM
Is it the same relay that doesn’t open? Can you get this relay to open by using the soft front panel?