Improving machines’ energy efficiency through dynamic energy mode control to meet demand requirements with minimal energy consumption is a promising approach. This study considers a machine operating in working, idle, off, and warmup energy modes with different energy consumption in each mode. A deterministic fluid model is developed to analyze an energy mode control policy that determines when to keep the machine working, off or idle, and switch to other modes based on the inventory/backlog level to minimize the total energy, inventory, and backlog costs. This approach facilitates the derivation of closed-form expressions for the optimal thresholds and the associated costs. This modeling approach allows us to prove that a policy that operates the machine between the working and off modes or the working and idle modes is always better than a hybrid policy that operates the machine in working, off, and idle modes simultaneously. We use the solution of the deterministic fluid model to propose an approximate policy for machines with stochastic production, warmup, and demand processes. We compare the results of the proposed approximation method with the optimal solution of a stochastic system where the production and warmup times are exponential and the demand inter-arrival times have Erlang distribution. The optimal solution for the stochastic system is determined by solving a Markovian Decision Process (MDP). Our numerical experiments show that the proposed approximation method predicts the optimal policy type for the stochastic case with a 89.3% accuracy, and the average error between the optimal cost and the cost obtained with the approximation method is 1.37% for 729 different cases tested. Furthermore, the computational efficiency of the proposed approximation is around 250 times better than the effort to determine the optimal policy using an MDP approach. We propose this approximation method where the control parameters are given in closed form as an easy-to-implement and effective policy to control energy modes to minimize the total energy, inventory, and backlog costs. Furthermore, we present the deterministic fluid modeling approach as a versatile approach to analyze energy mode control problems.