# devices.kepco:BOP5020mg


The device class for the Kepco BOP 50-20MG power supply.


Usage

``` python
devices.kepco:BOP5020mg(
    interface,
    **kwargs,
)
```


It can possibly be used with different models with little changes.


## Methods

| Name | Description |
|----|----|
| [__init__()](#__init__) | Initialize the BOP5020mg device. |
| [getCurrent()](#getCurrent) | Get the actual current at the device output. |
| [getCurrentSetting()](#getCurrentSetting) | Get the programmed value of current at the device output. |
| [getVoltage()](#getVoltage) | Get the actual voltage at the device output. |
| [setCurrent()](#setCurrent) | Set the output current in A. |
| [setCurrentProtection()](#setCurrentProtection) | Set the output protection current in A. |
| [setCurrentWait()](#setCurrentWait) | Set the output current in A so the actual one is within tolerance. |
| [setMode()](#setMode) | Set the output mode to current or voltage. |
| [setOutput()](#setOutput) | Set the output current ON or OFF. |
| [setRemote()](#setRemote) | Set the device to remote mode. |
| [setVoltage()](#setVoltage) | Set the output voltage in V. |
| [setVoltageProtection()](#setVoltageProtection) | Set the output protection voltage in V. |

------------------------------------------------------------------------


### \_\_init\_\_()


Initialize the BOP5020mg device.


Usage

``` python
__init__(
    interface,
    **kwargs,
)
```


#### Parameters


`interface: str`  
VISA resource name for the device

`**kwargs: dict`  
Additional keyword arguments to pass to the VISA device


------------------------------------------------------------------------


### getCurrent()


Get the actual current at the device output.


Usage

``` python
getCurrent()
```


#### Returns


`float`  
Actual current in A


------------------------------------------------------------------------


### getCurrentSetting()


Get the programmed value of current at the device output.


Usage

``` python
getCurrentSetting()
```


#### Returns


`float`  
Set current in A


------------------------------------------------------------------------


### getVoltage()


Get the actual voltage at the device output.


Usage

``` python
getVoltage()
```


#### Returns


`float`  
Actual voltage in V


------------------------------------------------------------------------


### setCurrent()


Set the output current in A.


Usage

``` python
setCurrent(current)
```


#### Parameters


`current: float`  
Output current in A


------------------------------------------------------------------------


### setCurrentProtection()


Set the output protection current in A.


Usage

``` python
setCurrentProtection(
    voltage,
    resistance=0.8,
)
```


Calculates the current from the applied voltage and the total resistance of the electromagnet.


#### Parameters


`voltage: float`  
Output voltage in V

`resistance: float = ``0.8`  
Total resistance of the electromagnet in Ohm, default is 0.8


------------------------------------------------------------------------


### setCurrentWait()


Set the output current in A so the actual one is within tolerance.


Usage

``` python
setCurrentWait(
    current,
    tolerance=0.4,
)
```


Adjusts the current incrementally until the desired value is reached.


#### Parameters


`current: float`  
Output current in A

`tolerance: float = ``0.4`  
Tolerance for the actual current in A, default is 0.4


------------------------------------------------------------------------


### setMode()


Set the output mode to current or voltage.


Usage

``` python
setMode(mode)
```


#### Parameters


`mode: str`  
Takes "current" or "voltage" as input


------------------------------------------------------------------------


### setOutput()


Set the output current ON or OFF.


Usage

``` python
setOutput(output=None)
```


#### Parameters


`output: bool = None`  
True for ON, False for OFF


------------------------------------------------------------------------


### setRemote()


Set the device to remote mode.


Usage

``` python
setRemote()
```


------------------------------------------------------------------------


### setVoltage()


Set the output voltage in V.


Usage

``` python
setVoltage(voltage)
```


#### Parameters


`voltage: float`  
Output voltage in V


------------------------------------------------------------------------


### setVoltageProtection()


Set the output protection voltage in V.


Usage

``` python
setVoltageProtection(
    current,
    resistance=0.8,
)
```


Calculates the voltage from the applied current and the total resistance of the electromagnet.


#### Parameters


`current: float`  
Output current in A

`resistance: float = ``0.8`  
Total resistance of the electromagnet in Ohm, default is 0.8
