Skip to content

aaronzi/opcua-timeseries

Repository files navigation

OPC UA Time Series Server

A comprehensive OPC UA server implementation simulating a CNC machining center that produces realistic manufacturing time series data. Built with Python 3.13 and asyncua, designed for testing, development, and demonstration of industrial IoT applications.

Features

  • Realistic CNC Simulation: Simulates a DMG MORI CTX 650 CNC lathe with authentic operating characteristics
  • Comprehensive Data Model: Includes spindle, feed system, tool management, vibration monitoring, and production metrics
  • Time Series Data: Generates realistic time-varying data with noise and correlations between parameters
  • OPC UA Compliance: Full OPC UA server implementation with methods, variables, and folder organization
  • Docker Support: Ready-to-deploy Docker container with development container support
  • Extensible Architecture: Modular design allows easy addition of new machine types and parameters

Machine Simulation

The server simulates a CNC machining center with the following subsystems:

Spindle System

  • Speed (RPM) with realistic acceleration/deceleration
  • Load percentage based on cutting conditions
  • Torque and power calculations
  • Temperature monitoring with thermal modeling

Feed System

  • Variable feed rates (mm/min)
  • 3-axis position tracking (X, Y, Z)
  • Feed override controls
  • Realistic motion profiles

Tool Management

  • Tool wear simulation (X and Z axes)
  • Tool life monitoring
  • Tool state tracking (New, Good, Worn, Broken)
  • Tool change operations

Vibration Monitoring

  • 3-axis vibration sensors (mm/s RMS)
  • Overall vibration calculation
  • Correlation with spindle speed and tool wear

Production Metrics

  • Parts produced counter
  • Cycle time measurement
  • Good/rejected parts tracking
  • Efficiency calculations

Auxiliary Systems

  • Coolant level and temperature
  • Air pressure monitoring
  • Hydraulic pressure tracking

Quick Start

Docker off-the-shelf component

This project provides a ready-to-use Docker image for quick deployment. You can run the OPC UA server without needing to set up the environment manually.

docker pull aaronzi/opcua-timeseries:latest
docker run -p 4840:4840 aaronzi/opcua-timeseries:latest

Using Docker (Recommended)

  1. Clone the repository:

    git clone https://github.com/aaronzi/opcua-timeseries
    cd opcua-timeseries
  2. Build and run with Docker:

    docker build -t opcua-timeseries .
    docker run -p 4840:4840 opcua-timeseries
  3. Or use Docker Compose:

    docker-compose up

Security & Supply Chain

This project implements comprehensive supply chain security measures:

  • πŸ” SBOM Generation: Software Bill of Materials for complete dependency tracking
  • πŸ“‹ Provenance Attestations: Cryptographically signed build records
  • πŸ›‘οΈ Container Security: Non-root user, read-only filesystem, security policies
  • βœ… Automated CI/CD: GitHub Actions with attestation support
  • πŸ“¦ Multi-platform Builds: AMD64 and ARM64 support with consistent attestations

For detailed security information, see SECURITY.md.

Using Dev Container

  1. Open in VS Code with Dev Containers extension
  2. Reopen in Container when prompted
  3. Run the server: Use the provided launch configurations in the Run and Debug panel to start the server within the container environment.

Local Development

  1. Install Python 3.13
  2. Install dependencies:
    pip install -r requirements-dev.txt
  3. Run the server:
    python -m server.main

Usage

Server Connection

The OPC UA server runs on opc.tcp://localhost:4840/freeopcua/server/ by default.

Client Examples

Basic Connection Test

python -m server.client_test

Data Collection Example

python examples/client/client_example.py

Using OPC UA Client Tools

  • UaExpert: Professional OPC UA client for browsing and monitoring
  • FreeOpcUa Client: Python-based client library

Node Structure

CNC Machine/
β”œβ”€β”€ Information/
β”‚   β”œβ”€β”€ Manufacturer
β”‚   β”œβ”€β”€ Model
β”‚   └── SerialNumber
β”œβ”€β”€ State/
β”‚   └── CurrentState
β”œβ”€β”€ Spindle/
β”‚   β”œβ”€β”€ Speed
β”‚   β”œβ”€β”€ Load
β”‚   β”œβ”€β”€ Torque
β”‚   β”œβ”€β”€ Power
β”‚   └── Temperature
β”œβ”€β”€ FeedSystem/
β”‚   β”œβ”€β”€ FeedRate
β”‚   β”œβ”€β”€ Override
β”‚   └── Position/
β”‚       β”œβ”€β”€ X
β”‚       β”œβ”€β”€ Y
β”‚       └── Z
β”œβ”€β”€ Tool/
β”‚   β”œβ”€β”€ Number
β”‚   β”œβ”€β”€ LifeRemaining
β”‚   β”œβ”€β”€ WearX
β”‚   β”œβ”€β”€ WearZ
β”‚   └── State
β”œβ”€β”€ Vibration/
β”‚   β”œβ”€β”€ X_Axis
β”‚   β”œβ”€β”€ Y_Axis
β”‚   β”œβ”€β”€ Z_Axis
β”‚   └── Overall
β”œβ”€β”€ Production/
β”‚   β”œβ”€β”€ PartsProduced
β”‚   β”œβ”€β”€ CycleTime
β”‚   β”œβ”€β”€ GoodParts
β”‚   β”œβ”€β”€ RejectedParts
β”‚   └── Efficiency
β”œβ”€β”€ AuxiliarySystems/
β”‚   β”œβ”€β”€ CoolantLevel
β”‚   β”œβ”€β”€ CoolantTemperature
β”‚   β”œβ”€β”€ AirPressure
β”‚   └── HydraulicPressure
└── Methods/
    β”œβ”€β”€ ResetProductionCounters
    β”œβ”€β”€ EmergencyStop
    └── ChangeTool

Configuration

Server configuration is managed through config/server_config.yaml:

server:
  name: "CNC Machining Center OPC UA Server"
  endpoint: "opc.tcp://0.0.0.0:4840/freeopcua/server/"
  namespace: "http://manufacturing.example.com/cnc"

machine:
  name: "DMG MORI CTX 650 CNC Lathe"
  model: "CTX650"
  manufacturer: "DMG MORI"
  serial_number: "CTX650-2024-001"

simulation:
  update_interval: 1.0  # seconds
  noise_factor: 0.05    # 5% noise on sensor readings

Development

Adding New Machine Types

  1. Extend the simulation models in server/simulation.py
  2. Update the OPC UA node structure in server/opcua_server.py
  3. Add new configuration parameters in config/server_config.yaml
  4. Update documentation and examples

Testing

Run the test client to verify server functionality:

python -m server.client_test

Integration Examples

With InfluxDB

The Docker Compose configuration includes an optional InfluxDB service for time series data storage.

With Grafana

Create dashboards by connecting Grafana to InfluxDB or directly to the OPC UA server using OPC UA data sources.

With Industrial Systems

  • SCADA Systems: Connect using OPC UA client capabilities
  • MES Systems: Integrate production data through OPC UA
  • Condition Monitoring: Use vibration and temperature data for predictive maintenance

License

[Include your license information here]

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests if applicable
  5. Submit a pull request

Support

For issues, questions, or contributions, please use the GitHub issue tracker.

About

OPC UA Server producing Time Series Test Data

Resources

License

Security policy

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •