Skip to content

A distributed ICS simulation for conveyor systems featuring Raft Consensus, Kafka messaging, and Kubernetes-based resource management. πŸš€βš™οΈ

License

Notifications You must be signed in to change notification settings

hsn07pk/SmartConveyor-ICS

Repository files navigation

Conveyor System Simulation with Distributed ICS

A distributed Industrial Control System (ICS) simulation for conveyor systems, incorporating Raft Consensus, Kafka Message Broker, and Kubernetes-based resource management.

Overview

This project implements a distributed control system for simulating and managing conveyor belt operations. It demonstrates modern distributed systems architecture with real-time control capabilities.

Key Components

  • Client: Simulates conveyor belt operations and sensor data generation
  • Server: Core ICS simulator processing sensor data and system logic
  • Kafka Message Broker: Handles inter-component communication
  • Raft Consensus Service: Manages distributed consensus and leader election
  • Resource Manager: Kubernetes-based workload scheduling
  • XR Client: Optional AR/VR integration capability
  • LLM Agents: Future AI-driven optimization (planned feature)

Architecture

graph TD
    A["LLM Agents (Future Integration)"] -->|gRPC/Protobuf| B["ICS Simulator (gRPC Server)"]
    B -->|gRPC/Protobuf| C["Message Broker (Kafka)"]
    C -->|gRPC| D["Consensus Service (Raft + Clocks)"]
    B -->|gRPC/Protobuf| E["XR Client"]
    C -->|gRPC| F["Resource Manager (K8s Scheduler)"]

    classDef service fill:#ADD8E6,stroke:#005A9C,stroke-width:2px,color:#000,font-weight:bold;
    classDef broker fill:#FFD700,stroke:#DAA520,stroke-width:2px,color:#000,font-weight:bold;
    classDef consensus fill:#98FB98,stroke:#228B22,stroke-width:2px,color:#000,font-weight:bold;
    classDef client fill:#FFB6C1,stroke:#FF69B4,stroke-width:2px,color:#000,font-weight:bold;
    
    class A,B,F service;
    class C broker;
    class D consensus;
    class E client;
Loading

Prerequisites

  • Docker Desktop
  • Minikube
  • kubectl
  • Python 3.8+
  • gRPC tools
  • Protocol Buffers compiler

Installation

  1. Clone the repository:
git clone https://github.com/yourusername/conveyor-system-simulation.git
cd conveyor-system-simulation
  1. Install dependencies:
# Server dependencies
cd server
pip install -r requirements.txt

# Client dependencies
cd ../client
pip install -r requirements.txt

Development Setup

Local Development

  1. Start Minikube:
minikube start
  1. Configure Docker environment:
# For PowerShell
minikube docker-env | Invoke-Expression

# For Bash
eval $(minikube docker-env)
  1. Build Docker images:
# Build server image
docker build -t server:latest -f server/Dockerfile server

# Build client image
docker build -t client:latest -f client/Dockerfile client

Kubernetes Deployment

  1. Apply Kubernetes configurations:
kubectl apply -f kubernetes/
  1. Verify deployment:
# Check running pods
kubectl get pods

# Check services
kubectl get svc

Monitoring and Debugging

Monitor system components:

# View pod logs (replace <pod-name>)
kubectl logs <pod-name>

# Get detailed pod information
kubectl describe pod <pod-name>

# Stream logs from a specific pod
kubectl logs -f <pod-name>

Usage

  1. Access the system dashboard:
minikube service dashboard-service
  1. Start the simulation:
# In the client directory
python client.py --host localhost --port 50051
  1. Monitor metrics:
# Access Prometheus metrics
minikube service prometheus-service

Troubleshooting

Common Issues

  1. Pods not starting:
# Check pod status
kubectl get pods
kubectl describe pod <pod-name>
  1. Service connectivity issues:
# Verify service endpoints
kubectl get endpoints

# Test service connectivity
kubectl port-forward service/<service-name> <local-port>:<service-port>
  1. Resource cleanup:
# Delete all resources
kubectl delete -f kubernetes/

# Delete specific resources
kubectl delete pods --all
kubectl delete deployments --all
kubectl delete services --all

Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit changes (git commit -m 'Add amazing feature')
  4. Push to branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Future Enhancements

  • Integration of LLM agents for predictive maintenance
  • Enhanced XR client capabilities
  • Advanced anomaly detection
  • Real-time optimization algorithms
  • Extended monitoring and alerting

License

This project is licensed under the MIT License - see the LICENSE file for details.

Contact

Muhammad Hassan Sohail - @LinkedIn Project Link: https://github.com/hsn07pk/conveyor-system-simulation

About

A distributed ICS simulation for conveyor systems featuring Raft Consensus, Kafka messaging, and Kubernetes-based resource management. πŸš€βš™οΈ

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •