# Eurotest HPP120256

Control the Eurotest HPP120256 power supply from Python with the `EurotestHPP120256` driver.

**Driver:** [pymeasure](https://pymeasure.readthedocs.io)  
**Type:** [Power supplies](https://dev.nominal.io/instro/instruments/type/psu.md)  
**Manufacturer:** [Eurotest](https://dev.nominal.io/instro/instruments/manufacturer/eurotest.md)

Represents the Euro Test High Voltage DC Source model HPP-120-256 and provides a high-level interface for interacting with the instrument using the Euro Test

## Publishing through instro

instro publishes the commands you send to a EurotestHPP120256 and the values you read from it, through any [publisher](https://dev.nominal.io/instro/library/publishers.md). It takes two forms, both described in the [pymeasure guide](https://dev.nominal.io/instro/library/pymeasure.md). Install with `uv add "instro[pymeasure]"`.

### With a PymeasureInstrument

[`PymeasureInstrument`](https://dev.nominal.io/instro/library/pymeasure.md#write-new-instro-code) wraps the driver in an instro instrument, with tags and background polling. The instrument is created inside the `with` block, and `.device` is the pymeasure instrument.

```python
from pymeasure.instruments.eurotest import EurotestHPP120256
from instro.pymeasure import PymeasureInstrument

with PymeasureInstrument(
    name="hpp120256",
    instrument=EurotestHPP120256("GPIB0::20::INSTR"),
    dataset_rid="<dataset rid>",
) as hpp120256:

    print(hpp120256.device.id)
    print(hpp120256.device.lam_status)
    print(hpp120256.device.status)

    hpp120256.device.ramp_to_zero(100.0)

    hpp120256.device.voltage_ramp = 50.0  # V/s
    hpp120256.device.current_limit = 2.0  # mA
    inst.kill_enabled = True  # Enable over-current protection
    time.sleep(1.0)  # Give time to enable kill
    inst.output_enabled = True
    time.sleep(1.0)  # Give time to output on

    abs_output_voltage_error = 0.02 # kV

    hpp120256.device.wait_for_output_voltage_reached(abs_output_voltage_error, 1.0, 40.0)

    # Here voltage HV output should be at 0.0 kV

    print("Setting the output voltage to 1.0kV...")
    hpp120256.device.voltage_setpoint = 1.0  # kV

    # Now HV output should be rising to reach the 1.0kV at 50.0 V/s

    hpp120256.device.wait_for_output_voltage_reached(abs_output_voltage_error, 1.0, 40.0)

    # Here voltage HV output should be at 1.0 kV

    hpp120256.device.shutdown()

    hpp120256.device.wait_for_output_voltage_reached(abs_output_voltage_error, 1.0, 60.0)

    # Here voltage HV output should be at 0.0 kV

    inst.output_enabled = False

    # Now the HV voltage source is in safe state
```

### With existing pymeasure code (`attach()`)

[`attach()`](https://dev.nominal.io/instro/library/pymeasure.md#publish-from-existing-code) adds publishing to pymeasure code you already have. The imports, the `attach()` call after the instrument is created, and `recorder.close()` are all that instro adds.

```python
from pymeasure.instruments.eurotest import EurotestHPP120256
from instro.lib import NominalCorePublisher
from instro.pymeasure import attach

hpp120256 = EurotestHPP120256("GPIB0::20::INSTR")
recorder = attach(hpp120256, "hpp120256", [NominalCorePublisher(dataset_rid="<dataset rid>")])

print(hpp120256.id)
print(hpp120256.lam_status)
print(hpp120256.status)

hpp120256.ramp_to_zero(100.0)

hpp120256.voltage_ramp = 50.0  # V/s
hpp120256.current_limit = 2.0  # mA
inst.kill_enabled = True  # Enable over-current protection
time.sleep(1.0)  # Give time to enable kill
inst.output_enabled = True
time.sleep(1.0)  # Give time to output on

abs_output_voltage_error = 0.02 # kV

hpp120256.wait_for_output_voltage_reached(abs_output_voltage_error, 1.0, 40.0)

# Here voltage HV output should be at 0.0 kV

print("Setting the output voltage to 1.0kV...")
hpp120256.voltage_setpoint = 1.0  # kV

# Now HV output should be rising to reach the 1.0kV at 50.0 V/s

hpp120256.wait_for_output_voltage_reached(abs_output_voltage_error, 1.0, 40.0)

# Here voltage HV output should be at 1.0 kV

hpp120256.shutdown()

hpp120256.wait_for_output_voltage_reached(abs_output_voltage_error, 1.0, 60.0)

# Here voltage HV output should be at 0.0 kV

inst.output_enabled = False

# Now the HV voltage source is in safe state

recorder.close()  # flush and close the publishers
```

The examples are adapted from the [pymeasure documentation for `EurotestHPP120256`](https://pymeasure.readthedocs.io/en/latest/api/instruments/eurotest/eurotestHPP120256.html#pymeasure.instruments.eurotest.eurotestHPP120256.EurotestHPP120256), which lists every property and method.
