Desktop GUI for generating, previewing, uploading, and controlling waveforms on a Kepco BIT 802E / BOP power supply. The app uses a hardened SCPI controller with Telnet-first communication, socket fallback, chunked LIST uploads, live status polling, and safety interlocks for disconnect and shutdown.
- Generate
DC,Sine,Square,Triangle,Sawtooth, and CSV-based waveforms - Preview waveform shape and timing before anything is sent to hardware
- Upload LIST waveforms in verified chunks that respect device limits
- Connect over Telnet on
5024with automatic fallback to SCPI socket5025 - Scan local
/24networks for devices and validate them with*IDN? - Use manual SCPI controls for diagnostics, measurements, and overrides
- Persist session logs to
logs/kepco_dashboard_date_YYYY-MM-DD_HHMMSS.log - Develop offline with the included simulator in
kepco_simulator.py - Enforce safe disconnect behavior by returning output to
0 V,0 A, andOFF
kepco_ui.py: main CustomTkinter desktop applicationkepco_simulator.py: simulator that emulates Kepco Telnet and socket behaviordocs/interface.md: architecture and interface notesdocs/802e_manual.md: device reference materialrequirements.txt: Python dependencies
- Minimum dwell:
0.0005 s - Maximum dwell:
10.0 s - Maximum points per single LIST upload:
1000 - Maximum total staged points in the UI:
4000 - Preferred transport: Telnet on
5024 - Fallback transport: direct SCPI socket on
5025
- Create and activate a virtual environment.
python -m venv .venv
.\.venv\Scripts\Activate.ps1
pip install -r requirements.txt- Optional: run the simulator for offline testing.
python kepco_simulator.py- Start the UI.
python kepco_ui.py- In the app:
- Select or scan for a device IP
- Connect and confirm identity
- Choose control mode and waveform settings
- Preview the waveform locally
- Upload the waveform
- Toggle output on to run it
- Stop or disconnect when finished
This diagram focuses on the actual user-triggered paths in the UI.
flowchart TD
A[Launch UI] --> B[Session log opens]
B --> C[Enter IP or click Scan Network]
C --> D[Click Connect]
D --> E{Connection and *IDN? succeed}
E -- No --> F[Show connection error in log]
E -- Yes --> G[Connected state enabled and status polling starts]
G --> H[Select VOLT or CURR mode]
H --> I[Choose waveform type]
I --> J[Enter waveform settings or load CSV]
J --> K[Click Preview Waveform]
K --> L[Preview plot updates locally]
L --> M[Click Upload]
M --> N{Request accepted}
N -- No --> O[Show validation or upload error]
N -- Yes --> P[Waveform or DC setpoint becomes ready]
P --> Q[Click Output toggle]
Q --> R{Ready waveform is DC, single LIST, or multi-chunk LIST}
R -- DC --> S[Send OUTP ON]
R -- Single LIST --> T[Run uploaded LIST]
R -- Multi-chunk LIST --> U[Start streamed chunk sequence]
S --> V[Status tab and measurements update]
T --> V
U --> V
G --> W[Manual Override tab]
W --> X[Send SCPI command or query]
X --> V
V --> Y[Click Output toggle OFF or Stop]
Y --> Z[Return output to safe idle state]
Z --> G
G --> AA[Click Disconnect or close app]
AA --> AB[Run safety shutdown and verify OFF at 0 V and 0 A]
AB --> AC[Socket closes and UI returns to disconnected state]
This diagram focuses on the controller behavior used for connect, command execution, upload, run, and disconnect.
flowchart TD
A[UI action starts worker thread] --> B[KepcoController]
B --> C[Try TCP connect on 5024 Telnet]
C --> D{Telnet connect works}
D -- Yes --> E[Drain Telnet negotiation bytes]
D -- No --> F[Try TCP connect on 5025 socket]
F --> G{Socket connect works}
G -- No --> H[Return connection failure to UI]
G -- Yes --> I[Use socket transport]
E --> J[Send *IDN?]
I --> J
J --> K[Read response and strip Telnet prompt or echo noise]
K --> L[Return connected state to UI]
L --> M{Operation}
M -- Preview --> N[No SCPI traffic]
M -- Manual command --> O[Send SCPI command]
M -- Manual query --> P[Send SCPI query and read one response]
M -- Upload LIST --> Q[Prepare LIST upload]
M -- Output ON --> R[Run DC output or LIST mode]
M -- Output OFF or Disconnect --> S[Stop output and verify safe state]
O --> T[Pause about 35 ms between non-query commands]
T --> U[If using Telnet drain echoed bytes]
P --> V[Read one response line]
V --> W[Remove IAC bytes prompt text and echoed command]
Q --> X[Optional disarm of active LIST mode]
X --> Y[Send FUNC:MODE mode and mode:RANG 1]
Y --> Z[Send LIST:CLE and wait]
Z --> AA[Send LIST values in small batches]
AA --> AB[Pause between commands and drain Telnet echo]
AB --> AC[Send LIST:DWEL and wait]
AC --> AD[Query LIST points accepted]
AD --> AE[Query SYST:ERR?]
AE --> AF[Return upload success or failure to UI]
R --> AG[DC: OUTP ON]
R --> AH[LIST: LIST:COUN then mode:MODE LIST]
AG --> AI[Status polling continues]
AH --> AI
S --> AJ[For LIST stop return mode to FIX and turn output OFF]
AJ --> AK[Send VOLT 0 and CURR 0 for disconnect]
AK --> AL[Verify OUTP? VOLT? and CURR?]
AL --> AM{Verification passed}
AM -- No --> AN[Block disconnect and report interlock error]
AM -- Yes --> AO[Close socket and reset UI state]
Previewis local-only and does not send SCPI commands.Uploadsends SCPI only after input validation, dwell calculation, and software interlock checks.- Single-chunk waveforms are uploaded once and can then be armed or run.
- Multi-chunk waveforms are streamed chunk-by-chunk because the device accepts at most
1000LIST points per upload. - The controller spaces non-query commands by about
35 msto respect device throughput limits. - On Telnet, the controller drains echoed command bytes so the device echo buffer does not block later commands.
- Status polling runs only while connected and updates output state, measurements, and the status tab.
- CSV input accepts numeric values and flattens rows into one point list.
- The UI uses the loaded CSV values as the waveform data and computes dwell from the requested frequency.
- CSV data is truncated to the app's maximum supported total point count when necessary.
- CSV waveforms require at least
2valid points.
- The app prevents disconnect while an upload or multi-chunk stream is active.
- Before disconnect, the controller attempts the following sequence:
- Stop LIST mode
- Set
VOLT 0 - Set
CURR 0 - Send
OUTP OFF - Verify
OUTP?,VOLT?, andCURR? - If verification fails, disconnect is blocked and the user is shown an interlock error.
- If connection fails, confirm the device is reachable on port
5024or5025. - If the app connects but commands appear to stall, inspect Telnet echo handling and device firmware behavior.
- If uploads fail, check waveform size, dwell constraints, and software limits in the selected control mode.
- Use
kepco_simulator.pyto reproduce connection and upload behavior without hardware. - Review the log panel or the saved session log file for command-level details.
- The SCPI controller is implemented in
KepcoControllerinsidekepco_ui.py. - Device discovery is handled by
Discovery.scan_subnet. - Waveform timing and point generation live in
WaveformGen. - The GUI orchestration is handled by
DashboardApp.
- The repository does not currently include automated tests.
- CSV mode is labeled
untestedin the UI and should be validated on target hardware. - During AC waveform uploads using the LIST command, Live Measurement readback values are inaccurate due to limitations of the 802E BIT LAN card.
- Higher frequency waveforms are limited by the number of points that can be sent due to a dwell time minimum of 0.0005 seconds. This produces a larger step difference between each point.