{"library":"pyvisa-sim","title":"PyVISA-sim","description":"PyVISA-sim is a Python library that provides a simulated backend for PyVISA, allowing users to develop and test instrument control applications without needing physical hardware. It supports common resource types like TCPIP, GPIB, RS232, and USB, mimicking their behavior. The current version is 0.7.1, released on 2024-05-13, and it follows a regular, active release cadence.","language":"python","status":"active","last_verified":"Fri Apr 17","install":{"commands":["pip install pyvisa-sim"],"cli":null},"imports":["import pyvisa; rm = pyvisa.ResourceManager('@sim')"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import pyvisa\n\n# Create a resource manager that uses the simulated backend\n# The '@sim' string tells PyVISA to load pyvisa-sim as the backend\nrm = pyvisa.ResourceManager('@sim')\n\n# List available simulated resources (pyvisa-sim comes with some defaults)\nprint(\"Available resources:\", rm.list_resources())\n\n# Open a simulated instrument resource\n# This instrument is defined within pyvisa-sim's default simulation\ntry:\n    instrument = rm.open_resource('USB::0x1000::0x2000::0x3000::INSTR')\n\n    # Basic SCPI commands\n    print(\"Writing '*IDN?'...\")\n    instrument.write('*IDN?')\n    idn = instrument.read()\n    print(\"Read IDN:\", idn)\n\n    # Example of a command that changes state (simulation only)\n    instrument.write('MEASURE:VOLTAGE:DC?')\n    voltage = instrument.read()\n    print(\"Simulated DC Voltage:\", voltage)\n\n    # Close the instrument\n    instrument.close()\n    print(\"Instrument closed.\")\n\nexcept Exception as e:\n    print(f\"An error occurred: {e}\")\nfinally:\n    # Close the resource manager\n    rm.close()\n    print(\"Resource manager closed.\")","lang":"python","description":"This quickstart demonstrates how to initialize PyVISA with the simulated backend, list available simulated resources, open a default simulated USB instrument, perform basic SCPI write and read operations, and properly close the instrument and resource manager.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}