{"id":23346355,"url":"https://github.com/akurtz87/modbus_plc_python_scada_simulator","last_synced_at":"2025-04-07T17:19:51.543Z","repository":{"id":263006693,"uuid":"879427873","full_name":"AKurtz87/MODBUS_PLC_Python_SCADA_Simulator","owner":"AKurtz87","description":"Simulated industrial control system with Modbus TCP/IP and web HMI to manage air conditioning units.","archived":false,"fork":false,"pushed_at":"2024-11-15T14:23:10.000Z","size":685,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-13T19:39:07.680Z","etag":null,"topics":["hmi-visualization","http","industrial-automation","modbus","modbus-client","modbus-server","modbus-tcp","pymodbus"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AKurtz87.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-10-27T21:42:18.000Z","updated_at":"2025-01-22T19:45:29.000Z","dependencies_parsed_at":"2024-11-15T15:28:19.334Z","dependency_job_id":"85035f84-e6fd-4c40-814d-337ec6adbebe","html_url":"https://github.com/AKurtz87/MODBUS_PLC_Python_SCADA_Simulator","commit_stats":null,"previous_names":["akurtz87/modbus_plc_python_scada_simulator"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AKurtz87%2FMODBUS_PLC_Python_SCADA_Simulator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AKurtz87%2FMODBUS_PLC_Python_SCADA_Simulator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AKurtz87%2FMODBUS_PLC_Python_SCADA_Simulator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AKurtz87%2FMODBUS_PLC_Python_SCADA_Simulator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AKurtz87","download_url":"https://codeload.github.com/AKurtz87/MODBUS_PLC_Python_SCADA_Simulator/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247694882,"owners_count":20980733,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["hmi-visualization","http","industrial-automation","modbus","modbus-client","modbus-server","modbus-tcp","pymodbus"],"created_at":"2024-12-21T07:13:32.745Z","updated_at":"2025-04-07T17:19:51.504Z","avatar_url":"https://github.com/AKurtz87.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Industrial Control System Simulation using Modbus TCP/IP\n\nThis repository contains scripts simulating an industrial control system for managing 10 air conditioning units using **Modbus TCP/IP** communication protocol. The system includes a **server-side PLC simulation**, a **client-side HTTP server**, and two web-based interfaces for monitoring and controlling the units.\n\n## Overview\n\n### Key Components:\n1. **Two PLCs** (simulated locally) with IDs **1** and **2**.\n2. **Modbus TCP/IP** protocol for client-server communication.\n3. **Web-based HMIs**:\n   - **Control Dashboard**: Allows monitoring and controlling air conditioning units.\n   - **Temperature Graph Interface**: Displays temperature trends over time.\n\n## Components and Functionality\n\n### 1. PLC Server (`2PLCs_server_modbus.py`)\n- Simulates **two PLCs** (IDs 1 and 2) locally, managing 10 air conditioning units.\n- Manages three types of Modbus registers:\n  - **Holding Registers**: Store real-time temperature data.\n  - **Discrete Inputs**: Represent the ON/OFF status of the air conditioning units.\n  - **Coils**: Allow user control to turn units ON or OFF via the HMI.\n- Behavior:\n  - Units decrease the temperature by **1°C every 10 seconds** when ON.\n  - Units increase the temperature by **1°C every 10 seconds** when OFF.\n  - Target operating temperature is **7°C**; maximum temperature is **30°C**.\n\n### 2. Client (`2PLCs_client_web_hmi_modbus_graph.py`)\n- Implements an **HTTP server** providing web-based HMIs.\n- Communicates with the PLCs via Modbus protocol.\n- Includes two interfaces:\n  - **Dashboard HMI (`dashboard.html`)**:\n    - Displays real-time data for temperature, status, and controls.\n    - Allows users to turn units ON/OFF.\n    - Highlights high temperatures (≥12°C) with 🚨 alerts.\n  - **Graph Interface (`graph.html`)**:\n    - Displays real-time temperature graphs for all 10 units.\n    - Uses **Chart.js** for dynamic graph updates.\n    - Highlights critical conditions with visual cues.\n\n### 3. AC System Operation\nOnce the server-side and client-side scripts are launched, the system operates as follows:\n- The **server script** reads the value of the **discrete inputs** to verify if each air conditioning unit is **ON** or **OFF**.\n- If an air conditioning unit is **ON**, the system decreases the corresponding **holding register** value (temperature) by **1 degree** every **10 seconds** to simulate cooling.\n- If the unit is **OFF**, the **holding register** value (temperature) increases by **1 degree** every **10 seconds** to simulate a lack of cooling.\n- The **temperature changes** are visible in the **HMI**, allowing users to monitor the real-time status of each unit.\n- Through the **HMI**, users can manually **turn ON or OFF** the air conditioning units by interacting with the **coils** to maintain an **operating temperature of 7 degrees**.\n- The **maximum temperature** that can be reached with all air conditioning units **OFF** is **30 degrees**.\n\n### Web Interfaces\n\n#### Dashboard HMI\n- Features:\n  - Real-time temperature, status, and control actions.\n  - Alerts for high temperatures (≥12°C) with 🚨.\n  - Buttons for ON/OFF control of each unit.\n- Background: Air-conditioning-themed design.\n\n\u003cimg width=\"1432\" alt=\"Screenshot 2024-11-15 at 14 56 03\" src=\"https://github.com/user-attachments/assets/79446951-758e-4017-b3a6-e1b897a75179\"\u003e\n\n#### Graph Interface\n- Features:\n  - Line graphs showing temperature trends.\n  - Updates every 5 seconds.\n  - Color-coded temperature thresholds for clear visualization.\n- Design: Minimalist, responsive layout with color-coded graphs.\n\n\u003cimg width=\"1422\" alt=\"Screenshot 2024-11-15 at 14 56 28\" src=\"https://github.com/user-attachments/assets/8f0c7775-9023-46fc-a918-fdda70e71cbf\"\u003e\n\n## Installation and Usage\n\n### Prerequisites\n- Python 3.7 or higher.\n- Install dependencies using:\n  ```bash\n  pip install -r requirements.txt\n  ```\n\n### Running the Simulation\n1. **Start the PLC Server**:\n   ```bash\n   python3 2PLCs_server_modbus.py\n   ```\n   - Simulates the PLCs and initializes Modbus registers.\n\n2. **Start the Client**:\n   ```bash\n   python3 2PLCs_client_web_hmi_modbus_graph.py\n   ```\n   - Starts the HTTP server providing access to the HMIs.\n\n3. **Access the HMIs**:\n   - **Control Dashboard**: `http://localhost:8000/dashboard`\n   - **Graph Interface**: `http://localhost:8000/graph`\n\n## Folder Structure\n- `2PLCs_server_modbus.py`: PLC simulation script.\n- `2PLCs_client_web_hmi_modbus_graph.py`: HTTP server for HMIs.\n- `templatess/dashboard.html`: Control and status interface.\n- `templates/graph.html`: Temperature graph visualization interface.\n- `requirements.txt`: List of Python dependencies.\n\n## Technologies Used\n- **Python**: Core simulation and server.\n- **Modbus TCP/IP**: Industrial communication protocol.\n- **Flask**: HTTP server for web-based interfaces.\n- **Chart.js**: Interactive temperature graphs.\n- **HTML/CSS/JavaScript**: Web HMI development.\n\n## Features\n- Real-time temperature control and monitoring.\n- Dynamic graph visualization.\n- Scalable design for additional features.\n\n## Contact\nFor questions or suggestions, contact [codewars87@gmail.com].\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fakurtz87%2Fmodbus_plc_python_scada_simulator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fakurtz87%2Fmodbus_plc_python_scada_simulator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fakurtz87%2Fmodbus_plc_python_scada_simulator/lists"}