European incentive policies led to a faster development of renewable energy sources during these last years. These new energy sources highly impact the planning and operation of our electrical system. More flexibility is now required for electrical system operators to be able to counterpace the increase of power variability and unwished energy flow in their networks. Energy storage systems are a possible flexibility and thus open new challenges about research works and studies for grid applications. The task of this paper is to study the use of a lithium-ion battery to remove constraints in electrical grids and to increase the penetration of renewable energy sources in the liberalized electricity market. A linearized model of a lithium-ion battery is presented and is used in an optimization framework. This one is then used to calculate the optimal schedule of storage load and discharge actions in order to produce the highest possible benefits while taking into account hardware and grid constraints. An application in an industrial microgrid is presented to reduce the operation energy cost.