Database Connection

✓ Connected to database 'hkcconhmpi' at hkcconhmpi.mysql.db

Database Tables

Table Name Status
wps_pump_families ✓ Exists
wps_pump_models ✓ Exists
wps_pump_performance ✓ Exists
wps_pump_dimensions ✓ Exists

Setup Instructions

1. Create Database

First, create the MySQL database:

CREATE DATABASE wellpumps_selector;
USE wellpumps_selector;

2. Create Tables

Import this SQL schema:

-- Pump Families Table
CREATE TABLE wps_pump_families (
    id INT AUTO_INCREMENT PRIMARY KEY,
    name VARCHAR(50) NOT NULL UNIQUE,
    series VARCHAR(50) NOT NULL,
    well_diameter_inch DECIMAL(4,1) NOT NULL,
    well_diameter_mm INT NOT NULL,
    pipe_connection VARCHAR(20),
    frequency INT DEFAULT 50,
    material VARCHAR(100),
    max_flow DECIMAL(8,1),
    max_head DECIMAL(8,1),
    description TEXT,
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    INDEX idx_series (series)
);

-- Pump Models Table
CREATE TABLE wps_pump_models (
    id INT AUTO_INCREMENT PRIMARY KEY,
    family_id INT NOT NULL,
    model_name VARCHAR(80) NOT NULL UNIQUE,
    rated_flow DECIMAL(8,1),
    stages INT,
    variant VARCHAR(10),
    power_kw DECIMAL(8,1),
    power_hp DECIMAL(8,1),
    full_load_current DECIMAL(8,1),
    voltage VARCHAR(20) DEFAULT '3x400V',
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    FOREIGN KEY (family_id) REFERENCES wps_pump_families(id) ON DELETE CASCADE,
    INDEX idx_family_id (family_id),
    INDEX idx_model_name (model_name)
);

-- Performance Data Table
CREATE TABLE wps_pump_performance (
    id INT AUTO_INCREMENT PRIMARY KEY,
    model_id INT NOT NULL,
    flow_rate DECIMAL(8,1) NOT NULL,
    head DECIMAL(8,1) NOT NULL,
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    FOREIGN KEY (model_id) REFERENCES wps_pump_models(id) ON DELETE CASCADE,
    INDEX idx_model_id (model_id),
    INDEX idx_flow_rate (flow_rate),
    INDEX idx_flow_head (flow_rate, head)
);

-- Pump Dimensions Table
CREATE TABLE wps_pump_dimensions (
    id INT AUTO_INCREMENT PRIMARY KEY,
    model_id INT NOT NULL UNIQUE,
    dim_a_mm INT,
    dim_b_mm INT,
    dim_c_mm INT,
    dim_d_mm INT,
    dim_e_mm INT,
    dim_e_star_mm INT,
    motor_type VARCHAR(10),
    weight_pump_kg DECIMAL(8,1),
    weight_electropump_kg DECIMAL(8,1),
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    FOREIGN KEY (model_id) REFERENCES wps_pump_models(id) ON DELETE CASCADE,
    INDEX idx_model_id (model_id)
);

3. Insert Sample Data

Here's example data to get started:

-- Insert pump family
INSERT INTO wps_pump_families (name, well_diameter_mm, pipe_connection)
VALUES ('4 inch Submersible', 98, 'NPT 1-1/4"');

-- Insert pump model
INSERT INTO wps_pump_models (family_id, name, rated_flow, power_kw, voltage, full_load_current, num_stages)
VALUES (1, 'SP-4-40', 40, 5.5, '230V', 24, 40);

-- Insert performance data points
INSERT INTO performance_data (model_id, flow_m3h, head_m) VALUES
(1, 0, 120),
(1, 10, 118),
(1, 20, 115),
(1, 30, 110),
(1, 40, 100),
(1, 50, 85);

-- Insert dimensions
INSERT INTO wps_pump_dimensions (model_id, dimension_a, dimension_b, motor_type, pump_weight_kg)
VALUES (1, 1500, 200, 'Squirrel Cage', 180);

4. Configure Application

Edit config.php with your database credentials:

define('DB_HOST', 'localhost');
define('DB_NAME', 'wellpumps_selector');
define('DB_USER', 'root');
define('DB_PASS', '');

5. Test the Application

Once tables are created with data, visit:

  • Pump Selector: index.php
  • Pump Datasheet: datasheet.php?id=1
  • PDF Datasheet: pdf_datasheet.php?id=1

API Documentation

Pump Selection Endpoint

GET api.php?action=select&well_diameter=98&flow=20&head=50

Parameters:

  • action=select - Pump selection mode
  • well_diameter - Well diameter in mm (or "All")
  • flow - Required flow in m³/h
  • head - Required head in meters

Model Data Endpoint

GET api.php?action=get_model&id=1

Parameters:

  • action=get_model - Get full model data
  • id - Pump model ID

Quick Links

Go to Pump Selector View Sample Datasheet View Sample PDF