ARTICLE

Pump & Valve Automation สำหรับ Smart Farm: สั่งงานอย่างไรให้มี Feedback และไม่ชนกัน.

ออกแบบ Pump/Valve Automation ระดับระบบ ตั้งแต่ command ownership, sequence, feedback, dry-run/no-flow, timeout, interlock, manual mode และ recovery โดยไม่แทน electrical protection

Smart FarmAutomationIoTElectricalโดย Thospaakเผยแพร่ 10 ต.ค. 2569อัปเดต 15 ต.ค. 2569
ภาพสถานีปั๊มน้ำและวาล์วของระบบ Smart Farm ที่เชื่อมท่อหลักกับแปลงให้น้ำและอุปกรณ์ควบคุมภาคสนาม

พื้นฐาน Pump/Motor อยู่ที่ Pump/Motor Control Basics และการเลือก Valve อยู่ที่ Solenoid vs Motorized Valve หน้านี้จึงโฟกัส coordination ระหว่างอุปกรณ์

Command Ownership ต้องมีเจ้าของชัด

ปัญหาที่เจอบ่อยคือหลายระบบสั่งอุปกรณ์เดียวกัน:

  • schedule
  • soil rule
  • dashboard button
  • Home Assistant/MQTT
  • local switch

ต้องกำหนดว่าใครมีสิทธิ์สั่งในแต่ละ mode และ conflict แก้อย่างไร

ตัวอย่าง state:

AUTO
MANUAL
MAINTENANCE LOCKOUT
FAULT

ไม่ควรให้ทุก source publish ON/OFF ลง topic เดียวโดยไม่มี arbitration

Command ไม่เท่ากับ Feedback

Pump ON command ≠ Pump running confirmed
Valve OPEN command ≠ Water path confirmed

feedback อาจมาจาก:

  • flow
  • pressure
  • auxiliary contact
  • current/energy state
  • actuator position feedback

เลือกให้เหมาะกับ consequence ของ failure

Sequence ต้อง explicit

ระบบ irrigation ควรมี state machine มากกว่า delay กระจัดกระจาย

ตัวอย่างเชิงแนวคิด:

IDLE
 → PRECHECK
 → PREPARE WATER PATH
 → START PUMP / OPEN VALVE ตาม hydraulic design
 → VERIFY
 → RUN
 → STOP SEQUENCE
 → VERIFY STOP
 → IDLE

ลำดับจริงขึ้นกับ hydraulic/equipment design จึงไม่ควร copy เป็น wiring/control recipe ตายตัว

State machine ควรบันทึก เหตุผลที่ transition ด้วย ไม่ใช่รู้เพียง state ปัจจุบัน ตัวอย่าง:

Transition Evidence ที่ควรมี
IDLE → PRECHECK request id, owner, zone, permission chain
PRECHECK → PREPARE tank/source ready, no lockout, sensor freshness
PREPARE → VERIFY command accepted, valve/pump sequence issued
VERIFY → RUN flow/pressure/feedback อยู่ในช่วงที่ยอมรับ
RUN → STOP target reached, max runtime, operator stop หรือ fault
STOP → IDLE actual flow/state กลับสู่เงื่อนไขหยุดที่ยืนยันได้

การ log transition แบบนี้ช่วยให้ภายหลังตอบได้ว่า “ปั๊มไม่ทำงานเพราะอะไร” แทนที่จะเห็นเพียง state = OFF

Timeout ทุกขั้นที่รอ Feedback

ถ้ารอ flow หรือ valve state โดยไม่มี timeout ระบบอาจค้างตลอดไป

ทุก transition สำคัญควรมี:

  • expected feedback
  • timeout
  • action on timeout
  • alarm/event

No-flow หลัง Start

ถ้าระบบสั่ง run แล้วไม่มี flow อาจเป็น:

  • tank/source unavailable
  • pump fault
  • valve/path issue
  • blocked pipe
  • flow sensor fault

อย่า retry ไม่จำกัด ควร bounded retry หรือ require operator ตาม risk

ถ้าจะ retry ควรนับเป็น attempt ใหม่ พร้อม request/attempt id และเก็บเหตุผลของครั้งก่อน ไม่ควรลบ fault เดิมแล้วทำเหมือนไม่เคยเกิดขึ้น เพราะจะทำให้ระบบดูเหมือนทำงานปกติทั้งที่มี intermittent failure

Unexpected Flow ตอนควรหยุด

flow ยังอยู่เมื่อ command ปิดแล้วอาจบอก:

  • valve stuck/open
  • bypass/other source
  • sensor error
  • hydraulic drain-down

ต้องใช้ timing/context เพื่อแยก normal transient จาก fault

Dry-run และ Overload

Automation software อาจใช้ level/flow เป็น additional evidence แต่ไม่ควรถูกอธิบายว่าแทน equipment-native dry-run, overload หรือ electrical protection ที่ระบบต้องการ

Software control ≠ electrical/mechanical protection

Manual Mode ที่ดี

Manual Mode ควร:

  • แสดงชัดว่าระบบอยู่ Manual
  • จำกัด authority ตาม design
  • log operator action
  • ยังเคารพ critical protection/interlock ที่ต้องมี
  • ไม่ทำให้ Auto เข้ามาแย่ง command ระหว่าง maintenance

Recovery หลัง Controller Reboot

คำถามสำคัญ:

  • output boot state คืออะไร
  • ถ้า reboot กลาง irrigation จะ resume หรือ stop
  • last command ยัง valid หรือไม่
  • physical state ถูก re-read ก่อน command ใหม่หรือไม่

โดยทั่วไปอย่า assume ว่า retained software state เท่ากับ physical state ปัจจุบัน

ก่อนกลับเข้า AUTO หลัง reboot ควร reconcile อย่างน้อย mode + requested state + actual feedback + sensor freshness + active lockout แล้วจึงตัดสินใจว่าจะ resume, stop หรือ require operator ตาม consequence ของ process

Valve Zone หลายตัว

ถ้ามีหลาย zone ควรกำหนด:

  • allowed simultaneous zones
  • total flow/pressure capacity
  • priority
  • minimum off/on time
  • conflict policy

เปิดหลาย valve โดยไม่สน hydraulic capacity อาจทำให้ทุก zone ได้ flow ไม่พอ

Telemetry ที่ควรบันทึก

  • requested state
  • actual/confirmed state
  • command owner
  • mode
  • start/stop timestamps
  • flow/pressure
  • runtime
  • fault code/reason

ช่วย debug ได้มากกว่าบันทึกเฉพาะ pump=on

อ่าน Pressure & Flow Monitoring สำหรับ feedback layer และ Offline, Manual & Fail-safe สำหรับ degraded operation

Pump & Valve Automation ที่ดีจึงเป็น stateful control system ที่รู้ว่าใครสั่ง อุปกรณ์ตอบสนองหรือไม่ และเมื่อผิดปกติจะหยุด/ถอยอย่างไร ไม่ใช่ relay ON/OFF ผ่าน Internet