arcee-ai/wipro-pump-demo
Python
Captured source
source ↗arcee-ai/wipro-pump-demo
Language: Python
Stars: 0
Forks: 0
Open issues: 0
Created: 2025-04-24T19:05:03Z
Pushed: 2025-04-24T19:05:16Z
Default branch: main
Fork: no
Archived: no
README:
Mock System Status Pump API
This project provides a simple Flask-based API to simulate sensor data (vibration, temperature, pressure) for a mock pump ("Rig 42"). It's designed for use in demos, such as the PumpGuard 20 concept, allowing interaction without needing real hardware.
Features
- Simulates normal operating conditions.
- Simulates specific anomalies:
- High vibration (> 3.0g)
- Rapid temperature increase (> 0.5°C/min)
- Provides REST endpoints to get status and control the simulation mode.
- Uses
uvfor environment management and execution.
Setup and Running
1. Prerequisites:
- Python 3.x
uv(Install from astral-sh/uv)- A Unix-like shell (bash, zsh)
2. Make the script executable (first time only):
chmod +x run.sh
3. Run the server:
./run.sh
This script will:
- Create a Python virtual environment (
.venv) if it doesn't exist. - Install the required dependency (Flask) using
uv. - Start the Flask server.
The server will run on http://0.0.0.0:5001 by default, meaning it's accessible from your local machine and potentially other devices on the same network.
API Endpoints
The server runs on port 5001 by default. Replace localhost with the actual IP address if accessing from another machine on the network.
1. Get Pump Status
Retrieves the latest simulated sensor data.
- Endpoint:
GET /status - Method:
GET - `curl` Example:
curl http://localhost:5001/status
- Example Response:
{
"pump_id": "Rig 42",
"timestamp": "2025-04-24T16:49:00Z",
"vibration": 1.234,
"temperature": 62.51,
"pressure": 110.5
}2. Control Simulation Mode
Changes the behavior of the data simulation.
- Endpoint:
POST /control - Method:
POST - Request Body: JSON object with a
modekey. - Valid modes:
"normal","high_vibration","rapid_temp_increase" - `curl` Examples:
- Set to Normal:
curl -X POST -H "Content-Type: application/json" -d '{"mode": "normal"}' http://localhost:5001/control- Trigger High Vibration:
curl -X POST -H "Content-Type: application/json" -d '{"mode": "high_vibration"}' http://localhost:5001/control- Trigger Rapid Temperature Increase:
curl -X POST -H "Content-Type: application/json" -d '{"mode": "rapid_temp_increase"}' http://localhost:5001/control- Example Success Response:
{
"message": "Pump simulation mode set to 'high_vibration'"
}- Example Error Response:
{
"error": "Invalid mode 'low_pressure' specified"
}Files
app.py: Main Flask application code.pump_simulator.py: Class handling the simulation logic.requirements.txt: Python dependencies (installed viauv).run.sh: Script to set up the environment and run the application.PLAN.md: The architectural plan document.README.md: This file.
Notability
notability 1.0/10Trivial demo repo with no traction.