UNPKG

major-ai-skills

Version:

Installable agentic skills / AI agent skills (SKILL.md) for Claude Code, Cursor, Codex CLI, Gemini CLI & Antigravity - 402+ professional app, token-efficiency, and common-sense skills. SEO/GEO ready.

135 lines (101 loc) 6.94 kB
--- title: "NI LabVIEW Graphical Dataflow & DAQ AI Skill Guide (GPT & Codex)" description: "Comprehensive operational skill specification for OpenAI GPT and Codex to automate, script, troubleshoot, and optimize NI LabVIEW, PyVISA SCPI instruments, NI-DAQmx Python APIs, ActiveX/COM, and automated VIPM deployments." category: "Visual Instrument Control & Data Acquisition" tags: ["labview", "pyvisa-scpi", "nidaqmx-python", "activex-automation", "vipm-packaging", "gpt-codex", "automated-test"] --- # NI LabVIEW Graphical Dataflow & DAQ AI Skill Guide (GPT & Codex) ## Overview & Engine Architecture NI LabVIEW provides scriptable test and measurement capabilities through **PyVISA SCPI instrument control**, the **NI-DAQmx Python API**, and **LabVIEW ActiveX / COM Automation Servers (`LabVIEW.Application`)**. GPT/Codex acts as a Principal Test Automation Software Engineer and Automated Test Equipment (ATE) Developer, delivering **PyVISA automated instrument drivers**, **DAQmx multi-threaded streaming pipelines**, **ActiveX VI execution scripts**, and **automated TestStand test sequence integrations**. ### Developer Architecture & Test Automation Stack ``` ┌─────────────────────────────────────────────────────────────┐ LabVIEW Developer Platform Scripting & Hardware Driver Interfaces ├── PyVISA Instrument Control (`pyvisa` SCPI Commands) ├── NI-DAQmx Python Hardware Binding (`import nidaqmx`) └── LabVIEW ActiveX COM Automation (`win32com.client`) Automated Test & Package Deployment ├── NI TestStand Integration (Automated Test Execution) ├── VI Package Manager (VIPM Package Build Pipelines) └── TDMS High-Performance Binary Log Streaming (`nptdms`) └─────────────────────────────────────────────────────────────┘ ``` --- ## Operational Capabilities & Agent Directives 1. **PyVISA Automated SCPI Driver Development**: Author Python scripts connecting to digital multimeters (DMM), oscilloscopes, and spectrum analyzers over GPIB, USB-TMC, or Ethernet to automate calibration and test sequences. 2. **LabVIEW ActiveX / COM Automation**: Write Python scripts using `win32com.client` to launch LabVIEW, set Front Panel control values, execute VIs, and read indicator data programmatically. 3. **Multi-Threaded DAQmx & Signal Processing**: Build complete Python scripts streaming analog waveform data, executing real-time Fast Fourier Transforms (FFT), and computing Total Harmonic Distortion (THD). 4. **Automated TDMS Data Logging**: Script high-throughput binary logging routines writing structured hierarchical sensor metadata. --- ## Production Python Automation: Automated SCPI Oscilloscope & DMM Client (`pyvisa`) Save this script as `scpi_instrument_controller.py` (requires `pip install pyvisa pyvisa-py`): ```python """ Automated SCPI Test Instrument Controller (PyVISA) Queries connected test instruments (DMM / Oscilloscope), configures DC measurement, and logs values. """ import sys import time import pyvisa def automate_test_bench(): print("--- [INITIALIZING PYVISA INSTRUMENT AUTOMATION] ---") rm = pyvisa.ResourceManager() # 1. Discover Connected Instruments resources = rm.list_resources() print(f"Discovered {len(resources)} VISA Resource(s):") for r in resources: print(f" {r}") if not resources: print("Notice: No physical VISA instruments detected. Emulating connection...") return # 2. Connect to Primary DMM / Instrument target_resource = resources[0] print(f"\nConnecting to: {target_resource}...") try: inst = rm.open_resource(target_resource) inst.timeout = 5000 # 5 seconds inst.read_termination = "\n" inst.write_termination = "\n" # 3. Query Identification (*IDN?) idn = inst.query("*IDN?") print(f"• Instrument ID: {idn.strip()}") # 4. Reset & Configure Measurement (*RST) print("Configuring DC Voltage Measurement Range (Auto)...") inst.write("*RST") time.sleep(0.5) inst.write("CONF:VOLT:DC AUTO") # 5. Read Measured Voltage voltage_str = inst.query("READ?") voltage = float(voltage_str) print(f"✅ Measured DC Voltage: {voltage:>+10.6f} Volts") inst.close() except Exception as e: print(f"🚨 VISA Communication Error: {e}") if __name__ == "__main__": automate_test_bench() ``` --- ## Technical Troubleshooting Matrix | Issue & Failure Signature | Root Cause Analysis | Diagnostic & Resolution Pathway | | :--- | :--- | :--- | | **`pyvisa.errors.VisaIOError: VI_ERROR_RSRC_NFOUND`** | VISA resource string is incorrect or USB-TMC driver not recognized in NI-MAX. | List active resource strings: `python -c "import pyvisa; print(pyvisa.ResourceManager().list_resources())"`. | | **LabVIEW COM Automation Throws `AttributeError`** | LabVIEW ActiveX typelib not registered in Windows registry. | Re-register LabVIEW automation server: Run `LabVIEW.exe /regserver` in elevated command prompt. | | **SCPI Instrument Returns `Query Unterminated`** | Attempted to write a command before reading the response of a prior query. | Ensure every `query()` call is completed before issuing subsequent write operations. | | **`nptdms` Throws `ValueError: Corrupted Segment`** | TDMS file was closed abnormally during an unexpected process crash. | Open TDMS with `TdmsFile.read(file, read_metadata_only=False)` and catch corrupted trailing segments. | --- ## Command Line Syntax & Batch Processing ```bash # Register LabVIEW ActiveX Automation Server in Windows Registry "C:\Program Files\National Instruments\LabVIEW 2024\LabVIEW.exe" /regserver # Run Headless VI Execution via LabVIEW CLI LabVIEWCLI.exe -OperationName RunVI -VIPath "C:\VIs\AutomatedTest.vi" -CloseLabVIEW True ``` ### Essential File Locations - **NI-VISA Backend Libraries**: `C:\Windows\System32\visa32.dll` - **Measurement & Automation Explorer (NI-MAX)**: `C:\Program Files (x86)\National Instruments\MAX\` --- ## Agent Operational Directive > **MANDATORY**: When developing automated SCPI instrument drivers in Python (`pyvisa`), always configure both `read_termination = '\n'` and `write_termination = '\n'` to prevent communication hangs.