Kompletny emulator systemu C20 z wieloma mikroserwisami w Docker. System oferuje dwa tryby pracy:
System składa się z następujących mikroserwisów:
Get everything running in 3 commands:
git clone <repository-url>
cd dockemu
make quick-start
Then open http://localhost:8088 for the unified dashboard! 🎉
This project provides a complete Docker-based simulation environment for C20 hardware components, including:
Serwis | Port | Opis | URL |
---|---|---|---|
WebGUI | 8088 | Główny interfejs | http://localhost:8088 |
LCD Display | 8089 | Symulator LCD | http://localhost:8089 |
HUI Keyboard | 8087 | Panel klawiatury | http://localhost:8087 |
Modbus Visualizer | 8084 | Wizualizacja Modbus | http://localhost:8084 |
Modbus IO API | 8085 | API Modbus RTU | http://localhost:8085 |
RPi3PC API | 4000 | API emulatora | http://localhost:4000 |
MQTT Broker | 1883 | MQTT protokół | mqtt://localhost:1883 |
MQTT WebSocket | 9001 | WebSocket MQTT | ws://localhost:9001 |
git clone <repository-url>
cd dockemu
make build
make up
make status
Access: http://localhost:8088
The unified dashboard provides complete control over all simulators:
Ctrl+1
- Grid layoutCtrl+2
- Tab layoutCtrl+3
- Focus layoutCtrl+R
- Refresh allCtrl+F
- Toggle fullscreenEsc
- Exit fullscreen/close modalsAccess: http://localhost:8091
Simulates the 7.9” HDMI display showing:
Access: http://localhost:8092
Interactive keyboard interface for:
Usage:
Access: http://localhost:8084
Real-time visualization of 8-channel Modbus RTU:
How to use:
BLS Mask Testing:
# Run BLS 5000 test
make shell SERVICE=rpi
python3 /shared/test_procedures.py --test BLS_5000
# Run BLS 8000 test
python3 /shared/test_procedures.py --test BLS_8000
API Testing:
# Start a test procedure via API
curl -X POST http://localhost:8088/api/procedures/start \
-H "Content-Type: application/json" \
-d '{"procedure": "BLS_5000_TEST", "serial": "SN123456"}'
I2C Communication Test:
make shell SERVICE=rpi
python3 -c "
from hardware.i2c_bus import I2CBusSimulator
import asyncio
async def test_sensors():
bus = I2CBusSimulator()
# Read LP sensor (0x48)
lp_data = await bus.read(0x48, 2)
print(f'LP Pressure: {int.from_bytes(lp_data, \"big\")} mbar')
# Read MP sensor (0x49)
mp_data = await bus.read(0x49, 2)
print(f'MP Pressure: {int.from_bytes(mp_data, \"big\")} mbar')
# Read HP sensor (0x4A)
hp_data = await bus.read(0x4A, 2)
print(f'HP Pressure: {int.from_bytes(hp_data, \"big\")} mbar')
asyncio.run(test_sensors())
"
Control 12-channel outputs:
make shell SERVICE=rpi
python3 -c "
from hardware.gpio_controller import GPIOController
import time
gpio = GPIOController()
# Turn on valve 1
gpio.set_pin(1, True)
time.sleep(2)
# Turn off valve 1
gpio.set_pin(1, False)
"
Service | Port | Description | Health Check |
---|---|---|---|
Unified Dashboard | 8088 | Main control interface | http://localhost:8088/health |
LCD Display | 8091 | System display simulation | http://localhost:8091 |
HUI Keyboard | 8092 | Interactive keyboard | http://localhost:8092 |
Modbus Visual | 8084 | I/O visualization | http://localhost:8084 |
MQTT Broker | 1883 | Message communication | - |
WebSocket | 9001 | Real-time communication | - |
make help # Show all available commands
make build # Build all Docker images
make up # Start all services
make down # Stop all services
make restart # Restart all services
make clean # Complete cleanup (containers, images, volumes)
make logs # Show logs from all services
make logs-service SERVICE=rpi # Show logs from specific service
make shell SERVICE=rpi # Open shell in container
make status # Show container status
make monitoring # Real-time resource monitoring
make test-all # Run all test procedures
make test-bls # Run BLS mask tests
make test-modbus # Test Modbus communication
make install # Setup project dependencies
make backup # Create project backup
make dev # Start in development mode
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ Unified │ │ LCD Display │ │ HUI Keyboard │
│ Dashboard │ │ (nginx) │ │ (Flask) │
│ :8088 │ │ :8091 │ │ :8092 │
└─────────────────┘ └─────────────────┘ └─────────────────┘
│ │ │
└───────────────────────┼───────────────────────┘
│
┌───────────────────────┼───────────────────────┐
│ │ │
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ RPI Controller │ │ Modbus I/O │ │ MQTT Broker │
│ (Python) │ │ Visualizer │ │ (Mosquitto) │
│ I2C/GPIO │ │ :8084 │ │ :1883/:9001 │
└─────────────────┘ └─────────────────┘ └─────────────────┘
│ │ │
└───────────────────────┼───────────────────────┘
│
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ Pressure │ │ Valve │ │ Test │
│ Sensors │ │ Controller │ │ Procedures │
│ (I2C) │ │ (I2C) │ │ (Python) │
└─────────────────┘ └─────────────────┘ └─────────────────┘
# Clean everything and rebuild
make clean
make build
# Check specific service logs
make logs-service SERVICE=<service-name>
# Check what's using ports
sudo netstat -tulpn | grep :808
# Stop conflicting services
sudo systemctl stop <service-name>
# Fix Docker permissions
sudo usermod -aG docker $USER
newgrp docker
# Check container status
make status
# Restart specific service
make restart-service SERVICE=<service-name>
# Emergency stop and restart
make down
make up
docker ps | grep lcd
make logs-service SERVICE=lcd-display
make shell SERVICE=rpi
curl http://localhost:8092/health
telnet localhost 5020
mkdir new-service
cd new-service
Add Dockerfile and code
new-service:
build: ./new-service
container_name: c20-new-service
ports:
- "8086:80"
networks:
- c20-network
The C20 protocol (shared/protocols/c20_protocol.py
) can be extended with:
# Run unit tests
make shell SERVICE=rpi
python3 -m pytest /app/tests/ -v
# Integration tests
make test-all
# Load testing
make monitoring # Monitor during tests
For issues and questions:
make logs
Happy simulating! 🎉