> ## Documentation Index
> Fetch the complete documentation index at: https://instro.nominal.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Quickstart

> Drive a simulated power supply end-to-end in about five minutes. No hardware required

## Step-by-step

`instro` ships with a built-in SCPI simulator, so you can try the library without owning any hardware.

<Steps>
  <Step title="Install instro">
    ```bash theme={null}
    pip install instro
    ```
  </Step>

  <Step title="Start the simulated PSU">
    Open a separate terminal and start the bundled simulator.

    ```bash theme={null}
    python -m instro.psu.scpi_sim_server
    ```
  </Step>

  <Step title="Construct an InstroPSU">
    Create an `InstroPSU` driven by the `SimulatedPSU` driver. The driver owns the VISA transport.

    ```python theme={null}
    from instro.psu import InstroPSU
    from instro.psu.drivers import SimulatedPSU
    from instro.lib.publishers import FilePublisher

    file_pub = FilePublisher(format="jsonl", directory="/tmp/instro/")
    psu = InstroPSU(
        name="bench_psu",
        driver=SimulatedPSU("TCPIP0::127.0.0.1::5025::SOCKET"),
        publishers=[file_pub],
        num_channels=2,
    )
    psu.open()
    ```
  </Step>

  <Step title="Configure Instrument">
    ```python theme={null}
    psu.set_voltage(5.0, channel=1)
    psu.set_current_limit(1.0, channel=1)
    psu.set_overvoltage_protection_level(5.5, channel=1)
    psu.set_overvoltage_protection_enabled(True, channel=1)
    psu.output_enable(True, channel=1)
    ```
  </Step>

  <Step title="Make Measurements">
    Measurement getters return a [Measurement](/library/library#measurements-and-commands) object. Use `.latest` to grab the current value. Every measurement is timestamped, tagged, and streamed to the [Publishers](/library/publishers).

    ```python theme={null}
    voltage = psu.get_voltage(channel=1)
    current = psu.get_current(channel=1)
    print(f"V: {voltage.latest:.3f} V")
    print(f"I: {current.latest:.3f} A")
    ```
  </Step>

  <Step title="Close Up Shop">
    When you're done, disable the output and close the connection. `close()` stops the background daemon and flushes the publishers.

    ```python theme={null}
    psu.output_enable(False, channel=1)
    psu.close()
    ```
  </Step>

  <Step title="Read the Data">
    All `Commands` and `Measurements` are logged to the `publishers`.

    ```python theme={null}
    print(file_pub.file_path.read_text())  # commands and measurements written to the publisher
    ```
  </Step>
</Steps>

<Columns cols={3}>
  <Card title="Installation" icon="download" href="/installation" />

  <Card title="Examples" icon="code" href="/examples" />

  <Card title="Supported Instruments" icon="microchip" href="/instruments" />
</Columns>
