To counter the effects of global climate change, attributed to the CO2 emissions resulting from burning fossil fuels for generating electricity and heat, global efforts are being made to achieve an energy transition. This includes that the share of energy generated using sustainable sources (e.g. solar, wind, hydro) should be increased, while the share of energy generated using fossil sources (e.g. natural gas, coal, oil) should be decreased, ultimately phasing out the usage of fossil fuels altogether. How this energy transition should be achieved, or even when the energy transition should be completed is subject of heated debates in political arenas, courts of law and the society as a whole. Whether or not future electricity demands can be met by sustainable sources is a particular important part of this debate. On the one hand, fossil fuels are ( for the moment) cheap and readily available, by using fossil fuels it is always possible to generate the appropriate amount of electricity to match the demand. On the other hand, generating electricity from sunlight or wind can only be done when enough sun- light is available or the wind-speed is in an appropriate bandwidth. However, as electricity is also used during the night, and on cloudy, windless or stormy days, using sustainable energy sources as the primary supply for electricity generation can lead to a significant mismatch between supply and demand. This can imply that sometimes the electricity generated by solar parks during the day has to be curtailed because there is no demand for it, while during the night electricity still has to be generated using fossil fuels to meet the demand. A solution to this problem seems obvious: store the electricity. This allows to generate electricity using sustainable sources when available, and to store a sufficient amount to be able to meet the demand at all times. Although, this solution sounds simple, still many questions remain. Which type of storage should be used?, Where should the storage be located?, What should be the capacity of the storage?, How should the storage be used?, etc. In this thesis these types of questions are addressed for a specific type of storage: batteries. To answer these questions, and to support the important decisions necessary to complete the energy transition, three contributions are made: The first contribution is the development of the diffusion buffer model (DiBu- model) for battery state of charge (SoC) prediction. This model is specifically designed to be used in simulation tools for energy management in (smart) grids. Hence, this model should be a consolidation of broad applicability, accuracy and simplicity. The broad applicability of the DiBu-model is demonstrated by accurate predictions of the SoC of Lead-acid, Lithium-ion Polymer and Lithium Iron-phosphate batteries under various scenarios. The accuracy of the model is demonstrated by comparing the predicted SoC for various scenarios to the SoC calculated from measurements on real batteries subjected to these scenarios. The results show that it is possible to accurately predict the SoC for these types of batteries using the DiBu-model, where the difference between the predicted SoC and the SoC calculated from measurements is generally less than 5%. The broad applicability and accuracy are also demonstrated by accurate SoC predictions on an experimental Seasalt battery, although a slight modification to the model was necessary in this case. The simplicity is demonstrated by integrating the DiBu-model in the DEMKit smart grid energy management toolkit. Here the results show that by using the DiBu-model more realistic predictions of the SoC can be made, compared to an idealized battery model used previously. The integration of the model in DEMKit is validated by comparing the SoC predicted using DEMKit to the SoC derived from measurements on an actual battery. The difference between the predicted and measured SoC is generally less than 1.5%. The second contribution is the so called "16 houses case" in which the integration of batteries in a smart microgrid is considered. More specifically the possibilities of "soft-islanding" ( near autarkic behaviour) a microgrid with 16 houses is in- vestigated. The research is focussed on an idealised "greenfield" neighbourhood where energy is generated by PV-panels as well as by a CHP and energy is stored using batteries as well as a heat buffer. Firstly, a proper sizing of the equipment is determined based on energy production and consumption data of several weeks spread over the year. Secondly, one year simulations for several scenarios are presented and the degree of autarky ( DoA) for each scenario is compared. It is demonstrated that a (nearly) autarkic operating microgrid can be achieved by combining the proper sizing of energy generation and storage assets, with an advanced control. It is possible to achieve a DoA of 99.1% over a year, meaning that less than one percent of the energy has to be imported from the main grid. Subsequently the tools and methods used for the ideal neighbourhood are applied in a case study of a real neighbourhood: Markluiden. For this neighbourhood it is possible to reach a DoA of around 91% over a year. The third contribution concerns the Seasalt battery, a novel battery currently under development at Dr Ten B.V. The Seasalt battery is particularly suitable for stationary use, e.g. as a home or neighbourhood battery. In that role it is an alternative to e.g. Lead-acid and Lithium-ion Polymer batteries. A detailed description of the battery and it’s behaviour is given, in addition to a discussion of it’s advantages and disadvantages. The advantages include the usage of environ- mentally friendly and (where possible) sustainable materials in it’s construction, and limited risks to health and safety compared to Lead-acid and Lithium-ion Polymer batteries. Disadvantages include a lower capacity / weight and capacity / volume ratio in comparison with the aforementioned batteries. Furthermore, examples of real-world application of the Seasalt battery are discussed. Finally, the prevention of dendrites forming at the anode of the Seasalt battery, which was a particularly challenging aspect of the battery design, is discussed in detail.