OpenPLC Ladder Logic Programming Needed

Заказчик: AI | Опубликовано: 13.11.2025

Requirement Specification — Fully Automatic 4-Tank Water System (ESP32 + OpenPLC Logic)** ## **1. System Overview** The system controls water filling for **4 tanks** using: * A **primary source** (main water supply) * A **secondary source** (Tank 1 acting as backup source) The system is: * Fully automatic * No manual mode * No emergency mode * No user intervention required Each tank uses a **3-wire float switch** (Common + Full + Empty). All float “common” wires are tied to **GND**. Every tank requires **2 digital inputs**: * One for **Empty** * One for **Full** Only these FULL/EMPTY signals are used — no percentage levels. --- ## **2. Digital Input Mapping (2 Inputs per Tank)** | Tank | EMPTY Input | FULL Input | | ---------- | ----------- | ---------- | | **Tank 1** | X2 | X3 | | **Tank 2** | X4 | X5 | | **Tank 3** | X6 | X7 | | **Tank 4** | X8 | X9 | Additional system input: * **X1 = Primary Source Water Available (Active High)** * **X10 = Not used / spare** All inputs operate at **5V logic** via optocouplers. --- ## **3. Digital Output Mapping** | Output | Function | | ---------- | ------------- | | **Y1** | Tank 1 Valve | | **Y2** | Tank 2 Valve | | **Y3** | Tank 3 Valve | | **Y4** | Tank 4 Valve | | **Y5** | Pump | | **Y6–Y10** | Spare outputs | --- ## **4. Automatic Primary Source Logic** Primary source active when **X1 = TRUE**. When primary water is available: 1. System starts filling using this tank order: * **Tank 1 → Tank 2 → Tank 3 → Tank 4** 2. The system does **not require EMPTY**; partial fill like 40% is treated as “not full”. 3. A tank is considered finished when its **FULL** input goes TRUE. 4. After the final tank reaches FULL, pump and all valves turn OFF. 5. If primary water disappears at any moment (X1 → FALSE): * Pump OFF * All valves OFF * All tank steps cleared --- ## **5. Automatic Secondary Source Logic** Secondary source activates only when: * **Primary not available (X1 = FALSE)** * AND * **Any of Tank 2, Tank 3, or Tank 4 is EMPTY** Rules: 1. Fill sequence in secondary: * **Tank 2 → Tank 3 → Tank 4** 2. **Tank 1 is skipped** during secondary operation. 3. If **Tank 1 becomes EMPTY during secondary mode (X2 = TRUE)**: * Pump OFF * All valves OFF * Secondary mode stops 4. If primary water returns during secondary filling (X1 = TRUE): * Instant switch back to primary logic * Pump keeps running * Only valves switch over --- ## **6. All Tanks Full Condition** All tanks are full when: * X3 = TRUE * X5 = TRUE * X7 = TRUE * X9 = TRUE When all tanks full: * Pump OFF * All valves OFF * System idle --- ## **7. No Manual or Emergency Modes** * No manual buttons * No emergency stop * No reset delays * Fully automatic control only --- ## **8. Sequence Summary** ### **Primary Sequence:** T1 → T2 → T3 → T4 → STOP ### **Secondary Sequence:** T2 → T3 → T4 → STOP (T1 is never filled during secondary) --- ## **9. System Logic Summary** * Only one tank fills at a time * Float UP = Full * Float DOWN = Empty * Each tank uses **2 digital inputs** * Loss of primary immediately stops operation * Return of primary source immediately switches back * Secondary source depends on Tank 1 level * Pump runs during any active filling step * All operations are automatic