Skip to content

A slim PyQt5 Python desktop tool for real-time visualization and CSV/XLSX logging of GSV-6 / GSV-8 CAN measurement amplifiers using a dynamic device-channel tree view.

Notifications You must be signed in to change notification settings

me-systeme/GSV86CANViewer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

9 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ”· GSV86CAN Viewer – Tree View Measurement Monitor & Logger

Overview

GSV86CAN Viewer is a lightweight Windows desktop application (Python / PyQt5) for monitoring and logging measurement data from GSV-6 / GSV-8 CAN-based measurement amplifiers.

The application:

  • Communicates with one or more GSV devices over CAN bus using the vendor DLL
  • Displays live measurement values in a tree view grouped by Device β†’ Channel
  • Supports zeroing (tare) of all devices
  • Logs measurement data to CSV or Excel (XLSX) files
  • Uses a YAML configuration file for CAN IDs and device options

The software is designed to be:

  • Robust against missing or misconfigured devices
  • Easily extensible (new devices, sensors, layouts)
  • Clear and deterministic for experimental and test‑bench use

GSV86CAN Viewer – Main Window


✨ Application Features

🌳 Live Tree View (Device β†’ Channel β†’ Value)

The main view shows a tree list:

  • one top-level entry per device (from config.yaml)
  • one child entry per device channel (channel count detected at runtime) Each channel row displays:
  • Channel number (1-based)
  • Current measurement value (e.g. kN) The device rows show:
  • Device number
  • CAN Answer ID
  • Serial number (if readable) Channel count is determined dynamically via chan = gsv.activate(...). You do not need to configure a channel mapping.

🎨 Device Color Coding

  • Devices with configuration or communication errors are highlighted in red.

This makes it easy to visually identify:

  • Which devices failed to initialize correctly

βš–οΈ Zero / Tare Function

  • A "Zero" button is available below the tree.
  • When pressed, a confirmation dialog is shown.
  • If confirmed, all active devices are zeroed via the DLL.

Technical notes:

  • Zeroing is executed safely inside the acquisition thread
  • The UI immediately updates values to zero for visual feedback

⏺️ Recording / Logging

If logging is enabled in the YAML file:

  • A REC button is shown
  • Recording can be started/stopped at runtime

Supported formats:

  • .csv (streaming write)
  • .xlsx (written when recording stops)

Features:

  • Automatic filename increment (data.xlsx β†’ data_001.xlsx β†’ data_002.xlsx)
  • User confirmation if a file already exists
  • Configurable logging rate (e.g. 1 sample per second)

Notes:

  • Logging rate is independent of the device measurement frequency.
  • Logging writes complete rows using last-known values.
  • On startup, some channels may need a short time until they deliver their first value (depending on device streaming / CAN traffic).

πŸ“‘ Status & Device Information

At the bottom of the window:

  • Status line shows initialization messages, warnings, and errors
  • Devices line shows live update rates per CAN ID (Hz)

This helps diagnose:

  • CAN communication issues
  • Incorrect baud rates or IDs
  • Devices that stopped sending data

🧩 YAML Configuration File

All application behavior is controlled by config.yaml. The configuration file controls:

  • CAN baud rate and DLL buffer size
  • Device CAN IDs (cmd/answer)
  • Optional settings (frequency, scaling, sensor mapping)
  • Logging

βš™οΈ 1. dll

dll:
  mybuffersize: 300
  canbaud: 250000
Key Description
mybuffersize Internal DLL read buffer size
canbaud CAN bus baud rate (must match hardware)

πŸ’Ύ 2. logging

logging:
  file: "messdaten.xlsx"
  rate_hz: 1.0
Key Description
file Log file path (.csv or .xlsx). Empty = no logging
rate_hz Logging rate in samples per second

Notes:

  • Logging is independent of device frequency
  • Values are sampled from the latest available data

πŸ”Œ 5. devices

devices:
  frequency: 10
  load_default_settings: false
  auto_sensitivity_adjustment: false
  config:
    - dev_no: 1
      cmd_id: "0x0C8"
      answer_id: "0x0C9"
Key Description
frequency Global measurement frequency (Hz, ≀ 100 recommended)
load_default_settings Loads factory defaults via DLL before reading ranges/scales.
auto_sensitivity_adjustment Automatically increases sensitivity of the devices
dev_no Logical device number
cmd_id CAN command ID
answer_id CAN answer ID

Per‑device frequency overrides are supported by setting frequency inside a device entry.


πŸ§ͺ 6. sensors

Defines physical sensor properties.

sensors:
  - sensor_no: 1
    nominal_load: "250 kN"
    char_value: "3.15 mV/V"

Used to:

  • Compute scaling factors
  • Automatically adjust input ranges

7. sensor_mapping

Maps sensors to device channels.

sensor_mapping:
  - sensor_no: 1
    channel: [1, 0]

Meaning:

  • Sensor 1 is connected to device 1, channel 0

πŸš€ Getting Started

πŸ“¦ Requirements

  • Windows (DLL‑based)
  • Python 3.10+ 32 bit (recommended)
  • Installed CAN hardware (PCAN)
  • GSV CAN DLL (GSV86CAN.dll)

Python Dependencies

Install required packages:

pip install PyQt5 pyyaml openpyxl

Project Structure

project_root/
β”‚
β”œβ”€ config.yaml
β”œβ”€ GSV86CAN.dll
β”œβ”€ src/
β”‚  └─ gsv86canviewer/
β”‚     β”œβ”€ main.py
β”‚     β”œβ”€ main_window.py
β”‚     β”œβ”€ reader_thread.py
β”‚     β”œβ”€ recorder.py
β”‚     β”œβ”€ gsv86can.py
β”‚     β”œβ”€ utils.py
β”‚     └─ config.py

▢️ Running the Application

Start the application by running

python run.py

On startup:

  1. Devices are activated (CAN IDs from config)
  2. Channel count is detected automatically per device (activate() result)
  3. Streaming starts and the tree view updates as values arrive

🧱 Building a Single-File Windows Executable (Onefile)

The application can be packaged into a single standalone .exe using PyInstaller.

Characteristics

  • The resulting executable is one single file
  • The vendor DLL (GSV86CAN.dll) is embedded inside the executable
  • At runtime, PyInstaller extracts the DLL to a temporary directory and loads it automatically
  • The configuration file config.yaml remains external and must be located next to the .exe

Build Command

Run the following command from the project root directory:

python -m PyInstaller --noconfirm --clean --windowed --onefile  --paths "src"  --add-binary "GSV86CAN.dll;."  run.py

Resulting Files

After a successful build, the dist/ directory will contain:

dist/
└─ run.exe

To run the application, place config.yaml next to the executable:

run.exe
config.yaml

Design Notes

  • All DLL calls are isolated in gsv86can.py
  • All hardware access runs in a QThread (no UI blocking)
  • UI logic is strictly separated from acquisition logic
  • YAML config is loaded once and treated as read‑only
  • Channel structure is not configured manually:
    • devices from YAML
    • channels from activate()

License / Usage

This application is intended for engineering, laboratory, and test‑bench use.

Ensure that:

  • CAN IDs do not conflict with other devices
  • Frequencies stay within device limits
  • Zeroing is performed only under safe conditions

About

A slim PyQt5 Python desktop tool for real-time visualization and CSV/XLSX logging of GSV-6 / GSV-8 CAN measurement amplifiers using a dynamic device-channel tree view.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages