Self-adaptive control system for greenhouses