:SWITch Subsystem

Flex Apps:
FlexOTO
FlexOTO Instance:
Hardware Diagram

Use the :SWITch subsystem to select the type of connection to FlexOTO's optical switch: a supported switch or a generic switch for which you have written a switch driver. To select the type of connection, use the :SWITch:DMEThod command. A generic switch driver tells FlexOTO the ports available on the switch and allows FlexOTO to properly set routes through the switch. This subsystem's commands perform tasks that are associated with the Switch Connection Setup dialog.

When using a supported optical switch, FlexOTO will automatically scan the com ports to find the switch. You can manually initiate a scan by sending the :SWITch:SCAN command. To remove any currently installed switch (supported or generic), use the :SWITch:DISConnect command.

To connect your generic instrument driver, use the following commands:

  • :SWITch:CARGument to enter any command-line argument that your driver expects. For example, a COM port or VISA address. FlexOTO passes this argument to your driver.
  • :SWITch:CONNected? to determined if the specified switch driver is connected (running) which indicates that the switch block is available on the User Instruments palette.
  • :SWITch:DISConnect To remove a currently installed switch from the Hardware Diagram and from the User Instruments palette
  • :SWITch:RDRiver to connect (run) your switch driver.
  • :SWITch:UDPath to enter the file name, including path, of your switch driver.

Example

This example shows the commands that are required to connect your switch driver, place the resulting switch block on the Hardware Diagram, and then connects a switch port to a DCA-M module's input.

hwdiagram.write(':SWITch:DMEThod UDRiver')
hwdiagram.write(':SWITch:UDPath "C:\\Python\\FlexOTO\my_switch_driver.py"')
hwdiagram.write(':SWITch:CARGument "COM4"')
hwdiagram.write(':SWITch:RDRiver')
hwdiagram.write(':CONFigure:SWITch:ACTive "My Switch-2", ON'  # place on hardware diagram
hwdiagram.write(':CONFigure:PORT:CONNect "My Switch-2", "6", "N1092B-US920000003", "A"'  # connect switch port