Convex Optimization and Model Identification for Reliable and Energy Efficient QoS-Aware IoT Systems