In the future smart city, new information and communication technologies will enable a better management of the available resources. The future smart grid infrastructure is emerging as a complex system where fine-grained monitoring and control of energy generating and/or consuming entities within the electricity network is possible. This will result to better approaches that will boost energy efficiency. A simulation of a dynamic ecosystem such as the smart city, will enable us to test new concepts and resource-optimization approaches. Therefore we have analyzed, designed, and build a simulator based on software agents that attempts to create the dynamic behavior of a smart city. It simulates discrete heterogeneous devices that consume and/or produce energy, that are able to act autonomously and collaborate. The behavior of these devices and their groupings e.g. smart houses, has been modeled in order to map as near as possible the real behavior patterns of the respective physical objects.