Metadata-Version: 2.4
Name: semiswitch
Version: 1.0.2
Summary: API for SQN controller
Author: Umesh Puri
Requires-Python: >=3.8
Description-Content-Type: text/markdown

# SQN Core Network Configuration and Uses Guide

This document contains the default settings and instructions for configuring the **SQN Core Controller**.



---

## 1. Default Network Settings
Upon shipping, the controller is pre-configured with the following factory defaults:

* **IP Address:** `192.168.10.29`
* **Port:** `80`
* **Subnet Mask:** `255.255.255.0`
* **Gateway:** `192.168.10.1`

---

## 2. Initial Computer Setup
To communicate with the controller, your computer must be on the same subnet. Configure your Ethernet adapter with the following static IP settings:

| Setting         | Value                                               |
| :-------------- | :-------------------------------------------------- |
| **IP Address** | `192.168.10.x` (any number **2–254**, except **29**) |
| **Subnet Mask** | `255.255.255.0`                                     |
| **Gateway** | `192.168.10.1`                                       |

---

## 3. Updating Controller Settings via Python
You can update the controller's network configuration using the `SemiSwitch` library. 

```python
import semiswitch as sq

# Connect to the controller using default settings
rf_switch = sq.Switch(ip_address='192.168.10.29', port=80)

# Set your new preferred network settings
# Replace 'x' with your specific network values
rf_switch.set_IP(
    ip_address='192.xxx.xxx.xxx',
    port=xxxx,
    mask='xxx.xxx.xxx.xxx',
    gateway='192.xxx.xxx.xxx'
)
```
```
Note: After running the script, a connection error will appear.This is expected. Once the script has executed, the controller will be accessible on the newly configured network.

```
#### *Quickly press the Reset button more than 10 times to restore the controller to its default network settings.*


# 4. Controlling the RF switch
Four RF switch ports are available (output_0-3). The controller allows only one active port at a time; switching to a new port will automatically turn off the previous selection. The example below illustrates how to create a switch instance, sequentially route the RF input to output_0 and output_1, and reset the switch. While resetting and closing, we leave the switch outputs open intentionally in this example.
```python 
import semiswitch as sq

rf_switch = sq.Switch(ip_address='192.168.10.29', port=80)
# open all RF ports
rf_switch.open_all()
# switch on the output_0 port
rf_switch.output_0.close()
# switch on the output_1 port
rf_switch.output_1.close()
# open all RF port
rf_switch.open_all()
# close the connection
rf_switch.close()
```

# 5. Controlling the RF switch with custom supply voltages
The supply voltages which are applied to the logical bus, controlling the switch state, are default set to VSS = -8 V, VDD = 8 V. To customize the supplies the bus pin attribute of the RF switch instance can be reconfigure by just changing the corresponding attributes. Depending on the transconductance of the switch MOSFETs at chosen supply level it will of course change the RF gain, and can cause a significant insertion-loss if values are chosen too close to the threshold voltages. The example below shows how to switch to output_0 with a custom supply.<br>
```python
import semiswitch as sq
# Create the switch instance
rf_switch = sq.Switch(ip_address='192.168.10.29', port=80)
# Set Channel 01 to +6.0V
rf_switch.bus.VDD = 5.0
rf_switch.bus.VSS = -6.0
# switch on the output_1 port
rf_switch.output_1.close()
# open all RF port
rf_switch.open_all()
# close the connection
rf_switch.close()
```




# 6. Controlling the DAC module directly
SQN_Core8 controller has a total of 8 DC voltage ports, which are named as dac_01, dac_02, dac_03, ... , dac_08. Each channel can be set from -10 V to +10 V. In the example below, we configure the controller ports directly, by addressing the controller attribure of the switch.<br>


```python
import semiswitch as sq
# Create the switch instance
rf_switch = sq.Switch(ip_address='192.168.10.29', port=80)
# Set Channel 01 to +6.0V
rf_switch.controller.dac_01.set_voltage(6.0) 
# Set Channel 02 to -6.0V
rf_switch.controller.dac_02.set_voltage(-6.0)
# Close socket
rf_switch.close()
```

Multiple channels can also be configured simultaneously
```python
import semiswitch as sq
# Create the switch instance
rf_switch = sq.Switch(ip_address='192.168.10.29', port=80)
# Group dac_01, dac_03, dac_02, dac_07 into a single pin
pin_group=[getattr(rf_switch.controller,_pin_name) for _pin_name in "dac_01","dac_03","dac_02","dac_07",]         
channels = sq.DACChannels(pins=pin_group)
# Set dac_01 = 1V, dac_03 = 2V, dac_02 = 3V, dac_07 = 4V
channels.set_voltage([1.0,2.0,3.0,4.0])             
# Set all channels to 0V
rf_switch.set_all_zero()
# Set dac_01, dac_03, dac_02, dac_07 all to 5V
channels.set_voltage(5)
# Close socket
switch.close()

```











   

