© 2016 ACM.The ow of energy in a network of intermittent sources of energy, such as renewables, batteries, and of work such as sensing tasks, communication packets and tasks executed in computer servers, is modeled as an Energy Packet Network. Both tasks for execution and energy flows into the system are random processes. A G-Network is used to model the system where both tasks and data packets, and energy in the form of discrete units, move between energy storage units, network routers and computing servers. This queueing network approach offers the advantage of leading to an analytical solution of the equilibrium joint probability distribution for the backlog of work and the amount of energy that is stored in the system. We then consider the problem of deciding how energy and workload should be allocated among the workstations in the system so as to optimise utility functions that combine the need to offer short response times to computing jobs and data packets, while maintaining some level of reserve energy in storage for potential future needs. We propose a gradient based approach to exploit the continuous and differentiable structure of the utility function and suggest an approximate gradient algorithm based on a Neumann expansion to simplify the computations. The performance of the approximate algorithms is compared numerically to the case where an exact gradient algorithm is used, both for the computational cost and the resulting minimum value of the utility function.